[svn:dbd-oracle] r13071 - dbd-oracle/branches/rs_array

[email protected]
Newsgroups perl.dbd.oracle.changes
Message-ID <[email protected]>
Author: byterock
Date: Fri Jul 17 05:30:27 2009
New Revision: 13071

Modified:
   dbd-oracle/branches/rs_array/Oracle.h
   dbd-oracle/branches/rs_array/dbdimp.c
   dbd-oracle/branches/rs_array/oci8.c

Log:
final version me thinks

Modified: dbd-oracle/branches/rs_array/Oracle.h
==============================================================================
--- dbd-oracle/branches/rs_array/Oracle.h	(original)
+++ dbd-oracle/branches/rs_array/Oracle.h	Fri Jul 17 05:30:27 2009
@@ -1,5 +1,6 @@
 /*
-   Copyright (c) 1994-2006  Tim Bunce
+   Copyright (c) 1994-2006	Tim Bunce
+   Copyright (c) 2006~		John Scoles
 
    See the COPYRIGHT section in the Oracle.pm file for terms.
 
@@ -97,26 +98,43 @@
 
 /* Oracle types */
 #define ORA_VARCHAR2		1
-#define ORA_STRING			5
 #define ORA_NUMBER			2
+#define ORA_INT				3	/* (ORANET TYPE) integer */
+#define ORA_FLT				4	/* (ORANET TYPE) Floating point number */
+#define ORA_STRING			5
+#define ORA_VNU				6	/* NUM with preceding length byte */
+#define ORA_PDN				7	/* (ORANET TYPE) Packed Decimal Numeric */
 #define ORA_LONG			8
 #define ORA_ROWID			11
 #define ORA_DATE			12
 #define ORA_RAW				23
 #define ORA_LONGRAW			24
+#define ORA_LVB				95	/* Longer long binary */
 #define ORA_CHAR			96
 #define ORA_CHARZ			97
+#define ORA_CUR				102	/* cursor  type */
+#define ORA_RDD				104	/* rowid descriptor */
 #define ORA_MLSLABEL		105
+#define ORA_XMLTYPE			108
+#define ORA_REF				110	/* ref type */
 #define ORA_CLOB 			112
 #define ORA_BLOB			113
+#define ORA_BFILEE			114	/* binary file lob */
+#define ORA_CFILEE			115	/* character file lob */
 #define ORA_RSET			116
 #define ORA_VARCHAR2_TABLE	201
 #define ORA_NUMBER_TABLE	202
-#define ORA_XMLTYPE			108
-
+#define ORA_ANSI_DATE		184                      /* ANSI Date */
+#define ORA_TIME			185                           /* TIME */
+#define ORA_TIME_TZ			186            /* TIME WITH TIME ZONE */
+#define ORA_TIMESTAMP		187                      /* TIMESTAMP */
+#define ORA_TIMESTAMP_TZ	188       /* TIMESTAMP WITH TIME ZONE */
+#define ORA_INTERVAL_YM		189         /* INTERVAL YEAR TO MONTH */
+#define ORA_INTERVAL_DS		190         /* INTERVAL DAY TO SECOND */
+#define ORA_TIMESTAMP_LTZ	232        /* TIMESTAMP WITH LOCAL TZ */
 
