以下の関数により Oracle8 および Oracle7 データベースへのアクセスが 可能となります。この関数は、Oracle8 Call-Interface (OCI8) を使用し ます。
この拡張モジュールは、通常のOracle 拡張モジュールより柔軟性があります。 この拡張モジュールは、グローバルおよびローカルの PHP 変数の Ocacle プレースホルダーへのバインドをサポートします。また、LOB,FILE,ROWID を完全にサポートしており、ユーザー定義の変数が使用可能です。
この拡張モジュールを使用するには、Oracle8クライアントライブラリを 必要とします。
この拡張モジュールを使用する前に Webデーモンのユーザでもある OracleユーザのOracle用環境変数が正しく設定されていることを確認し て下さい。設定されている必要がある変数を以下に示します。
ORACLE_HOME
ORACLE_SID
LD_PRELOAD
LD_LIBRARY_PATH
NLS_LANG
ORA_NLS33
Webサーバーのユーザ用に環境変数を設定した後、Webサーバーのユーザ (nobody, www)をグループoracleに追加して下さい。
Webサーバが起動しないか、起動時にクラッシュする場合: Apacheがpthreadライブラリにリンクされているかどうか次のように確認 して下さい。
# ldd /www/apache/bin/httpd libpthread.so.0 => /lib/libpthread.so.0 (0x4001c000) libm.so.6 => /lib/libm.so.6 (0x4002f000) libcrypt.so.1 => /lib/libcrypt.so.1 (0x4004c000) libdl.so.2 => /lib/libdl.so.2 (0x4007a000) libc.so.6 => /lib/libc.so.6 (0x4007e000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)libpthread がこの一覧にない場合、Apacheを再インストールする必要 があります。
UnixWareのようないくつかのシステムでは、libpthreadの代わりに libthreadが使用されています。PHPとApacheは、 EXTRA_LIBS=-lthreadをconfigureに指定する必要があります。
オプション--with-oci8[=DIR]を指定 してPHPをコンパイルする必要があります。ただし、DIRのデフォルトは、 環境変数ORACLE_HOMEの値です。
この拡張モジュールは設定ディレクティブを全く定義しません。
これらの定数は、この拡張モジュールで定義されており、 この拡張モジュールがPHP内部にコンパイルされているか実行時に動的にロー ドされるかのどちらかの場合のみ使用可能です。
Statement execution mode. Statement is not committed automatically when using this mode.
Statement execution mode. Use this mode if you don't want to really execute query, but only get select-list description.
Statement execution mode. Statement is automatically committed after oci_execute() call.
Statement fetch mode. Used when the application knows in advance exactly how many rows it will be fetching. This mode turns prefetching off for Oracle release 8 or later mode. Cursor is cancelled after the desired rows are fetched and may result in reduced server-side resource usage.
Used with oci_bind_by_name() when binding BFILEs.
Used with oci_bind_by_name() when binding CFILEs.
Used with oci_bind_by_name() when binding CLOBs.
Used with oci_bind_by_name() when binding BLOBs.
Used with oci_bind_by_name() when binding ROWIDs.
Used with oci_bind_by_name() when binding cursors, previously allocated with oci_new_descriptor().
Used with oci_bind_by_name() when binding named data types.
The same as OCI_B_BFILE.
The same as OCI_B_CFILEE.
The same as OCI_B_CLOB.
The same as OCI_B_BLOB.
The same as OCI_B_ROWID.
The same as OCI_B_NTY.
Default mode of oci_fetch_all().
Alternative mode of oci_fetch_all().
Used with oci_fetch_all() and oci_fetch_array() to get an associative array as a result.
Used with oci_fetch_all() and oci_fetch_array() to get an enumerated array as a result.
Used with oci_fetch_all() and oci_fetch_array() to get an array with both associative and number indices.
Used with oci_fetch_array() to get empty array elements if field's value is NULL.
Used with oci_fetch_array() to get value of LOB instead of the descriptor.
This flag tells oci_new_descriptor() to initialize new FILE descriptor.
This flag tells oci_new_descriptor() to initialize new LOB descriptor.
This flag tells oci_new_descriptor() to initialize new ROWID descriptor.
The same as OCI_DTYPE_FILE.
The same as OCI_DTYPE_LOB.
The same as OCI_DTYPE_ROWID.
コマンドラインで実行するのと同様な手法により、ストアドプロシージャ に簡単にアクセス可能です。
例 2. ストアドプロシージャの使用法
|