[PHP-CVS] cvs: php-src /ext/sqlite3 php_sqlite3_structs.h sqlite3.c /ext/sqlite3/tests sqlite3_enable_exceptions.phpt

2009-06-07 Thread Scott MacVicar
scottmacMon Jun  8 02:15:42 2009 UTC

  Modified files:  
/php-src/ext/sqlite3php_sqlite3_structs.h sqlite3.c 
/php-src/ext/sqlite3/tests  sqlite3_enable_exceptions.phpt 
  Log:
  Change more things to the UTF-16 API and make SQLite3::enableExceptions() 
return the previous value.
  
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/php_sqlite3_structs.h?r1=1.8r2=1.9diff_format=u
Index: php-src/ext/sqlite3/php_sqlite3_structs.h
diff -u php-src/ext/sqlite3/php_sqlite3_structs.h:1.8 
php-src/ext/sqlite3/php_sqlite3_structs.h:1.9
--- php-src/ext/sqlite3/php_sqlite3_structs.h:1.8   Mon Apr 27 18:15:54 2009
+++ php-src/ext/sqlite3/php_sqlite3_structs.h   Mon Jun  8 02:15:42 2009
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: php_sqlite3_structs.h,v 1.8 2009/04/27 18:15:54 scottmac Exp $ */
+/* $Id: php_sqlite3_structs.h,v 1.9 2009/06/08 02:15:42 scottmac Exp $ */
 
 #ifndef PHP_SQLITE_STRUCTS_H
 #define PHP_SQLITE_STRUCTS_H
@@ -55,7 +55,7 @@
 typedef struct _php_sqlite3_func {
struct _php_sqlite3_func *next;
 
-   const char *func_name;
+   const UChar *func_name;
int argc;
 
zval *func, *step, *fini;
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/sqlite3.c?r1=1.43r2=1.44diff_format=u
Index: php-src/ext/sqlite3/sqlite3.c
diff -u php-src/ext/sqlite3/sqlite3.c:1.43 php-src/ext/sqlite3/sqlite3.c:1.44
--- php-src/ext/sqlite3/sqlite3.c:1.43  Sun May 17 16:39:30 2009
+++ php-src/ext/sqlite3/sqlite3.c   Mon Jun  8 02:15:42 2009
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: sqlite3.c,v 1.43 2009/05/17 16:39:30 felipe Exp $ */
+/* $Id: sqlite3.c,v 1.44 2009/06/08 02:15:42 scottmac Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -30,6 +30,8 @@
 #include php_sqlite3_structs.h
 #include main/SAPI.h
 
+#include SAPI.h
+
 #include sqlite3.h
 
 #include zend_exceptions.h
@@ -424,14 +426,14 @@
 }
 /* }}} */
 
-/* {{{ proto SQLite3Stmt SQLite3::prepare(String Query)
+/* {{{ proto SQLite3Stmt SQLite3::prepare(String Query) U
Returns a prepared SQL statement for execution. */
 PHP_METHOD(sqlite3, prepare)
 {
php_sqlite3_db_object *db_obj;
php_sqlite3_stmt *stmt_obj;
zval *object = getThis();
-   char *sql;
+   UChar *sql;
int sql_len, errcode;
php_sqlite3_free_list *free_item;
 
@@ -439,7 +441,7 @@
 
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj-initialised, SQLite3)
 
-   if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, 
sql, sql_len)) {
+   if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, u, 
sql, sql_len)) {
return;
}
 
@@ -454,8 +456,8 @@
 
Z_ADDREF_P(object);
 
-   /* Todo: utf-8 or utf-16 = sqlite3_prepare16_v2 */
-   errcode = sqlite3_prepare_v2(db_obj-db, sql, sql_len, 
(stmt_obj-stmt), NULL);
+   /* TODO: We can pass the length in bytes potentially in future */
+   errcode = sqlite3_prepare16_v2(db_obj-db, sql, -1, (stmt_obj-stmt), 
NULL);
if (errcode != SQLITE_OK) {
php_sqlite3_error(db_obj, Unable to prepare statement: %d, 
%s, errcode, sqlite3_errmsg(db_obj-db));
zval_dtor(return_value);
@@ -472,7 +474,7 @@
 }
 /* }}} */
 
-/* {{{ proto SQLite3Result SQLite3::query(String Query)
+/* {{{ proto SQLite3Result SQLite3::query(String Query) U
Returns true or false, for queries that return data it will return a 
SQLite3Result object. */
 PHP_METHOD(sqlite3, query)
 {
@@ -487,7 +489,7 @@
 
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj-initialised, SQLite3)
 
