Lines Matching refs:dbh

46 int _pdo_mysql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int line TSRMLS_DC)  in _pdo_mysql_error()  argument
48 pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; in _pdo_mysql_error()
60 pdo_err = &dbh->error_code; in _pdo_mysql_error()
74 pefree(einfo->errmsg, dbh->is_persistent); in _pdo_mysql_error()
85 dbh->is_persistent); in _pdo_mysql_error()
90 dbh->is_persistent); in _pdo_mysql_error()
93 einfo->errmsg = pestrdup(mysql_error(H->server), dbh->is_persistent); in _pdo_mysql_error()
106 if (!dbh->methods) { in _pdo_mysql_error()
117 static int pdo_mysql_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info TSRMLS_DC) in pdo_mysql_fetch_error_func() argument
119 pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; in pdo_mysql_fetch_error_func()
123 PDO_DBG_INF_FMT("dbh=%p stmt=%p", dbh, stmt); in pdo_mysql_fetch_error_func()
141 static int mysql_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) in mysql_handle_closer()
143 pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; in mysql_handle_closer()
146 PDO_DBG_INF_FMT("dbh=%p", dbh); in mysql_handle_closer()
153 pefree(H->einfo.errmsg, dbh->is_persistent); in mysql_handle_closer()
156 pefree(H, dbh->is_persistent); in mysql_handle_closer()
157 dbh->driver_data = NULL; in mysql_handle_closer()
164 static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, z… in mysql_handle_preparer() argument
166 pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; in mysql_handle_preparer()
174 PDO_DBG_INF_FMT("dbh=%p", dbh); in mysql_handle_preparer()
198 strcpy(dbh->error_code, stmt->error_code); in mysql_handle_preparer()
203 pdo_mysql_error(dbh); in mysql_handle_preparer()
219 pdo_mysql_error(dbh); in mysql_handle_preparer()
241 dbh->alloc_own_columns = 1; in mysql_handle_preparer()
256 static long mysql_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRMLS_DC) in mysql_handle_doer() argument
258 pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; in mysql_handle_doer()
260 PDO_DBG_INF_FMT("dbh=%p", dbh); in mysql_handle_doer()
264 pdo_mysql_error(dbh); in mysql_handle_doer()
269 pdo_mysql_error(dbh); in mysql_handle_doer()
291 static char *pdo_mysql_last_insert_id(pdo_dbh_t *dbh, const char *name, unsigned int *len TSRMLS_DC) in pdo_mysql_last_insert_id() argument
293 pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; in pdo_mysql_last_insert_id()
302 static int mysql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted… in mysql_handle_quoter() argument
304 pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; in mysql_handle_quoter()
306 PDO_DBG_INF_FMT("dbh=%p", dbh); in mysql_handle_quoter()
318 static int mysql_handle_begin(pdo_dbh_t *dbh TSRMLS_DC) in mysql_handle_begin()
321 PDO_DBG_INF_FMT("dbh=%p", dbh); in mysql_handle_begin()
322 PDO_DBG_RETURN(0 <= mysql_handle_doer(dbh, ZEND_STRL("START TRANSACTION") TSRMLS_CC)); in mysql_handle_begin()
327 static int mysql_handle_commit(pdo_dbh_t *dbh TSRMLS_DC) in mysql_handle_commit()
330 PDO_DBG_INF_FMT("dbh=%p", dbh); in mysql_handle_commit()
332 PDO_DBG_RETURN(0 <= mysql_commit(((pdo_mysql_db_handle *)dbh->driver_data)->server)); in mysql_handle_commit()
334 PDO_DBG_RETURN(0 <= mysql_handle_doer(dbh, ZEND_STRL("COMMIT") TSRMLS_CC)); in mysql_handle_commit()
340 static int mysql_handle_rollback(pdo_dbh_t *dbh TSRMLS_DC) in mysql_handle_rollback()
343 PDO_DBG_INF_FMT("dbh=%p", dbh); in mysql_handle_rollback()
345 PDO_DBG_RETURN(0 <= mysql_rollback(((pdo_mysql_db_handle *)dbh->driver_data)->server)); in mysql_handle_rollback()
347 PDO_DBG_RETURN(0 <= mysql_handle_doer(dbh, ZEND_STRL("ROLLBACK") TSRMLS_CC)); in mysql_handle_rollback()
353 static inline int mysql_handle_autocommit(pdo_dbh_t *dbh TSRMLS_DC) in mysql_handle_autocommit()
356 PDO_DBG_INF_FMT("dbh=%p", dbh); in mysql_handle_autocommit()
357 PDO_DBG_INF_FMT("dbh->autocommit=%d", dbh->auto_commit); in mysql_handle_autocommit()
359 …PDO_DBG_RETURN(0 <= mysql_autocommit(((pdo_mysql_db_handle *)dbh->driver_data)->server, dbh->auto_… in mysql_handle_autocommit()
361 if (dbh->auto_commit) { in mysql_handle_autocommit()
362 PDO_DBG_RETURN(0 <= mysql_handle_doer(dbh, ZEND_STRL("SET AUTOCOMMIT=1") TSRMLS_CC)); in mysql_handle_autocommit()
364 PDO_DBG_RETURN(0 <= mysql_handle_doer(dbh, ZEND_STRL("SET AUTOCOMMIT=0") TSRMLS_CC)); in mysql_handle_autocommit()
371 static int pdo_mysql_set_attribute(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC) in pdo_mysql_set_attribute() argument
374 PDO_DBG_INF_FMT("dbh=%p", dbh); in pdo_mysql_set_attribute()
381 if (dbh->auto_commit ^ Z_BVAL_P(val)) { in pdo_mysql_set_attribute()
382 dbh->auto_commit = Z_BVAL_P(val); in pdo_mysql_set_attribute()
383 mysql_handle_autocommit(dbh TSRMLS_CC); in pdo_mysql_set_attribute()
388 ((pdo_mysql_db_handle *)dbh->driver_data)->buffered = Z_BVAL_P(val); in pdo_mysql_set_attribute()
392 ((pdo_mysql_db_handle *)dbh->driver_data)->emulate_prepare = Z_BVAL_P(val); in pdo_mysql_set_attribute()
395 ((pdo_mysql_db_handle *)dbh->driver_data)->fetch_table_names = Z_BVAL_P(val); in pdo_mysql_set_attribute()
401 ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = 1024*1024; in pdo_mysql_set_attribute()
402 …PDO_DBG_INF_FMT("Adjusting invalid buffer size to =%l", ((pdo_mysql_db_handle *)dbh->driver_data)-… in pdo_mysql_set_attribute()
404 ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = Z_LVAL_P(val); in pdo_mysql_set_attribute()
417 static int pdo_mysql_get_attribute(pdo_dbh_t *dbh, long attr, zval *return_value TSRMLS_DC) argument
419 pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
422 PDO_DBG_INF_FMT("dbh=%p", dbh);
448 pdo_mysql_error(dbh);
454 ZVAL_LONG(return_value, dbh->auto_commit);
481 static int pdo_mysql_check_liveness(pdo_dbh_t *dbh TSRMLS_DC)
483 pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
490 PDO_DBG_INF_FMT("dbh=%p", dbh);
537 static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_DC) argument
570 PDO_DBG_INF_FMT("dbh=%p", dbh);
575 php_pdo_parse_data_source(dbh->data_source, dbh->data_source_len, vars, 5);
577 H = pecalloc(1, sizeof(pdo_mysql_db_handle), dbh->is_persistent);
585 if (!(H->server = pdo_mysql_init(dbh->is_persistent))) {
586 pdo_mysql_error(dbh);
590 dbh->driver_data = H;
628 pdo_mysql_error(dbh);
642 pdo_mysql_error(dbh);
660 pdo_mysql_error(dbh);
670 pdo_mysql_error(dbh);
680 pdo_mysql_error(dbh);
689 pdo_mysql_error(dbh);
724 pdo_mysql_error(dbh);
736 pdo_mysql_error(dbh);
761 if (dbh->password) {
762 password_len = strlen(dbh->password);
765 …if (mysqlnd_connect(H->server, host, dbh->username, dbh->password, password_len, dbname, dbname_le…
768 …if (mysql_real_connect(H->server, host, dbh->username, dbh->password, dbname, port, unix_socket, c…
770 pdo_mysql_error(dbh);
774 if (!dbh->auto_commit) {
775 mysql_handle_autocommit(dbh TSRMLS_CC);
780 dbh->alloc_own_columns = 1;
781 dbh->max_escaped_char_length = 2;
782 dbh->methods = &mysql_methods;
793 dbh->methods = &mysql_methods;