当前位置: 首页>>代码示例>>C++>>正文


C++ PDO_DBG_ENTER函数代码示例

本文整理汇总了C++中PDO_DBG_ENTER函数的典型用法代码示例。如果您正苦于以下问题:C++ PDO_DBG_ENTER函数的具体用法?C++ PDO_DBG_ENTER怎么用?C++ PDO_DBG_ENTER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PDO_DBG_ENTER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _nuodb_error

/* map driver specific SQLSTATE error message to PDO error */
void _nuodb_error(pdo_dbh_t * dbh, pdo_stmt_t * stmt, char const * file, long line TSRMLS_DC) /* {{{ */
{
    int error_code = 0;
    const char *error_msg = "UKNOWN ERROR";
    pdo_nuodb_db_handle * H = stmt ? ((pdo_nuodb_stmt *)stmt->driver_data)->H
                              : (pdo_nuodb_db_handle *)dbh->driver_data;
    pdo_error_type * const error_code_str = stmt ? &stmt->error_code : &dbh->error_code;


    PDO_DBG_ENTER("_nuodb_error");
    PDO_DBG_INF_FMT("file=%s line=%d", file, line);

    // TODO -- We could do a better job of mapping NuoDB errors codes into PDO error
    // codes, but for now just use "HY000"
    strcpy(*error_code_str, "HY000");

    if (stmt != NULL) {
        pdo_nuodb_stmt *pdo_stmt = (pdo_nuodb_stmt *) stmt->driver_data;
        if (pdo_stmt != NULL) {
            if (pdo_stmt->error_msg != NULL)
                error_msg = pdo_stmt->error_msg;
            error_code = pdo_stmt->error_code;
        }
    }

    nuodb_throw_zend_exception(*error_code_str, error_code, error_msg);
    PDO_DBG_VOID_RETURN;
}
开发者ID:evail,项目名称:nuodb-drivers,代码行数:29,代码来源:nuodb_driver.c

示例2: mysql_handle_doer

/* {{{ mysql_handle_doer */
static zend_long mysql_handle_doer(pdo_dbh_t *dbh, const char *sql, size_t sql_len)
{
	pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
	PDO_DBG_ENTER("mysql_handle_doer");
	PDO_DBG_INF_FMT("dbh=%p", dbh);
	PDO_DBG_INF_FMT("sql=%.*s", (int)sql_len, sql);

	if (mysql_real_query(H->server, sql, sql_len)) {
		pdo_mysql_error(dbh);
		PDO_DBG_RETURN(-1);
	} else {
		my_ulonglong c = mysql_affected_rows(H->server);
		if (c == (my_ulonglong) -1) {
			pdo_mysql_error(dbh);
			PDO_DBG_RETURN(H->einfo.errcode ? -1 : 0);
		} else {

			/* MULTI_QUERY support - eat up all unfetched result sets */
			MYSQL_RES* result;
			while (mysql_more_results(H->server)) {
				if (mysql_next_result(H->server)) {
					PDO_DBG_RETURN(1);
				}
				result = mysql_store_result(H->server);
				if (result) {
					mysql_free_result(result);
				}
			}
			PDO_DBG_RETURN((int)c);
		}
	}
}
开发者ID:bishopb,项目名称:php-src,代码行数:33,代码来源:mysql_driver.c

示例3: mysql_handle_autocommit

/* {{{ mysql_handle_autocommit */
static inline int mysql_handle_autocommit(pdo_dbh_t *dbh)
{
	PDO_DBG_ENTER("mysql_handle_autocommit");
	PDO_DBG_INF_FMT("dbh=%p", dbh);
	PDO_DBG_INF_FMT("dbh->autocommit=%d", dbh->auto_commit);
	PDO_DBG_RETURN(0 <= mysql_autocommit(((pdo_mysql_db_handle *)dbh->driver_data)->server, dbh->auto_commit));
}
开发者ID:bishopb,项目名称:php-src,代码行数:8,代码来源:mysql_driver.c

示例4: nuodb_throw_zend_exception