-   if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, 
sql, sql_len)) {
+   if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, 
sql, sql_len, UG(utf8_conv))) {
return;
}
 
@@ -497,8 +499,8 @@
 
/* If there was no return value then just execute the query */
if (!return_value_used) {
-   /* Todo: utf-8 */
if (sqlite3_exec(db_obj-db, sql, NULL, NULL, errtext) != 
SQLITE_OK) {
+   /* TODO: Check if errtext is UTF-8 */
php_sqlite3_error(db_obj, %s, errtext);
sqlite3_free(errtext);
}
@@ -514,8 +516,8 @@
 
Z_ADDREF_P(object);
 
-   /* Todo: utf-8 or utf-16 = sqlite3_prepare16_v2 */
-   return_code = sqlite3_prepare_v2(db_obj-db, sql, sql_len, 
(stmt_obj-stmt), NULL);
+   /* TODO: Use bytes if we know it */
+   return_code = sqlite3_prepare_v2(db_obj-db, sql, -1, 
(stmt_obj-stmt), NULL);
if (return_code != SQLITE_OK) {
php_sqlite3_error(db_obj, Unable to prepare statement: %d, 
%s, return_code, sqlite3_errmsg(db_obj-db));
zval_ptr_dtor(stmt);
@@ -588,7 +590,7 @@
 }
 /* }}} */
 
-/* {{{ proto SQLite3Result 

[PHP-CVS] cvs: php-src /ext/sqlite3 php_sqlite3_structs.h sqlite3.c

2009-04-27 Thread Scott MacVicar
scottmacMon Apr 27 18:15:54 2009 UTC

  Modified files:  
/php-src/ext/sqlite3sqlite3.c php_sqlite3_structs.h 
  Log:
  Add the ability to enable exceptions rather than warnings for sqlite3, needed 
for pyrus.
  
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/sqlite3.c?r1=1.37r2=1.38diff_format=u
Index: php-src/ext/sqlite3/sqlite3.c
diff -u php-src/ext/sqlite3/sqlite3.c:1.37 php-src/ext/sqlite3/sqlite3.c:1.38
--- php-src/ext/sqlite3/sqlite3.c:1.37  Tue Mar 17 02:42:41 2009
+++ php-src/ext/sqlite3/sqlite3.c   Mon Apr 27 18:15:54 2009
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: sqlite3.c,v 1.37 2009/03/17 02:42:41 scottmac Exp $ */
+/* $Id: sqlite3.c,v 1.38 2009/04/27 18:15:54 scottmac Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -41,9 +41,33 @@
 static void sqlite3_param_dtor(void *data);
 static int php_sqlite3_compare_stmt_zval_free( php_sqlite3_free_list 
**free_list, zval *statement );
 
-#define SQLITE3_CHECK_INITIALIZED(member, class_name) \
+/* {{{ Error Handler
+*/
+static void php_sqlite3_error(php_sqlite3_db_object *db_obj, char *format, ...)
+{
+   va_list arg;
+   char*message;
+   TSRMLS_FETCH();
+
+   va_start(arg, format); 
+   vspprintf(message, 0, format, arg);
+   va_end(arg);
+
+   if (db_obj-exception) {
+   zend_throw_exception(zend_exception_get_default(TSRMLS_C), 
message, 0 TSRMLS_CC);
+   } else {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, message);
+   }
+   
+   if (message) {
+   efree(message);
+   }
+}
+/* }}} */
+
+#define SQLITE3_CHECK_INITIALIZED(db_obj, member, class_name) \
if (!(member)) { \
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, The  #class_name 
 object has not been correctly initialised); \
+   php_sqlite3_error(db_obj, The  #class_name  object has not 
been correctly initialised); \
RETURN_FALSE; \
}
 
@@ -174,7 +198,7 @@
zend_llist_clean((db_obj-free_list));
errcode = sqlite3_close(db_obj-db);
if (errcode != SQLITE_OK) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to 
close database: %d, %s, errcode, sqlite3_errmsg(db_obj-db));
+   php_sqlite3_error(db_obj, Unable to close database: 
%d, %s, errcode, sqlite3_errmsg(db_obj-db));
RETURN_FALSE;
}
db_obj-initialised = 0;
@@ -194,14 +218,14 @@
int sql_len;
db_obj = (php_sqlite3_db_object *)zend_object_store_get_object(object 
TSRMLS_CC);
 
