[PHP-CVS] cvs: php4 /ext/mysqli mysqli_api.c mysqli_fe.c php_mysqli.h
georg Sun Jun 22 04:46:39 2003 EDT Modified files: /php4/ext/mysqlimysqli_api.c mysqli_fe.c php_mysqli.h Log: added new function mysqli_stmt_num_rows Index: php4/ext/mysqli/mysqli_api.c diff -u php4/ext/mysqli/mysqli_api.c:1.32 php4/ext/mysqli/mysqli_api.c:1.33 --- php4/ext/mysqli/mysqli_api.c:1.32 Sun Jun 22 02:16:47 2003 +++ php4/ext/mysqli/mysqli_api.cSun Jun 22 04:46:39 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.32 2003/06/22 06:16:47 georg Exp $ + $Id: mysqli_api.c,v 1.33 2003/06/22 08:46:39 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -1697,6 +1697,25 @@ MYSQLI_CLEAR_RESOURCE(mysql_stmt); RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto mixed mysqli_stmt_num_rows(object stmt) + Return the number of rows in statements result set */ +PHP_FUNCTION(mysqli_stmt_num_rows) +{ + STMT*stmt; + zval*mysql_stmt; + my_ulonglongrc; + PR_STMT *prstmt; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O, mysql_stmt, mysqli_stmt_class_entry) == FAILURE) { + return; + } + MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, mysql_stmt, mysqli_stmt); + + rc = mysql_stmt_num_rows(stmt-stmt); + MYSQLI_RETURN_LONG_LONG(rc) } /* }}} */ Index: php4/ext/mysqli/mysqli_fe.c diff -u php4/ext/mysqli/mysqli_fe.c:1.12 php4/ext/mysqli/mysqli_fe.c:1.13 --- php4/ext/mysqli/mysqli_fe.c:1.12Sat Jun 21 09:35:26 2003 +++ php4/ext/mysqli/mysqli_fe.c Sun Jun 22 04:46:39 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_fe.c,v 1.12 2003/06/21 13:35:26 georg Exp $ + $Id: mysqli_fe.c,v 1.13 2003/06/22 08:46:39 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -114,6 +114,7 @@ PHP_FE(mysqli_stmt_close, NULL) PHP_FE(mysqli_stmt_errno, NULL) PHP_FE(mysqli_stmt_error, NULL) + PHP_FE(mysqli_stmt_num_rows,NULL) #if MYSQL_VERSION_ID = 40101 PHP_FE(mysqli_stmt_sqlstate,NULL) #endif @@ -231,6 +232,7 @@ PHP_FALIAS(close,mysqli_stmt_close,NULL) PHP_FALIAS(errno,mysqli_stmt_errno,NULL) PHP_FALIAS(error,mysqli_stmt_error,NULL) + PHP_FALIAS(num_rows, mysqli_stmt_num_rows,NULL) #if MYSQL_VERSION_ID = 40101 PHP_FALIAS(sqlstate, mysqli_stmt_sqlstate,NULL) #endif Index: php4/ext/mysqli/php_mysqli.h diff -u php4/ext/mysqli/php_mysqli.h:1.16 php4/ext/mysqli/php_mysqli.h:1.17 --- php4/ext/mysqli/php_mysqli.h:1.16 Sat Jun 21 09:35:26 2003 +++ php4/ext/mysqli/php_mysqli.hSun Jun 22 04:46:39 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: php_mysqli.h,v 1.16 2003/06/21 13:35:26 georg Exp $ + $Id: php_mysqli.h,v 1.17 2003/06/22 08:46:39 georg Exp $ */ /* A little hack to prevent build break, when mysql is used together with @@ -263,6 +263,7 @@ PHP_FUNCTION(mysqli_stmt_close); PHP_FUNCTION(mysqli_stmt_errno); PHP_FUNCTION(mysqli_stmt_error); +PHP_FUNCTION(mysqli_stmt_num_rows); #if MYSQL_VERSION_ID = 40101 PHP_FUNCTION(mysqli_stmt_sqlstate); #endif -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/mysqli mysqli_api.c mysqli_fe.c php_mysqli.h
georg Sat Jun 21 09:35:26 2003 EDT Modified files: /php4/ext/mysqlimysqli_api.c mysqli_fe.c php_mysqli.h Log: new functions (4.1.1): mysql_sqlstate, mysql_stmt_sqlstate Index: php4/ext/mysqli/mysqli_api.c diff -u php4/ext/mysqli/mysqli_api.c:1.30 php4/ext/mysqli/mysqli_api.c:1.31 --- php4/ext/mysqli/mysqli_api.c:1.30 Tue Jun 10 16:03:33 2003 +++ php4/ext/mysqli/mysqli_api.cSat Jun 21 09:35:25 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.30 2003/06/10 20:03:33 imajes Exp $ + $Id: mysqli_api.c,v 1.31 2003/06/21 13:35:25 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -1725,6 +1725,24 @@ } /* }}} */ +/* {{{ proto string mysqli_sqlstate(resource link) + Returns the SQLSTATE error from previous MySQL operation */ +#if MYSQL_VERSION_ID = 40101 +PHP_FUNCTION(mysqli_sqlstate) +{ + MYSQL *mysql; + zval*mysql_link; + PR_MYSQL*prmysql; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O, mysql_link, mysqli_link_class_entry) == FAILURE) { + return; + } + MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, mysql_link, mysqli_link); + RETURN_STRING((char *)mysql_sqlstate(mysql),1); +} +#endif +/* }}} */ + /* {{{ proto string mysqli_ssl_set(resource link [,string key [,string cert [,string ca [,string capath [,string cipher]) */ PHP_FUNCTION(mysqli_ssl_set) @@ -1817,6 +1835,25 @@ } RETURN_TRUE; } +/* }}} */ + +/* {{{ proto string mysqli_stmt_error(resource stmt) +*/ +#if MYSQL_VERSION_ID = 40101 +PHP_FUNCTION(mysqli_stmt_sqlstate) +{ + STMT*stmt; + zval*mysql_stmt; + PR_STMT *prstmt; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O, mysql_stmt, mysqli_stmt_class_entry) == FAILURE) { + return; + } + MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, mysql_stmt, mysqli_stmt); + + RETURN_STRING((char *)mysql_stmt_sqlstate(stmt-stmt),1); +} +#endif /* }}} */ /* {{{ proto resource mysqli_store_result(resource link) Index: php4/ext/mysqli/mysqli_fe.c diff -u php4/ext/mysqli/mysqli_fe.c:1.11 php4/ext/mysqli/mysqli_fe.c:1.12 --- php4/ext/mysqli/mysqli_fe.c:1.11Tue Jun 10 16:03:33 2003 +++ php4/ext/mysqli/mysqli_fe.c Sat Jun 21 09:35:26 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_fe.c,v 1.11 2003/06/10 20:03:33 imajes Exp $ + $Id: mysqli_fe.c,v 1.12 2003/06/21 13:35:26 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -104,12 +104,19 @@ PHP_FE(mysqli_send_query, NULL) PHP_FALIAS(mysqli_set_opt, mysqli_options, NULL) PHP_FE(mysqli_slave_query, NULL) + +#if MYSQL_VERSION_ID = 40101 + PHP_FE(mysqli_sqlstate, NULL) +#endif PHP_FE(mysqli_ssl_set, NULL) PHP_FE(mysqli_stat, NULL) PHP_FE(mysqli_stmt_affected_rows, NULL) PHP_FE(mysqli_stmt_close, NULL) PHP_FE(mysqli_stmt_errno, NULL) PHP_FE(mysqli_stmt_error, NULL) +#if MYSQL_VERSION_ID = 40101 + PHP_FE(mysqli_stmt_sqlstate,NULL) +#endif PHP_FE(mysqli_store_result, NULL) PHP_FE(mysqli_stmt_store_result,NULL) PHP_FE(mysqli_thread_id, NULL) @@ -168,6 +175,9 @@ PHP_FALIAS(select_db,mysqli_select_db,NULL) PHP_FALIAS(set_opt, mysqli_options,NULL) PHP_FALIAS(slave_query,mysqli_slave_query,NULL) +#if MYSQL_VERSION_ID = 40101 + PHP_FALIAS(sqlstate, mysqli_sqlstate,NULL) +#endif PHP_FALIAS(ssl_set,mysqli_ssl_set,NULL) PHP_FALIAS(stat,mysqli_stat,NULL) PHP_FALIAS(store_result,mysqli_store_result,NULL) @@ -221,6 +231,9 @@ PHP_FALIAS(close,mysqli_stmt_close,NULL) PHP_FALIAS(errno,mysqli_stmt_errno,NULL) PHP_FALIAS(error,mysqli_stmt_error,NULL) +#if MYSQL_VERSION_ID = 40101 + PHP_FALIAS(sqlstate, mysqli_stmt_sqlstate,NULL) +#endif {NULL, NULL, NULL} }; /* }}} */ Index:
[PHP-CVS] cvs: php4 /ext/mysqli mysqli_api.c
sniper Mon Jun 2 07:42:39 2003 EDT Modified files: /php4/ext/mysqlimysqli_api.c Log: - No c++ comments in c code.. Index: php4/ext/mysqli/mysqli_api.c diff -u php4/ext/mysqli/mysqli_api.c:1.28 php4/ext/mysqli/mysqli_api.c:1.29 --- php4/ext/mysqli/mysqli_api.c:1.28 Sat May 31 18:03:57 2003 +++ php4/ext/mysqli/mysqli_api.cMon Jun 2 07:42:39 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.28 2003/05/31 22:03:57 helly Exp $ + $Id: mysqli_api.c,v 1.29 2003/06/02 11:42:39 sniper Exp $ */ #ifdef HAVE_CONFIG_H @@ -1436,7 +1436,7 @@ MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, mysql_link, mysqli_link); /* remove some insecure options */ - flags ^= CLIENT_MULTI_QUERIES; // don't allow multi_queries via connect parameter + flags ^= CLIENT_MULTI_QUERIES; /* don't allow multi_queries via connect parameter */ if (PG(open_basedir) strlen(PG(open_basedir))) { flags ^= CLIENT_LOCAL_FILES; } @@ -1710,7 +1710,8 @@ int dbname_len; PR_MYSQL*prmysql; -// if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Os, mysql_link, mysqli_link_class_entry, dbname, dbname_len) == FAILURE) { +/* if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Os, mysql_link, mysqli_link_class_entry, dbname, dbname_len) == FAILURE) { +*/ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), Os, mysql_link, mysqli_link_class_entry, dbname, dbname_len) == FAILURE) { return; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/mysqli mysqli_api.c
helly Sat May 31 18:03:57 2003 EDT Modified files: /php4/ext/mysqlimysqli_api.c Log: - fix one warning - fix some commit by accident? # did someone here mix c and php code ? Index: php4/ext/mysqli/mysqli_api.c diff -u php4/ext/mysqli/mysqli_api.c:1.27 php4/ext/mysqli/mysqli_api.c:1.28 --- php4/ext/mysqli/mysqli_api.c:1.27 Sat May 31 03:05:34 2003 +++ php4/ext/mysqli/mysqli_api.cSat May 31 18:03:57 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.27 2003/05/31 07:05:34 georg Exp $ + $Id: mysqli_api.c,v 1.28 2003/05/31 22:03:57 helly Exp $ */ #ifdef HAVE_CONFIG_H @@ -1303,7 +1303,7 @@ MYSQL *mysql; STMT*stmt; PR_MYSQL*prmysql; - PR_STMT *prstmt; + PR_STMT *prstmt = NULL; char*query = NULL; unsigned intquery_len; zval*mysql_link; @@ -1436,7 +1436,7 @@ MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, mysql_link, mysqli_link); /* remove some insecure options */ - $flags ^= CLIENT_MULTI_QUERIES; // don't allow multi_queries via connect parameter + flags ^= CLIENT_MULTI_QUERIES; // don't allow multi_queries via connect parameter if (PG(open_basedir) strlen(PG(open_basedir))) { flags ^= CLIENT_LOCAL_FILES; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/mysqli mysqli_api.c
georg Sat May 31 03:05:34 2003 EDT Modified files: /php4/ext/mysqlimysqli_api.c Log: additional check for unsecure connect options Index: php4/ext/mysqli/mysqli_api.c diff -u php4/ext/mysqli/mysqli_api.c:1.26 php4/ext/mysqli/mysqli_api.c:1.27 --- php4/ext/mysqli/mysqli_api.c:1.26 Sat May 3 23:15:02 2003 +++ php4/ext/mysqli/mysqli_api.cSat May 31 03:05:34 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.26 2003/05/04 03:15:02 zak Exp $ + $Id: mysqli_api.c,v 1.27 2003/05/31 07:05:34 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -1434,6 +1434,12 @@ } MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, prmysql, PR_MYSQL *, mysql_link, mysqli_link); + + /* remove some insecure options */ + $flags ^= CLIENT_MULTI_QUERIES; // don't allow multi_queries via connect parameter + if (PG(open_basedir) strlen(PG(open_basedir))) { + flags ^= CLIENT_LOCAL_FILES; + } if (mysql_real_connect(mysql,hostname,username,passwd,dbname,port,socket,flags) == NULL) { /* Save error messages */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/mysqli mysqli_api.c
georg Thu Apr 3 03:03:59 2003 EDT Modified files: /php4/ext/mysqlimysqli_api.c Log: fixed mysqli_prepare_result Index: php4/ext/mysqli/mysqli_api.c diff -u php4/ext/mysqli/mysqli_api.c:1.21 php4/ext/mysqli/mysqli_api.c:1.22 --- php4/ext/mysqli/mysqli_api.c:1.21 Mon Mar 17 07:48:38 2003 +++ php4/ext/mysqli/mysqli_api.cThu Apr 3 03:03:59 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.21 2003/03/17 12:48:38 hholzgra Exp $ + $Id: mysqli_api.c,v 1.22 2003/04/03 08:03:59 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -1342,10 +1342,11 @@ */ PHP_FUNCTION(mysqli_prepare_result) { - STMT*stmt; - MYSQL_RES *result; - zval*mysql_stmt; - PR_STMT *prstmt; + STMT*stmt; + MYSQL_RES *result; + zval*mysql_stmt; + PR_STMT *prstmt = NULL; + MYSQLI_RESOURCE *mysqli_resource; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O, mysql_stmt, mysqli_stmt_class_entry) == FAILURE) { return; @@ -1356,7 +1357,10 @@ RETURN_FALSE; } - MYSQLI_RETURN_RESOURCE(result, mysqli_result_class_entry); + mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE)); + mysqli_resource-ptr = (void *)result; + mysqli_resource-prinfo = (void *)prstmt; + MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_result_class_entry); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/mysqli mysqli_api.c
hholzgraMon Mar 17 07:48:39 2003 EDT Modified files: /php4/ext/mysqlimysqli_api.c Log: more proto fixes Index: php4/ext/mysqli/mysqli_api.c diff -u php4/ext/mysqli/mysqli_api.c:1.20 php4/ext/mysqli/mysqli_api.c:1.21 --- php4/ext/mysqli/mysqli_api.c:1.20 Sat Mar 15 17:51:49 2003 +++ php4/ext/mysqli/mysqli_api.cMon Mar 17 07:48:38 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.20 2003/03/15 22:51:49 hholzgra Exp $ + $Id: mysqli_api.c,v 1.21 2003/03/17 12:48:38 hholzgra Exp $ */ #ifdef HAVE_CONFIG_H @@ -634,7 +634,7 @@ } /* }}} */ -/* {{{ proto string mysql_error(resource link) +/* {{{ proto string mysqli_error(resource link) Returns the text of the error message from previous MySQL operation */ PHP_FUNCTION(mysqli_error) { @@ -766,7 +766,7 @@ } /* }}} */ -/* {{{ proto int mysql_fetch_field (resource result) +/* {{{ proto int mysqli_fetch_field (resource result) Get column information from a result and return as an object */ PHP_FUNCTION(mysqli_fetch_field) { @@ -799,7 +799,7 @@ } /* }}} */ -/* {{{ proto int mysql_fetch_fields (resource result) +/* {{{ proto int mysqli_fetch_fields (resource result) */ PHP_FUNCTION(mysqli_fetch_fields) { @@ -845,7 +845,7 @@ } /* }}} */ -/* {{{ proto int mysql_fetch_field_direct (resource result, int offset) +/* {{{ proto int mysqli_fetch_field_direct (resource result, int offset) */ PHP_FUNCTION(mysqli_fetch_field_direct) { @@ -1098,7 +1098,7 @@ } /* }}} */ -/* {{{ resource mysqli_init(void) +/* {{{ proto resource mysqli_init(void) initialize mysqli */ PHP_FUNCTION(mysqli_init) { @@ -1775,7 +1775,7 @@ } /* }}} */ -/* {{{ bool resource mysqli_stmt_store_result(stmt) +/* {{{ proto resource mysqli_stmt_store_result(stmt) */ PHP_FUNCTION(mysqli_stmt_store_result) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/mysqli mysqli_api.c mysqli_nonapi.c mysqli_profiler.c
hholzgraSat Mar 15 17:51:49 2003 EDT Modified files: /php4/ext/mysqlimysqli_api.c mysqli_nonapi.c mysqli_profiler.c Log: lots of proto stuff Index: php4/ext/mysqli/mysqli_api.c diff -u php4/ext/mysqli/mysqli_api.c:1.19 php4/ext/mysqli/mysqli_api.c:1.20 --- php4/ext/mysqli/mysqli_api.c:1.19 Mon Mar 10 20:19:21 2003 +++ php4/ext/mysqli/mysqli_api.cSat Mar 15 17:51:49 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.19 2003/03/11 01:19:21 georg Exp $ + $Id: mysqli_api.c,v 1.20 2003/03/15 22:51:49 hholzgra Exp $ */ #ifdef HAVE_CONFIG_H @@ -31,7 +31,7 @@ /* {{{ proto mixed mysqli_affected_rows(resource link) -*/ + Get number of affected rows in previous MySQL operation */ PHP_FUNCTION(mysqli_affected_rows) { MYSQL *mysql; @@ -54,7 +54,7 @@ /* }}} */ /* {{{ proto bool mysqli_autocommit(resource link, bool mode) -*/ + Turn auto commit on or of */ PHP_FUNCTION(mysqli_autocommit) { MYSQL *mysql; @@ -77,7 +77,8 @@ } /* }}} */ -/* {{{ proto bool mysqli_bind_param(resource stmt, mixed, [mixed,]) +/* {{{ proto bool mysqli_bind_param(resource stmt, mixed variable, int type [,mixed,]) + Bind variables to a prepared statement as parameters */ PHP_FUNCTION(mysqli_bind_param) @@ -204,7 +205,8 @@ } /* }}} */ -/* {{{ proto bool mysqli_bind_result(resource stmt, mixed var, long len, [mixed,long]) +/* {{{ proto bool mysqli_bind_result(resource stmt, mixed var, int len [,mixed,int]) + Bind variables to a prepared statement for result storage */ /* TODO: @@ -358,7 +360,7 @@ /* }}} */ /* {{{ proto bool mysqli_change_user(resource link, string user, string password, string database) -*/ + Change logged in user of the active connection */ PHP_FUNCTION(mysqli_change_user) { MYSQL *mysql; @@ -386,6 +388,7 @@ /* }}} */ /* {{{ proto string mysqli_character_set_name(resource link) + Returns the name of the charater set used for this connection */ PHP_FUNCTION(mysqli_character_set_name) { @@ -410,7 +413,7 @@ /* }}} */ /* {{{ proto bool mysqli_close(resource link) - close connection */ + Close connection */ PHP_FUNCTION(mysqli_close) { zval*mysql_link; @@ -439,6 +442,7 @@ /* }}} */ /* {{{ proto bool mysqli_commit(resource link) + Commit outstanding actions and close transaction */ PHP_FUNCTION(mysqli_commit) { @@ -460,7 +464,7 @@ /* }}} */ /* {{{ proto void mysqli_data_seek(resource result) -*/ + Move internal result pointer */ PHP_FUNCTION(mysqli_data_seek) { MYSQL_RES *result; @@ -615,7 +619,7 @@ /* }}} */ /* {{{ proto int mysqli_errno(resource link) -*/ + Returns the numerical value of the error message from previous MySQL operation */ PHP_FUNCTION(mysqli_errno) { MYSQL *mysql; @@ -631,7 +635,7 @@ /* }}} */ /* {{{ proto string mysql_error(resource link) -*/ + Returns the text of the error message from previous MySQL operation */ PHP_FUNCTION(mysqli_error) { MYSQL *mysql; @@ -647,6 +651,7 @@ /* }}} */ /* {{{ proto int mysqli_execute(resource stmt) + Execute a prepared statement */ PHP_FUNCTION(mysqli_execute) { @@ -691,6 +696,7 @@ /* }}} */ /* {{{ proto int mysqli_fetch(resource stmt) + Fetch results from a prepared statement into the bound variables */ PHP_FUNCTION(mysqli_fetch) { @@ -761,7 +767,7 @@ /* }}} */ /* {{{ proto int mysql_fetch_field (resource result) -*/ + Get column information from a result and return as an object */ PHP_FUNCTION(mysqli_fetch_field) { MYSQL_RES *result; @@ -874,7 +880,7 @@ /* }}} */ /* {{{ proto array mysqli_fetch_lengths (resource result) -*/ + Get the length of each output in a result */ PHP_FUNCTION(mysqli_fetch_lengths) { MYSQL_RES *result; @@ -903,7 +909,7 @@ /* }}} */ /* {{{ proto array mysqli_fetch_row (resource result) -*/ + Get a result row as an enumerated array */ PHP_FUNCTION(mysqli_fetch_row) { php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQLI_NUM); @@ -928,7 +934,7 @@ /* }}} */ /* {{{ proto int mysqli_field_seek(resource link, int fieldnr) -*/ + Set result pointer to a specified field offset */ PHP_FUNCTION(mysqli_field_seek) { MYSQL_RES *result; @@ -952,7 +958,7 @@ /* }}} */ /* {{{ proto int mysqli_field_tell(resource result) -*/ + Get current field offset of result pointer */ PHP_FUNCTION(mysqli_field_tell) { MYSQL_RES *result; @@ -969,7 +975,7 @@ /* }}} */ /* {{{ proto int mysqli_free_result(resource result) -*/ + Free result memory */ PHP_FUNCTION(mysqli_free_result) { MYSQL_RES *result; @@ -991,8 +997,8 @@ } /* }}} */ -/* {{{ proto
[PHP-CVS] cvs: php4 /ext/mysqli mysqli_api.c
georg Sat Feb 22 02:47:47 2003 EDT Modified files: /php4/ext/mysqlimysqli_api.c Log: removed some comments Index: php4/ext/mysqli/mysqli_api.c diff -u php4/ext/mysqli/mysqli_api.c:1.16 php4/ext/mysqli/mysqli_api.c:1.17 --- php4/ext/mysqli/mysqli_api.c:1.16 Sat Feb 22 02:31:01 2003 +++ php4/ext/mysqli/mysqli_api.cSat Feb 22 02:47:46 2003 -15,7 +15,7 | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.16 2003/02/22 07:31:01 georg Exp $ + $Id: mysqli_api.c,v 1.17 2003/02/22 07:47:46 georg Exp $ */ #ifdef HAVE_CONFIG_H -148,8 +148,8 case MYSQLI_BIND_STRING: bind[ofs].buffer_type = MYSQL_TYPE_VAR_STRING; - bind[ofs].buffer = NULL; // Z_STRVAL_PP(args[i]); - bind[ofs].buffer_length = 0; // strlen(Z_STRVAL_PP(args[i])); + bind[ofs].buffer = NULL; + bind[ofs].buffer_length = 0; bind[ofs].is_null = stmt-is_null[ofs]; break; -283,8 +283,6 case MYSQL_TYPE_LONGLONG: stmt-bind[ofs].type = IS_STRING; - - /* TODO: change and check buflen when bug #74 is fixed */ stmt-bind[ofs].buflen = sizeof(my_ulonglong); stmt-bind[ofs].buffer = (char *)emalloc(stmt-bind[ofs].buflen); bind[ofs].buffer_type = MYSQL_TYPE_LONGLONG; -659,9 +657,6 efree(stmt-vars[i]-value.str.val); } ZVAL_STRING(stmt-vars[i], stmt-bind[i].buffer, 1); - /* - stmt-vars[i]-value.str.len = strlen(stmt-bind[i].buffer); - stmt-vars[i]-value.str.val = stmt-bind[i].buffer; */ } break; default: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/mysqli mysqli_api.c mysqli_fe.c php_mysqli.h
georg Tue Feb 18 03:49:00 2003 EDT Modified files: /php4/ext/mysqliphp_mysqli.h mysqli_api.c mysqli_fe.c Log: added new function mysqli_stmt_store_result Index: php4/ext/mysqli/php_mysqli.h diff -u php4/ext/mysqli/php_mysqli.h:1.8 php4/ext/mysqli/php_mysqli.h:1.9 --- php4/ext/mysqli/php_mysqli.h:1.8Sun Feb 16 10:56:57 2003 +++ php4/ext/mysqli/php_mysqli.hTue Feb 18 03:49:00 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: php_mysqli.h,v 1.8 2003/02/16 15:56:57 iliaa Exp $ + $Id: php_mysqli.h,v 1.9 2003/02/18 08:49:00 georg Exp $ */ /* A little hack to prevent build break, when mysql is used together with @@ -231,6 +231,7 @@ PHP_FUNCTION(mysqli_stmt_close); PHP_FUNCTION(mysqli_stmt_errno); PHP_FUNCTION(mysqli_stmt_error); +PHP_FUNCTION(mysqli_stmt_store_result); PHP_FUNCTION(mysqli_store_result); PHP_FUNCTION(mysqli_thread_id); PHP_FUNCTION(mysqli_thread_safe); Index: php4/ext/mysqli/mysqli_api.c diff -u php4/ext/mysqli/mysqli_api.c:1.14 php4/ext/mysqli/mysqli_api.c:1.15 --- php4/ext/mysqli/mysqli_api.c:1.14 Mon Feb 17 22:12:38 2003 +++ php4/ext/mysqli/mysqli_api.cTue Feb 18 03:49:00 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.14 2003/02/18 03:12:38 iliaa Exp $ + $Id: mysqli_api.c,v 1.15 2003/02/18 08:49:00 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -1630,8 +1630,27 @@ } /* }}} */ +/* {{{ bool resource mysqli_stmt_store_result(stmt) +*/ +PHP_FUNCTION(mysqli_stmt_store_result) +{ + STMT *stmt; + zval *mysql_stmt; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O, +mysql_stmt, mysqli_stmt_class_entry) == FAILURE) { + return; + } + MYSQLI_FETCH_RESOURCE(stmt, STMT *, mysql_stmt, mysqli_stmt); + + if (mysql_stmt_store_result(stmt-stmt)){ + RETURN_FALSE; + } + RETURN_TRUE; +} +/* }}} */ /* {{{ proto int mysqli_thread_id(resource link) */ + PHP_FUNCTION(mysqli_thread_id) { MYSQL *mysql; Index: php4/ext/mysqli/mysqli_fe.c diff -u php4/ext/mysqli/mysqli_fe.c:1.6 php4/ext/mysqli/mysqli_fe.c:1.7 --- php4/ext/mysqli/mysqli_fe.c:1.6 Mon Feb 17 04:38:32 2003 +++ php4/ext/mysqli/mysqli_fe.c Tue Feb 18 03:49:00 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_fe.c,v 1.6 2003/02/17 09:38:32 georg Exp $ + $Id: mysqli_fe.c,v 1.7 2003/02/18 08:49:00 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -110,6 +110,7 @@ PHP_FE(mysqli_stmt_errno, NULL) PHP_FE(mysqli_stmt_error, NULL) PHP_FE(mysqli_store_result, NULL) + PHP_FE(mysqli_stmt_store_result,NULL) PHP_FE(mysqli_thread_id, NULL) PHP_FE(mysqli_thread_safe, NULL) PHP_FE(mysqli_use_result, NULL) @@ -207,13 +208,14 @@ * Every user visible function must have an entry in mysqli_stmt_functions[]. */ function_entry mysqli_stmt_methods[] = { + PHP_FALIAS(affected_rows,mysqli_stmt_affected_rows,NULL) PHP_FALIAS(bind_param,mysqli_bind_param,NULL) PHP_FALIAS(bind_result,mysqli_bind_result,NULL) PHP_FALIAS(execute,mysqli_execute,NULL) PHP_FALIAS(fetch,mysqli_fetch,NULL) PHP_FALIAS(param_count,mysqli_param_count,NULL) PHP_FALIAS(send_long_data,mysqli_send_long_data,NULL) - PHP_FALIAS(affected_rows,mysqli_stmt_affected_rows,NULL) + PHP_FALIAS(store_result,mysqli_stmt_store_result,NULL) PHP_FALIAS(close,mysqli_stmt_close,NULL) PHP_FALIAS(errno,mysqli_stmt_errno,NULL) PHP_FALIAS(error,mysqli_stmt_error,NULL) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/mysqli mysqli_api.c
iliaa Mon Feb 17 22:12:38 2003 EDT Modified files: /php4/ext/mysqlimysqli_api.c Log: Fixed compiler warning. Index: php4/ext/mysqli/mysqli_api.c diff -u php4/ext/mysqli/mysqli_api.c:1.13 php4/ext/mysqli/mysqli_api.c:1.14 --- php4/ext/mysqli/mysqli_api.c:1.13 Mon Feb 17 19:00:51 2003 +++ php4/ext/mysqli/mysqli_api.cMon Feb 17 22:12:38 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.13 2003/02/18 00:00:51 georg Exp $ + $Id: mysqli_api.c,v 1.14 2003/02/18 03:12:38 iliaa Exp $ */ #ifdef HAVE_CONFIG_H @@ -535,7 +535,8 @@ } MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, mysql_link, mysqli_link); - return (mysql_enable_rpl_parse(mysql)); + mysql_enable_rpl_parse(mysql); + RETURN_TRUE; } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/mysqli mysqli_api.c mysqli_fe.c mysqli_nonapi.c php_mysqli.h
georg Sun Feb 16 07:03:37 2003 EDT Modified files: /php4/ext/mysqlimysqli_api.c mysqli_fe.c mysqli_nonapi.c php_mysqli.h Log: added new function mysqli_stmt_affected_rows added bigint support for mysqli_affected_rows fixed memleak in mysqli_prepare (stmt-is_null) fixed return type for mysqli_connect Index: php4/ext/mysqli/mysqli_api.c diff -u php4/ext/mysqli/mysqli_api.c:1.9 php4/ext/mysqli/mysqli_api.c:1.10 --- php4/ext/mysqli/mysqli_api.c:1.9Fri Feb 14 15:14:44 2003 +++ php4/ext/mysqli/mysqli_api.cSun Feb 16 07:03:37 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.9 2003/02/14 20:14:44 iliaa Exp $ + $Id: mysqli_api.c,v 1.10 2003/02/16 12:03:37 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -30,12 +30,14 @@ #include php_mysqli.h -/* {{{ proto long mysqli_affected_rows(resource link) +/* {{{ proto mixed mysqli_affected_rows(resource link) */ PHP_FUNCTION(mysqli_affected_rows) { - MYSQL *mysql; - zval *mysql_link; + MYSQL *mysql; + zval*mysql_link; + my_ulonglongrc; + charret[40]; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O, mysql_link, mysqli_link_class_entry) == FAILURE) { return; @@ -43,7 +45,12 @@ MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, mysql_link, mysqli_link); - RETURN_LONG(mysql_affected_rows(mysql)); + rc = mysql_affected_rows(mysql); + if (rc != (long)rc) { + sprintf((char *)ret, %llu, rc); + RETURN_STRING(ret,1); + } + RETURN_LONG(rc); } /* }}} */ @@ -112,7 +119,7 @@ efree(args); RETURN_FALSE; } - + stmt-is_null = ecalloc(num_vars, sizeof(char)); bind = (MYSQL_BIND *)ecalloc(num_vars, sizeof(MYSQL_BIND)); for (i=start; i num_vars * 2 + start; i+=2) { @@ -988,14 +995,14 @@ } /* }}} */ -/* {{{ proto int mysqli_insert_id(resource link) +/* {{{ proto mixed mysqli_insert_id(resource link) */ PHP_FUNCTION(mysqli_insert_id) { - MYSQL *mysql; - my_ulonglong rc; - char ret[50]; - zval *mysql_link; + MYSQL *mysql; + my_ulonglongrc; + charret[50]; + zval*mysql_link; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O, mysql_link, mysqli_link_class_entry) == FAILURE) { return; @@ -1004,11 +1011,10 @@ rc = mysql_insert_id(mysql); if (rc != (long)rc) { - sprintf((char *)ret, %lld, rc); + sprintf((char *)ret, %llu, rc); RETURN_STRING(ret,1); - } else { - RETURN_LONG(rc); - } + } + RETURN_LONG(rc); } /* }}} */ @@ -1181,10 +1187,6 @@ RETURN_FALSE; } - if (mysql_param_count(stmt-stmt)) { - stmt-is_null = (char *)emalloc(mysql_param_count(stmt-stmt)); - } - MYSQLI_RETURN_RESOURCE(stmt, mysqli_stmt_class_entry); } /* }}} */ @@ -1495,9 +1497,34 @@ } /* }}} */ +/* {{{ proto mixed mysqli_stmt_affected_rows(object stmt) +*/ +PHP_FUNCTION(mysqli_stmt_affected_rows) +{ + STMT*stmt; + zval*mysql_stmt; + my_ulonglongrc; + charret[50]; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O, +mysql_stmt, mysqli_stmt_class_entry) == FAILURE) { + return; + } + MYSQLI_FETCH_RESOURCE(stmt, STMT *, mysql_stmt, mysqli_stmt); + + rc = mysql_stmt_affected_rows(stmt-stmt); + if (rc != (long)rc) { + sprintf((char *)ret, %llu, rc); + RETURN_STRING(ret, 1); + } + + RETURN_LONG(rc); +} +/* }}} */ + /* {{{ proto bool mysqli_stmt_close(resource stmt) close statement */ -PHP_FUNCTION(mysqli_stmt_close) { +PHP_FUNCTION(mysqli_stmt_close) +{ STMT*stmt; zval*mysql_stmt; Index: php4/ext/mysqli/mysqli_fe.c diff -u php4/ext/mysqli/mysqli_fe.c:1.4 php4/ext/mysqli/mysqli_fe.c:1.5 --- php4/ext/mysqli/mysqli_fe.c:1.4 Wed Feb 12 19:11:17 2003 +++ php4/ext/mysqli/mysqli_fe.c Sun Feb 16 07:03:37 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_fe.c,v 1.4 2003/02/13 00:11:17 georg Exp $ + $Id: mysqli_fe.c,v 1.5 2003/02/16 12:03:37 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -105,6 +105,7 @@ PHP_FE(mysqli_slave_query, NULL) PHP_FE(mysqli_ssl_set,
[PHP-CVS] cvs: php4 /ext/mysqli mysqli_api.c php_mysqli.h
iliaa Sun Feb 16 10:56:57 2003 EDT Modified files: /php4/ext/mysqlimysqli_api.c php_mysqli.h Log: Moved longlong conversion to a macro. Index: php4/ext/mysqli/mysqli_api.c diff -u php4/ext/mysqli/mysqli_api.c:1.10 php4/ext/mysqli/mysqli_api.c:1.11 --- php4/ext/mysqli/mysqli_api.c:1.10 Sun Feb 16 07:03:37 2003 +++ php4/ext/mysqli/mysqli_api.cSun Feb 16 10:56:57 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.10 2003/02/16 12:03:37 georg Exp $ + $Id: mysqli_api.c,v 1.11 2003/02/16 15:56:57 iliaa Exp $ */ #ifdef HAVE_CONFIG_H @@ -36,8 +36,7 @@ { MYSQL *mysql; zval*mysql_link; - my_ulonglongrc; - charret[40]; + my_ulonglongrc; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O, mysql_link, mysqli_link_class_entry) == FAILURE) { return; @@ -46,11 +45,7 @@ MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, mysql_link, mysqli_link); rc = mysql_affected_rows(mysql); - if (rc != (long)rc) { - sprintf((char *)ret, %llu, rc); - RETURN_STRING(ret,1); - } - RETURN_LONG(rc); + MYSQLI_RETURN_LONG_LONG(rc); } /* }}} */ @@ -648,7 +643,7 @@ my_ulonglong lval; memcpy (lval, stmt-bind[i].buffer, sizeof(my_ulonglong)); if (lval != (long)lval) { - sprintf((char *)tmp, %lld, lval); + sprintf((char *)tmp, +%llu, lval); ZVAL_STRING(stmt-vars[i], tmp, 1); } else { ZVAL_LONG(stmt-vars[i], lval); @@ -1000,8 +995,7 @@ PHP_FUNCTION(mysqli_insert_id) { MYSQL *mysql; - my_ulonglongrc; - charret[50]; + my_ulonglongrc; zval*mysql_link; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O, mysql_link, mysqli_link_class_entry) == FAILURE) { @@ -1009,12 +1003,7 @@ } MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, mysql_link, mysqli_link); rc = mysql_insert_id(mysql); - - if (rc != (long)rc) { - sprintf((char *)ret, %llu, rc); - RETURN_STRING(ret,1); - } - RETURN_LONG(rc); + MYSQLI_RETURN_LONG_LONG(rc) } /* }}} */ @@ -1503,8 +1492,7 @@ { STMT*stmt; zval*mysql_stmt; - my_ulonglongrc; - charret[50]; + my_ulonglongrc; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O, mysql_stmt, mysqli_stmt_class_entry) == FAILURE) { return; @@ -1512,12 +1500,7 @@ MYSQLI_FETCH_RESOURCE(stmt, STMT *, mysql_stmt, mysqli_stmt); rc = mysql_stmt_affected_rows(stmt-stmt); - if (rc != (long)rc) { - sprintf((char *)ret, %llu, rc); - RETURN_STRING(ret, 1); - } - - RETURN_LONG(rc); + MYSQLI_RETURN_LONG_LONG(rc) } /* }}} */ Index: php4/ext/mysqli/php_mysqli.h diff -u php4/ext/mysqli/php_mysqli.h:1.7 php4/ext/mysqli/php_mysqli.h:1.8 --- php4/ext/mysqli/php_mysqli.h:1.7Sun Feb 16 07:03:37 2003 +++ php4/ext/mysqli/php_mysqli.hSun Feb 16 10:56:57 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: php_mysqli.h,v 1.7 2003/02/16 12:03:37 georg Exp $ + $Id: php_mysqli.h,v 1.8 2003/02/16 15:56:57 iliaa Exp $ */ /* A little hack to prevent build break, when mysql is used together with @@ -119,6 +119,17 @@ { \ mysqli_object *intern = (mysqli_object *)zend_object_store_get_object(*(__id) TSRMLS_CC);\ intern-ptr = NULL; \ +} + +#define MYSQLI_RETURN_LONG_LONG(__val) \ +{ \ + if ((__val) LONG_MAX) { \ + RETURN_LONG((__val)); \ + } else {\ + char ret[40]; \ + sprintf(ret, %llu, (__val)); \ + RETURN_STRING(ret,1); \ + } \ } #define MYSQLI_STORE_RESULT0 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/mysqli mysqli_api.c
georg Fri Feb 14 11:31:51 2003 EDT Modified files: /php4/ext/mysqlimysqli_api.c Log: bind_result fix Index: php4/ext/mysqli/mysqli_api.c diff -u php4/ext/mysqli/mysqli_api.c:1.4 php4/ext/mysqli/mysqli_api.c:1.5 --- php4/ext/mysqli/mysqli_api.c:1.4Thu Feb 13 12:15:22 2003 +++ php4/ext/mysqli/mysqli_api.cFri Feb 14 11:31:51 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.4 2003/02/13 17:15:22 edink Exp $ + $Id: mysqli_api.c,v 1.5 2003/02/14 16:31:51 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -282,12 +282,12 @@ case MYSQL_TYPE_LONGLONG: stmt-bind[ofs].type = IS_STRING; - stmt-bind[ofs].buflen = (stmt-stmt-fields) ? stmt-stmt-fields[ofs].length + 1 : 256; + stmt-bind[ofs].buflen = sizeof(my_ulonglong); stmt-bind[ofs].buffer = (char *)emalloc(stmt-bind[ofs].buflen); bind[ofs].buffer_type = MYSQL_TYPE_LONGLONG; bind[ofs].buffer = stmt-bind[ofs].buffer; bind[ofs].is_null = stmt-is_null[ofs]; - bind[ofs].buffer_length = stmt-bind[ofs].buflen - 1; + bind[ofs].buffer_length = stmt-bind[ofs].buflen; break; case MYSQL_TYPE_DATE: case MYSQL_TYPE_TIME: @@ -298,15 +298,16 @@ case MYSQL_TYPE_BLOB: case MYSQL_TYPE_TIMESTAMP: stmt-bind[ofs].type = IS_STRING; - stmt-bind[ofs].buflen = (stmt-stmt-fields) ? stmt-stmt-fields[ofs].length + 1: 256; + stmt-bind[ofs].buflen = (stmt-stmt-fields) ? +stmt-stmt-fields[ofs].length + 1: 250; stmt-bind[ofs].buffer = (char *)emalloc(stmt-bind[ofs].buflen); bind[ofs].buffer_type = MYSQL_TYPE_STRING; bind[ofs].buffer = stmt-bind[ofs].buffer; bind[ofs].is_null = stmt-is_null[ofs]; bind[ofs].buffer_length = stmt-bind[ofs].buflen; + bind[ofs].length = stmt-bind[ofs].buflen; break; } - bind[ofs].length = stmt-bind[ofs].buflen; +// bind[ofs].length = stmt-bind[ofs].buflen; } if (mysql_bind_result(stmt-stmt, bind)) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/mysqli mysqli_api.c
georg Fri Feb 14 13:17:25 2003 EDT Modified files: /php4/ext/mysqlimysqli_api.c Log: fixed a bug in mysqli_fetch removed c++ comment (thx to Jani :) fixed compiler warning Index: php4/ext/mysqli/mysqli_api.c diff -u php4/ext/mysqli/mysqli_api.c:1.6 php4/ext/mysqli/mysqli_api.c:1.7 --- php4/ext/mysqli/mysqli_api.c:1.6Fri Feb 14 11:49:09 2003 +++ php4/ext/mysqli/mysqli_api.cFri Feb 14 13:17:25 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.6 2003/02/14 16:49:09 iliaa Exp $ + $Id: mysqli_api.c,v 1.7 2003/02/14 18:17:25 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -282,6 +282,8 @@ case MYSQL_TYPE_LONGLONG: stmt-bind[ofs].type = IS_STRING; + + /* TODO: change and check buflen when bug #74 is fixed +*/ stmt-bind[ofs].buflen = sizeof(my_ulonglong); stmt-bind[ofs].buffer = (char *)emalloc(stmt-bind[ofs].buflen); bind[ofs].buffer_type = MYSQL_TYPE_LONGLONG; @@ -298,7 +300,7 @@ case MYSQL_TYPE_BLOB: case MYSQL_TYPE_TIMESTAMP: stmt-bind[ofs].type = IS_STRING; - stmt-bind[ofs].buflen = (stmt-stmt-fields) ? stmt-stmt-fields[ofs].length + 1: 250; + stmt-bind[ofs].buflen = (stmt-stmt-fields) ? +stmt-stmt-fields[ofs].length + 1: 256; stmt-bind[ofs].buffer = (char *)emalloc(stmt-bind[ofs].buflen); bind[ofs].buffer_type = MYSQL_TYPE_STRING; bind[ofs].buffer = stmt-bind[ofs].buffer; @@ -307,7 +309,6 @@ bind[ofs].length = stmt-bind[ofs].buflen; break; } -// bind[ofs].length = stmt-bind[ofs].buflen; } if (mysql_bind_result(stmt-stmt, bind)) { @@ -598,7 +599,7 @@ } /* }}} */ -/* {{{ proto bool mysqli_fetch(resource stmt) +/* {{{ proto int mysqli_fetch(resource stmt) */ PHP_FUNCTION(mysqli_fetch) { @@ -622,39 +623,38 @@ } if (!(ret = mysql_fetch(stmt-stmt))) { - RETURN_FALSE; - } - for (i = 0; i stmt-var_cnt; i++) { - if (!stmt-is_null[i]) { - switch (stmt-bind[i].type) { - case IS_LONG: - stmt-vars[i]-type = IS_LONG; - break; - case IS_DOUBLE: - stmt-vars[i]-type = IS_DOUBLE; - break; - case IS_STRING: - if (stmt-stmt-bind[i].buffer_type == MYSQL_TYPE_LONGLONG) { - char tmp[50]; - my_ulonglong lval; - memcpy (lval, stmt-bind[i].buffer, sizeof(my_ulonglong)); - if (lval != (long)lval) { - sprintf((char *)tmp, %lld, lval); - ZVAL_STRING(stmt-vars[i], tmp, 1); + for (i = 0; i stmt-var_cnt; i++) { + if (!stmt-is_null[i]) { + switch (stmt-bind[i].type) { + case IS_LONG: + stmt-vars[i]-type = IS_LONG; + break; + case IS_DOUBLE: + stmt-vars[i]-type = IS_DOUBLE; + break; + case IS_STRING: + if (stmt-stmt-bind[i].buffer_type == +MYSQL_TYPE_LONGLONG) { + char tmp[50]; + my_ulonglong lval; + memcpy (lval, +stmt-bind[i].buffer, sizeof(my_ulonglong)); + if (lval != (long)lval) { + sprintf((char *)tmp, +%lld, lval); + +ZVAL_STRING(stmt-vars[i], tmp, 1); + } else { +
[PHP-CVS] cvs: php4 /ext/mysqli mysqli_api.c
iliaa Fri Feb 14 13:35:30 2003 EDT Modified files: /php4/ext/mysqlimysqli_api.c Log: CS fixes. Index: php4/ext/mysqli/mysqli_api.c diff -u php4/ext/mysqli/mysqli_api.c:1.7 php4/ext/mysqli/mysqli_api.c:1.8 --- php4/ext/mysqli/mysqli_api.c:1.7Fri Feb 14 13:17:25 2003 +++ php4/ext/mysqli/mysqli_api.cFri Feb 14 13:35:30 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.7 2003/02/14 18:17:25 georg Exp $ + $Id: mysqli_api.c,v 1.8 2003/02/14 18:35:30 iliaa Exp $ */ #ifdef HAVE_CONFIG_H @@ -100,8 +100,7 @@ } MYSQLI_FETCH_RESOURCE(stmt, STMT *, args[0], mysqli_stmt); start = 1; - } - else { + } else { object = (getThis()); MYSQLI_FETCH_RESOURCE(stmt, STMT *, object, mysqli_stmt); } @@ -434,7 +433,7 @@ PHP_FUNCTION(mysqli_debug) { char*debug; - int debug_len; + int debug_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, debug, debug_len) == FAILURE) { return; @@ -546,7 +545,7 @@ PHP_FUNCTION(mysqli_error) { MYSQL *mysql; - zval*mysql_link; + zval *mysql_link; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O, mysql_link, mysqli_link_class_entry) == FAILURE) { return; @@ -962,7 +961,7 @@ { MYSQL *mysql; char *info = NULL; - zval*mysql_link = NULL; + zval *mysql_link = NULL; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O, mysql_link, mysqli_link_class_entry) == FAILURE) { return; @@ -1277,7 +1276,8 @@ /* {{{ proto bool mysqli_real_query(resource link, string query) */ -PHP_FUNCTION(mysqli_real_query) { +PHP_FUNCTION(mysqli_real_query) +{ MYSQL *mysql; zval*mysql_link; char*query = NULL; @@ -1350,7 +1350,8 @@ /* {{{ proto int mysqli_rpl_parse_enabled(resource link) */ -PHP_FUNCTION(mysqli_rpl_parse_enabled) { +PHP_FUNCTION(mysqli_rpl_parse_enabled) +{ MYSQL *mysql; zval *mysql_link; @@ -1365,7 +1366,8 @@ /* {{{ proto bool mysqli_rpl_probe(resource link) */ -PHP_FUNCTION(mysqli_rpl_probe) { +PHP_FUNCTION(mysqli_rpl_probe) +{ MYSQL *mysql; zval *mysql_link; @@ -1384,11 +1386,12 @@ /* {{{ proto int mysqli_rpl_query_type(string query) */ -PHP_FUNCTION(mysqli_rpl_query_type) { +PHP_FUNCTION(mysqli_rpl_query_type) +{ MYSQL *mysql; zval*mysql_link; char*query; - int query_len; + int query_len; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), Os, mysql_link, mysqli_link_class_entry, query, query_len) == FAILURE) { return; @@ -1429,7 +1432,8 @@ /* {{{ proto bool mysqli_send_query(resource link, string query) */ -PHP_FUNCTION(mysqli_send_query) { +PHP_FUNCTION(mysqli_send_query) +{ MYSQL *mysql; zval*mysql_link; char*query = NULL; @@ -1449,7 +1453,8 @@ /* {{{ proto bool mysqli_slave_query(resource link, string query) */ -PHP_FUNCTION(mysqli_slave_query) { +PHP_FUNCTION(mysqli_slave_query) +{ MYSQL *mysql; zval*mysql_link; char*query = NULL; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/mysqli mysqli_api.c
edink Thu Feb 13 12:15:22 2003 EDT Modified files: /php4/ext/mysqlimysqli_api.c Log: Use my_ulonglong instead of unsigned long long to make msvc++ happy. Index: php4/ext/mysqli/mysqli_api.c diff -u php4/ext/mysqli/mysqli_api.c:1.3 php4/ext/mysqli/mysqli_api.c:1.4 --- php4/ext/mysqli/mysqli_api.c:1.3Wed Feb 12 19:11:17 2003 +++ php4/ext/mysqli/mysqli_api.cThu Feb 13 12:15:22 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.3 2003/02/13 00:11:17 georg Exp $ + $Id: mysqli_api.c,v 1.4 2003/02/13 17:15:22 edink Exp $ */ #ifdef HAVE_CONFIG_H @@ -633,8 +633,8 @@ case IS_STRING: if (stmt-stmt-bind[i].buffer_type == MYSQL_TYPE_LONGLONG) { char tmp[50]; - unsigned long long lval; - memcpy (lval, stmt-bind[i].buffer, sizeof(long long)); + my_ulonglong lval; + memcpy (lval, stmt-bind[i].buffer, +sizeof(my_ulonglong)); if (lval != (long)lval) { sprintf((char *)tmp, %lld, lval); ZVAL_STRING(stmt-vars[i], tmp, 1); @@ -1001,7 +1001,7 @@ PHP_FUNCTION(mysqli_insert_id) { MYSQL *mysql; - unsigned long long rc; + my_ulonglong rc; char ret[50]; zval *mysql_link; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/mysqli mysqli_api.c mysqli_fe.c php_mysqli.h
georg Wed Feb 12 05:39:07 2003 EDT Modified files: /php4/ext/mysqlimysqli_api.c mysqli_fe.c php_mysqli.h Log: removed function mysql_num_warnings (libmysql change). Index: php4/ext/mysqli/mysqli_api.c diff -u php4/ext/mysqli/mysqli_api.c:1.1 php4/ext/mysqli/mysqli_api.c:1.2 --- php4/ext/mysqli/mysqli_api.c:1.1Tue Feb 11 19:45:53 2003 +++ php4/ext/mysqli/mysqli_api.cWed Feb 12 05:39:06 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.1 2003/02/12 00:45:53 georg Exp $ + $Id: mysqli_api.c,v 1.2 2003/02/12 10:39:06 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -1079,22 +1079,6 @@ } RETURN_LONG(mysql_num_rows(result)); -} -/* }}} */ - -/* {{{ proto int mysqli_num_warnings - */ -PHP_FUNCTION(mysqli_num_warnings) -{ - MYSQL *mysql; - zval *mysql_link = NULL; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O, mysql_link, mysqli_link_class_entry) == FAILURE) { - return; - } - MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, mysql_link, mysqli_link); - - RETURN_LONG(mysql_warning_count(mysql)); } /* }}} */ Index: php4/ext/mysqli/mysqli_fe.c diff -u php4/ext/mysqli/mysqli_fe.c:1.1 php4/ext/mysqli/mysqli_fe.c:1.2 --- php4/ext/mysqli/mysqli_fe.c:1.1 Tue Feb 11 19:45:53 2003 +++ php4/ext/mysqli/mysqli_fe.c Wed Feb 12 05:39:06 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_fe.c,v 1.1 2003/02/12 00:45:53 georg Exp $ + $Id: mysqli_fe.c,v 1.2 2003/02/12 10:39:06 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -80,7 +80,6 @@ PHP_FE(mysqli_master_query, NULL) PHP_FE(mysqli_num_fields, NULL) PHP_FE(mysqli_num_rows, NULL) - PHP_FE(mysqli_num_warnings, NULL) PHP_FE(mysqli_options, NULL) PHP_FE(mysqli_param_count, NULL) PHP_FE(mysqli_ping, NULL) Index: php4/ext/mysqli/php_mysqli.h diff -u php4/ext/mysqli/php_mysqli.h:1.1 php4/ext/mysqli/php_mysqli.h:1.2 --- php4/ext/mysqli/php_mysqli.h:1.1Tue Feb 11 19:45:53 2003 +++ php4/ext/mysqli/php_mysqli.hWed Feb 12 05:39:06 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: php_mysqli.h,v 1.1 2003/02/12 00:45:53 georg Exp $ + $Id: php_mysqli.h,v 1.2 2003/02/12 10:39:06 georg Exp $ */ #include mysql.h @@ -186,7 +186,6 @@ PHP_FUNCTION(mysqli_master_query); PHP_FUNCTION(mysqli_num_fields); PHP_FUNCTION(mysqli_num_rows); -PHP_FUNCTION(mysqli_num_warnings); PHP_FUNCTION(mysqli_options); PHP_FUNCTION(mysqli_param_count); PHP_FUNCTION(mysqli_ping); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/mysqli mysqli_api.c mysqli_fe.c php_mysqli.h
georg Wed Feb 12 19:11:17 2003 EDT Modified files: /php4/ext/mysqliphp_mysqli.h mysqli_fe.c mysqli_api.c Log: added new function int mysql_get_server_version this function is available since libmysql change set 1.1450 (2002-02-13) Index: php4/ext/mysqli/php_mysqli.h diff -u php4/ext/mysqli/php_mysqli.h:1.2 php4/ext/mysqli/php_mysqli.h:1.3 --- php4/ext/mysqli/php_mysqli.h:1.2Wed Feb 12 05:39:06 2003 +++ php4/ext/mysqli/php_mysqli.hWed Feb 12 19:11:17 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: php_mysqli.h,v 1.2 2003/02/12 10:39:06 georg Exp $ + $Id: php_mysqli.h,v 1.3 2003/02/13 00:11:17 georg Exp $ */ #include mysql.h @@ -179,6 +179,7 @@ PHP_FUNCTION(mysqli_get_host_info); PHP_FUNCTION(mysqli_get_proto_info); PHP_FUNCTION(mysqli_get_server_info); +PHP_FUNCTION(mysqli_get_server_version); PHP_FUNCTION(mysqli_info); PHP_FUNCTION(mysqli_insert_id); PHP_FUNCTION(mysqli_init); Index: php4/ext/mysqli/mysqli_fe.c diff -u php4/ext/mysqli/mysqli_fe.c:1.3 php4/ext/mysqli/mysqli_fe.c:1.4 --- php4/ext/mysqli/mysqli_fe.c:1.3 Wed Feb 12 16:07:28 2003 +++ php4/ext/mysqli/mysqli_fe.c Wed Feb 12 19:11:17 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_fe.c,v 1.3 2003/02/12 21:07:28 georg Exp $ + $Id: mysqli_fe.c,v 1.4 2003/02/13 00:11:17 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -73,6 +73,7 @@ PHP_FE(mysqli_get_host_info,NULL) PHP_FE(mysqli_get_proto_info, NULL) PHP_FE(mysqli_get_server_info, NULL) + PHP_FE(mysqli_get_server_version, NULL) PHP_FE(mysqli_init, NULL) PHP_FE(mysqli_info, NULL) PHP_FE(mysqli_insert_id, NULL) @@ -141,6 +142,7 @@ PHP_FALIAS(get_host_info,mysqli_get_host_info,NULL) PHP_FALIAS(get_proto_info,mysqli_get_proto_info,NULL) PHP_FALIAS(get_server_info,mysqli_get_server_info,NULL) + PHP_FALIAS(get_server_version,mysqli_get_server_version,NULL) PHP_FALIAS(init,mysqli_init,NULL) PHP_FALIAS(info,mysqli_info,NULL) PHP_FALIAS(insert_id,mysqli_insert_id,NULL) Index: php4/ext/mysqli/mysqli_api.c diff -u php4/ext/mysqli/mysqli_api.c:1.2 php4/ext/mysqli/mysqli_api.c:1.3 --- php4/ext/mysqli/mysqli_api.c:1.2Wed Feb 12 05:39:06 2003 +++ php4/ext/mysqli/mysqli_api.cWed Feb 12 19:11:17 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.2 2003/02/12 10:39:06 georg Exp $ + $Id: mysqli_api.c,v 1.3 2003/02/13 00:11:17 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -944,6 +944,23 @@ MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, mysql_link, mysqli_link); RETURN_STRING((char *)mysql_get_server_info(mysql), 1); +} + +/* }}} */ + +/* {{{ proto int mysqli_get_server_version +*/ +PHP_FUNCTION(mysqli_get_server_version) +{ + MYSQL *mysql; + zval*mysql_link = NULL; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O, +mysql_link, mysqli_link_class_entry) == FAILURE) { + return; + } + MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, mysql_link, mysqli_link); + + RETURN_LONG(mysql_get_server_version(mysql)); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php