Back to index

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

Go to the source code of this file.

Classes

struct  pdo_mysql_error_info
struct  pdo_mysql_db_handle
struct  pdo_mysql_column
struct  pdo_mysql_stmt

Defines

#define PDO_MYSQL_PARAM_BIND   MYSQL_BIND
#define PDO_DBG_ENABLED   0
#define PDO_DBG_RETURN(value)   return (value)
#define PDO_DBG_VOID_RETURN   return;
#define PDO_MYSQL_G(v)   (pdo_mysql_globals.v)
#define pdo_mysql_error(s)   _pdo_mysql_error(s, NULL, __FILE__, __LINE__ TSRMLS_CC)
#define pdo_mysql_error_stmt(s)   _pdo_mysql_error(stmt->dbh, stmt, __FILE__, __LINE__ TSRMLS_CC)

Enumerations

enum  {
  PDO_MYSQL_ATTR_USE_BUFFERED_QUERY = PDO_ATTR_DRIVER_SPECIFIC, PDO_MYSQL_ATTR_LOCAL_INFILE, PDO_MYSQL_ATTR_INIT_COMMAND, PDO_MYSQL_ATTR_READ_DEFAULT_FILE,
  PDO_MYSQL_ATTR_READ_DEFAULT_GROUP, PDO_MYSQL_ATTR_MAX_BUFFER_SIZE, PDO_MYSQL_ATTR_COMPRESS, PDO_MYSQL_ATTR_DIRECT_QUERY,
  PDO_MYSQL_ATTR_FOUND_ROWS, PDO_MYSQL_ATTR_IGNORE_SPACE, PDO_MYSQL_ATTR_SSL_KEY, PDO_MYSQL_ATTR_SSL_CERT,
  PDO_MYSQL_ATTR_SSL_CA, PDO_MYSQL_ATTR_SSL_CAPATH, PDO_MYSQL_ATTR_SSL_CIPHER
}

Functions

static void PDO_DBG_INF (char *msg)
static void PDO_DBG_ERR (char *msg)
static void PDO_DBG_INF_FMT (char *format,...)
static void PDO_DBG_ERR_FMT (char *format,...)
static void PDO_DBG_ENTER (char *func_name)
int _pdo_mysql_error (pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int line TSRMLS_DC)

Variables

char * default_socket
pdo_driver_t pdo_mysql_driver

Class Documentation

struct pdo_mysql_error_info

Definition at line 92 of file php_pdo_mysql_int.h.

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

Definition at line 100 of file php_pdo_mysql_int.h.

Collaboration diagram for pdo_mysql_db_handle:
Class Members
unsigned _reserved:31
unsigned attached:1
unsigned buffered:1
pdo_mysql_error_info einfo
unsigned emulate_prepare:1
unsigned fetch_table_names:1
unsigned long max_buffer_size
MYSQL * server
struct pdo_mysql_column

Definition at line 115 of file php_pdo_mysql_int.h.

Class Members
MYSQL_FIELD * def
struct pdo_mysql_stmt

Definition at line 119 of file php_pdo_mysql_int.h.

Collaboration diagram for pdo_mysql_stmt:
Class Members
MYSQL_ROW current_data
long * current_lengths
pdo_mysql_error_info einfo
const MYSQL_FIELD * fields
pdo_mysql_db_handle * H
MYSQL_RES * result

Define Documentation

#define PDO_DBG_ENABLED   0

Definition at line 51 of file php_pdo_mysql_int.h.

#define PDO_DBG_RETURN (   value)    return (value)

Definition at line 58 of file php_pdo_mysql_int.h.

#define PDO_DBG_VOID_RETURN   return;

Definition at line 59 of file php_pdo_mysql_int.h.

#define pdo_mysql_error (   s)    _pdo_mysql_error(s, NULL, __FILE__, __LINE__ TSRMLS_CC)

Definition at line 153 of file php_pdo_mysql_int.h.

#define pdo_mysql_error_stmt (   s)    _pdo_mysql_error(stmt->dbh, stmt, __FILE__, __LINE__ TSRMLS_CC)

Definition at line 154 of file php_pdo_mysql_int.h.

#define PDO_MYSQL_G (   v)    (pdo_mysql_globals.v)

Definition at line 88 of file php_pdo_mysql_int.h.

#define PDO_MYSQL_PARAM_BIND   MYSQL_BIND

Definition at line 32 of file php_pdo_mysql_int.h.


Enumeration Type Documentation

