-
Couldn't load subscription status.
- Fork 8k
ext/sqlite3: Sqlite3Result::fetchAll() #18884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
support associative and indexes arrays for results.
3510530 to
1245997
Compare
ext/sqlite3/sqlite3.c
Outdated
| zval result; | ||
| array_init_size(&result, result_obj->column_count); | ||
|
|
||
| for (i = 0; i < result_obj->column_count; i ++) { | ||
| zval data; | ||
| sqlite_value_to_zval(result_obj->stmt_obj->stmt, i, &data); | ||
|
|
||
| if (mode & PHP_SQLITE3_NUM) { | ||
| add_index_zval(&result, i, &data); | ||
| } | ||
|
|
||
| if (mode & PHP_SQLITE3_ASSOC) { | ||
| if (mode & PHP_SQLITE3_NUM) { | ||
| if (Z_REFCOUNTED(data)) { | ||
| Z_ADDREF(data); | ||
| } | ||
| } | ||
| zend_symtable_update(Z_ARR_P(&result), result_obj->column_names[i], &data); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part of the code is almost identical to fetchArray() and is therefore redundant. How about consolidating it into an inline function or something similar?
|
This was merged via 375316d wasn't it? Please confirm and close this PR if so. |
|
indeed. |
support associative and indexes arrays for results.