void nuodb_throw_zend_exception(const char *sql_state, int code, const char *msg) {
  TSRMLS_FETCH();
  PDO_DBG_ENTER("nuodb_throw_zend_exception");
  PDO_DBG_INF_FMT("Throwing exception: SQLSTATE[%s] [%d] %s", sql_state, code, msg);
  zend_throw_exception_ex(php_pdo_get_exception(), code TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
			  sql_state, code, msg);
  PDO_DBG_VOID_RETURN;
}
开发者ID:evail,项目名称:nuodb-drivers,代码行数:8,代码来源:nuodb_driver.c

示例5: php_pdo_int64_to_str

/* {{{ pdo_mysql_last_insert_id */
static char *pdo_mysql_last_insert_id(pdo_dbh_t *dbh, const char *name, size_t *len)
{
	pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
	char *id = php_pdo_int64_to_str(mysql_insert_id(H->server));
	PDO_DBG_ENTER("pdo_mysql_last_insert_id");
	*len = strlen(id);
	PDO_DBG_RETURN(id);
}
开发者ID:bishopb,项目名称:php-src,代码行数:9,代码来源:mysql_driver.c

示例6: mysql_handle_rollback

/* {{{ mysql_handle_rollback */
static int mysql_handle_rollback(pdo_dbh_t *dbh)
{
	PDO_DBG_ENTER("mysql_handle_rollback");
	PDO_DBG_INF_FMT("dbh=%p", dbh);
#if MYSQL_VERSION_ID >= 40100 || defined(PDO_USE_MYSQLND)
	PDO_DBG_RETURN(0 <= mysql_rollback(((pdo_mysql_db_handle *)dbh->driver_data)->server));
#else
	PDO_DBG_RETURN(0 <= mysql_handle_doer(dbh, ZEND_STRL("ROLLBACK")));
#endif
}
开发者ID:mdesign83,项目名称:php-src,代码行数:11,代码来源:mysql_driver.c

示例7: pdo_mysql_request_shutdown

/* {{{ pdo_mysql_request_shutdown */
static void pdo_mysql_request_shutdown(pdo_dbh_t *dbh)
{
	pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;

	PDO_DBG_ENTER("pdo_mysql_request_shutdown");
	PDO_DBG_INF_FMT("dbh=%p", dbh);
#ifdef PDO_USE_MYSQLND
	if (H->server) {
		mysqlnd_end_psession(H->server);
	}
#endif
}
开发者ID:bishopb,项目名称:php-src,代码行数:13,代码来源:mysql_driver.c

示例8: PHP_RSHUTDOWN_FUNCTION

/* {{{ PHP_RSHUTDOWN_FUNCTION
 */
static PHP_RSHUTDOWN_FUNCTION(pdo_mysql)
{
	MYSQLND_DEBUG *dbg = PDO_MYSQL_G(dbg);
	PDO_DBG_ENTER("RSHUTDOWN");
	if (dbg) {
		dbg->m->close(dbg);
		dbg->m->free_handle(dbg);
		PDO_MYSQL_G(dbg) = NULL;
	}

	return SUCCESS;
}
开发者ID:13572293130,项目名称:php-src,代码行数:14,代码来源:pdo_mysql.c

示例9: pdo_mysql_set_attribute

