sybase_ct batch query
| From: | Michael Ulbrich | Date: | Fri, 14 Feb 2003 13:37:08 +0000 |
| Subject: | sybase_ct batch query | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-94242@lists.php.net to get a copy of this message | ||
Hi there,
here's a small patch for sybase_query() in ext/sybase_ct.c which gives
some extended functionality in that it allows to send batch queries from
php to the Sybase backend.
Currently it's only possible to send single queries via sybase_query(),
but in some cases it can be convenient to construct SQL batches and send
them as a single sequence of queries to the DB. The only restriction
then is (AFAIK) that, if you want to return a result, it has to be the
last SQL statement in the batch. It can be preceeded by any (reasonable)
number of "preparing" queries, which only return some SUCCEED/FAIL
status.
Here's an example:
$sql ="SELECT id, name INTO #tmp1 FROM person ";
$sql .= INSERT #tmp1 VALUES (some_id, "some_name") ";
$sql .= DELETE FROM #tmp1 WHERE some_condition ";
$sql .= SELECT * FROM #tmp1";
$result_id = sybase_query($query, $conn_id);
Well, if this does not make too much sense ... I hope you get the idea
;-)
I've just adapted the code for 4.3.0, but we've been using this without
any bad experience in production on 4.2.1 for some time now.
I'd like to ask the sybase_ct maintainer, if he sees any conflicts with
the code for sybase_unbuffered_query() that was newly introduced in
4.3.0.
If you think the new functionality is useful, feel free to use it ...
Best regards ... Michael U.