dbTalk Databases Forums  

LibPq.dll change a database connection.

comp.databases.postgresql comp.databases.postgresql


Discuss LibPq.dll change a database connection. in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Enzo Campanella
 
Posts: n/a

Default LibPq.dll change a database connection. - 11-14-2008 , 03:47 AM






Hello to all.

You can change the database of an active connection similar to the function
of MySql mysql_select_db (oConn, cNewDB), without creating a new connection?

Thank you.
Enzo.

Original Message:

E' possibile cambiare il database di una connessione attiva simile alla
funzione di MySql mysql_select_db( oConn, cNewDB ), senza creare una nuova
connessione?

Grazie.
Enzo.


Reply With Quote
  #2  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: LibPq.dll change a database connection. - 11-14-2008 , 07:08 AM






Enzo Campanella <v.campanella (AT) tin (DOT) it> wrote:
Quote:
You can change the database of an active connection similar to the function
of MySql mysql_select_db (oConn, cNewDB), without creating a new connection?
I guess you are talking about PHP here, right?

I believe that there you are confused by the different terminology in
these two database systems.

What is called a "database" in MySQL is called a "schema" in PostgreSQL.
A "database" in PostgreSQL cannot really be translated into MySQL, but
for the present purpose you can compare it to a MySQL "instance".

In MySQL you connect to an instance and can select your database.
In PostgreSQL you connect to a database and can select your default schema.

The best translation of your sample statement into PostgreSQL would be:

pg_query(oConn, "SET search_path = " . cNewDB);

Yours,
Laurenz Albe


Reply With Quote
  #3  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: LibPq.dll change a database connection. - 11-14-2008 , 07:08 AM



Enzo Campanella <v.campanella (AT) tin (DOT) it> wrote:
Quote:
You can change the database of an active connection similar to the function
of MySql mysql_select_db (oConn, cNewDB), without creating a new connection?
I guess you are talking about PHP here, right?

I believe that there you are confused by the different terminology in
these two database systems.

What is called a "database" in MySQL is called a "schema" in PostgreSQL.
A "database" in PostgreSQL cannot really be translated into MySQL, but
for the present purpose you can compare it to a MySQL "instance".

In MySQL you connect to an instance and can select your database.
In PostgreSQL you connect to a database and can select your default schema.

The best translation of your sample statement into PostgreSQL would be:

pg_query(oConn, "SET search_path = " . cNewDB);

Yours,
Laurenz Albe


Reply With Quote
  #4  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: LibPq.dll change a database connection. - 11-14-2008 , 07:08 AM



Enzo Campanella <v.campanella (AT) tin (DOT) it> wrote:
Quote:
You can change the database of an active connection similar to the function
of MySql mysql_select_db (oConn, cNewDB), without creating a new connection?
I guess you are talking about PHP here, right?

I believe that there you are confused by the different terminology in
these two database systems.

What is called a "database" in MySQL is called a "schema" in PostgreSQL.
A "database" in PostgreSQL cannot really be translated into MySQL, but
for the present purpose you can compare it to a MySQL "instance".

In MySQL you connect to an instance and can select your database.
In PostgreSQL you connect to a database and can select your default schema.

The best translation of your sample statement into PostgreSQL would be:

pg_query(oConn, "SET search_path = " . cNewDB);

Yours,
Laurenz Albe


Reply With Quote
  #5  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: LibPq.dll change a database connection. - 11-14-2008 , 07:08 AM



Enzo Campanella <v.campanella (AT) tin (DOT) it> wrote:
Quote:
You can change the database of an active connection similar to the function
of MySql mysql_select_db (oConn, cNewDB), without creating a new connection?
I guess you are talking about PHP here, right?

I believe that there you are confused by the different terminology in
these two database systems.

What is called a "database" in MySQL is called a "schema" in PostgreSQL.
A "database" in PostgreSQL cannot really be translated into MySQL, but
for the present purpose you can compare it to a MySQL "instance".

In MySQL you connect to an instance and can select your database.
In PostgreSQL you connect to a database and can select your default schema.

The best translation of your sample statement into PostgreSQL would be:

pg_query(oConn, "SET search_path = " . cNewDB);

Yours,
Laurenz Albe


Reply With Quote
  #6  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: LibPq.dll change a database connection. - 11-14-2008 , 07:08 AM



Enzo Campanella <v.campanella (AT) tin (DOT) it> wrote:
Quote:
You can change the database of an active connection similar to the function
of MySql mysql_select_db (oConn, cNewDB), without creating a new connection?
I guess you are talking about PHP here, right?