-   SQLITE3_CHECK_INITIALIZED(db_obj-initialised, SQLite3)
+   SQLITE3_CHECK_INITIALIZED(db_obj, db_obj-initialised, SQLite3)
 
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, 
sql, sql_len, UG(utf8_conv))) {
return;
}
 
if (sqlite3_exec(db_obj-db, sql, NULL, NULL, errtext) != SQLITE_OK) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, errtext);
+   php_sqlite3_error(db_obj, %s, errtext);
sqlite3_free(errtext);
RETURN_FALSE;
}
@@ -235,7 +259,7 @@
zval *object = getThis();
db_obj = (php_sqlite3_db_object *)zend_object_store_get_object(object 
TSRMLS_CC);
 
-   SQLITE3_CHECK_INITIALIZED(db_obj-initialised, SQLite3)
+   SQLITE3_CHECK_INITIALIZED(db_obj, db_obj-initialised, SQLite3)
 
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -253,7 +277,7 @@
zval *object = getThis();
db_obj = (php_sqlite3_db_object *)zend_object_store_get_object(object 
TSRMLS_CC);
 
-   SQLITE3_CHECK_INITIALIZED(db_obj-db, SQLite3)
+   SQLITE3_CHECK_INITIALIZED(db_obj, db_obj-db, SQLite3)
 
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -271,7 +295,7 @@
zval *object = getThis();
db_obj = (php_sqlite3_db_object *)zend_object_store_get_object(object 
TSRMLS_CC);
 
-   SQLITE3_CHECK_INITIALIZED(db_obj-db, SQLite3)
+   SQLITE3_CHECK_INITIALIZED(db_obj, db_obj-db, SQLite3)
 
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -293,19 +317,19 @@
int extension_len, extension_dir_len;
db_obj = (php_sqlite3_db_object *)zend_object_store_get_object(object 
TSRMLS_CC);
 
-   SQLITE3_CHECK_INITIALIZED(db_obj-initialised, SQLite3)
+   SQLITE3_CHECK_INITIALIZED(db_obj, db_obj-initialised, SQLite3)
 
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, 
extension, extension_len)) {
return;
}
 
if (!SQLITE3G(extension_dir)) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, SQLite Extension 
are disabled);
+   php_sqlite3_error(db_obj, SQLite Extension are disabled);

[PHP-CVS] cvs: php-src /ext/sqlite3 php_sqlite3_structs.h sqlite3.c /ext/sqlite3/tests sqlite3_25_create_aggregate.phpt

2008-12-24 Thread Scott MacVicar
scottmacWed Dec 24 19:21:42 2008 UTC

  Modified files:  
/php-src/ext/sqlite3php_sqlite3_structs.h sqlite3.c 
/php-src/ext/sqlite3/tests  sqlite3_25_create_aggregate.phpt 
  Log:
  Stop using sqlite3_aggregate_count() as this is now deprecated.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/php_sqlite3_structs.h?r1=1.4r2=1.5diff_format=u
Index: php-src/ext/sqlite3/php_sqlite3_structs.h
diff -u php-src/ext/sqlite3/php_sqlite3_structs.h:1.4 
php-src/ext/sqlite3/php_sqlite3_structs.h:1.5
--- php-src/ext/sqlite3/php_sqlite3_structs.h:1.4   Fri Aug  1 08:27:46 2008
+++ php-src/ext/sqlite3/php_sqlite3_structs.h   Wed Dec 24 19:21:42 2008
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: php_sqlite3_structs.h,v 1.4 2008/08/01 08:27:46 tony2001 Exp $ */
+/* $Id: php_sqlite3_structs.h,v 1.5 2008/12/24 19:21:42 scottmac Exp $ */
 
 #ifndef PHP_SQLITE_STRUCTS_H
 #define PHP_SQLITE_STRUCTS_H
@@ -72,6 +72,12 @@
zend_llist free_list;
 } php_sqlite3_db_object;
 
