mirror of
https://github.com/php/php-src.git
synced 2024-12-12 03:15:29 +08:00
Rename sqlite_fetch_string() to sqlite_fetch_single() + alias
This commit is contained in:
parent
d6e84b639c
commit
add3674b20
@ -51,7 +51,7 @@ PHP_FUNCTION(sqlite_array_query);
|
||||
PHP_FUNCTION(sqlite_single_query);
|
||||
|
||||
PHP_FUNCTION(sqlite_fetch_array);
|
||||
PHP_FUNCTION(sqlite_fetch_string);
|
||||
PHP_FUNCTION(sqlite_fetch_single);
|
||||
PHP_FUNCTION(sqlite_fetch_all);
|
||||
PHP_FUNCTION(sqlite_current);
|
||||
PHP_FUNCTION(sqlite_column);
|
||||
|
@ -164,7 +164,8 @@ function_entry sqlite_functions[] = {
|
||||
PHP_FE(sqlite_array_query, NULL)
|
||||
PHP_FE(sqlite_single_query, NULL)
|
||||
PHP_FE(sqlite_fetch_array, NULL)
|
||||
PHP_FE(sqlite_fetch_string, NULL)
|
||||
PHP_FE(sqlite_fetch_single, NULL)
|
||||
PHP_FALIAS(sqlite_fetch_string, sqlite_fetch_single, NULL)
|
||||
PHP_FE(sqlite_fetch_all, NULL)
|
||||
PHP_FE(sqlite_current, NULL)
|
||||
PHP_FE(sqlite_column, NULL)
|
||||
@ -214,7 +215,7 @@ function_entry sqlite_funcs_db[] = {
|
||||
|
||||
function_entry sqlite_funcs_query[] = {
|
||||
PHP_ME_MAPPING(fetch_array, sqlite_fetch_array, NULL)
|
||||
PHP_ME_MAPPING(fetch_string, sqlite_fetch_string, NULL)
|
||||
PHP_ME_MAPPING(fetch_single, sqlite_fetch_single, NULL)
|
||||
PHP_ME_MAPPING(fetch_all, sqlite_fetch_all, NULL)
|
||||
PHP_ME_MAPPING(column, sqlite_column, NULL)
|
||||
PHP_ME_MAPPING(changes, sqlite_changes, NULL)
|
||||
@ -234,7 +235,7 @@ function_entry sqlite_funcs_query[] = {
|
||||
|
||||
function_entry sqlite_funcs_ub_query[] = {
|
||||
PHP_ME_MAPPING(fetch_array, sqlite_fetch_array, NULL)
|
||||
PHP_ME_MAPPING(fetch_string, sqlite_fetch_string, NULL)
|
||||
PHP_ME_MAPPING(fetch_single, sqlite_fetch_single, NULL)
|
||||
PHP_ME_MAPPING(fetch_all, sqlite_fetch_all, NULL)
|
||||
PHP_ME_MAPPING(column, sqlite_column, NULL)
|
||||
PHP_ME_MAPPING(changes, sqlite_changes, NULL)
|
||||
@ -1698,8 +1699,8 @@ PHP_FUNCTION(sqlite_array_query)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_sqlite_fetch_string */
|
||||
static void php_sqlite_fetch_string(struct php_sqlite_result *res, zend_bool decode_binary, zval *return_value TSRMLS_DC)
|
||||
/* {{{ php_sqlite_fetch_single */
|
||||
static void php_sqlite_fetch_single(struct php_sqlite_result *res, zend_bool decode_binary, zval *return_value TSRMLS_DC)
|
||||
{
|
||||
const char **rowdata;
|
||||
char *decoded;
|
||||
@ -1805,7 +1806,7 @@ PHP_FUNCTION(sqlite_single_query)
|
||||
|
||||
while (rres->curr_row < rres->nrows) {
|
||||
MAKE_STD_ZVAL(ent);
|
||||
php_sqlite_fetch_string(rres, decode_binary, ent TSRMLS_CC);
|
||||
php_sqlite_fetch_single(rres, decode_binary, ent TSRMLS_CC);
|
||||
|
||||
/* if set and we only have 1 row in the result set, return the result as a string. */
|
||||
if (srow) {
|
||||
@ -1830,7 +1831,7 @@ PHP_FUNCTION(sqlite_single_query)
|
||||
|
||||
/* {{{ proto string sqlite_fetch_array(resource result [, bool decode_binary])
|
||||
Fetches first column of a result set as a string */
|
||||
PHP_FUNCTION(sqlite_fetch_string)
|
||||
PHP_FUNCTION(sqlite_fetch_single)
|
||||
{
|
||||
zval *zres;
|
||||
zend_bool decode_binary = 1;
|
||||
@ -1849,7 +1850,7 @@ PHP_FUNCTION(sqlite_fetch_string)
|
||||
ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result);
|
||||
}
|
||||
|
||||
php_sqlite_fetch_string(res, decode_binary, return_value TSRMLS_CC);
|
||||
php_sqlite_fetch_single(res, decode_binary, return_value TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -23,12 +23,12 @@ foreach ($data as $str) {
|
||||
echo "====BUFFERED====\n";
|
||||
$r = $db->query("SELECT a, b from strings");
|
||||
while ($r->has_more()) {
|
||||
var_dump($r->fetch_string());
|
||||
var_dump($r->fetch_single());
|
||||
}
|
||||
echo "====UNBUFFERED====\n";
|
||||
$r = $db->unbuffered_query("SELECT a, b from strings");
|
||||
while ($r->has_more()) {
|
||||
var_dump($r->fetch_string());
|
||||
var_dump($r->fetch_single());
|
||||
}
|
||||
echo "DONE!\n";
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user