Skip to content

Commit add3674

Browse files
committed
Rename sqlite_fetch_string() to sqlite_fetch_single() + alias
1 parent d6e84b6 commit add3674

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

ext/sqlite/php_sqlite.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ PHP_FUNCTION(sqlite_array_query);
5151
PHP_FUNCTION(sqlite_single_query);
5252

5353
PHP_FUNCTION(sqlite_fetch_array);
54-
PHP_FUNCTION(sqlite_fetch_string);
54+
PHP_FUNCTION(sqlite_fetch_single);
5555
PHP_FUNCTION(sqlite_fetch_all);
5656
PHP_FUNCTION(sqlite_current);
5757
PHP_FUNCTION(sqlite_column);

ext/sqlite/sqlite.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ function_entry sqlite_functions[] = {
164164
PHP_FE(sqlite_array_query, NULL)
165165
PHP_FE(sqlite_single_query, NULL)
166166
PHP_FE(sqlite_fetch_array, NULL)
167-
PHP_FE(sqlite_fetch_string, NULL)
167+
PHP_FE(sqlite_fetch_single, NULL)
168+
PHP_FALIAS(sqlite_fetch_string, sqlite_fetch_single, NULL)
168169
PHP_FE(sqlite_fetch_all, NULL)
169170
PHP_FE(sqlite_current, NULL)
170171
PHP_FE(sqlite_column, NULL)
@@ -214,7 +215,7 @@ function_entry sqlite_funcs_db[] = {
214215

215216
function_entry sqlite_funcs_query[] = {
216217
PHP_ME_MAPPING(fetch_array, sqlite_fetch_array, NULL)
217-
PHP_ME_MAPPING(fetch_string, sqlite_fetch_string, NULL)
218+
PHP_ME_MAPPING(fetch_single, sqlite_fetch_single, NULL)
218219
PHP_ME_MAPPING(fetch_all, sqlite_fetch_all, NULL)
219220
PHP_ME_MAPPING(column, sqlite_column, NULL)
220221
PHP_ME_MAPPING(changes, sqlite_changes, NULL)
@@ -234,7 +235,7 @@ function_entry sqlite_funcs_query[] = {
234235

235236
function_entry sqlite_funcs_ub_query[] = {
236237
PHP_ME_MAPPING(fetch_array, sqlite_fetch_array, NULL)
237-
PHP_ME_MAPPING(fetch_string, sqlite_fetch_string, NULL)
238+
PHP_ME_MAPPING(fetch_single, sqlite_fetch_single, NULL)
238239
PHP_ME_MAPPING(fetch_all, sqlite_fetch_all, NULL)
239240
PHP_ME_MAPPING(column, sqlite_column, NULL)
240241
PHP_ME_MAPPING(changes, sqlite_changes, NULL)
@@ -1698,8 +1699,8 @@ PHP_FUNCTION(sqlite_array_query)
16981699
}
16991700
/* }}} */
17001701

1701-
/* {{{ php_sqlite_fetch_string */
1702-
static void php_sqlite_fetch_string(struct php_sqlite_result *res, zend_bool decode_binary, zval *return_value TSRMLS_DC)
1702+
/* {{{ php_sqlite_fetch_single */
1703+
static void php_sqlite_fetch_single(struct php_sqlite_result *res, zend_bool decode_binary, zval *return_value TSRMLS_DC)
17031704
{
17041705
const char **rowdata;
17051706
char *decoded;
@@ -1805,7 +1806,7 @@ PHP_FUNCTION(sqlite_single_query)
18051806

18061807
while (rres->curr_row < rres->nrows) {
18071808
MAKE_STD_ZVAL(ent);
1808-
php_sqlite_fetch_string(rres, decode_binary, ent TSRMLS_CC);
1809+
php_sqlite_fetch_single(rres, decode_binary, ent TSRMLS_CC);
18091810

18101811
/* if set and we only have 1 row in the result set, return the result as a string. */
18111812
if (srow) {
@@ -1830,7 +1831,7 @@ PHP_FUNCTION(sqlite_single_query)
18301831

18311832
/* {{{ proto string sqlite_fetch_array(resource result [, bool decode_binary])
18321833
Fetches first column of a result set as a string */
1833-
PHP_FUNCTION(sqlite_fetch_string)
1834+
PHP_FUNCTION(sqlite_fetch_single)
18341835
{
18351836
zval *zres;
18361837
zend_bool decode_binary = 1;
@@ -1849,7 +1850,7 @@ PHP_FUNCTION(sqlite_fetch_string)
18491850
ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result);
18501851
}
18511852

1852-
php_sqlite_fetch_string(res, decode_binary, return_value TSRMLS_CC);
1853+
php_sqlite_fetch_single(res, decode_binary, return_value TSRMLS_CC);
18531854
}
18541855
/* }}} */
18551856

ext/sqlite/tests/sqlite_oo_016.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ foreach ($data as $str) {
2323
echo "====BUFFERED====\n";
2424
$r = $db->query("SELECT a, b from strings");
2525
while ($r->has_more()) {
26-
var_dump($r->fetch_string());
26+
var_dump($r->fetch_single());
2727
}
2828
echo "====UNBUFFERED====\n";
2929
$r = $db->unbuffered_query("SELECT a, b from strings");
3030
while ($r->has_more()) {
31-
var_dump($r->fetch_string());
31+
var_dump($r->fetch_single());
3232
}
3333
echo "DONE!\n";
3434
?>

0 commit comments

Comments
 (0)