Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

d_postgres_f.c File Reference

Forms version of the PostgreSQL driver. More...

#include "../config.h"
#include <libpq-fe.h>
#include <postgres.h>
#include "buf.h"
#include "db_conn.h"

Include dependency graph for d_postgres_f.c:

Include dependency graph

Go to the source code of this file.

Data Structures

struct  DBConnection_PG
 PostgreSQL-specific connection data. More...


Defines

#define BASENAME   "Database"
 Database name.

#define BASEHOST   "Host"
 Database host.

#define BASEPORT   "Port"
 Database port.

#define BASELOGIN   "Username"
 Database username.

#define BASEPASS   "Password"
 Database password.

#define PSQL_TYPESTR   "PostgreSQL";
 The text label that identifies the PostgreSQL driver.


Functions

DBConnectionpg_dbconnection_free (DBConnection *dbc)
 Free the PostgreSQL connection.

char * pg_DBform_to_url (Form *frm)
void pg_DBurl_to_form (Form *frm, char *url)
 Copy the login variables from a text URL to a form.

DBConnectionpg_dbconnection_new ()
 Allocate a new database connection, , with the included private DBConnection_PG data.

DBConnectorregister_PostgreSQL (void(*error_dialog)(char *, char *))
 Register the PostgreSQL driver.


Detailed Description

Forms version of the PostgreSQL driver.

Author:
Lionel ULMER , Darryl Luff

Definition in file d_postgres_f.c.


Define Documentation

#define DEFQUERY_S
 

Value:

"SELECT a.attnum, a.attname, t.typname, a.attlen,"  \
        "a.atttypmod, a.attnotnull, a.atthasdef\n"  \
        "FROM pg_class c, pg_attribute a, pg_type t\n"  \
        "WHERE c.relname = '%s' AND\n"  \
        "a.attnum > 0 AND\n"    \
        "a.attrelid = c.oid AND\n"  \
        "a.atttypid = t.oid\n"  \
        "ORDER BY attnum"

#define PGDEF_S
 

Value:

"SELECT d.adsrc\n"  \
        "FROM pg_attrdef d, pg_class c\n"   \
        "WHERE c.relname = '%s' AND\n"  \
        "c.oid = d.adrelid AND\n"   \
        "d.adnum = %s"

#define TBLDEF_S
 

Value:

"SELECT usename, relname, relkind, relhasrules\n"   \
    "FROM pg_class, pg_user\n"  \
    "WHERE relkind = 'r' AND\n" \
    "relname !~ '^pg_' AND\n"   \
    "relname !~ '^xin[vx][0-9]+' AND\n" \
    "usesysid = relowner\n" \
    "ORDER BY relname"


Function Documentation

DBConnection* pg_dbconnection_free DBConnection   dbc
 

Free the PostgreSQL connection.

Parameters:
dbc  The connection to free.
Returns:
Always returns NULL.

Definition at line 88 of file d_postgres_f.c.

References db_conn::pvt.

DBConnection* pg_dbconnection_new  
 

Allocate a new database connection, , with the included private DBConnection_PG data.

Returns:
a pointer to the new db connection.

Definition at line 589 of file d_postgres_f.c.

References db_conn::pvt, and db_conn::pvtlen.

char* pg_DBform_to_url Form   frm
 

Parameters:
frm  The form to copy to.
Returns:
The URL text.

Definition at line 390 of file d_postgres_f.c.

References _a_buf::b_dat, BASEHOST, BASELOGIN, BASENAME, BASEPASS, buf_check(), buf_strcat(), buf_strcpy(), frm_get_title(), and frm_get_value_by_name().

Referenced by register_PostgreSQL().

void pg_DBurl_to_form Form   frm,
char *    url
 

Copy the login variables from a text URL to a form.

URL format is "postgresql://[user[:pass]@]host[:port]/dbname"

Parameters:
frm  The form to copy to.
url  The database URL to copy from.

Definition at line 470 of file d_postgres_f.c.

References BASEHOST, BASELOGIN, BASENAME, BASEPASS, BASEPORT, frm_clear_fields(), and frm_set_value_by_name().

Referenced by register_PostgreSQL().


Generated on Sun May 9 19:19:19 2004 for GtkSQL by doxygen1.2.18