mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Move static functions further up so they are delared efore being used.
This commit is contained in:
parent
8cec20a565
commit
1fd53fd2ae
1 changed files with 58 additions and 60 deletions
|
@ -34,6 +34,64 @@
|
|||
#include "php_mysqli_structs.h"
|
||||
#include "mysqli_priv.h"
|
||||
|
||||
#if !defined(MYSQLI_USE_MYSQLND)
|
||||
/* {{{ mysqli_tx_cor_options_to_string */
|
||||
static void mysqli_tx_cor_options_to_string(const MYSQL * const conn, smart_str * str, const unsigned int mode)
|
||||
{
|
||||
if (mode & TRANS_COR_AND_CHAIN && !(mode & TRANS_COR_AND_NO_CHAIN)) {
|
||||
if (str->len) {
|
||||
smart_str_appendl(str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(str, "AND CHAIN", sizeof("AND CHAIN") - 1);
|
||||
} else if (mode & TRANS_COR_AND_NO_CHAIN && !(mode & TRANS_COR_AND_CHAIN)) {
|
||||
if (str->len) {
|
||||
smart_str_appendl(str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(str, "AND NO CHAIN", sizeof("AND NO CHAIN") - 1);
|
||||
}
|
||||
|
||||
if (mode & TRANS_COR_RELEASE && !(mode & TRANS_COR_NO_RELEASE)) {
|
||||
if (str->len) {
|
||||
smart_str_appendl(str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(str, "RELEASE", sizeof("RELEASE") - 1);
|
||||
} else if (mode & TRANS_COR_NO_RELEASE && !(mode & TRANS_COR_RELEASE)) {
|
||||
if (str->len) {
|
||||
smart_str_appendl(str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(str, "NO RELEASE", sizeof("NO RELEASE") - 1);
|
||||
}
|
||||
smart_str_0(str);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto bool mysqli_commit_or_rollback_libmysql */
|
||||
static int mysqli_commit_or_rollback_libmysql(MYSQL * conn, zend_bool commit, const unsigned int mode, const char * const name)
|
||||
{
|
||||
int ret;
|
||||
smart_str tmp_str = {0, 0, 0};
|
||||
mysqli_tx_cor_options_to_string(conn, &tmp_str, mode);
|
||||
smart_str_0(&tmp_str);
|
||||
|
||||
{
|
||||
char * commented_name = NULL;
|
||||
unsigned int commented_name_len = name? spprintf(&commented_name, 0, " /*%s*/", name):0;
|
||||
char * query;
|
||||
unsigned int query_len = spprintf(&query, 0, (commit? "COMMIT%s %s":"ROLLBACK%s %s"),
|
||||
commented_name? commented_name:"", tmp_str.c? tmp_str.c:"");
|
||||
smart_str_free(&tmp_str);
|
||||
|
||||
ret = mysql_real_query(conn, query, query_len);
|
||||
efree(query);
|
||||
if (commented_name) {
|
||||
efree(commented_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
/* {{{ proto mixed mysqli_affected_rows(object link)
|
||||
Get number of affected rows in previous MySQL operation */
|
||||
PHP_FUNCTION(mysqli_affected_rows)
|
||||
|
@ -646,66 +704,6 @@ PHP_FUNCTION(mysqli_close)
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
#if !defined(MYSQLI_USE_MYSQLND)
|
||||
/* {{{ mysqli_tx_cor_options_to_string */
|
||||
static void mysqli_tx_cor_options_to_string(const MYSQL * const conn, smart_str * str, const unsigned int mode)
|
||||
{
|
||||
if (mode & TRANS_COR_AND_CHAIN && !(mode & TRANS_COR_AND_NO_CHAIN)) {
|
||||
if (str->len) {
|
||||
smart_str_appendl(str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(str, "AND CHAIN", sizeof("AND CHAIN") - 1);
|
||||
} else if (mode & TRANS_COR_AND_NO_CHAIN && !(mode & TRANS_COR_AND_CHAIN)) {
|
||||
if (str->len) {
|
||||
smart_str_appendl(str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(str, "AND NO CHAIN", sizeof("AND NO CHAIN") - 1);
|
||||
}
|
||||
|
||||
if (mode & TRANS_COR_RELEASE && !(mode & TRANS_COR_NO_RELEASE)) {
|
||||
if (str->len) {
|
||||
smart_str_appendl(str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(str, "RELEASE", sizeof("RELEASE") - 1);
|
||||
} else if (mode & TRANS_COR_NO_RELEASE && !(mode & TRANS_COR_RELEASE)) {
|
||||
if (str->len) {
|
||||
smart_str_appendl(str, ", ", sizeof(", ") - 1);
|
||||
}
|
||||
smart_str_appendl(str, "NO RELEASE", sizeof("NO RELEASE") - 1);
|
||||
}
|
||||
smart_str_0(str);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto bool mysqli_commit_or_rollback_libmysql */
|
||||
static int mysqli_commit_or_rollback_libmysql(MYSQL * conn, zend_bool commit, const unsigned int mode, const char * const name)
|
||||
{
|
||||
int ret;
|
||||
smart_str tmp_str = {0, 0, 0};
|
||||
mysqli_tx_cor_options_to_string(conn, &tmp_str, mode);
|
||||
smart_str_0(&tmp_str);
|
||||
|
||||
{
|
||||
char * commented_name = NULL;
|
||||
unsigned int commented_name_len = name? spprintf(&commented_name, 0, " /*%s*/", name):0;
|
||||
char * query;
|
||||
unsigned int query_len = spprintf(&query, 0, (commit? "COMMIT%s %s":"ROLLBACK%s %s"),
|
||||
commented_name? commented_name:"", tmp_str.c? tmp_str.c:"");
|
||||
smart_str_free(&tmp_str);
|
||||
|
||||
ret = mysql_real_query(conn, query, query_len);
|
||||
efree(query);
|
||||
if (commented_name) {
|
||||
efree(commented_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
|
||||
/* {{{ proto bool mysqli_commit(object link)
|
||||
Commit outstanding actions and close transaction */
|
||||
PHP_FUNCTION(mysqli_commit)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue