pajoye                                   Sun, 20 Jun 2010 15:30:49 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=300614

Log:
- #51295, SQLite3::busyTimeout not existing

Bug: http://bugs.php.net/51295 (Feedback) SQLite3::busyTimeout not existing
      
Changed paths:
    U   php/php-src/trunk/NEWS
    U   php/php-src/trunk/ext/sqlite3/sqlite3.c

Modified: php/php-src/trunk/NEWS
===================================================================
--- php/php-src/trunk/NEWS      2010-06-20 15:02:32 UTC (rev 300613)
+++ php/php-src/trunk/NEWS      2010-06-20 15:30:49 UTC (rev 300614)
@@ -77,10 +77,12 @@
     functions. (Kalle)
   . y2k_compliance ini option. (Kalle)

+- Implemented #51295 (SQLite3::busyTimeout not existing). (Mark)
 - Implemented FR #42060 (Add paged Results support). (a...@openldap.org,
   iaren...@eteo.mondragon.edu, jean...@au-fil-du.net, remy.sai...@gmail.com)

 - Fixed PDO objects binary incompatibility. (Dmitry)
+

 ?? ??? 20??, PHP 5.3.3
 - Upgraded bundled PCRE to version 8.01. (Ilia)

Modified: php/php-src/trunk/ext/sqlite3/sqlite3.c
===================================================================
--- php/php-src/trunk/ext/sqlite3/sqlite3.c     2010-06-20 15:02:32 UTC (rev 
300613)
+++ php/php-src/trunk/ext/sqlite3/sqlite3.c     2010-06-20 15:30:49 UTC (rev 
300614)
@@ -298,6 +298,33 @@
 }
 /* }}} */

+/* {{{ proto bool SQLite3::busyTimeout(int msecs)
+   Sets a busy handler that will sleep until database is not locked or timeout 
is reached. Passing a value less than or equal to zero turns off all busy 
handlers. */
+PHP_METHOD(sqlite3, busyTimeout)
+{
+       php_sqlite3_db_object *db_obj;
+       zval *object = getThis();
+       long ms;
+       int return_code;
+       db_obj = (php_sqlite3_db_object *)zend_object_store_get_object(object 
TSRMLS_CC);
+
+       SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
+
+       if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", 
&ms)) {
+               return;
+       }
+
+       return_code = sqlite3_busy_timeout(db_obj->db, ms);
+       if (return_code != SQLITE_OK) {
+               php_sqlite3_error(db_obj, "Unable to set busy timeout: %d, %s", 
return_code, sqlite3_errmsg(db_obj->db));
+               RETURN_FALSE;
+       }
+
+       RETURN_TRUE;
+}
+/* }}} */
+
+
 #ifndef SQLITE_OMIT_LOAD_EXTENSION
 /* {{{ proto bool SQLite3::loadExtension(String Shared Library)
    Attempts to load an SQLite extension library. */
@@ -1652,6 +1679,10 @@
        ZEND_ARG_INFO(0, encryption_key)
 ZEND_END_ARG_INFO()

+ZEND_BEGIN_ARG_INFO(arginfo_sqlite3_busytimeout, 0)
+       ZEND_ARG_INFO(0, ms)
+ZEND_END_ARG_INFO()
+
 #ifndef SQLITE_OMIT_LOAD_EXTENSION
 ZEND_BEGIN_ARG_INFO(arginfo_sqlite3_loadextension, 0)
        ZEND_ARG_INFO(0, shared_library)
@@ -1736,6 +1767,7 @@
        PHP_ME(sqlite3,         lastInsertRowID,        arginfo_sqlite3_void, 
ZEND_ACC_PUBLIC)
        PHP_ME(sqlite3,         lastErrorCode,          arginfo_sqlite3_void, 
ZEND_ACC_PUBLIC)
        PHP_ME(sqlite3,         lastErrorMsg,           arginfo_sqlite3_void, 
ZEND_ACC_PUBLIC)
+       PHP_ME(sqlite3,         busyTimeout,            
arginfo_sqlite3_busytimeout, ZEND_ACC_PUBLIC)
 #ifndef SQLITE_OMIT_LOAD_EXTENSION
        PHP_ME(sqlite3,         loadExtension,          
arginfo_sqlite3_loadextension, ZEND_ACC_PUBLIC)
 #endif

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

Reply via email to