[odb-users] Different database schemas - postgresql

Konstantin Mikhailov ekimka at gmail.com
Tue Dec 13 07:05:50 EST 2011


Is it possible to specify different database schema
for different persistent objects/tables ? We need
simulanteous access to the tables located in the
different schemas.

I've tried to embed schema in the table name in the
form

#pragma db object table("myschema.test")
class Test {

public:

    // ~~ Accessors

    int id() const throw() {
        return id_;
    }

    void id(int id) {
        id_ = id;
    }

private:

    friend class odb::access;

    // ~~ Fields

    #pragma db id auto
    int id_;

};

But in *-odb.cxx i've got:

  const char access::object_traits< ::Test >::find_statement[] =
  "SELECT "
  "\"myschema.test\".\"id\""
  " FROM \"myschema.test\""
  " WHERE \"myschema.test\".\"id\"=$1";

Unfortunatelly it will not work due to double quotes around
the table name.


More information about the odb-users mailing list