Lines Matching refs:dbh
42 int _pdo_mysql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int line) in _pdo_mysql_error() argument
44 pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; in _pdo_mysql_error()
56 pdo_err = &dbh->error_code; in _pdo_mysql_error()
70 pefree(einfo->errmsg, dbh->is_persistent); in _pdo_mysql_error()
81 dbh->is_persistent); in _pdo_mysql_error()
88 dbh->is_persistent); in _pdo_mysql_error()
94 dbh->is_persistent); in _pdo_mysql_error()
98 einfo->errmsg = pestrdup(mysql_stmt_error(S->stmt), dbh->is_persistent); in _pdo_mysql_error()
100 einfo->errmsg = pestrdup(mysql_error(H->server), dbh->is_persistent); in _pdo_mysql_error()
114 if (!dbh->methods) { in _pdo_mysql_error()
124 static void pdo_mysql_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info) in pdo_mysql_fetch_error_func() argument
126 pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; in pdo_mysql_fetch_error_func()
130 PDO_DBG_INF_FMT("dbh=%p stmt=%p", dbh, stmt); in pdo_mysql_fetch_error_func()
148 static void mysql_handle_closer(pdo_dbh_t *dbh) in mysql_handle_closer() argument
150 pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; in mysql_handle_closer()
153 PDO_DBG_INF_FMT("dbh=%p", dbh); in mysql_handle_closer()
160 pefree(H->einfo.errmsg, dbh->is_persistent); in mysql_handle_closer()
163 pefree(H, dbh->is_persistent); in mysql_handle_closer()
164 dbh->driver_data = NULL; in mysql_handle_closer()
170 static bool mysql_handle_preparer(pdo_dbh_t *dbh, zend_string *sql, pdo_stmt_t *stmt, zval *driver_… in mysql_handle_preparer() argument
172 pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; in mysql_handle_preparer()
179 PDO_DBG_INF_FMT("dbh=%p", dbh); in mysql_handle_preparer()
202 strcpy(dbh->error_code, stmt->error_code); in mysql_handle_preparer()
207 pdo_mysql_error(dbh); in mysql_handle_preparer()
225 pdo_mysql_error(dbh); in mysql_handle_preparer()
243 dbh->alloc_own_columns = 1; in mysql_handle_preparer()
258 static zend_long mysql_handle_doer(pdo_dbh_t *dbh, const zend_string *sql) in mysql_handle_doer() argument
260 pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; in mysql_handle_doer()
262 PDO_DBG_INF_FMT("dbh=%p", dbh); in mysql_handle_doer()
266 pdo_mysql_error(dbh); in mysql_handle_doer()
271 pdo_mysql_error(dbh); in mysql_handle_doer()
279 pdo_mysql_error(dbh); in mysql_handle_doer()
294 static zend_string *pdo_mysql_last_insert_id(pdo_dbh_t *dbh, const zend_string *name) in pdo_mysql_last_insert_id() argument
296 pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; in pdo_mysql_last_insert_id()
308 static zend_string* mysql_handle_quoter(pdo_dbh_t *dbh, const zend_string *unquoted, enum pdo_param… in mysql_handle_quoter() argument
310 pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; in mysql_handle_quoter()
327 PDO_DBG_INF_FMT("dbh=%p", dbh); in mysql_handle_quoter()
353 static bool mysql_handle_begin(pdo_dbh_t *dbh) in mysql_handle_begin() argument
359 PDO_DBG_INF_FMT("dbh=%p", dbh); in mysql_handle_begin()
362 return_value = mysql_handle_doer(dbh, command); in mysql_handle_begin()
369 static bool mysql_handle_commit(pdo_dbh_t *dbh) in mysql_handle_commit() argument
372 PDO_DBG_INF_FMT("dbh=%p", dbh); in mysql_handle_commit()
373 if (mysql_commit(((pdo_mysql_db_handle *)dbh->driver_data)->server)) { in mysql_handle_commit()
374 pdo_mysql_error(dbh); in mysql_handle_commit()
382 static bool mysql_handle_rollback(pdo_dbh_t *dbh) in mysql_handle_rollback() argument
385 PDO_DBG_INF_FMT("dbh=%p", dbh); in mysql_handle_rollback()
386 if (mysql_rollback(((pdo_mysql_db_handle *)dbh->driver_data)->server)) { in mysql_handle_rollback()
387 pdo_mysql_error(dbh); in mysql_handle_rollback()
395 static inline int mysql_handle_autocommit(pdo_dbh_t *dbh) in mysql_handle_autocommit() argument
398 PDO_DBG_INF_FMT("dbh=%p", dbh); in mysql_handle_autocommit()
399 PDO_DBG_INF_FMT("dbh->autocommit=%d", dbh->auto_commit); in mysql_handle_autocommit()
400 if (mysql_autocommit(((pdo_mysql_db_handle *)dbh->driver_data)->server, dbh->auto_commit)) { in mysql_handle_autocommit()
401 pdo_mysql_error(dbh); in mysql_handle_autocommit()
409 static bool pdo_mysql_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val) in pdo_mysql_set_attribute() argument
414 PDO_DBG_INF_FMT("dbh=%p", dbh); in pdo_mysql_set_attribute()
423 if (dbh->auto_commit ^ bval) { in pdo_mysql_set_attribute()
424 dbh->auto_commit = bval; in pdo_mysql_set_attribute()
425 if (!mysql_handle_autocommit(dbh)) { in pdo_mysql_set_attribute()
435 …((pdo_mysql_db_handle *)dbh->driver_data)->assume_national_character_set_strings = lval == PDO_PAR… in pdo_mysql_set_attribute()
443 ((pdo_mysql_db_handle *)dbh->driver_data)->buffered = bval; in pdo_mysql_set_attribute()
452 ((pdo_mysql_db_handle *)dbh->driver_data)->emulate_prepare = bval; in pdo_mysql_set_attribute()
459 ((pdo_mysql_db_handle *)dbh->driver_data)->fetch_table_names = bval; in pdo_mysql_set_attribute()
468 pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; in pdo_mysql_set_attribute()
470 pdo_mysql_error(dbh); in pdo_mysql_set_attribute()
481 ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = 1024*1024; in pdo_mysql_set_attribute()
482 …PDO_DBG_INF_FMT("Adjusting invalid buffer size to =%l", ((pdo_mysql_db_handle *)dbh->driver_data)-… in pdo_mysql_set_attribute()
484 ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = lval; in pdo_mysql_set_attribute()
497 static int pdo_mysql_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *return_value) argument
499 pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
502 PDO_DBG_INF_FMT("dbh=%p", dbh);
528 pdo_mysql_error(dbh);
535 ZVAL_LONG(return_value, dbh->auto_commit);
588 static zend_result pdo_mysql_check_liveness(pdo_dbh_t *dbh) argument
590 pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
593 PDO_DBG_INF_FMT("dbh=%p", dbh);
603 static void pdo_mysql_request_shutdown(pdo_dbh_t *dbh) argument
606 PDO_DBG_INF_FMT("dbh=%p", dbh);
609 pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
624 static bool pdo_mysql_in_transaction(pdo_dbh_t *dbh) argument
626 pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
660 static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options) argument
696 PDO_DBG_INF_FMT("dbh=%p", dbh);
701 php_pdo_parse_data_source(dbh->data_source, dbh->data_source_len, vars, 7);
703 H = pecalloc(1, sizeof(pdo_mysql_db_handle), dbh->is_persistent);
711 if (!(H->server = pdo_mysql_init(dbh->is_persistent))) {
712 pdo_mysql_error(dbh);
716 if (dbh->is_persistent) {
721 dbh->driver_data = H;
723 dbh->skip_param_evt =
769 pdo_mysql_error(dbh);
787 pdo_mysql_error(dbh);
807 pdo_mysql_error(dbh);
817 pdo_mysql_error(dbh);
827 pdo_mysql_error(dbh);
836 pdo_mysql_error(dbh);
876 pdo_mysql_error(dbh);
901 pdo_mysql_error(dbh);
906 …unsigned int int_and_float_native = !pdo_attr_lval(driver_options, PDO_ATTR_STRINGIFY_FETCHES, dbh…
908 pdo_mysql_error(dbh);
914 pdo_mysql_error(dbh);
932 if (!dbh->username && vars[5].optval) {
933 dbh->username = pestrdup(vars[5].optval, dbh->is_persistent);
936 if (!dbh->password && vars[6].optval) {
937 dbh->password = pestrdup(vars[6].optval, dbh->is_persistent);
946 if (dbh->password) {
947 password_len = strlen(dbh->password);
950 …if (mysqlnd_connect(H->server, host, dbh->username, dbh->password, password_len, dbname, dbname_le…
953 …if (mysql_real_connect(H->server, host, dbh->username, dbh->password, dbname, port, unix_socket, c…
955 pdo_mysql_error(dbh);
959 if (!dbh->auto_commit) {
960 mysql_handle_autocommit(dbh);
965 dbh->alloc_own_columns = 1;
966 dbh->max_escaped_char_length = 2;
967 dbh->methods = &mysql_methods;
978 dbh->methods = &mysql_methods;