Back to index

php5  5.3.10
Functions | Variables
pdo_dblib.c File Reference
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "pdo/php_pdo.h"
#include "pdo/php_pdo_driver.h"
#include "php_pdo_dblib.h"
#include "php_pdo_dblib_int.h"
#include "zend_exceptions.h"

Go to the source code of this file.

Functions

static PHP_GINIT_FUNCTION (dblib)
int error_handler (DBPROCESS *dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr)
int msg_handler (DBPROCESS *dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, DBUSMALLINT line)
 PHP_RSHUTDOWN_FUNCTION (pdo_dblib)
 PHP_MINIT_FUNCTION (pdo_dblib)
 PHP_MSHUTDOWN_FUNCTION (pdo_dblib)
 PHP_MINFO_FUNCTION (pdo_dblib)

Variables

const zend_function_entry pdo_dblib_functions []
zend_module_entry pdo_dblib_module_entry

Function Documentation

int error_handler ( DBPROCESS *  dbproc,
int  severity,
int  dberr,
int  oserr,
char *  dberrstr,
char *  oserrstr 
)

Definition at line 89 of file pdo_dblib.c.

{
       pdo_dblib_err *einfo;
       char *state = "HY000";
       TSRMLS_FETCH();

       einfo = (pdo_dblib_err*)dbgetuserdata(dbproc);
       if (!einfo) einfo = &DBLIB_G(err);

       einfo->severity = severity;
       einfo->oserr = oserr;
       einfo->dberr = dberr;
       if (einfo->oserrstr) {
              efree(einfo->oserrstr);
       }
       if (einfo->dberrstr) {
              efree(einfo->dberrstr);
       }
       if (oserrstr) {
              einfo->oserrstr = estrdup(oserrstr);
       } else {
              einfo->oserrstr = NULL;
       }
       if (dberrstr) {
              einfo->dberrstr = estrdup(dberrstr);
       } else {
              einfo->dberrstr = NULL;
       }

       switch (dberr) {
              case SYBESEOF:
              case SYBEFCON:       state = "01002"; break;
              case SYBEMEM: state = "HY001"; break;
              case SYBEPWD: state = "28000"; break;
       }
       strcpy(einfo->sqlstate, state);

#if 0
       php_error_docref(NULL TSRMLS_CC, E_WARNING,
              "dblib error: %d %s (severity %d)",
              dberr, dberrstr, severity); 
#endif

       return INT_CANCEL;
}

Here is the caller graph for this function:

int msg_handler ( DBPROCESS *  dbproc,
DBINT  msgno,
int  msgstate,
int  severity,
char *  msgtext,
char *  srvname,
char *  procname,
DBUSMALLINT  line 
)

Definition at line 136 of file pdo_dblib.c.

{
       pdo_dblib_err *einfo;
       TSRMLS_FETCH();

       if (severity) {
              einfo = (pdo_dblib_err*)dbgetuserdata(dbproc);
              if (!einfo) {
                     einfo = &DBLIB_G(err);
              }

              if (einfo->lastmsg) {
                     efree(einfo->lastmsg);
              }

              einfo->lastmsg = estrdup(msgtext);
       }

#if 0
       php_error_docref(NULL TSRMLS_CC, E_WARNING, "dblib message: %s (severity %d)", msgtext, severity);
#endif

       return 0;
}

Here is the caller graph for this function:

static PHP_GINIT_FUNCTION ( dblib  ) [static]

Definition at line 162 of file pdo_dblib.c.

{
       memset(dblib_globals, 0, sizeof(*dblib_globals));
       dblib_globals->err.sqlstate = dblib_globals->sqlstate;
}
PHP_MINFO_FUNCTION ( pdo_dblib  )

Definition at line 219 of file pdo_dblib.c.

{
       php_info_print_table_start();
       php_info_print_table_header(2, "PDO Driver for "
#if PDO_DBLIB_IS_MSSQL
              "MSSQL"
#elif defined(PHP_WIN32)
              "FreeTDS/Sybase/MSSQL"
#else
              "FreeTDS/Sybase"
#endif
              " DB-lib", "enabled");
       php_info_print_table_row(2, "Flavour", PDO_DBLIB_FLAVOUR);
       php_info_print_table_end();
}

Here is the call graph for this function:

PHP_MINIT_FUNCTION ( pdo_dblib  )

Definition at line 185 of file pdo_dblib.c.

{
       if (FAIL == dbinit()) {
              return FAILURE;
       }
       
       if (FAILURE == php_pdo_register_driver(&pdo_dblib_driver)) {
              return FAILURE;
       }
       
       /* TODO: 
       
       dbsetifile()
       dbsetmaxprocs()
       dbsetlogintime()
       dbsettime()
       
        */

#if !PHP_DBLIB_IS_MSSQL
       dberrhandle(error_handler);
       dbmsghandle(msg_handler);
#endif

       return SUCCESS;
}

Here is the call graph for this function:

PHP_MSHUTDOWN_FUNCTION ( pdo_dblib  )

Definition at line 212 of file pdo_dblib.c.

Here is the call graph for this function:

PHP_RSHUTDOWN_FUNCTION ( pdo_dblib  )

Definition at line 168 of file pdo_dblib.c.

{
       if (DBLIB_G(err).oserrstr) {
              efree(DBLIB_G(err).oserrstr);
              DBLIB_G(err).oserrstr = NULL;
       }
       if (DBLIB_G(err).dberrstr) {
              efree(DBLIB_G(err).dberrstr);
              DBLIB_G(err).dberrstr = NULL;
       }
       if (DBLIB_G(err).lastmsg) {
              efree(DBLIB_G(err).lastmsg);
              DBLIB_G(err).lastmsg = NULL;
       }
       return SUCCESS;
}

Variable Documentation

Initial value:

Definition at line 38 of file pdo_dblib.c.

zend_module_entry pdo_dblib_module_entry
Initial value:
 {





       STANDARD_MODULE_HEADER,






       "pdo_dblib",

       pdo_dblib_functions,
       PHP_MINIT(pdo_dblib),
       PHP_MSHUTDOWN(pdo_dblib),
       NULL,
       PHP_RSHUTDOWN(pdo_dblib),
       PHP_MINFO(pdo_dblib),
       "1.0.1",
       PHP_MODULE_GLOBALS(dblib),
       PHP_GINIT(dblib),
       NULL,
       NULL,
       STANDARD_MODULE_PROPERTIES_EX
}

Definition at line 52 of file pdo_dblib.c.