scottmac Wed Aug 6 14:02:44 2008 UTC Modified files: /php-src/ext/sqlite3 sqlite3.c /php-src/ext/sqlite3/tests sqlite3_12_unfinalized_stmt_cleanup.phpt sqlite3_25_create_aggregate.phpt Log: MFB: Update coding standards and fix a test, this was already in 5.3 alpha 1
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/sqlite3.c?r1=1.10&r2=1.11&diff_format=u Index: php-src/ext/sqlite3/sqlite3.c diff -u php-src/ext/sqlite3/sqlite3.c:1.10 php-src/ext/sqlite3/sqlite3.c:1.11 --- php-src/ext/sqlite3/sqlite3.c:1.10 Sat Aug 2 04:40:45 2008 +++ php-src/ext/sqlite3/sqlite3.c Wed Aug 6 14:02:44 2008 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sqlite3.c,v 1.10 2008/08/02 04:40:45 felipe Exp $ */ +/* $Id: sqlite3.c,v 1.11 2008/08/06 14:02:44 scottmac Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -375,7 +375,7 @@ } /* }}} */ -/* {{{ proto sqlite3_stmt SQLite3::prepare(String Query) +/* {{{ proto SQLite3Stmt SQLite3::prepare(String Query) Returns a prepared SQL statement for execution. */ PHP_METHOD(sqlite3, prepare) { @@ -414,8 +414,8 @@ } /* }}} */ -/* {{{ proto sqlite3_result SQLite3::query(String Query) - Returns true or false, for queries that return data it will return a sqlite3_result object. */ +/* {{{ proto SQLite3Result SQLite3::query(String Query) + Returns true or false, for queries that return data it will return a SQLite3Result object. */ PHP_METHOD(sqlite3, query) { php_sqlite3_db_object *db_obj; @@ -530,7 +530,7 @@ } /* }}} */ -/* {{{ proto sqlite3_result SQLite3::querySingle(String Query [, entire_row = false]) +/* {{{ proto SQLite3Result SQLite3::querySingle(String Query [, entire_row = false]) Returns a string of the first column, or an array of the entire row. */ PHP_METHOD(sqlite3, querySingle) { @@ -893,9 +893,9 @@ } /* }}} */ -/* {{{ proto int SQLite3_stmt::paramCount() U +/* {{{ proto int SQLite3Stmt::paramCount() U Returns the number of parameters within the prepared statement. */ -PHP_METHOD(sqlite3_stmt, paramCount) +PHP_METHOD(sqlite3stmt, paramCount) { php_sqlite3_stmt *stmt_obj; zval *object = getThis(); @@ -909,9 +909,9 @@ } /* }}} */ -/* {{{ proto bool SQLite3_stmt::close() U +/* {{{ proto bool SQLite3Stmt::close() U Closes the prepared statement. */ -PHP_METHOD(sqlite3_stmt, close) +PHP_METHOD(sqlite3stmt, close) { php_sqlite3_stmt *stmt_obj; zval *object = getThis(); @@ -927,9 +927,9 @@ } /* }}} */ -/* {{{ proto bool SQLite3_stmt::reset() U +/* {{{ proto bool SQLite3Stmt::reset() U Reset the prepared statement to the state before it was executed, bindings still remain. */ -PHP_METHOD(sqlite3_stmt, reset) +PHP_METHOD(sqlite3stmt, reset) { php_sqlite3_stmt *stmt_obj; zval *object = getThis(); @@ -947,9 +947,9 @@ } /* }}} */ -/* {{{ proto bool SQLite3_stmt::clear() U +/* {{{ proto bool SQLite3Stmt::clear() U Clear all current bound parameters. */ -PHP_METHOD(sqlite3_stmt, clear) +PHP_METHOD(sqlite3stmt, clear) { php_sqlite3_stmt *stmt_obj; zval *object = getThis(); @@ -1013,9 +1013,9 @@ } /* }}} */ -/* {{{ proto bool SQLite3_stmt::bindParam(int parameter_number, mixed parameter [, int type]) +/* {{{ proto bool SQLite3Stmt::bindParam(int parameter_number, mixed parameter [, int type]) Bind Paramater to a stmt variable. */ -PHP_METHOD(sqlite3_stmt, bindParam) +PHP_METHOD(sqlite3stmt, bindParam) { php_sqlite3_stmt *stmt_obj; zval *object = getThis(); @@ -1044,9 +1044,9 @@ } /* }}} */ -/* {{{ proto bool SQLite3_stmt::bindValue(inte parameter_number, mixed parameter [, int type]) +/* {{{ proto bool SQLite3Stmt::bindValue(inte parameter_number, mixed parameter [, int type]) Bind Value of a parameter to a stmt variable. */ -PHP_METHOD(sqlite3_stmt, bindValue) +PHP_METHOD(sqlite3stmt, bindValue) { php_sqlite3_stmt *stmt_obj; zval *object = getThis(); @@ -1075,9 +1075,9 @@ } /* }}} */ -/* {{{ proto SQLite3_result SQLite3_stmt::execute() +/* {{{ proto SQLite3Result SQLite3Stmt::execute() Executes a prepared statement and returns a result set object. */ -PHP_METHOD(sqlite3_stmt, execute) +PHP_METHOD(sqlite3stmt, execute) { php_sqlite3_stmt *stmt_obj; php_sqlite3_result *result; @@ -1194,15 +1194,15 @@ } /* }}} */ -/* {{{ proto int SQLite3_result::numColumns() U +/* {{{ proto int SQLite3Result::numColumns() U Number of columns in the result set. */ -PHP_METHOD(sqlite3_result, numColumns) +PHP_METHOD(sqlite3result, numColumns) { php_sqlite3_result *result_obj; zval *object = getThis(); result_obj = (php_sqlite3_result *)zend_object_store_get_object(object TSRMLS_CC); - SQLITE3_CHECK_INITIALIZED(result_obj->stmt_obj->initialised, SQLite3_result) + SQLITE3_CHECK_INITIALIZED(result_obj->stmt_obj->initialised, SQLite3Result) if (zend_parse_parameters_none() == FAILURE) { return; @@ -1212,16 +1212,16 @@ } /* }}} */ -/* {{{ proto string SQLite3_result::columnName(int column) U +/* {{{ proto string SQLite3Result::columnName(int column) U Returns the name of the nth column. */ -PHP_METHOD(sqlite3_result, columnName) +PHP_METHOD(sqlite3result, columnName) { php_sqlite3_result *result_obj; zval *object = getThis(); long column = 0; result_obj = (php_sqlite3_result *)zend_object_store_get_object(object TSRMLS_CC); - SQLITE3_CHECK_INITIALIZED(result_obj->stmt_obj->initialised, SQLite3_result) + SQLITE3_CHECK_INITIALIZED(result_obj->stmt_obj->initialised, SQLite3Result) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &column) == FAILURE) { return; @@ -1231,16 +1231,16 @@ } /* }}} */ -/* {{{ proto int SQLite3_result::columnType(int column) U +/* {{{ proto int SQLite3Result::columnType(int column) U Returns the type of the nth column. */ -PHP_METHOD(sqlite3_result, columnType) +PHP_METHOD(sqlite3result, columnType) { php_sqlite3_result *result_obj; zval *object = getThis(); long column = 0; result_obj = (php_sqlite3_result *)zend_object_store_get_object(object TSRMLS_CC); - SQLITE3_CHECK_INITIALIZED(result_obj->stmt_obj->initialised, SQLite3_result) + SQLITE3_CHECK_INITIALIZED(result_obj->stmt_obj->initialised, SQLite3Result) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &column) == FAILURE) { return; @@ -1250,9 +1250,9 @@ } /* }}} */ -/* {{{ proto array SQLite3_result::fetchArray([int mode]) U +/* {{{ proto array SQLite3Result::fetchArray([int mode]) U Fetch a result row as both an associative or numerically indexed array or both. */ -PHP_METHOD(sqlite3_result, fetchArray) +PHP_METHOD(sqlite3result, fetchArray) { php_sqlite3_result *result_obj; zval *object = getThis(); @@ -1260,7 +1260,7 @@ long mode = PHP_SQLITE3_BOTH; result_obj = (php_sqlite3_result *)zend_object_store_get_object(object TSRMLS_CC); - SQLITE3_CHECK_INITIALIZED(result_obj->stmt_obj->initialised, SQLite3_result) + SQLITE3_CHECK_INITIALIZED(result_obj->stmt_obj->initialised, SQLite3Result) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &mode) == FAILURE) { return; @@ -1305,15 +1305,15 @@ } /* }}} */ -/* {{{ proto bool SQLite3_result::reset() U +/* {{{ proto bool SQLite3Result::reset() U Resets the result set back to the first row. */ -PHP_METHOD(sqlite3_result, reset) +PHP_METHOD(sqlite3result, reset) { php_sqlite3_result *result_obj; zval *object = getThis(); result_obj = (php_sqlite3_result *)zend_object_store_get_object(object TSRMLS_CC); - SQLITE3_CHECK_INITIALIZED(result_obj->stmt_obj->initialised, SQLite3_result) + SQLITE3_CHECK_INITIALIZED(result_obj->stmt_obj->initialised, SQLite3Result) if (zend_parse_parameters_none() == FAILURE) { return; @@ -1329,15 +1329,15 @@ } /* }}} */ -/* {{{ proto bool SQLite3_result::finalize() U +/* {{{ proto bool SQLite3Result::finalize() U Closes the result set. */ -PHP_METHOD(sqlite3_result, finalize) +PHP_METHOD(sqlite3result, finalize) { php_sqlite3_result *result_obj; zval *object = getThis(); result_obj = (php_sqlite3_result *)zend_object_store_get_object(object TSRMLS_CC); - SQLITE3_CHECK_INITIALIZED(result_obj->stmt_obj->initialised, SQLite3_result) + SQLITE3_CHECK_INITIALIZED(result_obj->stmt_obj->initialised, SQLite3Result) if (zend_parse_parameters_none() == FAILURE) { return; @@ -1434,64 +1434,64 @@ ZEND_END_ARG_INFO() static -ZEND_BEGIN_ARG_INFO(arginfo_sqlite3_stmt_paramcount, 0) +ZEND_BEGIN_ARG_INFO(arginfo_sqlite3stmt_paramcount, 0) ZEND_END_ARG_INFO() static -ZEND_BEGIN_ARG_INFO(arginfo_sqlite3_stmt_close, 0) +ZEND_BEGIN_ARG_INFO(arginfo_sqlite3stmt_close, 0) ZEND_END_ARG_INFO() static -ZEND_BEGIN_ARG_INFO(arginfo_sqlite3_stmt_reset, 0) +ZEND_BEGIN_ARG_INFO(arginfo_sqlite3stmt_reset, 0) ZEND_END_ARG_INFO() static -ZEND_BEGIN_ARG_INFO(arginfo_sqlite3_stmt_clear, 0) +ZEND_BEGIN_ARG_INFO(arginfo_sqlite3stmt_clear, 0) ZEND_END_ARG_INFO() static -ZEND_BEGIN_ARG_INFO(arginfo_sqlite3_stmt_execute, 0) +ZEND_BEGIN_ARG_INFO(arginfo_sqlite3stmt_execute, 0) ZEND_END_ARG_INFO() static -ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_stmt_bindparam, 0, 0, 2) +ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3stmt_bindparam, 0, 0, 2) ZEND_ARG_INFO(0, param_number) ZEND_ARG_INFO(1, param) ZEND_ARG_INFO(0, type) ZEND_END_ARG_INFO() static -ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_stmt_bindvalue, 0, 0, 2) +ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3stmt_bindvalue, 0, 0, 2) ZEND_ARG_INFO(0, param_number) ZEND_ARG_INFO(0, param) ZEND_ARG_INFO(0, type) ZEND_END_ARG_INFO() static -ZEND_BEGIN_ARG_INFO(arginfo_sqlite3_result_numcolumns, 0) +ZEND_BEGIN_ARG_INFO(arginfo_sqlite3result_numcolumns, 0) ZEND_END_ARG_INFO() static -ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_result_columnname, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3result_columnname, 0, 0, 1) ZEND_ARG_INFO(0, column_number) ZEND_END_ARG_INFO() static -ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_result_columntype, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3result_columntype, 0, 0, 1) ZEND_ARG_INFO(0, column_number) ZEND_END_ARG_INFO() static -ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_result_fetcharray, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3result_fetcharray, 0, 0, 1) ZEND_ARG_INFO(0, mode) ZEND_END_ARG_INFO() static -ZEND_BEGIN_ARG_INFO(arginfo_sqlite3_result_reset, 0) +ZEND_BEGIN_ARG_INFO(arginfo_sqlite3result_reset, 0) ZEND_END_ARG_INFO() static -ZEND_BEGIN_ARG_INFO(arginfo_sqlite3_result_finalize, 0) +ZEND_BEGIN_ARG_INFO(arginfo_sqlite3result_finalize, 0) ZEND_END_ARG_INFO() /* }}} */ @@ -1520,25 +1520,25 @@ /* {{{ php_sqlite3_stmt_class_methods */ static zend_function_entry php_sqlite3_stmt_class_methods[] = { - PHP_ME(sqlite3_stmt, paramCount, arginfo_sqlite3_stmt_paramcount, ZEND_ACC_PUBLIC) - PHP_ME(sqlite3_stmt, close, arginfo_sqlite3_stmt_close, ZEND_ACC_PUBLIC) - PHP_ME(sqlite3_stmt, reset, arginfo_sqlite3_stmt_reset, ZEND_ACC_PUBLIC) - PHP_ME(sqlite3_stmt, clear, arginfo_sqlite3_stmt_clear, ZEND_ACC_PUBLIC) - PHP_ME(sqlite3_stmt, execute, arginfo_sqlite3_stmt_execute, ZEND_ACC_PUBLIC) - PHP_ME(sqlite3_stmt, bindParam, arginfo_sqlite3_stmt_bindparam, ZEND_ACC_PUBLIC) - PHP_ME(sqlite3_stmt, bindValue, arginfo_sqlite3_stmt_bindvalue, ZEND_ACC_PUBLIC) + PHP_ME(sqlite3stmt, paramCount, arginfo_sqlite3stmt_paramcount, ZEND_ACC_PUBLIC) + PHP_ME(sqlite3stmt, close, arginfo_sqlite3stmt_close, ZEND_ACC_PUBLIC) + PHP_ME(sqlite3stmt, reset, arginfo_sqlite3stmt_reset, ZEND_ACC_PUBLIC) + PHP_ME(sqlite3stmt, clear, arginfo_sqlite3stmt_clear, ZEND_ACC_PUBLIC) + PHP_ME(sqlite3stmt, execute, arginfo_sqlite3stmt_execute, ZEND_ACC_PUBLIC) + PHP_ME(sqlite3stmt, bindParam, arginfo_sqlite3stmt_bindparam, ZEND_ACC_PUBLIC) + PHP_ME(sqlite3stmt, bindValue, arginfo_sqlite3stmt_bindvalue, ZEND_ACC_PUBLIC) {NULL, NULL, NULL} }; /* }}} */ /* {{{ php_sqlite3_result_class_methods */ static zend_function_entry php_sqlite3_result_class_methods[] = { - PHP_ME(sqlite3_result, numColumns, arginfo_sqlite3_result_numcolumns, ZEND_ACC_PUBLIC) - PHP_ME(sqlite3_result, columnName, arginfo_sqlite3_result_columnname, ZEND_ACC_PUBLIC) - PHP_ME(sqlite3_result, columnType, arginfo_sqlite3_result_columntype, ZEND_ACC_PUBLIC) - PHP_ME(sqlite3_result, fetchArray, arginfo_sqlite3_result_fetcharray, ZEND_ACC_PUBLIC) - PHP_ME(sqlite3_result, reset, arginfo_sqlite3_result_reset, ZEND_ACC_PUBLIC) - PHP_ME(sqlite3_result, finalize, arginfo_sqlite3_result_finalize, ZEND_ACC_PUBLIC) + PHP_ME(sqlite3result, numColumns, arginfo_sqlite3result_numcolumns, ZEND_ACC_PUBLIC) + PHP_ME(sqlite3result, columnName, arginfo_sqlite3result_columnname, ZEND_ACC_PUBLIC) + PHP_ME(sqlite3result, columnType, arginfo_sqlite3result_columntype, ZEND_ACC_PUBLIC) + PHP_ME(sqlite3result, fetchArray, arginfo_sqlite3result_fetcharray, ZEND_ACC_PUBLIC) + PHP_ME(sqlite3result, reset, arginfo_sqlite3result_reset, ZEND_ACC_PUBLIC) + PHP_ME(sqlite3result, finalize, arginfo_sqlite3result_finalize, ZEND_ACC_PUBLIC) {NULL, NULL, NULL} }; /* }}} */ @@ -1788,13 +1788,13 @@ php_sqlite3_sc_entry = zend_register_internal_class(&ce TSRMLS_CC); /* Register SQLite 3 Prepared Statement Class */ - INIT_CLASS_ENTRY(ce, "SQLite3_stmt", php_sqlite3_stmt_class_methods); + INIT_CLASS_ENTRY(ce, "SQLite3Stmt", php_sqlite3_stmt_class_methods); ce.create_object = php_sqlite3_stmt_object_new; sqlite3_stmt_object_handlers.clone_obj = NULL; php_sqlite3_stmt_entry = zend_register_internal_class(&ce TSRMLS_CC); /* Register SQLite 3 Result Class */ - INIT_CLASS_ENTRY(ce, "SQLite3_result", php_sqlite3_result_class_methods); + INIT_CLASS_ENTRY(ce, "SQLite3Result", php_sqlite3_result_class_methods); ce.create_object = php_sqlite3_result_object_new; sqlite3_result_object_handlers.clone_obj = NULL; php_sqlite3_result_entry = zend_register_internal_class(&ce TSRMLS_CC); http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt diff -u php-src/ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt:1.3 php-src/ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt:1.4 --- php-src/ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt:1.3 Tue Jul 29 00:56:22 2008 +++ php-src/ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt Wed Aug 6 14:02:44 2008 @@ -47,6 +47,6 @@ bool(true) Check db was closed -Warning: SQLite3_result::numColumns(): The SQLite3_result object has not been correctly initialised in %s on line %d +Warning: SQLite3Result::numColumns(): The SQLite3_result object has not been correctly initialised in %s on line %d bool(false) Done http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_25_create_aggregate.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/sqlite3/tests/sqlite3_25_create_aggregate.phpt diff -u php-src/ext/sqlite3/tests/sqlite3_25_create_aggregate.phpt:1.2 php-src/ext/sqlite3/tests/sqlite3_25_create_aggregate.phpt:1.3 --- php-src/ext/sqlite3/tests/sqlite3_25_create_aggregate.phpt:1.2 Fri Jul 25 21:34:15 2008 +++ php-src/ext/sqlite3/tests/sqlite3_25_create_aggregate.phpt Wed Aug 6 14:02:44 2008 @@ -7,19 +7,17 @@ require_once(dirname(__FILE__) . '/new_db.inc'); -function sum_list_step(&$context, $string) { +function sum_list_step($context, $num_args, $string) { if (empty($context)) { $context = array('total' => 0, 'values' => array()); } - var_dump($context); $context['total'] += intval($string); $context['values'][] = $context['total']; - return true; + return $context; } -function sum_list_finalize(&$context) { - var_dump($context); +function sum_list_finalize($context) { return implode(',', $context['values']); } @@ -50,7 +48,11 @@ bool(true) bool(true) bool(true) - +Array +( + [S(a)] => 1,3,6,10,14 + [S(b)] => -1,-3,-6,-10,-14 +) Closing database bool(true) Done
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php