Skip to content

Commit e9cbbd8

Browse files
committed
ext/sqlite3: adding busy() call.
checks if the prepared statement had been fetched but did not complete yet.
1 parent 5740038 commit e9cbbd8

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

ext/sqlite3/sqlite3.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,23 @@ PHP_METHOD(SQLite3Stmt, readOnly)
14791479
}
14801480
/* }}} */
14811481

1482+
PHP_METHOD(SQLite3Stmt, busy)
1483+
{
1484+
php_sqlite3_stmt *stmt_obj;
1485+
zval *object = ZEND_THIS;
1486+
stmt_obj = Z_SQLITE3_STMT_P(object);
1487+
1488+
ZEND_PARSE_PARAMETERS_NONE();
1489+
1490+
SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3);
1491+
SQLITE3_CHECK_INITIALIZED_STMT(stmt_obj->stmt, SQLite3Stmt);
1492+
1493+
if (sqlite3_stmt_busy(stmt_obj->stmt)) {
1494+
RETURN_TRUE;
1495+
}
1496+
RETURN_FALSE;
1497+
}
1498+
14821499
/* bind parameters to a statement before execution */
14831500
static int php_sqlite3_bind_params(php_sqlite3_stmt *stmt_obj) /* {{{ */
14841501
{

ext/sqlite3/sqlite3.stub.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ public function readOnly(): bool {}
272272

273273
/** @tentative-return-type */
274274
public function reset(): bool {}
275+
276+
public function busy(): bool {}
275277
}
276278

277279
/** @not-serializable */

ext/sqlite3/sqlite3_arginfo.h

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)