Lines Matching refs:dbh
32 static void pdo_odbc_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info) in pdo_odbc_fetch_error_func() argument
34 pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; in pdo_odbc_fetch_error_func()
55 void pdo_odbc_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, PDO_ODBC_HSTMT statement, char *what, const c… in pdo_odbc_error() argument
61 pdo_odbc_db_handle *H = (pdo_odbc_db_handle*)dbh->driver_data; in pdo_odbc_error()
64 pdo_error_type *pdo_err = &dbh->error_code; in pdo_odbc_error()
102 if (!dbh->methods) { in pdo_odbc_error()
123 static void odbc_handle_closer(pdo_dbh_t *dbh) in odbc_handle_closer() argument
125 pdo_odbc_db_handle *H = (pdo_odbc_db_handle*)dbh->driver_data; in odbc_handle_closer()
135 pefree(H, dbh->is_persistent); in odbc_handle_closer()
136 dbh->driver_data = NULL; in odbc_handle_closer()
139 static bool odbc_handle_preparer(pdo_dbh_t *dbh, zend_string *sql, pdo_stmt_t *stmt, zval *driver_o… in odbc_handle_preparer() argument
142 pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; in odbc_handle_preparer()
161 strcpy(dbh->error_code, stmt->error_code); in odbc_handle_preparer()
207 strcpy(dbh->error_code, stmt->error_code); in odbc_handle_preparer()
217 static zend_long odbc_handle_doer(pdo_dbh_t *dbh, const zend_string *sql) in odbc_handle_doer() argument
219 pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; in odbc_handle_doer()
267 static bool odbc_handle_begin(pdo_dbh_t *dbh) in odbc_handle_begin() argument
269 if (dbh->auto_commit) { in odbc_handle_begin()
272 pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; in odbc_handle_begin()
283 static bool odbc_handle_commit(pdo_dbh_t *dbh) in odbc_handle_commit() argument
285 pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; in odbc_handle_commit()
298 if (dbh->auto_commit) { in odbc_handle_commit()
309 static bool odbc_handle_rollback(pdo_dbh_t *dbh) in odbc_handle_rollback() argument
311 pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; in odbc_handle_rollback()
323 if (dbh->auto_commit && H->dbc) { in odbc_handle_rollback()
335 static bool odbc_handle_set_attr(pdo_dbh_t *dbh, zend_long attr, zval *val) in odbc_handle_set_attr() argument
337 pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; in odbc_handle_set_attr()
351 if (dbh->in_txn) { in odbc_handle_set_attr()
352 …pdo_raise_impl_error(dbh, NULL, "HY000", "Cannot change autocommit mode while a transaction is alr… in odbc_handle_set_attr()
355 if (dbh->auto_commit ^ bval) { in odbc_handle_set_attr()
356 dbh->auto_commit = bval; in odbc_handle_set_attr()
360 dbh->auto_commit ? (SQLPOINTER) SQL_AUTOCOMMIT_ON : (SQLPOINTER) SQL_AUTOCOMMIT_OFF, in odbc_handle_set_attr()
365 dbh->auto_commit ? "SQLSetConnectAttr AUTOCOMMIT = ON" : "SQLSetConnectAttr AUTOCOMMIT = OFF" in odbc_handle_set_attr()
379 static int pdo_odbc_get_info_string(pdo_dbh_t *dbh, SQLUSMALLINT type, zval *val) in pdo_odbc_get_info_string() argument
384 pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; in pdo_odbc_get_info_string()
394 static int odbc_handle_get_attr(pdo_dbh_t *dbh, zend_long attr, zval *val) in odbc_handle_get_attr() argument
396 pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; in odbc_handle_get_attr()
403 return pdo_odbc_get_info_string(dbh, SQL_DBMS_VER, val); in odbc_handle_get_attr()
405 return pdo_odbc_get_info_string(dbh, SQL_DBMS_NAME, val); in odbc_handle_get_attr()
414 ZVAL_BOOL(val, dbh->auto_commit); in odbc_handle_get_attr()
420 static zend_result odbc_handle_check_liveness(pdo_dbh_t *dbh) in odbc_handle_check_liveness() argument
426 pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; in odbc_handle_check_liveness()
467 static int pdo_odbc_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{ */ in pdo_odbc_handle_factory() argument
474 H = pecalloc(1, sizeof(*H), dbh->is_persistent); in pdo_odbc_handle_factory()
476 dbh->driver_data = H; in pdo_odbc_handle_factory()
508 …(SQLPOINTER)(intptr_t)(dbh->auto_commit ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF), SQL_IS_INTEGER); in pdo_odbc_handle_factory()
523 if (strchr(dbh->data_source, '=')) { in pdo_odbc_handle_factory()
530 bool is_uid_set = dbh->username && *dbh->username in pdo_odbc_handle_factory()
531 && !strstr(dbh->data_source, "uid=") in pdo_odbc_handle_factory()
532 && !strstr(dbh->data_source, "UID="); in pdo_odbc_handle_factory()
533 bool is_pwd_set = dbh->password && *dbh->password in pdo_odbc_handle_factory()
534 && !strstr(dbh->data_source, "pwd=") in pdo_odbc_handle_factory()
535 && !strstr(dbh->data_source, "PWD="); in pdo_odbc_handle_factory()
538 …ool should_quote_uid = !php_odbc_connstr_is_quoted(dbh->username) && php_odbc_connstr_should_quote… in pdo_odbc_handle_factory()
539 …ool should_quote_pwd = !php_odbc_connstr_is_quoted(dbh->password) && php_odbc_connstr_should_quote… in pdo_odbc_handle_factory()
541 size_t estimated_length = php_odbc_connstr_estimate_quote_length(dbh->username); in pdo_odbc_handle_factory()
543 php_odbc_connstr_quote(uid, dbh->username, estimated_length); in pdo_odbc_handle_factory()
545 uid = dbh->username; in pdo_odbc_handle_factory()
548 size_t estimated_length = php_odbc_connstr_estimate_quote_length(dbh->password); in pdo_odbc_handle_factory()
550 php_odbc_connstr_quote(pwd, dbh->password, estimated_length); in pdo_odbc_handle_factory()
552 pwd = dbh->password; in pdo_odbc_handle_factory()
554 size_t new_dsn_size = strlen(dbh->data_source) in pdo_odbc_handle_factory()
557 char *dsn = pemalloc(new_dsn_size, dbh->is_persistent); in pdo_odbc_handle_factory()
558 snprintf(dsn, new_dsn_size, "%s;UID=%s;PWD=%s", dbh->data_source, uid, pwd); in pdo_odbc_handle_factory()
559 pefree((char*)dbh->data_source, dbh->is_persistent); in pdo_odbc_handle_factory()
560 dbh->data_source = dsn; in pdo_odbc_handle_factory()
569 rc = SQLDriverConnect(H->dbc, NULL, (SQLCHAR *) dbh->data_source, strlen(dbh->data_source), in pdo_odbc_handle_factory()
573 …rc = SQLConnect(H->dbc, (SQLCHAR *) dbh->data_source, SQL_NTS, (SQLCHAR *) dbh->username, SQL_NTS,… in pdo_odbc_handle_factory()
583 dbh->methods = &odbc_methods; in pdo_odbc_handle_factory()
584 dbh->alloc_own_columns = 1; in pdo_odbc_handle_factory()
589 dbh->methods = &odbc_methods; in pdo_odbc_handle_factory()