-/* other Oracle not in noraml API defines
 
+/*
 most of these are largly undocumented XML functions that are in the API but not defined
 not noramlly found in the  defines the prototypes of OCI functions in most clients
 Normally can be found in ociap.h (Oracle Call Interface - Ansi Prototypes

Modified: dbd-oracle/branches/rs_array/dbdimp.c
==============================================================================
--- dbd-oracle/branches/rs_array/dbdimp.c	(original)
+++ dbd-oracle/branches/rs_array/dbdimp.c	Fri Jul 17 05:30:27 2009
@@ -3074,7 +3074,7 @@
 				PerlIO_printf(DBILOGFP,"Statement Executed Succesfully!!\n");
 			break;
 			
-		case OCI_NO_DATA: /* selected all the rows at exe*/
+		case OCI_NO_DATA: /* selected all the rows at exe maybe*/
 		
 			if (imp_sth->row_cache_off && is_select){ /*row cache was off and was is_select so is this an error? */
 				 oci_error(sth, imp_sth->errhp, status, ora_sql_error(imp_sth,"OCIStmtExecute"));

Modified: dbd-oracle/branches/rs_array/oci8.c
==============================================================================
--- dbd-oracle/branches/rs_array/oci8.c	(original)
+++ dbd-oracle/branches/rs_array/oci8.c	Fri Jul 17 05:30:27 2009
@@ -75,28 +75,48 @@
 	dTHX;
 	SV *sv;
 	switch(dbtype) {
-		case  0:	return "DEFAULT (varchar)";
-		case  1:	return "VARCHAR";
-		case  2:	return "NVARCHAR2";
-		case  5:	return "STRING";
-		case  8:	return "LONG";
-		case 21:	return "BINARY FLOAT os-endian";
-		case 22:	return "BINARY DOUBLE os-endian";
-		case 23:	return "RAW";
-		case 24:	return "LONG RAW";
-		case 96:	return "CHAR";
-		case 97:	return "CHARZ";
-		case 100:	return "BINARY FLOAT oracle-endian";
-		case 101:	return "BINARY DOUBLE oracle-endian";
-		case 106:	return "MLSLABEL";
-		case 102:	return "SQLT_CUR	OCI 7 cursor variable";
-		case 112:	return "SQLT_CLOB / long";
-		case 113:	return "SQLT_BLOB / long";
-		case 116:	return "SQLT_RSET	OCI 8 cursor variable";
-		case ORA_VARCHAR2_TABLE:return "ORA_VARCHAR2_TABLE";
-		case ORA_NUMBER_TABLE: 	return "ORA_NUMBER_TABLE";
-		case ORA_XMLTYPE:		return "ORA_XMLTYPE or SQLT_NTY";/* SQLT_NTY	must be carefull here as its value (108) is the same for an embedded object Well realy only XML clobs not embedded objects  */
-
+		case  0:					return "DEFAULT (varchar)";
+		case ORA_VARCHAR2:			return "VARCHAR";
+		case ORA_NUMBER:			return "NVARCHAR2";
+		case ORA_INT:				return "(ORANET TYPE) integer3";
+		case ORA_FLT:				return "ORANET TYPE) Floating point number";
+		case ORA_STRING:			return "STRING";
+		case ORA_VNU:				return "NUM with preceding length byte";
+		case ORA_PDN:				return "(ORANET TYPE) Packed Decimal Numeric";
+		case ORA_LONG:				return "LONG";
+		case ORA_ROWID:				return "ROWID";
+		case ORA_DATE:				return "DATE";
+		case 21:					return "BINARY FLOAT os-endian";
+		case 22:					return "BINARY DOUBLE os-endian";
+		case ORA_RAW:				return "RAW";
+		case ORA_LONGRAW:			return "LONG RAW";
+		case ORA_LVB:				return "Longer LONG binary";
+		case ORA_CHAR:				return "CHAR";
+		case ORA_CHARZ:				return "CHARZ";
+		case 100:					return "BINARY FLOAT oracle-endian";
+		case 101:					return "BINARY DOUBLE oracle-endian";
+		case ORA_RDD:				return "ROWID descriptor";
+		case ORA_MLSLABEL:			return "MLSLABEL";
+		case 106:					return "MLSLABEL";
+		case ORA_CUR:				return "SQLT_CUR	OCI 7 cursor variable";
+		case ORA_REF:				return "REF";
+		case ORA_CLOB:				return "SQLT_CLOB / long";
+		case ORA_BLOB:				return "SQLT_BLOB / long";
+		case ORA_BFILEE:			return "BINARY FILE lob"; 
+		case ORA_CFILEE:			return "CHARACTER FILE lob";
+		case ORA_RSET:				return "SQLT_RSET	OCI 8 cursor variable";
+		case ORA_XMLTYPE:			return "ORA_XMLTYPE or SQLT_NTY or ORA_OBJECT";/* SQLT_NTY	must be carefull here as its value (108) is the same for an embedded object Well realy only XML clobs not embedded objects  */
+		case ORA_ANSI_DATE:			return "ANSI Date";
+		case ORA_TIME:				return "TIME";
+		case ORA_TIME_TZ:			return "TIME WITH TIME ZONE";
+		case ORA_TIMESTAMP:			return "TIMESTAMP";
+		case ORA_TIMESTAMP_TZ:		return "TIMESTAMP WITH TIME ZONE";
+		case ORA_INTERVAL_YM:		return "INTERVAL YEAR TO MONTH";
+		case ORA_INTERVAL_DS:		return "INTERVAL DAY TO SECOND";
+		case ORA_TIMESTAMP_LTZ:		return "TIMESTAMP WITH LOCAL TZ";
+		case ORA_VARCHAR2_TABLE:	return "VARCHAR2_TABLE";
+		case ORA_NUMBER_TABLE: 		return "NUMBER_TABLE";
+		
 	}
 	 sv = sv_2mortal(newSVpv("",0));
 	 sv_grow(sv, 50);
@@ -106,6 +126,7 @@
 
 
 
+
 char *
 oci_typecode_name(int typecode){
 
@@ -3139,7 +3160,7 @@
 		fbh->ftype	= 5;	/* default: return as null terminated string */
 
 		if (DBIS->debug >= 4 || dbd_verbose >= 4 )
-			PerlIO_printf(DBILOGFP, "Describe col #%d type=%d(%s),%d\n",i,fbh->dbtype,sql_typecode_name(fbh->dbtype),ORA_DATE);
+			PerlIO_printf(DBILOGFP, "Describe col #%d type=%d(%s)\n",i,fbh->dbtype,sql_typecode_name(fbh->dbtype));
 
 		switch (fbh->dbtype) {
 		/*	the simple types	*/
@@ -3267,11 +3288,12 @@
 				break;
 
 			case	ORA_ROWID:				/* ROWID	*/
-			case	104:				/* ROWID Desc	*/
+			case	ORA_RDD:				/* ROWID Desc	*/
 				fbh->disize = 20;
 				fbh->prec	= fbh->disize;
 				break;
-			case	108:				 /* some sort of embedded object */
+			case	ORA_XMLTYPE:	/*SQLT_NTY really just this for the XML interface*/
+									/* some sort of embedded object */
 				fbh->ftype  = fbh->dbtype;  /*varray or alike */
 				fbh->fetch_func = fetch_func_oci_object; /* need a new fetch function for it */
 				fbh->fetch_cleanup = fetch_cleanup_oci_object; /* clean up any AV  from the fetch*/
@@ -3286,7 +3308,7 @@
 				break;
 			case	ORA_CLOB:			/* CLOB	& NCLOB	*/
 			case	ORA_BLOB:			/* BLOB		*/
-			case	114:				/* BFILE	*/
+			case	ORA_BFILEE:			/* BFILE	*/
 				fbh->ftype  	  = fbh->dbtype;
 				imp_sth->ret_lobs = 1;
 				/* do we need some addition size logic here? (lab) */
@@ -3356,7 +3378,7 @@
 				break;
 
 #ifdef OCI_DTYPE_REF
-			case	111:				/* REF		*/
+			case	ORA_REF_PTR:				/* REF		*/
 				fbh_setup_getrefpv(fbh, OCI_DTYPE_REF, "OCIRefPtr");
 				break;
 #endif
@@ -3371,9 +3393,9 @@
 
 			case	182:				  /* INTERVAL YEAR TO MONTH */
 			case	183:				  /* INTERVAL DAY TO SECOND */
-			case	190:				  /* INTERVAL DAY TO SECOND */
-			case	187:				  /* TIMESTAMP */
-			case	188: 				/* TIMESTAMP WITH TIME ZONE	*/
+			case	ORA_INTERVAL_DS:				  /* INTERVAL DAY TO SECOND */
+			case	ORA_TIMESTAMP:				  /* TIMESTAMP */
+			case	ORA_TIMESTAMP_TZ: 				/* TIMESTAMP WITH TIME ZONE	*/
 			case	232:				  /* TIMESTAMP WITH LOCAL TIME ZONE */
 				/* actually dependent on NLS default date format*/
 					fbh->disize = 75;		/* XXX */
@@ -3398,7 +3420,7 @@
 					i, fbh->dbtype, sql_typecode_name(fbh->dbtype),fbh->scale, fbh->prec, fbh->nullok, fbh->name,
 					fbh->dbsize, fbh->len_char_used, fbh->len_char_size, fbh->csid,fbh->csform,oci_csform_name(fbh->csform), fbh->disize);
 
-		if (fbh->ftype == 5)	/* XXX need to handle wide chars somehow */
+		if (fbh->ftype == ORA_STRING)	/* XXX need to handle wide chars somehow */
 			fbh->disize += 1;	/* allow for null terminator */
 
 	/* dbsize can be zero for 'select NULL ...'			*/
@@ -3433,7 +3455,7 @@
 		int ftype = fbh->ftype;
 		/* add space for STRING null term, or VAR len prefix */
 
-		sb4 define_len = (ftype==94||ftype==95) ? fbh->disize+4 : fbh->disize;
+		sb4 define_len = (ftype==94||ftype==ORA_LVB) ? fbh->disize+4 : fbh->disize;
 		fb_ary_t  *fb_ary;
 		if (fbh->clbk_lob || fbh->piece_lob  ){/*init the cb_abuf with this call*/
 			fbh->fb_ary = fb_ary_cb_alloc(imp_sth->piece_size,define_len, imp_sth->rs_array_size);
@@ -3462,7 +3484,7 @@
 			(fbh->desc_h) ?					0 :		define_len,
 			(ub2)fbh->ftype,
 			fb_ary->aindp,
-			(ftype==94||ftype==95) ? NULL : fb_ary->arlen,
+			(ftype==94||ftype==ORA_LVB) ? NULL : fb_ary->arlen,
 			fb_ary->arcode,
 			fbh->define_mode,
 				status);
@@ -3472,7 +3494,7 @@
 			OCIDefineDynamic_log_stat(fbh->defnp,imp_sth->errhp,(dvoid *) fbh,status);
 		}
 
-		if (fbh->ftype == 108)  { /* Embedded object bind it differently*/
+		if (fbh->ftype == ORA_XMLTYPE)  { /* Embedded object bind it differently*/
 			if (DBIS->debug >= 5 || dbd_verbose >= 5 ){
 				PerlIO_printf(DBILOGFP,"Field #%d is a  object or colection of some sort. Using OCIDefineObject and or OCIObjectPin \n",i);
 			}
@@ -3572,15 +3594,17 @@
 
 			
 			OCIStmtFetch_log_stat(imp_sth->stmhp, imp_sth->errhp,1, imp_sth->fetch_orient,imp_sth->fetch_offset, status);
-			if (status == OCI_NO_DATA)
-				status = OCI_SUCCESS;
+			
+	/*		if (status == OCI_NO_DATA)
+				status = OCI_SUCCESS;*/
 				
 			
 			/*this will work without a round trip so might as well open it up for all statments handles*/
 			/* defualt and OCI_FETCH_NEXT are the same so this avoids miscaluation on the next value*/
 			OCIAttrGet_stmhp_stat(imp_sth, &imp_sth->fetch_position, 0, OCI_ATTR_CURRENT_POSITION, status);
-			if (status == OCI_NO_DATA)
-				status = OCI_SUCCESS;
+			
+			/*if (status == OCI_NO_DATA)
+				status = OCI_SUCCESS;*/
 				
 			if (DBIS->debug >= 4 || dbd_verbose >= 4 )
 				PerlIO_printf(DBILOGFP,"	Scrolling Fetch, postion after fetch=%d\n",imp_sth->fetch_position);
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.