Back to index

php5  5.3.10
Classes | Defines | Enumerations | Functions | Variables
php_pdo_pgsql_int.h File Reference
#include <libpq-fe.h>
#include <libpq/libpq-fs.h>
#include <php.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pdo_pgsql_error_info
struct  pdo_pgsql_db_handle
struct  pdo_pgsql_column
struct  pdo_pgsql_stmt
struct  pdo_pgsql_bound_param
struct  pdo_pgsql_lob_self

Defines

#define PHP_PDO_PGSQL_CONNECTION_FAILURE_SQLSTATE   "08006"
#define pdo_pgsql_error(d, e, z)   _pdo_pgsql_error(d, NULL, e, z, __FILE__, __LINE__ TSRMLS_CC)
#define pdo_pgsql_error_stmt(s, e, z)   _pdo_pgsql_error(s->dbh, s, e, z, __FILE__, __LINE__ TSRMLS_CC)
#define pdo_pgsql_sqlstate(r)   PQresultErrorField(r, PG_DIAG_SQLSTATE)

Enumerations

enum  { PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT = PDO_ATTR_DRIVER_SPECIFIC }
enum  pdo_pgsql_specific_constants {
  PGSQL_TRANSACTION_IDLE = PQTRANS_IDLE, PGSQL_TRANSACTION_ACTIVE = PQTRANS_ACTIVE, PGSQL_TRANSACTION_INTRANS = PQTRANS_INTRANS, PGSQL_TRANSACTION_INERROR = PQTRANS_INERROR,
  PGSQL_TRANSACTION_UNKNOWN = PQTRANS_UNKNOWN
}

Functions

int _pdo_pgsql_error (pdo_dbh_t *dbh, pdo_stmt_t *stmt, int errcode, const char *sqlstate, const char *file, int line TSRMLS_DC)
php_stream * pdo_pgsql_create_lob_stream (pdo_dbh_t *stmt, int lfd, Oid oid TSRMLS_DC)

Variables

pdo_driver_t pdo_pgsql_driver
php_stream_ops pdo_pgsql_lob_stream_ops

Class Documentation

struct pdo_pgsql_error_info

Definition at line 32 of file php_pdo_pgsql_int.h.

Class Members
unsigned int errcode
char * errmsg
const char * file
int line
struct pdo_pgsql_db_handle

Definition at line 40 of file php_pdo_pgsql_int.h.

Collaboration diagram for pdo_pgsql_db_handle:
Class Members
unsigned _reserved:31
unsigned attached:1
pdo_pgsql_error_info einfo
Oid pgoid
PGconn * server
unsigned int stmt_counter
struct pdo_pgsql_column

Definition at line 56 of file php_pdo_pgsql_int.h.

Class Members
zend_bool boolval
char * def
long intval
Oid pgsql_type
struct pdo_pgsql_stmt

Definition at line 63 of file php_pdo_pgsql_int.h.

Collaboration diagram for pdo_pgsql_stmt:
Class Members
pdo_pgsql_column * cols
int current_row
char * cursor_name
pdo_pgsql_db_handle * H
zend_bool is_prepared
PGresult * result
struct pdo_pgsql_bound_param

Definition at line 80 of file php_pdo_pgsql_int.h.

Class Members
Oid oid
struct pdo_pgsql_lob_self

Definition at line 98 of file php_pdo_pgsql_int.h.

Class Members
PGconn * conn
pdo_dbh_t * dbh
int lfd
Oid oid

Define Documentation

#define pdo_pgsql_error (   d,
  e,
 
)    _pdo_pgsql_error(d, NULL, e, z, __FILE__, __LINE__ TSRMLS_CC)

Definition at line 87 of file php_pdo_pgsql_int.h.

#define pdo_pgsql_error_stmt (   s,
  e,
 
)    _pdo_pgsql_error(s->dbh, s, e, z, __FILE__, __LINE__ TSRMLS_CC)

Definition at line 88 of file php_pdo_pgsql_int.h.

#define pdo_pgsql_sqlstate (   r)    PQresultErrorField(r, PG_DIAG_SQLSTATE)

Definition at line 92 of file php_pdo_pgsql_int.h.

Definition at line 30 of file php_pdo_pgsql_int.h.


Enumeration Type Documentation

anonymous enum
Enumerator:
PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT 

Definition at line 94 of file php_pdo_pgsql_int.h.

Enumerator:
PGSQL_TRANSACTION_IDLE 
PGSQL_TRANSACTION_ACTIVE 
PGSQL_TRANSACTION_INTRANS 
PGSQL_TRANSACTION_INERROR 
PGSQL_TRANSACTION_UNKNOWN 

Definition at line 105 of file php_pdo_pgsql_int.h.

                                  {
       PGSQL_TRANSACTION_IDLE = PQTRANS_IDLE,
       PGSQL_TRANSACTION_ACTIVE = PQTRANS_ACTIVE,
       PGSQL_TRANSACTION_INTRANS = PQTRANS_INTRANS,
       PGSQL_TRANSACTION_INERROR = PQTRANS_INERROR,
       PGSQL_TRANSACTION_UNKNOWN = PQTRANS_UNKNOWN
};

Function Documentation

int _pdo_pgsql_error ( pdo_dbh_t *  dbh,
pdo_stmt_t *  stmt,
int  errcode,
const char *  sqlstate,
const char *  file,
int line  TSRMLS_DC 
)

Definition at line 63 of file pgsql_driver.c.

{
       pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
       pdo_error_type *pdo_err = stmt ? &stmt->error_code : &dbh->error_code;
       pdo_pgsql_error_info *einfo = &H->einfo;
       char *errmsg = PQerrorMessage(H->server);

       einfo->errcode = errcode;
       einfo->file = file;
       einfo->line = line;

       if (einfo->errmsg) {
              pefree(einfo->errmsg, dbh->is_persistent);
              einfo->errmsg = NULL;
       }

       if (sqlstate == NULL) {
              strcpy(*pdo_err, "HY000");
       }
       else {
              strcpy(*pdo_err, sqlstate);
       }

       if (errmsg) {
              einfo->errmsg = _pdo_pgsql_trim_message(errmsg, dbh->is_persistent);
       }

       if (!dbh->methods) {
              zend_throw_exception_ex(php_pdo_get_exception(), einfo->errcode TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
                            *pdo_err, einfo->errcode, einfo->errmsg);
       }
       
       return errcode;
}

Here is the call graph for this function:

php_stream* pdo_pgsql_create_lob_stream ( pdo_dbh_t *  stmt,
int  lfd,
Oid oid  TSRMLS_DC 
)

Definition at line 171 of file pgsql_driver.c.

{
       php_stream *stm;
       struct pdo_pgsql_lob_self *self = ecalloc(1, sizeof(*self));
       pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;

       self->dbh = dbh;
       self->lfd = lfd;
       self->oid = oid;
       self->conn = H->server;

       stm = php_stream_alloc(&pdo_pgsql_lob_stream_ops, self, 0, "r+b");

       if (stm) {
              php_pdo_dbh_addref(dbh TSRMLS_CC);
              return stm;
       }

       efree(self);
       return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 1094 of file pgsql_driver.c.

Definition at line 159 of file pgsql_driver.c.