Back to index

php5  5.3.10
Classes | Defines | Functions | Variables
php_pdo_sqlite_int.h File Reference
#include <sqlite3.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pdo_sqlite_error_info
struct  pdo_sqlite_fci
struct  pdo_sqlite_func
struct  pdo_sqlite_db_handle
struct  pdo_sqlite_stmt

Defines

#define pdo_sqlite_error(s)   _pdo_sqlite_error(s, NULL, __FILE__, __LINE__ TSRMLS_CC)
#define pdo_sqlite_error_stmt(s)   _pdo_sqlite_error(stmt->dbh, stmt, __FILE__, __LINE__ TSRMLS_CC)

Functions

int _pdo_sqlite_error (pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int line TSRMLS_DC)

Variables

pdo_driver_t pdo_sqlite_driver

Class Documentation

struct pdo_sqlite_error_info

Definition at line 26 of file php_pdo_sqlite_int.h.

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

Definition at line 33 of file php_pdo_sqlite_int.h.

Collaboration diagram for pdo_sqlite_fci:
Class Members
zend_fcall_info_cache fcc
zend_fcall_info fci
struct pdo_sqlite_func

Definition at line 38 of file php_pdo_sqlite_int.h.

Collaboration diagram for pdo_sqlite_func:
Class Members
int argc
zval * fini
zval * func
const char * funcname
struct pdo_sqlite_func * next
zval * step
struct pdo_sqlite_db_handle

Definition at line 49 of file php_pdo_sqlite_int.h.

Collaboration diagram for pdo_sqlite_db_handle:
Class Members
sqlite3 * db
pdo_sqlite_error_info einfo
struct pdo_sqlite_func * funcs
struct pdo_sqlite_stmt

Definition at line 55 of file php_pdo_sqlite_int.h.

Collaboration diagram for pdo_sqlite_stmt:
Class Members
unsigned done:1
pdo_sqlite_db_handle * H
unsigned pre_fetched:1
sqlite3_stmt * stmt

Define Documentation

#define pdo_sqlite_error (   s)    _pdo_sqlite_error(s, NULL, __FILE__, __LINE__ TSRMLS_CC)

Definition at line 65 of file php_pdo_sqlite_int.h.

#define pdo_sqlite_error_stmt (   s)    _pdo_sqlite_error(stmt->dbh, stmt, __FILE__, __LINE__ TSRMLS_CC)

Definition at line 66 of file php_pdo_sqlite_int.h.


Function Documentation

int _pdo_sqlite_error ( pdo_dbh_t *  dbh,
pdo_stmt_t *  stmt,
const char *  file,
int line  TSRMLS_DC 
)

Definition at line 34 of file sqlite_driver.c.

{
       pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data;
       pdo_error_type *pdo_err = stmt ? &stmt->error_code : &dbh->error_code;
       pdo_sqlite_error_info *einfo = &H->einfo;

       einfo->errcode = sqlite3_errcode(H->db);
       einfo->file = file;
       einfo->line = line;

       if (einfo->errcode != SQLITE_OK) {
              if (einfo->errmsg) {
                     pefree(einfo->errmsg, dbh->is_persistent);
              }
              einfo->errmsg = pestrdup((char*)sqlite3_errmsg(H->db), dbh->is_persistent);
       } else { /* no error */
              strncpy(*pdo_err, PDO_ERR_NONE, sizeof(PDO_ERR_NONE));
              return 0;
       }
       switch (einfo->errcode) {
              case SQLITE_NOTFOUND:
                     strncpy(*pdo_err, "42S02", sizeof("42S02"));
                     break; 

              case SQLITE_INTERRUPT:
                     strncpy(*pdo_err, "01002", sizeof("01002"));
                     break;

              case SQLITE_NOLFS:
                     strncpy(*pdo_err, "HYC00", sizeof("HYC00"));
                     break;

              case SQLITE_TOOBIG:
                     strncpy(*pdo_err, "22001", sizeof("22001"));
                     break;
       
              case SQLITE_CONSTRAINT:
                     strncpy(*pdo_err, "23000", sizeof("23000"));
                     break;

              case SQLITE_ERROR:
              default:
                     strncpy(*pdo_err, "HY000", sizeof("HY000"));
                     break;
       }

       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 einfo->errcode;
}

Here is the call graph for this function:


Variable Documentation

Definition at line 742 of file sqlite_driver.c.