Back to index

php5  5.3.10
php_pdo_oci_int.h
Go to the documentation of this file.
00001 /*
00002   +----------------------------------------------------------------------+
00003   | PHP Version 5                                                        |
00004   +----------------------------------------------------------------------+
00005   | Copyright (c) 1997-2012 The PHP Group                                |
00006   +----------------------------------------------------------------------+
00007   | This source file is subject to version 3.01 of the PHP license,      |
00008   | that is bundled with this package in the file LICENSE, and is        |
00009   | available through the world-wide-web at the following url:           |
00010   | http://www.php.net/license/3_01.txt                                  |
00011   | If you did not receive a copy of the PHP license and are unable to   |
00012   | obtain it through the world-wide-web, please send a note to          |
00013   | license@php.net so we can mail you a copy immediately.               |
00014   +----------------------------------------------------------------------+
00015   | Author: Wez Furlong <wez@php.net>                                    |
00016   +----------------------------------------------------------------------+
00017 */
00018 
00019 /* $Id: php_pdo_oci_int.h 321634 2012-01-01 13:15:04Z felipe $ */
00020 
00021 #include <oci.h>
00022 
00023 typedef struct {
00024        const char *file;
00025        int line;
00026        sb4 errcode;
00027        char *errmsg;
00028 } pdo_oci_error_info;
00029 
00030 /* stuff we use in an OCI database handle */
00031 typedef struct {
00032        OCIServer     *server;
00033        OCISession    *session;
00034        OCIEnv        *env;
00035        OCIError      *err;
00036        OCISvcCtx     *svc;
00037        /* OCI9; 0 == use NLS_LANG */
00038        ub2                  charset;
00039        sword         last_err;
00040 
00041        unsigned      attached:1;
00042        unsigned      _reserved:31;
00043 
00044        pdo_oci_error_info einfo;
00045 } pdo_oci_db_handle;
00046 
00047 typedef struct {
00048        OCIDefine     *def;
00049        ub2                  fetched_len;
00050        ub2                  retcode;
00051        sb2                  indicator;
00052 
00053        char *data;
00054        ub4 datalen;
00055 
00056        ub2 dtype;
00057 
00058 } pdo_oci_column;
00059 
00060 typedef struct {
00061        pdo_oci_db_handle *H;
00062        OCIStmt              *stmt;
00063        OCIError      *err;
00064        sword         last_err;
00065        ub2                  stmt_type;
00066        ub4                  exec_type;
00067        pdo_oci_column *cols;
00068        pdo_oci_error_info einfo;
00069        unsigned int have_blobs:1;
00070 } pdo_oci_stmt;
00071 
00072 typedef struct {
00073        OCIBind              *bind; /* allocated by OCI */
00074        sb2                  oci_type;
00075        sb2                  indicator;
00076        ub2                  retcode;
00077 
00078        ub4                  actual_len;
00079 
00080        dvoid         *thing;       /* for LOBS, REFCURSORS etc. */
00081 
00082        unsigned used_for_output;
00083 } pdo_oci_bound_param;
00084 
00085 extern const ub4 PDO_OCI_INIT_MODE;
00086 extern pdo_driver_t pdo_oci_driver;
00087 extern OCIEnv *pdo_oci_Env;
00088 
00089 ub4 _oci_error(OCIError *err, pdo_dbh_t *dbh, pdo_stmt_t *stmt, char *what, sword status, int isinit, const char *file, int line TSRMLS_DC);
00090 #define oci_init_error(w)   _oci_error(H->err, dbh, NULL, w, H->last_err, TRUE, __FILE__, __LINE__ TSRMLS_CC)
00091 #define oci_drv_error(w)    _oci_error(H->err, dbh, NULL, w, H->last_err, FALSE, __FILE__, __LINE__ TSRMLS_CC)
00092 #define oci_stmt_error(w)   _oci_error(S->err, stmt->dbh, stmt, w, S->last_err, FALSE, __FILE__, __LINE__ TSRMLS_CC)
00093 
00094 extern struct pdo_stmt_methods oci_stmt_methods;
00095 
00096 /* Default prefetch size in number of rows */
00097 #define PDO_OCI_PREFETCH_DEFAULT 100
00098 
00099 /* Arbitrary assumed row length for prefetch memory limit calcuation */
00100 #define PDO_OCI_PREFETCH_ROWSIZE 1024