+/* Structure for SQLite Database object. */
+typedef struct _php_sqlite3_agg_context  {
+   zval *zval_context;
+   long row_count;
+} php_sqlite3_agg_context;
+
 typedef struct _php_sqlite3_stmt_object php_sqlite3_stmt;
 typedef struct _php_sqlite3_result_object php_sqlite3_result;
 
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/sqlite3.c?r1=1.23r2=1.24diff_format=u
Index: php-src/ext/sqlite3/sqlite3.c
diff -u php-src/ext/sqlite3/sqlite3.c:1.23 php-src/ext/sqlite3/sqlite3.c:1.24
--- php-src/ext/sqlite3/sqlite3.c:1.23  Fri Nov 28 15:36:34 2008
+++ php-src/ext/sqlite3/sqlite3.c   Wed Dec 24 19:21:42 2008
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: sqlite3.c,v 1.23 2008/11/28 15:36:34 felipe Exp $ */
+/* $Id: sqlite3.c,v 1.24 2008/12/24 19:21:42 scottmac Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -619,7 +619,7 @@
int i;
int ret;
int fake_argc;
-   zval **agg_context = NULL;
+   php_sqlite3_agg_context *agg_context = NULL;
 
if (is_agg) {
is_agg = 2;
@@ -643,16 +643,17 @@
 
if (is_agg) {
/* summon the aggregation context */
-   agg_context = (zval**)sqlite3_aggregate_context(context, 
sizeof(zval*));
-   if (!*agg_context) {
-   MAKE_STD_ZVAL(*agg_context);
-   ZVAL_NULL(*agg_context);
+   agg_context = (php_sqlite3_agg_context 
*)sqlite3_aggregate_context(context, sizeof(php_sqlite3_agg_context));
+
+   if (!agg_context-zval_context) {
+   MAKE_STD_ZVAL(agg_context-zval_context);
+   ZVAL_NULL(agg_context-zval_context);
}
-   zargs[0] = agg_context;
+   zargs[0] = agg_context-zval_context;
 
zargs[1] = emalloc(sizeof(zval*));
MAKE_STD_ZVAL(*zargs[1]);
-   ZVAL_LONG(*zargs[1], sqlite3_aggregate_count(context));
+   ZVAL_LONG(*zargs[1], agg_context-row_count);
}
 
for (i = 0; i  argc; i++) {
@@ -727,20 +728,20 @@
sqlite3_result_error(context, failed to invoke 
callback, 0);
}
 
