diff options
| author | Andrey Hristov <andrey@php.net> | 2008-01-28 18:27:49 +0000 |
|---|---|---|
| committer | Andrey Hristov <andrey@php.net> | 2008-01-28 18:27:49 +0000 |
| commit | 18c8e6501b2c1f9fc96dda7c2304523d46bf13a4 (patch) | |
| tree | f41112affbf103b699c603b36e354be143969cc3 /ext/mysqli/mysqli_nonapi.c | |
| parent | 618a29411d2f58a9bf55488f2d7220639ec92c23 (diff) | |
| download | php-git-18c8e6501b2c1f9fc96dda7c2304523d46bf13a4.tar.gz | |
MFB: More optimizations - less MM calls
Clearly separated fetching (physical reading) from decoding phases (data
interpretation). Threaded fetching added but disabled as needs more work for
Windows. For Linux needs some touches to add pthreads if this is enabled,
probably with a compile-time switch.
The code reorganisation makes it easy to add also async API, similar to
cURL's one.
Diffstat (limited to 'ext/mysqli/mysqli_nonapi.c')
| -rw-r--r-- | ext/mysqli/mysqli_nonapi.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c index 0e8effbe7e..811d775411 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -473,7 +473,11 @@ PHP_FUNCTION(mysqli_query) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty query"); RETURN_FALSE; } - if (resultmode != MYSQLI_USE_RESULT && resultmode != MYSQLI_STORE_RESULT) { + if (resultmode != MYSQLI_USE_RESULT && resultmode != MYSQLI_STORE_RESULT +#if defined(HAVE_MYSQLND) && defined(MYSQLND_THREADING) + && resultmode != MYSQLI_BG_STORE_RESULT +#endif + ) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value for resultmode"); RETURN_FALSE; } @@ -495,8 +499,19 @@ PHP_FUNCTION(mysqli_query) RETURN_TRUE; } - result = (resultmode == MYSQLI_USE_RESULT) ? mysql_use_result(mysql->mysql) : mysql_store_result(mysql->mysql); - + switch (resultmode) { + case MYSQLI_STORE_RESULT: + result = mysql_store_result(mysql->mysql); + break; + case MYSQLI_USE_RESULT: + result = mysql_use_result(mysql->mysql); + break; +#if defined(HAVE_MYSQLND) && defined(MYSQLND_THREADING) + case MYSQLI_BG_STORE_RESULT: + result = mysqli_bg_store_result(mysql->mysql); + break; +#endif + } if (!result) { php_mysqli_throw_sql_exception((char *)mysql_sqlstate(mysql->mysql), mysql_errno(mysql->mysql) TSRMLS_CC, "%s", mysql_error(mysql->mysql)); |
