Changeset 16
- Timestamp:
- 12/06/07 00:22:54 (1 year ago)
- Files:
-
- trunk/config.m4 (modified) (1 diff)
- trunk/config.w32 (modified) (1 diff)
- trunk/sqlite3.c (modified) (26 diffs)
- trunk/tests/sqlite3_03_insert.phpt (modified) (1 diff)
- trunk/tests/sqlite3_04_update.phpt (modified) (2 diffs)
- trunk/tests/sqlite3_05_delete.phpt (modified) (2 diffs)
- trunk/tests/sqlite3_06_prepared_stmt.phpt (modified) (2 diffs)
- trunk/tests/sqlite3_07_prepared_stmt.phpt (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/config.m4
r4 r16 59 59 fi 60 60 61 if test "$ enable_maintainer_zts" = "yes"; then61 if test "$ZEND_DEBUG" = "yes"; then 62 62 debug_flags="-DSQLITE_DEBUG=1" 63 63 fi trunk/config.w32
r2 r16 5 5 6 6 if (PHP_SQLITE3 != "no") { 7 8 EXTENSION("sqlite3", "sqlite3.c", null, "/ DTHREADSAFE=1 /I" + configure_module_dirname + "/libsqlite /I" + configure_module_dirname);7 ADD_FLAG("CFLAGS_SQLITE3", "/D THREADSAFE=1 "); 8 EXTENSION("sqlite3", "sqlite3.c", null, "/I" + configure_module_dirname + "/libsqlite /I" + configure_module_dirname); 9 9 ADD_SOURCES(configure_module_dirname + "/libsqlite", 10 10 "attach.c auth.c btmutex.c btree.c \ trunk/sqlite3.c
r15 r16 204 204 /* }}} */ 205 205 206 /* {{{ proto int SQLite3::last _insert_rowid()206 /* {{{ proto int SQLite3::lastInsertRowID() 207 207 Returns the rowid of the most recent INSERT into the database from the database connection. 208 208 */ 209 PHP_METHOD(sqlite3, last _insert_rowid)209 PHP_METHOD(sqlite3, lastInsertRowID) 210 210 { 211 211 php_sqlite3_db *db; … … 221 221 /* }}} */ 222 222 223 /* {{{ proto bool SQLite3::load _extension(String Shared Library)223 /* {{{ proto bool SQLite3::loadExtension(String Shared Library) 224 224 Attempts to load an SQLite extension library 225 225 */ 226 PHP_METHOD(sqlite3, load _extension)226 PHP_METHOD(sqlite3, loadExtension) 227 227 { 228 228 php_sqlite3_db *db; … … 267 267 } 268 268 269 /* Extension loading should only be enabled for when we attempt to load */269 /* Extension loading should only be enabled for when we attempt to load */ 270 270 sqlite3_enable_load_extension(db->db, 1); 271 271 if (sqlite3_load_extension(db->db, fullpath, 0, &errtext) != SQLITE_OK) { … … 275 275 RETURN_FALSE; 276 276 } 277 sqlite3_enable_load_extension(db->db, 0);277 sqlite3_enable_load_extension(db->db, 0); 278 278 279 279 RETURN_TRUE; … … 298 298 /* }}} */ 299 299 300 /* {{{ proto String SQLite3::escape _string(String Query)300 /* {{{ proto String SQLite3::escapeString(String value) 301 301 Returns a string that has been properly escaped 302 302 */ 303 PHP_METHOD(sqlite3, escape _string)303 PHP_METHOD(sqlite3, escapeString) 304 304 { 305 305 php_sqlite3_db *db; … … 466 466 MAKE_STD_ZVAL(*zargs[i + is_agg]); 467 467 468 /* get the value */469 468 switch (sqlite3_value_type(argv[i])) { 470 469 case SQLITE_INTEGER: … … 489 488 } 490 489 491 492 490 fc->fci.params = zargs; 493 494 491 495 492 if ((ret = zend_call_function(&fc->fci, &fc->fcc TSRMLS_CC)) == FAILURE) { … … 585 582 } 586 583 587 /* {{{ proto bool SQLite3::create _function(string name, mixed callback [, int argcount]))584 /* {{{ proto bool SQLite3::createFunction(string name, mixed callback [, int argcount])) 588 585 Allows registration of a PHP function as a SQLite UDF that can be called within SQL statements 589 586 */ 590 PHP_METHOD(sqlite3, create _function)587 PHP_METHOD(sqlite3, createFunction) 591 588 { 592 589 php_sqlite3_db *db; … … 636 633 /* }}} */ 637 634 638 /* {{{ proto bool SQLite3::create _aggregate(string name, mixed step, mixed final [, int argcount]))635 /* {{{ proto bool SQLite3::createAggregate(string name, mixed step, mixed final [, int argcount])) 639 636 Allows registration of a PHP function for use as an aggregate 640 637 */ 641 PHP_METHOD(sqlite3, create _aggregate)638 PHP_METHOD(sqlite3, createAggregate) 642 639 { 643 640 php_sqlite3_db *db; … … 698 695 /* }}} */ 699 696 700 /* {{{ proto int SQLite3_stmt::param _count()697 /* {{{ proto int SQLite3_stmt::paramCount() 701 698 Returns the number of parameters within the prepared statement 702 699 */ 703 PHP_METHOD(sqlite3_stmt, param _count)700 PHP_METHOD(sqlite3_stmt, paramCount) 704 701 { 705 702 php_sqlite3_stmt *internp; … … 859 856 /* }}} */ 860 857 861 /* {{{ proto bool SQLite3_stmt::bind _param(integer parameter_number, mixed parameter [, integer type])858 /* {{{ proto bool SQLite3_stmt::bindParam(integer parameter_number, mixed parameter [, integer type]) 862 859 Bind Paramater to a stmt variable 863 860 */ 864 PHP_METHOD(sqlite3_stmt, bind _param)861 PHP_METHOD(sqlite3_stmt, bindParam) 865 862 { 866 863 php_sqlite3_stmt *internp; … … 899 896 /* }}} */ 900 897 901 /* {{{ proto bool SQLite3_stmt::bind _value(integer parameter_number, mixed parameter [, integer type])898 /* {{{ proto bool SQLite3_stmt::bindValue(integer parameter_number, mixed parameter [, integer type]) 902 899 Bind Value of a parameter to a stmt variable 903 900 */ 904 PHP_METHOD(sqlite3_stmt, bind _value)901 PHP_METHOD(sqlite3_stmt, bindValue) 905 902 { 906 903 php_sqlite3_stmt *internp; … … 1015 1012 /* }}} */ 1016 1013 1017 /* {{{ proto int SQLite3_result::num _columns()1014 /* {{{ proto int SQLite3_result::numColumns() 1018 1015 Number of columns in result 1019 1016 */ 1020 PHP_METHOD(sqlite3_result, num _columns)1017 PHP_METHOD(sqlite3_result, numColumns) 1021 1018 { 1022 1019 php_sqlite3_result *internp; … … 1032 1029 /* }}} */ 1033 1030 1034 /* {{{ proto string SQLite3_result::column _name(int column)1031 /* {{{ proto string SQLite3_result::columnName(int column) 1035 1032 Returns the name of the nth column 1036 1033 */ 1037 PHP_METHOD(sqlite3_result, column _name)1034 PHP_METHOD(sqlite3_result, columnName) 1038 1035 { 1039 1036 php_sqlite3_result *internp; … … 1050 1047 /* }}} */ 1051 1048 1052 /* {{{ proto array SQLite3_result::fetch _array(int mode)1049 /* {{{ proto array SQLite3_result::fetchArray(int mode) 1053 1050 Fetch a result row as both an associative and numeric array 1054 1051 */ 1055 PHP_METHOD(sqlite3_result, fetch _array)1052 PHP_METHOD(sqlite3_result, fetchArray) 1056 1053 { 1057 1054 php_sqlite3_result *internp; … … 1104 1101 case SQLITE_BLOB: 1105 1102 default: 1106 /*ZVAL_STRINGL(data, (char*)sqlite3_column_text(*(internp->intern_stmt), i), sqlite3_column_bytes(*(internp->intern_stmt), i), 1);*/1107 1103 ZVAL_STRINGL(data, (char*)sqlite3_column_blob(*(internp->intern_stmt), i), sqlite3_column_bytes(*(internp->intern_stmt), i), 1); 1108 1104 } … … 1118 1114 add_assoc_zval(return_value, (char*)sqlite3_column_name(*(internp->intern_stmt), i), data); 1119 1115 } 1120 1121 /*add_index_zval(return_value, i, data);1122 add_assoc_zval(return_value, (char*)sqlite3_column_name(*(internp->intern_stmt), i), data);*/1123 1116 } 1124 1117 break; … … 1134 1127 1135 1128 /* {{{ proto bool SQLite3_result::finalize() 1136 Closes the prepared statement1129 Closes the result set 1137 1130 */ 1138 1131 PHP_METHOD(sqlite3_result, finalize) … … 1150 1143 } 1151 1144 1152 * internp->intern_stmt= (sqlite3_stmt *)NULL;1145 *(internp->intern_stmt) = (sqlite3_stmt *)NULL; 1153 1146 RETURN_TRUE; 1154 1147 } … … 1174 1167 PHP_ME(sqlite3, exec, NULL, ZEND_ACC_PUBLIC) 1175 1168 PHP_ME(sqlite3, version, NULL, ZEND_ACC_PUBLIC) 1176 PHP_ME(sqlite3, last _insert_rowid, NULL, ZEND_ACC_PUBLIC)1177 PHP_ME(sqlite3, load _extension, NULL, ZEND_ACC_PUBLIC)1169 PHP_ME(sqlite3, lastInsertRowID, NULL, ZEND_ACC_PUBLIC) 1170 PHP_ME(sqlite3, loadExtension, NULL, ZEND_ACC_PUBLIC) 1178 1171 PHP_ME(sqlite3, changes, NULL, ZEND_ACC_PUBLIC) 1179 PHP_ME(sqlite3, escape _string, NULL, ZEND_ACC_PUBLIC)1172 PHP_ME(sqlite3, escapeString, NULL, ZEND_ACC_PUBLIC) 1180 1173 PHP_ME(sqlite3, prepare, NULL, ZEND_ACC_PUBLIC) 1181 1174 PHP_ME(sqlite3, query, NULL, ZEND_ACC_PUBLIC) 1182 PHP_ME(sqlite3, create _function, NULL, ZEND_ACC_PUBLIC)1183 PHP_ME(sqlite3, create _aggregate, NULL, ZEND_ACC_PUBLIC)1175 PHP_ME(sqlite3, createFunction, NULL, ZEND_ACC_PUBLIC) 1176 PHP_ME(sqlite3, createAggregate, NULL, ZEND_ACC_PUBLIC) 1184 1177 /* Aliases */ 1185 1178 PHP_MALIAS(sqlite3, __construct, open, NULL, ZEND_ACC_PUBLIC) … … 1190 1183 /* {{{ php_sqlite3_stmt_class_methods */ 1191 1184 static zend_function_entry php_sqlite3_stmt_class_methods[] = { 1192 PHP_ME(sqlite3_stmt, param _count, NULL, ZEND_ACC_PUBLIC)1185 PHP_ME(sqlite3_stmt, paramCount, NULL, ZEND_ACC_PUBLIC) 1193 1186 PHP_ME(sqlite3_stmt, close, NULL, ZEND_ACC_PUBLIC) 1194 1187 PHP_ME(sqlite3_stmt, execute, NULL, ZEND_ACC_PUBLIC) … … 1198 1191 PHP_ME(sqlite3_stmt, bind_params, NULL, ZEND_ACC_PUBLIC) 1199 1192 #endif 1200 PHP_ME(sqlite3_stmt, bind _param, arginfo_sqlite3_stmt_bindparam, ZEND_ACC_PUBLIC)1201 PHP_ME(sqlite3_stmt, bind _value, arginfo_sqlite3_stmt_bindvalue, ZEND_ACC_PUBLIC)1193 PHP_ME(sqlite3_stmt, bindParam, arginfo_sqlite3_stmt_bindparam, ZEND_ACC_PUBLIC) 1194 PHP_ME(sqlite3_stmt, bindValue, arginfo_sqlite3_stmt_bindvalue, ZEND_ACC_PUBLIC) 1202 1195 {NULL, NULL, NULL} 1203 1196 }; … … 1206 1199 /* {{{ php_sqlite3_result_class_methods */ 1207 1200 static zend_function_entry php_sqlite3_result_class_methods[] = { 1208 PHP_ME(sqlite3_result, num _columns, NULL, ZEND_ACC_PUBLIC)1209 PHP_ME(sqlite3_result, column _name, NULL, ZEND_ACC_PUBLIC)1201 PHP_ME(sqlite3_result, numColumns, NULL, ZEND_ACC_PUBLIC) 1202 PHP_ME(sqlite3_result, columnName, NULL, ZEND_ACC_PUBLIC) 1210 1203 PHP_ME(sqlite3_result, finalize, NULL, ZEND_ACC_PUBLIC) 1211 PHP_ME(sqlite3_result, fetch _array, NULL, ZEND_ACC_PUBLIC)1204 PHP_ME(sqlite3_result, fetchArray, NULL, ZEND_ACC_PUBLIC) 1212 1205 {NULL, NULL, NULL} 1213 1206 }; … … 1373 1366 1374 1367 /* Allocate memory for it */ 1375 intern = emalloc( sizeof( php_sqlite3_result ));1376 memset( &intern->zo, 0, sizeof( php_sqlite3_result ));1368 intern = emalloc(sizeof(php_sqlite3_result)); 1369 memset(&intern->zo, 0, sizeof(php_sqlite3_result)); 1377 1370 1378 1371 intern->intern_stmt = emalloc(sizeof(sqlite3_stmt *)); … … 1411 1404 1412 1405 #if defined(ZTS) 1413 /* We should refuse to load if this wasn't a threasafe library*/1406 /* Refuse to load if this wasn't a threasafe library loaded */ 1414 1407 if (!sqlite3_threadsafe()) { 1415 1408 return FAILURE; … … 1471 1464 php_info_print_table_start(); 1472 1465 php_info_print_table_header(2, "SQLite3 support", "enabled"); 1473 php_info_print_table_row(2, "SQLite3 module version", PHP_SQLITE3_MODULE_VERSION );1466 php_info_print_table_row(2, "SQLite3 module version", PHP_SQLITE3_MODULE_VERSION); 1474 1467 php_info_print_table_row(2, "SQLite Library", sqlite3_libversion()); 1475 1468 php_info_print_table_end(); trunk/tests/sqlite3_03_insert.phpt
r13 r16 18 18 echo "SELECTING results\n"; 19 19 $results = $db->query("SELECT * FROM test ORDER BY id ASC"); 20 while ($result = $results->fetch _array(SQLITE3_NUM))20 while ($result = $results->fetchArray(SQLITE3_NUM)) 21 21 { 22 22 var_dump($result); trunk/tests/sqlite3_04_update.phpt
r13 r16 18 18 echo "SELECTING results\n"; 19 19 $results = $db->query("SELECT * FROM test ORDER BY id ASC"); 20 while ($result = $results->fetch _array(SQLITE3_NUM))20 while ($result = $results->fetchArray(SQLITE3_NUM)) 21 21 { 22 22 var_dump($result); … … 29 29 echo "Checking results\n"; 30 30 $results = $db->query("SELECT * FROM test ORDER BY id ASC"); 31 while ($result = $results->fetch _array(SQLITE3_NUM))31 while ($result = $results->fetchArray(SQLITE3_NUM)) 32 32 { 33 33 var_dump($result); trunk/tests/sqlite3_05_delete.phpt
r13 r16 18 18 echo "SELECTING results\n"; 19 19 $results = $db->query("SELECT * FROM test ORDER BY id ASC"); 20 while ($result = $results->fetch _array(SQLITE3_NUM))20 while ($result = $results->fetchArray(SQLITE3_NUM)) 21 21 { 22 22 var_dump($result); … … 29 29 echo "Checking results\n"; 30 30 $results = $db->query("SELECT * FROM test ORDER BY id ASC"); 31 while ($result = $results->fetch _array(SQLITE3_NUM))31 while ($result = $results->fetchArray(SQLITE3_NUM)) 32 32 { 33 33 var_dump($result); trunk/tests/sqlite3_06_prepared_stmt.phpt
r14 r16 1 1 --TEST-- 2 SQLite3:: query DELETE tests2 SQLite3::prepare Bound Variable test 3 3 --SKIPIF-- 4 4 <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?> … … 20 20 $foo = 'c'; 21 21 echo "BINDING Parameter\n"; 22 var_dump($stmt->bind _param(1, $foo, SQLITE_TEXT));22 var_dump($stmt->bindParam(1, $foo, SQLITE_TEXT)); 23 23 $foo = 'a'; 24 24 $results = $stmt->execute(); 25 while ($result = $results->fetch _array(SQLITE3_NUM))25 while ($result = $results->fetchArray(SQLITE3_NUM)) 26 26 { 27 27 var_dump($result);