-   if (agg_context) {
-   zval_ptr_dtor(agg_context);
+   if (agg_context  agg_context-zval_context) {
+   zval_ptr_dtor(agg_context-zval_context);
}
} else {
/* we're stepping in an aggregate; the return value goes into
 * the context */
-   if (agg_context) {
-   zval_ptr_dtor(agg_context);
+   if (agg_context  agg_context-zval_context) {
+   zval_ptr_dtor(agg_context-zval_context);
}
if (retval) {
-   *agg_context = retval;
+   agg_context-zval_context = retval;
retval = NULL;
} else {
-   *agg_context = NULL;
+   agg_context-zval_context = NULL;
}
}
 
@@ -763,7 +764,10 @@
 static void php_sqlite3_callback_step(sqlite3_context *context, int argc, 
sqlite3_value **argv) /* {{{ */
 {
php_sqlite3_func *func = (php_sqlite3_func *)sqlite3_user_data(context);
+   php_sqlite3_agg_context *agg_context = (php_sqlite3_agg_context 
*)sqlite3_aggregate_context(context, sizeof(php_sqlite3_agg_context));
+
TSRMLS_FETCH();
+   agg_context-row_count++;
 
sqlite3_do_callback(func-astep, func-step, argc, argv, context, 1 
TSRMLS_CC);
 }
@@ -772,7 +776,10 @@
 static void php_sqlite3_callback_final(sqlite3_context *context) /* {{{ */
 {
php_sqlite3_func *func = (php_sqlite3_func *)sqlite3_user_data(context);
+   php_sqlite3_agg_context 

[PHP-CVS] cvs: php-src /ext/sqlite3 php_sqlite3_structs.h sqlite3.c

2008-08-01 Thread Antony Dovgal
tony2001Fri Aug  1 08:27:47 2008 UTC

  Modified files:  
/php-src/ext/sqlite3php_sqlite3_structs.h sqlite3.c 
  Log:
  fix int-long mess causing lots of segfaults on x86_64
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/php_sqlite3_structs.h?r1=1.3r2=1.4diff_format=u
Index: php-src/ext/sqlite3/php_sqlite3_structs.h
diff -u php-src/ext/sqlite3/php_sqlite3_structs.h:1.3 
php-src/ext/sqlite3/php_sqlite3_structs.h:1.4
--- php-src/ext/sqlite3/php_sqlite3_structs.h:1.3   Tue Jul 29 00:56:22 2008
+++ php-src/ext/sqlite3/php_sqlite3_structs.h   Fri Aug  1 08:27:46 2008
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: php_sqlite3_structs.h,v 1.3 2008/07/29 00:56:22 scottmac Exp $ */
+/* $Id: php_sqlite3_structs.h,v 1.4 2008/08/01 08:27:46 tony2001 Exp $ */
 
 #ifndef PHP_SQLITE_STRUCTS_H
 #define PHP_SQLITE_STRUCTS_H
@@ -41,7 +41,7 @@
long param_number;
char *name;
int name_len;
-   int type;
+   long type;
 
zval *parameter;
 };
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/sqlite3.c?r1=1.8r2=1.9diff_format=u
Index: php-src/ext/sqlite3/sqlite3.c
diff -u php-src/ext/sqlite3/sqlite3.c:1.8 php-src/ext/sqlite3/sqlite3.c:1.9
--- php-src/ext/sqlite3/sqlite3.c:1.8   Thu Jul 31 16:35:33 2008
+++ php-src/ext/sqlite3/sqlite3.c   Fri Aug  1 08:27:46 2008
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: sqlite3.c,v 1.8 2008/07/31 16:35:33 scottmac Exp $ */
+/* $Id: sqlite3.c,v 1.9 2008/08/01 08:27:46 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -72,7 +72,8 @@
zval *object = getThis();
char *filename, *encryption_key, *fullpath;
zend_uchar filename_type;
-   int filename_len, encryption_key_len, flags = SQLITE_OPEN_READWRITE | 
SQLITE_OPEN_CREATE;
+   int filename_len, encryption_key_len;
+   long flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
db_obj = (php_sqlite3_db_object *)zend_object_store_get_object(object 
TSRMLS_CC);
 
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t|lS, 
filename, filename_len, filename_type, flags, encryption_key, 
encryption_key_len)) {
@@ -536,7 +537,8 @@
php_sqlite3_db_object *db_obj;
zval *object = getThis();
char *sql, *errtext = NULL;
-   int sql_len, return_code, entire_row = 0;
+   int sql_len, return_code;
+   zend_bool entire_row = 0;
sqlite3_stmt *stmt;
db_obj = (php_sqlite3_db_object *)zend_object_store_get_object(object 
TSRMLS_CC);
 
@@ -1145,7 +1147,7 @@
break;
 
default:
-   php_error_docref(NULL TSRMLS_CC, 
E_WARNING, Unknown parameter type: %d for parameter %ld, param-type, 
param-param_number);
+   php_error_docref(NULL TSRMLS_CC, 
E_WARNING, Unknown parameter type: %ld for parameter %ld, param-type, 
param-param_number);
RETURN_FALSE;
}
zend_hash_move_forward(stmt_obj-bound_params);
@@ -1216,7 +1218,7 @@
 {
php_sqlite3_result *result_obj;
zval *object = getThis();
-   int column = 0;
+   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)
@@ -1235,7 +1237,7 @@
 {
php_sqlite3_result *result_obj;
zval *object = getThis();
-   int column = 0;
+   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)
@@ -1254,7 +1256,8 @@
 {
php_sqlite3_result *result_obj;
zval *object = getThis();
-   int i, ret, mode = PHP_SQLITE3_BOTH;
+   int i, ret;
+   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)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/sqlite3 php_sqlite3_structs.h sqlite3.c /ext/sqlite3/tests sqlite3_12_unfinalized_stmt_cleanup.phpt

2008-07-28 Thread Scott MacVicar
scottmacTue Jul 29 00:56:22 2008 UTC

  Modified files:  
/php-src/ext/sqlite3php_sqlite3_structs.h sqlite3.c 
/php-src/ext/sqlite3/tests  sqlite3_12_unfinalized_stmt_cleanup.phpt 
  Log:
  Add freelist for tracking sqlite statements to free on implicit 
SQLite3::close()
  
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/php_sqlite3_structs.h?r1=1.2r2=1.3diff_format=u
Index: php-src/ext/sqlite3/php_sqlite3_structs.h
diff -u php-src/ext/sqlite3/php_sqlite3_structs.h:1.2 
php-src/ext/sqlite3/php_sqlite3_structs.h:1.3
--- php-src/ext/sqlite3/php_sqlite3_structs.h:1.2   Mon Jul 28 09:11:19 2008
+++ php-src/ext/sqlite3/php_sqlite3_structs.h   Tue Jul 29 00:56:22 2008
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: php_sqlite3_structs.h,v 1.2 2008/07/28 09:11:19 pajoye Exp $ */
+/* $Id: php_sqlite3_structs.h,v 1.3 2008/07/29 00:56:22 scottmac Exp $ */
 
 #ifndef PHP_SQLITE_STRUCTS_H
 #define PHP_SQLITE_STRUCTS_H
@@ -68,23 +68,18 @@
int initialised;
sqlite3 *db;
php_sqlite3_func *funcs;
-} php_sqlite3_db_object;
 
-/*typedef struct _php_sqlite3_stmt {
-   sqlite3_stmt *stmt;
-   int initialised;
-} php_sqlite3_stmt;*/
+   zend_llist free_list;
+} php_sqlite3_db_object;
 
 typedef struct _php_sqlite3_stmt_object php_sqlite3_stmt;
 typedef struct _php_sqlite3_result_object php_sqlite3_result;
 
 /* sqlite3 objects to be destroyed */
-typedef struct _php_sqlite3_stmt_free_list {
-   sqlite3_stmt *stmt;
-
-   zval *statement_object;
-   zval *result_object;
-} php_sqlite3_stmt_free_list;
+typedef struct _php_sqlite3_free_list {
+   zval *stmt_obj_zval;
+   php_sqlite3_stmt *stmt_obj;
+} php_sqlite3_free_list;
 
 /* Structure for SQLite Result object. */
 struct _php_sqlite3_result_object  {
@@ -92,8 +87,6 @@
php_sqlite3_db_object *db_obj;
php_sqlite3_stmt *stmt_obj;
zval *stmt_obj_zval;
-
-   int initialised;

int is_prepared_statement;
int complete;
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/sqlite3.c?r1=1.6r2=1.7diff_format=u
Index: php-src/ext/sqlite3/sqlite3.c
diff -u php-src/ext/sqlite3/sqlite3.c:1.6 php-src/ext/sqlite3/sqlite3.c:1.7
--- php-src/ext/sqlite3/sqlite3.c:1.6   Mon Jul 28 23:03:26 2008
+++ php-src/ext/sqlite3/sqlite3.c   Tue Jul 29 00:56:22 2008
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: sqlite3.c,v 1.6 2008/07/28 23:03:26 scottmac Exp $ */
+/* $Id: sqlite3.c,v 1.7 2008/07/29 00:56:22 scottmac Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -39,7 +39,7 @@
 static PHP_GINIT_FUNCTION(sqlite3);
 static int php_sqlite3_authorizer(void *autharg, int access_type, const char 
*arg3, const char *arg4, const char *arg5, const char *arg6);
 static void sqlite3_param_dtor(void *data);
-static int php_sqlite3_compare_stmt_free( php_sqlite3_stmt_free_list 
**stmt_list, sqlite3_stmt *statement );
+static int php_sqlite3_compare_stmt_zval_free( php_sqlite3_free_list 
**free_list, zval *statement );
 
 #define SQLITE3_CHECK_INITIALIZED(member, class_name) \
if (!(member)) { \
@@ -160,6 +160,7 @@
}
 
if (db_obj-initialised) {
+   zend_llist_clean((db_obj-free_list));
errcode = sqlite3_close(db_obj-db);
if (errcode != SQLITE_OK) {
RETURN_TRUE;
@@ -409,6 +410,7 @@
zval_dtor(return_value);
RETURN_FALSE;
}
+   stmt_obj-initialised = 1;
 }
 /* }}} */
 
@@ -462,31 +464,32 @@
RETURN_FALSE;
}
 
+   stmt_obj-initialised = 1;
+
object_init_ex(return_value, php_sqlite3_result_entry);
result = (php_sqlite3_result 
*)zend_object_store_get_object(return_value TSRMLS_CC);
result-db_obj = db_obj;
result-stmt_obj = stmt_obj;
result-stmt_obj_zval = stmt;
 
-   result-initialised = 1;
return_code = sqlite3_step(result-stmt_obj-stmt);
 
switch (return_code) {
case SQLITE_ROW: /* Valid Row */
case SQLITE_DONE: /* Valid but no results */
{
-   /*php_sqlite3_stmt_free_list *free_item;
-   free_item = emalloc(sizeof(php_sqlite3_stmt_free_list));
-   free_item-stmt = result-intern_stmt;
-   free_item-statement_object = NULL;
-   free_item-result_object = return_value;
-   zend_llist_add_element((db_obj-stmt_list), 
free_item);*/
+   php_sqlite3_free_list *free_item;
+   free_item = emalloc(sizeof(php_sqlite3_free_list));
+   free_item-stmt_obj = stmt_obj;
+   free_item-stmt_obj_zval = stmt;
+   zend_llist_add_element((db_obj-free_list), 
free_item);