anonymous enum
Enumerator:
PDO_MYSQL_ATTR_USE_BUFFERED_QUERY 
PDO_MYSQL_ATTR_LOCAL_INFILE 
PDO_MYSQL_ATTR_INIT_COMMAND 
PDO_MYSQL_ATTR_READ_DEFAULT_FILE 
PDO_MYSQL_ATTR_READ_DEFAULT_GROUP 
PDO_MYSQL_ATTR_MAX_BUFFER_SIZE 
PDO_MYSQL_ATTR_COMPRESS 
PDO_MYSQL_ATTR_DIRECT_QUERY 
PDO_MYSQL_ATTR_FOUND_ROWS 
PDO_MYSQL_ATTR_IGNORE_SPACE 
PDO_MYSQL_ATTR_SSL_KEY 
PDO_MYSQL_ATTR_SSL_CERT 
PDO_MYSQL_ATTR_SSL_CA 
PDO_MYSQL_ATTR_SSL_CAPATH 
PDO_MYSQL_ATTR_SSL_CIPHER 

Definition at line 158 of file php_pdo_mysql_int.h.


Function Documentation

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

Definition at line 57 of file mysql_driver.c.

{
       pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
       pdo_error_type *pdo_err; 
       pdo_mysql_error_info *einfo;
       pdo_mysql_stmt *S = NULL;

       PDO_DBG_ENTER("_pdo_mysql_error");
       PDO_DBG_INF_FMT("file=%s line=%d", file, line);
       if (stmt) {
              S = (pdo_mysql_stmt*)stmt->driver_data;
              pdo_err = &stmt->error_code;
              einfo   = &S->einfo;
       } else {
              pdo_err = &dbh->error_code;
              einfo   = &H->einfo;
       }

#if defined(HAVE_MYSQL_STMT_PREPARE) || defined(PDO_USE_MYSQLND)
       if (S && S->stmt) {
              einfo->errcode = mysql_stmt_errno(S->stmt);
       }
       else
#endif
       {
              einfo->errcode = mysql_errno(H->server);
       }

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

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

       if (einfo->errcode) {
              if (einfo->errcode == 2014) {
                     einfo->errmsg = pestrdup(
                            "Cannot execute queries while other unbuffered queries are active.  "
                            "Consider using PDOStatement::fetchAll().  Alternatively, if your code "
                            "is only ever going to run against mysql, you may enable query "
                            "buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.",
                            dbh->is_persistent);
              } else if (einfo->errcode == 2057) {
                     einfo->errmsg = pestrdup(
                            "A stored procedure returning result sets of different size was called. "
                            "This is not supported by libmysql",
                            dbh->is_persistent);

              } else {
                     einfo->errmsg = pestrdup(mysql_error(H->server), dbh->is_persistent);
              }
       } else { /* no error */
              strcpy(*pdo_err, PDO_ERR_NONE);
              PDO_DBG_RETURN(0);
       }

#if defined(HAVE_MYSQL_SQLSTATE) || defined(PDO_USE_MYSQLND)
# if defined(HAVE_MYSQL_STMT_PREPARE) || defined(PDO_USE_MYSQLND)
       if (S && S->stmt) {
              strcpy(*pdo_err, mysql_stmt_sqlstate(S->stmt));
       } else
# endif
       {
              strcpy(*pdo_err, mysql_sqlstate(H->server));
       }
#else
       strcpy(*pdo_err, pdo_mysql_get_sqlstate(einfo->errcode));
#endif

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

       PDO_DBG_RETURN(einfo->errcode);
}

Here is the call graph for this function:

static void PDO_DBG_ENTER ( char *  func_name) [inline, static]

Definition at line 57 of file php_pdo_mysql_int.h.

{}

Here is the caller graph for this function:

static void PDO_DBG_ERR ( char *  msg) [inline, static]

Definition at line 54 of file php_pdo_mysql_int.h.

{}

Here is the caller graph for this function:

static void PDO_DBG_ERR_FMT ( char *  format,
  ... 
) [inline, static]

Definition at line 56 of file php_pdo_mysql_int.h.

{}
static void PDO_DBG_INF ( char *  msg) [inline, static]

Definition at line 53 of file php_pdo_mysql_int.h.

{}

Here is the caller graph for this function:

static void PDO_DBG_INF_FMT ( char *  format,
  ... 
) [inline, static]

Definition at line 55 of file php_pdo_mysql_int.h.

{}

Here is the caller graph for this function:


Variable Documentation

Definition at line 69 of file php_pdo_mysql_int.h.

Definition at line 806 of file mysql_driver.c.