/* {{{ pdo_mysql_set_attribute */
static int pdo_mysql_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val)
{
	zend_long lval = zval_get_long(val);
	zend_bool bval = lval ? 1 : 0;
	PDO_DBG_ENTER("pdo_mysql_set_attribute");
	PDO_DBG_INF_FMT("dbh=%p", dbh);
	PDO_DBG_INF_FMT("attr=%l", attr);
	switch (attr) {
		case PDO_ATTR_AUTOCOMMIT:
			/* ignore if the new value equals the old one */
			if (dbh->auto_commit ^ bval) {
				dbh->auto_commit = bval;
				mysql_handle_autocommit(dbh);
			}
			PDO_DBG_RETURN(1);

		case PDO_ATTR_DEFAULT_STR_PARAM:
			((pdo_mysql_db_handle *)dbh->driver_data)->assume_national_character_set_strings = lval == PDO_PARAM_STR_NATL;
			PDO_DBG_RETURN(1);

		case PDO_MYSQL_ATTR_USE_BUFFERED_QUERY:
			/* ignore if the new value equals the old one */
			((pdo_mysql_db_handle *)dbh->driver_data)->buffered = bval;
			PDO_DBG_RETURN(1);

		case PDO_MYSQL_ATTR_DIRECT_QUERY:
		case PDO_ATTR_EMULATE_PREPARES:
			/* ignore if the new value equals the old one */
			((pdo_mysql_db_handle *)dbh->driver_data)->emulate_prepare = bval;
			PDO_DBG_RETURN(1);

		case PDO_ATTR_FETCH_TABLE_NAMES:
			((pdo_mysql_db_handle *)dbh->driver_data)->fetch_table_names = bval;
			PDO_DBG_RETURN(1);

#ifndef PDO_USE_MYSQLND
		case PDO_MYSQL_ATTR_MAX_BUFFER_SIZE:
			if (lval < 0) {
				/* TODO: Johannes, can we throw a warning here? */
 				((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = 1024*1024;
				PDO_DBG_INF_FMT("Adjusting invalid buffer size to =%l", ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size);
			} else {
				((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = lval;
			}
			PDO_DBG_RETURN(1);
			break;
#endif

		default:
			PDO_DBG_RETURN(0);
	}
}
开发者ID:bishopb,项目名称:php-src,代码行数:53,代码来源:mysql_driver.c

示例10: mysql_handle_quoter

/* {{{ mysql_handle_quoter */
static int mysql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type paramtype )
{
	pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
	PDO_DBG_ENTER("mysql_handle_quoter");
	PDO_DBG_INF_FMT("dbh=%p", dbh);
	PDO_DBG_INF_FMT("unquoted=%.*s", unquotedlen, unquoted);
	*quoted = safe_emalloc(2, unquotedlen, 3);
	*quotedlen = mysql_real_escape_string(H->server, *quoted + 1, unquoted, unquotedlen);
	(*quoted)[0] =(*quoted)[++*quotedlen] = '\'';
	(*quoted)[++*quotedlen] = '\0';
	PDO_DBG_INF_FMT("quoted=%.*s", *quotedlen, *quoted);
	PDO_DBG_RETURN(1);
}
开发者ID:mdesign83,项目名称:php-src,代码行数:14,代码来源:mysql_driver.c

示例11: mysql_handle_autocommit

/* {{{ mysql_handle_autocommit */
static inline int mysql_handle_autocommit(pdo_dbh_t *dbh)
{
	PDO_DBG_ENTER("mysql_handle_autocommit");
	PDO_DBG_INF_FMT("dbh=%p", dbh);
	PDO_DBG_INF_FMT("dbh->autocommit=%d", dbh->auto_commit);
#if MYSQL_VERSION_ID >= 40100 || defined(PDO_USE_MYSQLND)
	PDO_DBG_RETURN(0 <= mysql_autocommit(((pdo_mysql_db_handle *)dbh->driver_data)->server, dbh->auto_commit));
#else
	if (dbh->auto_commit) {
		PDO_DBG_RETURN(0 <= mysql_handle_doer(dbh, ZEND_STRL("SET AUTOCOMMIT=1")));
	} else {
		PDO_DBG_RETURN(0 <= mysql_handle_doer(dbh, ZEND_STRL("SET AUTOCOMMIT=0")));
	}
#endif
}
开发者ID:mdesign83,项目名称:php-src,代码行数:16,代码来源:mysql_driver.c

示例12: pdo_mysql_set_attribute

/* {{{ pdo_mysql_set_attribute */
static int pdo_mysql_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val)
{
	PDO_DBG_ENTER("pdo_mysql_set_attribute");
	PDO_DBG_INF_FMT("dbh=%p", dbh);
	PDO_DBG_INF_FMT("attr=%l", attr);
	switch (attr) {
		case PDO_ATTR_AUTOCOMMIT:
			convert_to_boolean(val);
			/* ignore if the new value equals the old one */
			if (dbh->auto_commit ^ (Z_TYPE_P(val) == IS_TRUE)) {
				dbh->auto_commit = (Z_TYPE_P(val) == IS_TRUE);
				mysql_handle_autocommit(dbh);
			}
			PDO_DBG_RETURN(1);

		case PDO_MYSQL_ATTR_USE_BUFFERED_QUERY:
			convert_to_boolean(val);
			/* ignore if the new value equals the old one */
			((pdo_mysql_db_handle *)dbh->driver_data)->buffered = (Z_TYPE_P(val) == IS_TRUE);
			PDO_DBG_RETURN(1);
		case PDO_MYSQL_ATTR_DIRECT_QUERY:
		case PDO_ATTR_EMULATE_PREPARES:
			convert_to_boolean(val);
			/* ignore if the new value equals the old one */
			((pdo_mysql_db_handle *)dbh->driver_data)->emulate_prepare = (Z_TYPE_P(val) == IS_TRUE);
			PDO_DBG_RETURN(1);
		case PDO_ATTR_FETCH_TABLE_NAMES:
			convert_to_boolean(val);
			((pdo_mysql_db_handle *)dbh->driver_data)->fetch_table_names = (Z_TYPE_P(val) == IS_TRUE);
			PDO_DBG_RETURN(1);
#ifndef PDO_USE_MYSQLND
		case PDO_MYSQL_ATTR_MAX_BUFFER_SIZE:
			convert_to_long(val);
			if (Z_LVAL_P(val) < 0) {
				/* TODO: Johannes, can we throw a warning here? */
 				((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = 1024*1024;
				PDO_DBG_INF_FMT("Adjusting invalid buffer size to =%l", ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size);
			} else {
				((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = Z_LVAL_P(val);
			}
			PDO_DBG_RETURN(1);
			break;
#endif

		default:
			PDO_DBG_RETURN(0);
	}
}
开发者ID:mdesign83,项目名称:php-src,代码行数:49,代码来源:mysql_driver.c

示例13: _record_error

int _record_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int line, const char *sql_state,  int error_code, const char *error_message)
{
	pdo_nuodb_db_handle *H = (pdo_nuodb_db_handle *)dbh->driver_data;
	pdo_error_type *pdo_err;
	pdo_nuodb_error_info *einfo;
	pdo_nuodb_stmt *S = NULL;

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

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

	if (!einfo->errcode) { /* no error */
		strcpy(*pdo_err, PDO_ERR_NONE);
		PDO_DBG_RETURN(0);
	}

	einfo->errmsg = pestrdup(error_message, dbh->is_persistent);
	strncpy(*pdo_err, sql_state, 6);


	if (!dbh->methods) {
		TSRMLS_FETCH();
		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);

}
开发者ID:thebithead,项目名称:nuodb-php-pdo,代码行数:47,代码来源:nuodb_driver.c

示例14: mysql_handle_closer

/* {{{ mysql_handle_closer */
static int mysql_handle_closer(pdo_dbh_t *dbh)
{
	pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;

	PDO_DBG_ENTER("mysql_handle_closer");
	PDO_DBG_INF_FMT("dbh=%p", dbh);
	if (H) {
		if (H->server) {
			mysql_close(H->server);
		}
		if (H->einfo.errmsg) {
			pefree(H->einfo.errmsg, dbh->is_persistent);
		}
		pefree(H, dbh->is_persistent);
		dbh->driver_data = NULL;
	}
	PDO_DBG_RETURN(0);
}
开发者ID:bishopb,项目名称:php-src,代码行数:19,代码来源:mysql_driver.c

示例15: pdo_mysql_fetch_error_func

/* {{{ pdo_mysql_fetch_error_func */
static int pdo_mysql_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info)
{
	pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
	pdo_mysql_error_info *einfo = &H->einfo;

	PDO_DBG_ENTER("pdo_mysql_fetch_error_func");
	PDO_DBG_INF_FMT("dbh=%p stmt=%p", dbh, stmt);
	if (stmt) {
		pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;
		einfo = &S->einfo;
	} else {
		einfo = &H->einfo;
	}

	if (einfo->errcode) {
		add_next_index_long(info, einfo->errcode);
		add_next_index_string(info, einfo->errmsg);
	}

	PDO_DBG_RETURN(1);
}
开发者ID:bishopb,项目名称:php-src,代码行数:22,代码来源:mysql_driver.c


注:本文中的PDO_DBG_ENTER函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。