php_pdo_oci_int.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 7 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2018 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 3.01 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available through the world-wide-web at the following url: |
  10. | http://www.php.net/license/3_01.txt |
  11. | If you did not receive a copy of the PHP license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@php.net so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Author: Wez Furlong <wez@php.net> |
  16. +----------------------------------------------------------------------+
  17. */
  18. #include <oci.h>
  19. typedef struct {
  20. const char *file;
  21. int line;
  22. sb4 errcode;
  23. char *errmsg;
  24. } pdo_oci_error_info;
  25. /* stuff we use in an OCI database handle */
  26. typedef struct {
  27. OCIServer *server;
  28. OCISession *session;
  29. OCIEnv *env;
  30. OCIError *err;
  31. OCISvcCtx *svc;
  32. /* OCI9; 0 == use NLS_LANG */
  33. ub4 prefetch;
  34. ub2 charset;
  35. sword last_err;
  36. sb4 max_char_width;
  37. unsigned attached:1;
  38. unsigned _reserved:31;
  39. pdo_oci_error_info einfo;
  40. } pdo_oci_db_handle;
  41. typedef struct {
  42. OCIDefine *def;
  43. ub2 fetched_len;
  44. ub2 retcode;
  45. sb2 indicator;
  46. char *data;
  47. ub4 datalen;
  48. ub2 dtype;
  49. } pdo_oci_column;
  50. typedef struct {
  51. pdo_oci_db_handle *H;
  52. OCIStmt *stmt;
  53. OCIError *err;
  54. sword last_err;
  55. ub2 stmt_type;
  56. ub4 exec_type;
  57. pdo_oci_column *cols;
  58. pdo_oci_error_info einfo;
  59. unsigned int have_blobs:1;
  60. } pdo_oci_stmt;
  61. typedef struct {
  62. OCIBind *bind; /* allocated by OCI */
  63. sb2 oci_type;
  64. sb2 indicator;
  65. ub2 retcode;
  66. ub4 actual_len;
  67. dvoid *thing; /* for LOBS, REFCURSORS etc. */
  68. unsigned used_for_output;
  69. } pdo_oci_bound_param;
  70. extern const ub4 PDO_OCI_INIT_MODE;
  71. extern const pdo_driver_t pdo_oci_driver;
  72. extern OCIEnv *pdo_oci_Env;
  73. ub4 _oci_error(OCIError *err, pdo_dbh_t *dbh, pdo_stmt_t *stmt, char *what, sword status, int isinit, const char *file, int line);
  74. #define oci_init_error(w) _oci_error(H->err, dbh, NULL, w, H->last_err, TRUE, __FILE__, __LINE__)
  75. #define oci_drv_error(w) _oci_error(H->err, dbh, NULL, w, H->last_err, FALSE, __FILE__, __LINE__)
  76. #define oci_stmt_error(w) _oci_error(S->err, stmt->dbh, stmt, w, S->last_err, FALSE, __FILE__, __LINE__)
  77. extern const struct pdo_stmt_methods oci_stmt_methods;
  78. /* Default prefetch size in number of rows */
  79. #define PDO_OCI_PREFETCH_DEFAULT 100
  80. /* Arbitrary assumed row length for prefetch memory limit calcuation */
  81. #define PDO_OCI_PREFETCH_ROWSIZE 1024
  82. enum {
  83. PDO_OCI_ATTR_ACTION = PDO_ATTR_DRIVER_SPECIFIC,
  84. PDO_OCI_ATTR_CLIENT_INFO,
  85. PDO_OCI_ATTR_CLIENT_IDENTIFIER,
  86. PDO_OCI_ATTR_MODULE
  87. };