Author: byterock
Date: Fri Oct 31 11:26:49 2008
New Revision: 12017
Modified:
dbd-oracle/trunk/Changes
dbd-oracle/trunk/Oracle.h
dbd-oracle/trunk/Oracle.pm
dbd-oracle/trunk/Oracle.xs
dbd-oracle/trunk/dbdimp.c
dbd-oracle/trunk/oci8.c
Log:
Added a few more constants to get rid of magic numbers
Modified: dbd-oracle/trunk/Changes
==============================================================================
--- dbd-oracle/trunk/Changes (original)
+++ dbd-oracle/trunk/Changes Fri Oct 31 11:26:49 2008
@@ -1,5 +1,6 @@
-=head1 Changes in DBD-Oracle 1.23(svn rev #####)
- Fix for rt.cpan.org Ticket #=38267: Inserts/Updates to BLOB's via synonyms fails from John Scoles
+=head1 Changes in DBD-Oracle 1.23(svn rev #####)
+ Added a few more constants to get rid of magic numbers from John Scoles
+ Fix for rt.cpan.org Ticket #=38267 Inserts/Updates to BLOB's via synonyms fails from John Scoles
Fix for rt.cpan.org Ticket #=39603 build problem and fix missing functions in oci.def from Zoltán Sebestyén
Fix for rt.cpan.org Ticket #=39374 Makefile.PL: error when reducing echo messages from make from Tippa
Fix for rt.cpan.org Ticket #=39232 binding large XMLTYPE fails on 64-bit perl from Jeff Klein
Modified: dbd-oracle/trunk/Oracle.h
==============================================================================
--- dbd-oracle/trunk/Oracle.h (original)
+++ dbd-oracle/trunk/Oracle.h Fri Oct 31 11:26:49 2008
@@ -95,11 +95,25 @@
long offset, UV len, long destoffset));
/* Oracle types */
-
+#define ORA_VARCHAR2 1
+#define ORA_STRING 5
+#define ORA_NUMBER 2
+#define ORA_LONG 8
+#define ORA_ROWID 11
+#define ORA_DATE 12
+#define ORA_RAW 23
+#define ORA_LONGRAW 24
+#define ORA_CHAR 96
+#define ORA_CHARZ 97
+#define ORA_MLSLABEL 105
+#define ORA_CLOB 112
+#define ORA_BLOB 113
+#define ORA_RSET 116
#define ORA_VARCHAR2_TABLE 201
#define ORA_NUMBER_TABLE 202
#define ORA_XMLTYPE 108
+
/* other Oracle not in noraml API defines
most of these are largly undocumented XML functions that are in the API but not defined
Modified: dbd-oracle/trunk/Oracle.pm
==============================================================================
--- dbd-oracle/trunk/Oracle.pm (original)
+++ dbd-oracle/trunk/Oracle.pm Fri Oct 31 11:26:49 2008
@@ -19,7 +19,7 @@
use Exporter ();
@ISA = qw(DynaLoader Exporter);
%EXPORT_TAGS = (
- ora_types => [ qw(
+ ora_types => [ qw(
ORA_VARCHAR2 ORA_STRING ORA_NUMBER ORA_LONG ORA_ROWID ORA_DATE
ORA_RAW ORA_LONGRAW ORA_CHAR ORA_CHARZ ORA_MLSLABEL ORA_XMLTYPE
ORA_CLOB ORA_BLOB ORA_RSET ORA_VARCHAR2_TABLE ORA_NUMBER_TABLE
Modified: dbd-oracle/trunk/Oracle.xs
==============================================================================
--- dbd-oracle/trunk/Oracle.xs (original)
+++ dbd-oracle/trunk/Oracle.xs Fri Oct 31 11:26:49 2008
@@ -10,21 +10,21 @@
constant(name=Nullch)
char *name
ALIAS:
- ORA_VARCHAR2 = 1
- ORA_NUMBER = 2
- ORA_STRING = 5
- ORA_LONG = 8
- ORA_ROWID = 11
- ORA_DATE = 12
- ORA_RAW = 23
- ORA_LONGRAW = 24
- ORA_CHAR = 96
- ORA_CHARZ = 97
+ ORA_VARCHAR2 = ORA_VARCHAR2
+ ORA_NUMBER = ORA_NUMBER
+ ORA_STRING = ORA_STRING
+ ORA_LONG = ORA_LONG
+ ORA_ROWID = ORA_ROWID
+ ORA_DATE = ORA_DATE
+ ORA_RAW = ORA_RAW
+ ORA_LONGRAW = ORA_LONGRAW
+ ORA_CHAR = ORA_CHAR
+ ORA_CHARZ = ORA_CHARZ
ORA_MLSLABEL = 105
ORA_XMLTYPE = ORA_XMLTYPE
- ORA_CLOB = 112
- ORA_BLOB = 113
- ORA_RSET = 116
+ ORA_CLOB = ORA_CLOB
+ ORA_BLOB = ORA_BLOB
+ ORA_RSET = ORA_RSET
ORA_VARCHAR2_TABLE = ORA_VARCHAR2_TABLE
ORA_NUMBER_TABLE = ORA_NUMBER_TABLE
ORA_SYSDBA = 0x0002
Modified: dbd-oracle/trunk/dbdimp.c
==============================================================================
--- dbd-oracle/trunk/dbdimp.c (original)
+++ dbd-oracle/trunk/dbdimp.c Fri Oct 31 11:26:49 2008
@@ -2795,7 +2795,7 @@
phs->ftype = ora_sql_type(imp_sth, phs->name, (int)sql_type);
/* treat Oracle7 SQLT_CUR as SQLT_RSET for Oracle8 */
if (phs->ftype==102)
- phs->ftype = 116;
+ phs->ftype = ORA_RSET;
/* some types require the trailing null included in the length. */
/* SQLT_STR=5=STRING, SQLT_AVC=97=VARCHAR */
@@ -3247,7 +3247,7 @@
phs->maxlen = 1;
/* treat Oracle7 SQLT_CUR as SQLT_RSET for Oracle8 */
if (phs->ftype==102)
- phs->ftype = 116;
+ phs->ftype = ORA_RSET;
/* some types require the trailing null included in the length. */
/* SQLT_STR=5=STRING, SQLT_AVC=97=VARCHAR */
phs->alen_incnull = (phs->ftype==SQLT_STR || phs->ftype==SQLT_AVC);
Modified: dbd-oracle/trunk/oci8.c
==============================================================================
--- dbd-oracle/trunk/oci8.c (original)
+++ dbd-oracle/trunk/oci8.c Fri Oct 31 11:26:49 2008
@@ -2626,10 +2626,10 @@
switch (fbh->dbtype) {
/* the simple types */
- case 1: /* VARCHAR2 */
+ case ORA_VARCHAR2: /* VARCHAR2 */
avg_width = fbh->dbsize / 2;
/* FALLTHRU */
- case 96: /* CHAR */
+ case ORA_CHAR: /* CHAR */
if ( CSFORM_IMPLIES_UTF8(fbh->csform) && !CS_IS_UTF8(fbh->csid) )
fbh->disize = fbh->dbsize * 4;
else
@@ -2637,12 +2637,12 @@
fbh->prec = fbh->disize;
break;
- case 23: /* RAW */
+ case ORA_RAW: /* RAW */
fbh->disize = fbh->dbsize * 2;
fbh->prec = fbh->disize;
break;
- case 2: /* NUMBER */
+ case ORA_NUMBER: /* NUMBER */
case 21: /* BINARY FLOAT os-endian */
case 22: /* BINARY DOUBLE os-endian */
case 100: /* BINARY FLOAT oracle-endian */
@@ -2651,14 +2651,14 @@
avg_width = 4; /* NUMBER approx +/- 1_000_000 */
break;
- case 12: /* DATE */
+ case ORA_DATE: /* DATE */
/* actually dependent on NLS default date format*/
fbh->disize = 75; /* a generous default */
fbh->prec = fbh->disize;
avg_width = 8; /* size in SQL*Net packet */
break;
- case 8: /* LONG */
+ case ORA_LONG: /* LONG */
if (imp_sth->clbk_lob){ /*get by peice with callback a slow*/
@@ -2703,7 +2703,7 @@
}
break;
- case 24: /* LONG RAW */
+ case ORA_LONGRAW: /* LONG RAW */
if (imp_sth->clbk_lob){ /*get by peice with callback a slow*/
fbh->clbk_lob = 1;
@@ -2741,7 +2741,7 @@
}
break;
- case 11: /* ROWID */
+ case ORA_ROWID: /* ROWID */
case 104: /* ROWID Desc */
fbh->disize = 20;
fbh->prec = fbh->disize;
@@ -2762,8 +2762,8 @@
}
break;
- case 112: /* CLOB & NCLOB */
- case 113: /* BLOB */
+ case ORA_CLOB: /* CLOB & NCLOB */
+ case ORA_BLOB: /* BLOB */
case 114: /* BFILE */
fbh->ftype = fbh->dbtype;
@@ -2773,7 +2773,7 @@
if (imp_sth->pers_lob){ /*get as one peice fasted but limited to how big you can get.*/
fbh->pers_lob = 1;
fbh->disize = fbh->disize+long_readlen; /*user set max value for the fetch*/
- if (fbh->dbtype == 112){
+ if (fbh->dbtype == ORA_CLOB){
fbh->ftype = SQLT_CHR;
} else {
fbh->ftype = SQLT_LVB; /*Binary form seems this is the only value where we cna get the length correctly*/
@@ -2790,7 +2790,7 @@
imp_sth->piece_size=imp_sth->long_readlen;
}
- if (fbh->dbtype == 112){
+ if (fbh->dbtype == ORA_CLOB){
fbh->ftype = SQLT_CHR;
} else {
fbh->ftype = SQLT_BIN; /*other Binary*/
@@ -2809,7 +2809,7 @@
if (!imp_sth->piece_size){ /*if not set use max value*/
imp_sth->piece_size=imp_sth->long_readlen;
}
- if (fbh->dbtype == 112){
+ if (fbh->dbtype == ORA_CLOB){
fbh->ftype = SQLT_CHR;
} else {
fbh->ftype = SQLT_BIN; /*other Binary */
@@ -2832,7 +2832,7 @@
break;
#endif
- case 116: /* RSET */
+ case ORA_RSET: /* RSET */
fbh->ftype = fbh->dbtype;
fbh->disize = sizeof(OCIStmt *);
fbh->fetch_func = fetch_func_rset;
@@ -2918,7 +2918,7 @@
/*add one extra byte incase the size of the lob is equal to the define_len*/
}
- if (fbh->ftype == 116) { /* RSET */
+ if (fbh->ftype == ORA_RSET) { /* RSET */
OCIHandleAlloc_ok(imp_sth->envhp,
(dvoid*)&((OCIStmt **)fb_ary->abuf)[0],
OCI_HTYPE_STMT, status);
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.