[PHP-users 3857] [Patch] pgsql function
Yasuo Ohgaki
php-users@php.gr.jp
Mon, 26 Nov 2001 14:54:09 +0900
This is a multi-part message in MIME format.
--------------090900000906090908020308
Content-Type: text/plain; charset=ISO-2022-JP
Content-Transfer-Encoding: 7bit
大垣です。
PHP+PostgreSQLの利用者は日本の方が多いので、こちらにもメールします。
PostgreSQLモジュールの非同期クエリー関数が必要だったのでパッチを作
りました。(PHP 4.2.0-dev用。4.1.0RCでは一部手動でパッチする必要あ
り。前に送ったパッチはlibpqの使い方を知らないと使えない+ゴミ処理を
していませんでしたが、今回のパッチはこれらの処理をしています)
このパッチで追加される関数は以下の通りです。
pg_send_query() - 非同期クエリーの送信
pg_get_result() - 非同期クエリー結果の取得
pg_is_busy() - 非同期クエリーを実行中か確認
pg_request_cancel - 実行中の非同期クエリーのキャンセル
pg_reset() - 現在の接続パラメータでDBに再接続 (エラーリカバリ用)
pg_status() - 接続状態の取得
使い方はテストスクリプトを参照してください。(output bufferをオフに
すると
非同期でクエリが実行されている事が確認できます)
備考:pg_send_query()を使って複数のクエリーを別々に送信する事はで
きません。だたし、複数のクエリーを一緒に送信して、pg_get_result()
で別々に結果を取得する事はできます。pg_get_result()を呼ぶ前に、
pg_is_busy()を使って取得可能な結果があるか確認しないと、
pg_get_result()はプロセスをブロックします。libpqにSSLを組み込んで
いると非同期に実行出来ない場合があります。Windowsではlibpqのコンパ
イル時にフラグを立ててコンパイルされていないと、プロセスはブロック
されます。
他に追加した方が良いlibpqがサポートする非同期関数、不具合があった
場合、変更した方が良い部分がある場合はメールをお願いします。
--
Yasuo Ohgaki
--------------090900000906090908020308
Content-Type: text/plain;
name="pgsql_test.php"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="pgsql_test.php"
PD9waHAKLyoqCiAqIFBvc3RncmVTUUwgYXN5bmMgcXVlcnkgZnVuY3Rpb24gdGVzdCBzY3Jp
cHQuCiAqCiAqIFRoZXJlIGFyZSBudW1iZXIgb2YgcmVzdHJpY3R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KfQplY2hvICJcbiI7CgokcmVzdWx0ID0gcGdfZ2V0X3Jlc3VsdCgkZGIpOwpkdW1wX3Jl
c3VsdCgkcmVzdWx0KTsKCi8vIFJFU0VUIGNvbm5lY3Rpb24KCmlmICghcGdfcmVzZXQoJGRi
KSkgCnsKCWRpZSgiRmFpbGVkIHRvIHJlc2V0IGNvbm5lY3Rpb24iKTsKfQoKLy8vLy8vLy8v
Ly8vLy8vIGJsb2NrZWQgcXVlcnkgLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLwplY2hvICJc
biAqKiogYmxvY2tpbmcgcWV1cnkgKioqIFxuXG4iOwoKY2hlY2tfc3RhdHVzKCRkYik7CiRy
ZXN1bHQgPSBleGVjdXRlX3F1ZXJ5KCRkYiwgZmFsc2UpOwplY2hvICJcbiI7CgpkdW1wX3Jl
c3VsdCgkcmVzdWx0KTsKCj8+CgoKCgoKCgoKCgoKCg==
--------------090900000906090908020308
Content-Type: text/plain;
name="pgsql_async.diff"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="pgsql_async.diff"
SW5kZXg6IHBnc3FsLmMKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PQpSQ1MgZmlsZTogL3JlcG9zaXRvcnkvcGhw
NC9leHQvcGdzcWwvcGdzcWwuYyx2CnJldHJpZXZpbmcgcmV2aXNpb24gMS4xMzAKZGlmZiAt
dSAtcjEuMTMwIHBnc3FsLmMKLS0tIHBnc3FsLmMJMTEgT2N0IDIwMDEgMjM6MzM6NDAgLTAw
MDAJMS4xMzAKKysrIHBnc3FsLmMJMjUgTm92IDIwMDEgMDk6MzU6MjIgLTAwMDAKQEAgLTk0
LDYgKzk0LDEyIEBACiAJUEhQX0ZBTElBUyhwZ19jbGllbnRlbmNvZGluZywJCXBnX2NsaWVu
dF9lbmNvZGluZywJCQlOVUxMKQogCVBIUF9GQUxJQVMocGdfc2V0Y2xpZW50ZW5jb2R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MTAyLDcg
KzEwOCw3IEBACiBjaGFyICpnZXRfZmllbGRfbmFtZShQR2Nvbm4gKnBnc3FsLCBPaWQgb2lk
LCBIYXNoVGFibGUgKmxpc3QpOwogdm9pZCBwaHBfcGdzcWxfZ2V0X2ZpZWxkX2luZm8oSU5U
RVJOQUxfRlVOQ1RJT05fUEFSQU1FVEVSUywgaW50IGVudHJ5X3R5cGUpOwogdm9pZCBwaHBf
cGdzcWxfZGF0YV9pbmZvKElOVEVSTkFMX0ZVTkNUSU9OX1BBUkFNRVRFUlMsIGludCBlbnRy
eV90eXBlKTsKLQordm9pZCBwaHBfcGdzcWxfZG9fYXN5bmMoSU5URVJOQUxfRlVOQ1RJT05f
UEFSQU1FVEVSUyxpbnQgZW50cnlfdHlwZSk7CiAKIHR5cGVkZWYgc3RydWN0IHBnTG9mcCB7
CiAgICAgICAgIFBHY29ubiAqY29ubjsK
--------------090900000906090908020308--
__________________________________________________
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/