Re: Sybase / patches
| From: | Timm Friebe | Date: | Thu, 22 Aug 2002 22:24:04 +0000 |
| Subject: | Re: Sybase / patches | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-87317@lists.php.net to get a copy of this message | ||
On Wed, 2002-08-21 at 10:22, Timm Friebe wrote:
[...]
> The sybase_unbuffered_query() is experimental and misusage (using it
> with inserts, closing the connection while reading or trying to fire up
> another query directly after etc.) may result in unexpected results.
> Maybe some more intense checks should be done. That's why it's
> experimental.
I went over a couple of the issues with unbufferd_query and now handle
"misusage":
1) Unbuffered queries only make sense with queries that actually
return rows. Using of sybase_unbuffered_query() with inserts e.g.
does not result in a warning or notice whatsoever.
2) Results are cancelled when you fire up another query without
reading or discarding all of them. Additionally, as in
mysql_unbufferd_query(), a notice with the following text is
issued:
18: $q1= sybase_unbuffered_query('select ...');
19: $q1= sybase_unbuffered_query('select ...');
Notice: Sybase: Called sybase_unbuffered_query() without first
fetching all rows from a previous unbuffered query in
test-sybase.unbuf.php on line 19
18: $q1= sybase_unbuffered_query('select ...');
19: $q1= sybase_query('select ...');
Notice: Sybase: Called sybase_query() without first
fetching all rows from a previous unbuffered query in
test-sybase.unbuf.php on line 19
3) I had a look at the memory thing (although "unbuffered", all rows
that have been read will reside in memory until sybase_free_result()
is called). Changing this would make seeking backwards impossible:
$q= sybase_query('...');
sybase_data_seek($q, 3); // Seek forward to row #4
// [...]
sybase_data_seek($q, 0); // Seek back to first row
If this isn't needed with sybase_unbuffered_query() I'd (try to:-))
change the implementation to free the memory used after each call to
any of the sybase_fetch_* functions and document this behaviour
accordingly.
IMHO, being able to seek back is pretty useless. But, at the moment,
it's possible - what happens if I do this with
mysql_unbuffered_query(), by the way?
4) While I'm at it, I should probably change zend_error() to
php_error_docref() to be compliant to the new error reporting
systems.
5) I added myself to the "Authors" in the header. Hope this is OK:-)
Comments?
The newest source can be found at
http://sitten-polizei.de/php/php_sybase_ct.c
and
http://sitten-polizei.de/php/php_sybase_ct.h
(Download both, the header file has changed!)
--
Timm