com php-src: Ignore the return value of sqlite3->busyTimeout() if their "API Armor" is not enabled.: ext/sqlite3/sqlite3.c
| From: | Kalle Sommer Nielsen | Date: | Thu, 20 Oct 2016 08:56:08 +0000 |
| Subject: | com php-src: Ignore the return value of sqlite3->busyTimeout() if their "API Armor" is not enabled.: ext/sqlite3/sqlite3.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95235@lists.php.net to get a copy of this message | ||
Commit: 6ca38e8cf8a4fa4b11a4a92131ef8f476659b7a9
Author: Kalle Sommer Nielsen <kalle@php.net> Thu, 20 Oct 2016 10:56:08 +0200
Parents: b4a6408029b6202af8bc4df2e0116f17b1067e88
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6ca38e8cf8a4fa4b11a4a92131ef8f476659b7a9
Log:
Ignore the return value of sqlite3->busyTimeout() if their "API Armor" is not enabled.
The sqlite3_busy_timeout() function can only ever return SQLITE_OK if the armor is not compiled in,
which means we can skip this error check
Changed paths:
M ext/sqlite3/sqlite3.c
Diff:
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index 601b0e8..969eb31 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -306,7 +306,9 @@ PHP_METHOD(sqlite3, busyTimeout)
php_sqlite3_db_object *db_obj;
zval *object = getThis();
zend_long ms;
+#ifdef SQLITE_ENABLE_API_ARMOR
int return_code;
+#endif
db_obj = Z_SQLITE3_DB_P(object);
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
@@ -315,11 +317,15 @@ PHP_METHOD(sqlite3, busyTimeout)
return;
}
+#ifdef SQLITE_ENABLE_API_ARMOR
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;
}
+#else
+ php_ignore_value(sqlite3_busy_timeout(db_obj->db, ms));
+#endif
RETURN_TRUE;
}