I believe that there you are confused by the different terminology in
these two database systems.

What is called a "database" in MySQL is called a "schema" in PostgreSQL.
A "database" in PostgreSQL cannot really be translated into MySQL, but
for the present purpose you can compare it to a MySQL "instance".

In MySQL you connect to an instance and can select your database.
In PostgreSQL you connect to a database and can select your default schema.

The best translation of your sample statement into PostgreSQL would be:

pg_query(oConn, "SET search_path = " . cNewDB);

Yours,
Laurenz Albe


Reply With Quote
  #7  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: LibPq.dll change a database connection. - 11-14-2008 , 07:08 AM



Enzo Campanella <v.campanella (AT) tin (DOT) it> wrote:
Quote:
You can change the database of an active connection similar to the function
of MySql mysql_select_db (oConn, cNewDB), without creating a new connection?
I guess you are talking about PHP here, right?

I believe that there you are confused by the different terminology in
these two database systems.

What is called a "database" in MySQL is called a "schema" in PostgreSQL.
A "database" in PostgreSQL cannot really be translated into MySQL, but
for the present purpose you can compare it to a MySQL "instance".

In MySQL you connect to an instance and can select your database.
In PostgreSQL you connect to a database and can select your default schema.

The best translation of your sample statement into PostgreSQL would be:

pg_query(oConn, "SET search_path = " . cNewDB);

Yours,
Laurenz Albe


Reply With Quote
  #8  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: LibPq.dll change a database connection. - 11-14-2008 , 07:08 AM



Enzo Campanella <v.campanella (AT) tin (DOT) it> wrote:
Quote:
You can change the database of an active connection similar to the function
of MySql mysql_select_db (oConn, cNewDB), without creating a new connection?
I guess you are talking about PHP here, right?

I believe that there you are confused by the different terminology in
these two database systems.

What is called a "database" in MySQL is called a "schema" in PostgreSQL.
A "database" in PostgreSQL cannot really be translated into MySQL, but
for the present purpose you can compare it to a MySQL "instance".

In MySQL you connect to an instance and can select your database.
In PostgreSQL you connect to a database and can select your default schema.

The best translation of your sample statement into PostgreSQL would be:

pg_query(oConn, "SET search_path = " . cNewDB);

Yours,
Laurenz Albe


Reply With Quote
  #9  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: LibPq.dll change a database connection. - 11-14-2008 , 07:08 AM



Enzo Campanella <v.campanella (AT) tin (DOT) it> wrote:
Quote:
You can change the database of an active connection similar to the function
of MySql mysql_select_db (oConn, cNewDB), without creating a new connection?
I guess you are talking about PHP here, right?

I believe that there you are confused by the different terminology in
these two database systems.

What is called a "database" in MySQL is called a "schema" in PostgreSQL.
A "database" in PostgreSQL cannot really be translated into MySQL, but
for the present purpose you can compare it to a MySQL "instance".

In MySQL you connect to an instance and can select your database.
In PostgreSQL you connect to a database and can select your default schema.

The best translation of your sample statement into PostgreSQL would be:

pg_query(oConn, "SET search_path = " . cNewDB);

Yours,
Laurenz Albe


Reply With Quote
  #10  
Old   
Enzo Campanella
 
Posts: n/a

Default Re: LibPq.dll change a database connection. - 11-18-2008 , 06:50 AM



Hello Laurenz.

Do not use PHP but I'm using Visual Object (VO).
I have created classes that interface in the LibPq.dll natively and inside
the classroom, I try to change the database. In practice I create a new
connection and, if OK, check the new connection to the classroom.
Who has Instanz class that is totally transparent.

Another question that you want to do is this:
is possible, through calls to the functions of libpq.dll, to backup the
database to which you are connected?
And if so, which function to use?

Thank you.
Enzo.

Origina Message:

Ciao Laurenz.

Non utilizzo PHP ma utilizzo Visual Object (VO).
Mi sono creato delle classi che interfacciano la LibPq.dll in modo nativo e,
dentro la classe, faccio il cambio del database. In pratica creo una nuova
connessione e, se va bene, assegno la nuova connessione alla classe.
A chi ha instanziato la classe questo è del tutto trasparente.

Un'altra domanda che ti volevo fare è la seguente:
è possibile, tramite chiamate alle funzioni di libpq.dll, fare il backup del
database a cui si è connessi?
E se si, quale funzioni utilizzare?

Grazie.
Enzo.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.