Skip to content

Commit

Permalink
Pass tsrmls to all functions, which might need it in the future.
Browse files Browse the repository at this point in the history
We are anyway breaking the internal ABI in 5.3.2 so this won't hurt
and make us prepared for the future.
  • Loading branch information
faizshukri committed Feb 3, 2010
1 parent 3247c25 commit e50de7d
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 146 deletions.
41 changes: 18 additions & 23 deletions ext/mysqlnd/mysqlnd.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,7 @@ MYSQLND_METHOD(mysqlnd_conn, simple_command)(MYSQLND *conn, enum php_mysqlnd_ser

/* {{{ mysqlnd_conn::set_server_option */
static enum_func_status
MYSQLND_METHOD(mysqlnd_conn, set_server_option)(MYSQLND * const conn,
enum_mysqlnd_server_option option TSRMLS_DC)
MYSQLND_METHOD(mysqlnd_conn, set_server_option)(MYSQLND * const conn, enum_mysqlnd_server_option option TSRMLS_DC)
{
enum_func_status ret;
char buffer[2];
Expand Down Expand Up @@ -1108,8 +1107,7 @@ MYSQLND_METHOD(mysqlnd_conn, list_fields)(MYSQLND *conn, const char *table, cons

/* {{{ mysqlnd_conn::list_method */
MYSQLND_RES *
MYSQLND_METHOD(mysqlnd_conn, list_method)(MYSQLND *conn, const char *query,
const char *achtung_wild, char *par1 TSRMLS_DC)
MYSQLND_METHOD(mysqlnd_conn, list_method)(MYSQLND *conn, const char *query, const char *achtung_wild, char *par1 TSRMLS_DC)
{
char *show_query = NULL;
size_t show_query_len;
Expand Down Expand Up @@ -1145,7 +1143,7 @@ MYSQLND_METHOD(mysqlnd_conn, list_method)(MYSQLND *conn, const char *query,

/* {{{ mysqlnd_conn::errno */
static unsigned int
MYSQLND_METHOD(mysqlnd_conn, errno)(const MYSQLND * const conn)
MYSQLND_METHOD(mysqlnd_conn, errno)(const MYSQLND * const conn TSRMLS_DC)
{
return conn->error_info.error_no;
}
Expand All @@ -1154,7 +1152,7 @@ MYSQLND_METHOD(mysqlnd_conn, errno)(const MYSQLND * const conn)

/* {{{ mysqlnd_conn::error */
static const char *
MYSQLND_METHOD(mysqlnd_conn, error)(const MYSQLND * const conn)
MYSQLND_METHOD(mysqlnd_conn, error)(const MYSQLND * const conn TSRMLS_DC)
{
return conn->error_info.error;
}
Expand All @@ -1163,7 +1161,7 @@ MYSQLND_METHOD(mysqlnd_conn, error)(const MYSQLND * const conn)

/* {{{ mysqlnd_conn::sqlstate */
static const char *
MYSQLND_METHOD(mysqlnd_conn, sqlstate)(const MYSQLND * const conn)
MYSQLND_METHOD(mysqlnd_conn, sqlstate)(const MYSQLND * const conn TSRMLS_DC)
{
return conn->error_info.sqlstate[0] ? conn->error_info.sqlstate:MYSQLND_SQLSTATE_NULL;
}
Expand All @@ -1182,8 +1180,7 @@ PHPAPI ulong mysqlnd_old_escape_string(char *newstr, const char *escapestr, size

/* {{{ mysqlnd_conn::escape_string */
static ulong
MYSQLND_METHOD(mysqlnd_conn, escape_string)(const MYSQLND * const conn, char *newstr,
const char *escapestr, size_t escapestr_len TSRMLS_DC)
MYSQLND_METHOD(mysqlnd_conn, escape_string)(const MYSQLND * const conn, char *newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC)
{
DBG_ENTER("mysqlnd_conn::escape_string");
DBG_INF_FMT("conn=%llu", conn->thread_id);
Expand All @@ -1208,9 +1205,7 @@ MYSQLND_METHOD(mysqlnd_conn, dump_debug_info)(MYSQLND * const conn TSRMLS_DC)

/* {{{ mysqlnd_conn::select_db */
static enum_func_status
MYSQLND_METHOD(mysqlnd_conn, select_db)(MYSQLND * const conn,
const char * const db,
unsigned int db_len TSRMLS_DC)
MYSQLND_METHOD(mysqlnd_conn, select_db)(MYSQLND * const conn, const char * const db, unsigned int db_len TSRMLS_DC)
{
enum_func_status ret;

Expand Down Expand Up @@ -1529,7 +1524,7 @@ MYSQLND_METHOD_PRIVATE(mysqlnd_conn, set_state)(MYSQLND * const conn, enum mysql

/* {{{ mysqlnd_conn::field_count */
static unsigned int
MYSQLND_METHOD(mysqlnd_conn, field_count)(const MYSQLND * const conn)
MYSQLND_METHOD(mysqlnd_conn, field_count)(const MYSQLND * const conn TSRMLS_DC)
{
return conn->field_count;
}
Expand All @@ -1538,7 +1533,7 @@ MYSQLND_METHOD(mysqlnd_conn, field_count)(const MYSQLND * const conn)

/* {{{ mysqlnd_conn::insert_id */
static uint64_t
MYSQLND_METHOD(mysqlnd_conn, insert_id)(const MYSQLND * const conn)
MYSQLND_METHOD(mysqlnd_conn, insert_id)(const MYSQLND * const conn TSRMLS_DC)
{
return conn->upsert_status.last_insert_id;
}
Expand All @@ -1547,7 +1542,7 @@ MYSQLND_METHOD(mysqlnd_conn, insert_id)(const MYSQLND * const conn)

/* {{{ mysqlnd_conn::affected_rows */
static uint64_t
MYSQLND_METHOD(mysqlnd_conn, affected_rows)(const MYSQLND * const conn)
MYSQLND_METHOD(mysqlnd_conn, affected_rows)(const MYSQLND * const conn TSRMLS_DC)
{
return conn->upsert_status.affected_rows;
}
Expand All @@ -1556,7 +1551,7 @@ MYSQLND_METHOD(mysqlnd_conn, affected_rows)(const MYSQLND * const conn)

/* {{{ mysqlnd_conn::warning_count */
static unsigned int
MYSQLND_METHOD(mysqlnd_conn, warning_count)(const MYSQLND * const conn)
MYSQLND_METHOD(mysqlnd_conn, warning_count)(const MYSQLND * const conn TSRMLS_DC)
{
return conn->upsert_status.warning_count;
}
Expand All @@ -1565,7 +1560,7 @@ MYSQLND_METHOD(mysqlnd_conn, warning_count)(const MYSQLND * const conn)

/* {{{ mysqlnd_conn::info */
static const char *
MYSQLND_METHOD(mysqlnd_conn, info)(const MYSQLND * const conn)
MYSQLND_METHOD(mysqlnd_conn, info)(const MYSQLND * const conn TSRMLS_DC)
{
return conn->last_message;
}
Expand All @@ -1590,7 +1585,7 @@ PHPAPI unsigned int mysqlnd_get_client_version()

/* {{{ mysqlnd_conn::get_server_info */
static const char *
MYSQLND_METHOD(mysqlnd_conn, get_server_info)(const MYSQLND * const conn)
MYSQLND_METHOD(mysqlnd_conn, get_server_info)(const MYSQLND * const conn TSRMLS_DC)
{
return conn->server_version;
}
Expand All @@ -1599,7 +1594,7 @@ MYSQLND_METHOD(mysqlnd_conn, get_server_info)(const MYSQLND * const conn)

/* {{{ mysqlnd_conn::get_host_info */
static const char *
MYSQLND_METHOD(mysqlnd_conn, get_host_info)(const MYSQLND * const conn)
MYSQLND_METHOD(mysqlnd_conn, get_host_info)(const MYSQLND * const conn TSRMLS_DC)
{
return conn->host_info;
}
Expand All @@ -1608,7 +1603,7 @@ MYSQLND_METHOD(mysqlnd_conn, get_host_info)(const MYSQLND * const conn)

/* {{{ mysqlnd_conn::get_proto_info */
static unsigned int
MYSQLND_METHOD(mysqlnd_conn, get_proto_info)(const MYSQLND *const conn)
MYSQLND_METHOD(mysqlnd_conn, get_proto_info)(const MYSQLND *const conn TSRMLS_DC)
{
return conn->protocol_version;
}
Expand All @@ -1617,7 +1612,7 @@ MYSQLND_METHOD(mysqlnd_conn, get_proto_info)(const MYSQLND *const conn)

/* {{{ mysqlnd_conn::charset_name */
static const char *
MYSQLND_METHOD(mysqlnd_conn, charset_name)(const MYSQLND * const conn)
MYSQLND_METHOD(mysqlnd_conn, charset_name)(const MYSQLND * const conn TSRMLS_DC)
{
return conn->charset->name;
}
Expand All @@ -1626,7 +1621,7 @@ MYSQLND_METHOD(mysqlnd_conn, charset_name)(const MYSQLND * const conn)

/* {{{ mysqlnd_conn::thread_id */
static uint64_t
MYSQLND_METHOD(mysqlnd_conn, thread_id)(const MYSQLND * const conn)
MYSQLND_METHOD(mysqlnd_conn, thread_id)(const MYSQLND * const conn TSRMLS_DC)
{
return conn->thread_id;
}
Expand All @@ -1635,7 +1630,7 @@ MYSQLND_METHOD(mysqlnd_conn, thread_id)(const MYSQLND * const conn)

/* {{{ mysqlnd_conn::get_server_version */
static unsigned long
MYSQLND_METHOD(mysqlnd_conn, get_server_version)(const MYSQLND * const conn)
MYSQLND_METHOD(mysqlnd_conn, get_server_version)(const MYSQLND * const conn TSRMLS_DC)
{
long major, minor, patch;
char *p;
Expand Down
65 changes: 33 additions & 32 deletions ext/mysqlnd/mysqlnd.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ PHPAPI enum_func_status _mysqlnd_poll(MYSQLND **r_array, MYSQLND **e_array, MYSQ
#define mysqlnd_num_rows(result) ((result)->stored_data? (result)->stored_data->row_count:0)
#define mysqlnd_num_fields(result) (result)->field_count

#define mysqlnd_fetch_lengths(result) ((result)->m.fetch_lengths? (result)->m.fetch_lengths((result)):NULL)
#define mysqlnd_fetch_lengths(result) ((result)->m.fetch_lengths? (result)->m.fetch_lengths((result) TSRMLS_CC) : NULL)

#define mysqlnd_field_seek(result, ofs) (result)->m.seek_field((result), (ofs))
#define mysqlnd_field_tell(result) ((result)->meta? (result)->meta->current_field:0)
Expand Down Expand Up @@ -192,31 +192,32 @@ PHPAPI enum_func_status _mysqlnd_poll(MYSQLND **r_array, MYSQLND **e_array, MYSQ
/*****************************************************************************************************/

/* Errors */
#define mysqlnd_errno(conn) (conn)->m->get_error_no((conn))
#define mysqlnd_error(conn) (conn)->m->get_error_str((conn))
#define mysqlnd_sqlstate(conn) (conn)->m->get_sqlstate((conn))
#define mysqlnd_errno(conn) (conn)->m->get_error_no((conn) TSRMLS_CC)
#define mysqlnd_error(conn) (conn)->m->get_error_str((conn) TSRMLS_CC)
#define mysqlnd_sqlstate(conn) (conn)->m->get_sqlstate((conn) TSRMLS_CC)

/* Charset */
#define mysqlnd_character_set_name(conn) (conn)->m->charset_name((conn))
#define mysqlnd_character_set_name(conn) (conn)->m->charset_name((conn) TSRMLS_CC)

/* Simple metadata */
#define mysqlnd_field_count(conn) (conn)->m->get_field_count((conn))
#define mysqlnd_insert_id(conn) (conn)->m->get_last_insert_id((conn))
#define mysqlnd_affected_rows(conn) (conn)->m->get_affected_rows((conn))
#define mysqlnd_warning_count(conn) (conn)->m->get_warning_count((conn))
#define mysqlnd_info(conn) (conn)->m->get_last_message((conn))
#define mysqlnd_get_server_info(conn) (conn)->m->get_server_information((conn))
#define mysqlnd_get_host_info(conn) (conn)->m->get_host_information((conn))
#define mysqlnd_get_proto_info(conn) (conn)->m->get_protocol_information((conn))
#define mysqlnd_thread_id(conn) (conn)->m->get_thread_id((conn))

#define mysqlnd_num_rows(result) (result)->m.num_rows((result))
#define mysqlnd_num_fields(result) (result)->m.num_fields((result))

PHPAPI unsigned long * mysqlnd_fetch_lengths(MYSQLND_RES * const result);

#define mysqlnd_field_seek(result, ofs) (result)->m.seek_field((result), (ofs))
#define mysqlnd_field_tell(result) (result)->m.field_tell((result))
#define mysqlnd_field_count(conn) (conn)->m->get_field_count((conn) TSRMLS_CC)
#define mysqlnd_insert_id(conn) (conn)->m->get_last_insert_id((conn) TSRMLS_CC)
#define mysqlnd_affected_rows(conn) (conn)->m->get_affected_rows((conn) TSRMLS_CC)
#define mysqlnd_warning_count(conn) (conn)->m->get_warning_count((conn) TSRMLS_CC)
#define mysqlnd_info(conn) (conn)->m->get_last_message((conn) TSRMLS_CC)
#define mysqlnd_get_server_info(conn) (conn)->m->get_server_information((conn) TSRMLS_CC)
#define mysqlnd_get_host_info(conn) (conn)->m->get_host_information((conn) TSRMLS_CC)
#define mysqlnd_get_proto_info(conn) (conn)->m->get_protocol_information((conn) TSRMLS_CC)
#define mysqlnd_thread_id(conn) (conn)->m->get_thread_id((conn) TSRMLS_CC)

#define mysqlnd_num_rows(result) (result)->m.num_rows((result) TSRMLS_CC)
#define mysqlnd_num_fields(result) (result)->m.num_fields((result) TSRMLS_CC)

#define mysqlnd_fetch_lengths(result) _mysqlnd_fetch_lengths((result) TSRMLS_CC)
PHPAPI unsigned long * _mysqlnd_fetch_lengths(MYSQLND_RES * const result TSRMLS_DC);

#define mysqlnd_field_seek(result, ofs) (result)->m.seek_field((result), (ofs) TSRMLS_CC)
#define mysqlnd_field_tell(result) (result)->m.field_tell((result) TSRMLS_CC)
#define mysqlnd_fetch_field(result) (result)->m.fetch_field((result) TSRMLS_CC)
#define mysqlnd_fetch_field_direct(result,fnr) (result)->m.fetch_field_direct((result), (fnr) TSRMLS_CC)
#define mysqlnd_fetch_fields(result) (result)->m.fetch_fields((result) TSRMLS_CC)
Expand All @@ -226,15 +227,15 @@ PHPAPI const char * mysqlnd_get_client_info();
PHPAPI unsigned int mysqlnd_get_client_version();

/* PS */
#define mysqlnd_stmt_insert_id(stmt) (stmt)->m->get_last_insert_id((stmt))
#define mysqlnd_stmt_affected_rows(stmt) (stmt)->m->get_affected_rows((stmt))
#define mysqlnd_stmt_num_rows(stmt) (stmt)->m->get_num_rows((stmt))
#define mysqlnd_stmt_param_count(stmt) (stmt)->m->get_param_count((stmt))
#define mysqlnd_stmt_field_count(stmt) (stmt)->m->get_field_count((stmt))
#define mysqlnd_stmt_warning_count(stmt) (stmt)->m->get_warning_count((stmt))
#define mysqlnd_stmt_errno(stmt) (stmt)->m->get_error_no((stmt))
#define mysqlnd_stmt_error(stmt) (stmt)->m->get_error_str((stmt))
#define mysqlnd_stmt_sqlstate(stmt) (stmt)->m->get_sqlstate((stmt))
#define mysqlnd_stmt_insert_id(stmt) (stmt)->m->get_last_insert_id((stmt) TSRMLS_CC)
#define mysqlnd_stmt_affected_rows(stmt) (stmt)->m->get_affected_rows((stmt) TSRMLS_CC)
#define mysqlnd_stmt_num_rows(stmt) (stmt)->m->get_num_rows((stmt) TSRMLS_CC)
#define mysqlnd_stmt_param_count(stmt) (stmt)->m->get_param_count((stmt) TSRMLS_CC)
#define mysqlnd_stmt_field_count(stmt) (stmt)->m->get_field_count((stmt) TSRMLS_CC)
#define mysqlnd_stmt_warning_count(stmt) (stmt)->m->get_warning_count((stmt) TSRMLS_CC)
#define mysqlnd_stmt_errno(stmt) (stmt)->m->get_error_no((stmt) TSRMLS_CC)
#define mysqlnd_stmt_error(stmt) (stmt)->m->get_error_str((stmt) TSRMLS_CC)
#define mysqlnd_stmt_sqlstate(stmt) (stmt)->m->get_sqlstate((stmt) TSRMLS_CC)
#endif /* MYSQLND_USE_OPTIMISATIONS */
/*****************************************************************************************************/

Expand Down Expand Up @@ -263,7 +264,7 @@ PHPAPI void mysqlnd_set_local_infile_handler(MYSQLND * const conn, const char *
#define mysqlnd_kill(conn, pid) (conn)->m->kill_connection((conn), (pid) TSRMLS_CC)
#define mysqlnd_refresh(conn, options) (conn)->m->refresh_server((conn), (options) TSRMLS_CC)
#define mysqlnd_shutdown(conn, level) (conn)->m->shutdown_server((conn), (level) TSRMLS_CC)
#define mysqlnd_get_server_version(conn) (conn)->m->get_server_version((conn))
#define mysqlnd_get_server_version(conn) (conn)->m->get_server_version((conn) TSRMLS_CC)
#define mysqlnd_set_character_set(conn, cs) (conn)->m->set_charset((conn), (cs) TSRMLS_CC)
#define mysqlnd_stat(conn, msg, msg_len) (conn)->m->get_server_statistics((conn), (msg), (msg_len) TSRMLS_CC)
#define mysqlnd_options(conn, opt, value) (conn)->m->set_client_option((conn), (opt), (value) TSRMLS_CC)
Expand Down
Loading

0 comments on commit e50de7d

Please sign in to comment.