[Liblas-commits] hg: update for 1.6.1 release
liblas-commits at liblas.org
liblas-commits at liblas.org
Tue Apr 5 12:32:45 EDT 2011
details: http://hg.liblas.orghg/rev/0c795852f6df
changeset: 2917:0c795852f6df
user: Howard Butler <hobu.inc at gmail.com>
date: Tue Apr 05 11:32:25 2011 -0500
description:
update for 1.6.1 release
Subject: hg: merge
details: http://hg.liblas.orghg/rev/657b40b92aac
changeset: 2918:657b40b92aac
user: Howard Butler <hobu.inc at gmail.com>
date: Tue Apr 05 11:32:40 2011 -0500
description:
merge
diffstat:
apps/oci_wrapper.cpp | 564 +++++++++++++++++++++++++++++++++++++++++++-------
apps/oci_wrapper.h | 64 +++++-
doc/download.txt | 22 +-
3 files changed, 554 insertions(+), 96 deletions(-)
diffs (truncated from 891 to 300 lines):
diff -r 04fbf3a53472 -r 657b40b92aac apps/oci_wrapper.cpp
--- a/apps/oci_wrapper.cpp Mon Apr 04 10:03:46 2011 -0500
+++ b/apps/oci_wrapper.cpp Tue Apr 05 11:32:40 2011 -0500
@@ -30,6 +30,8 @@
#include "oci_wrapper.h"
+#include <iostream>
+
static const OW_CellDepth ahOW_CellDepth[] = {
{"8BIT_U", GDT_Byte},
{"16BIT_U", GDT_UInt16},
@@ -148,7 +150,7 @@
}
if( CheckError( OCIAttrSet((dvoid *) hSession, (ub4) OCI_HTYPE_SESSION,
- (dvoid *) pszUserId, (ub4) strlen((char *) pszUserId),
+ (dvoid *) pszUserId, (ub4) strlen( pszUserId),
(ub4) OCI_ATTR_USERNAME, hError), hError ) )
{
return;
@@ -223,12 +225,17 @@
(size_t) 0,
(dvoid**) NULL ), hError );
- hNumArrayTDO = DescribeType( (char*) SDO_NUMBER_ARRAY );
- hGeometryTDO = DescribeType( (char*) SDO_GEOMETRY );
- hGeoRasterTDO = DescribeType( (char*) SDO_GEORASTER );
- hPCTDO = DescribeType( (char*) SDO_PC );
- hElemArrayTDO = DescribeType( (char*) SDO_ELEM_INFO_ARRAY);
- hOrdnArrayTDO = DescribeType( (char* ) SDO_ORDINATE_ARRAY);
+ hNumArrayTDO = DescribeType( SDO_NUMBER_ARRAY );
+ hGeometryTDO = DescribeType( SDO_GEOMETRY );
+ hGeoRasterTDO = DescribeType( SDO_GEORASTER );
+ hElemArrayTDO = DescribeType( SDO_ELEM_INFO_ARRAY);
+ hOrdnArrayTDO = DescribeType( SDO_ORDINATE_ARRAY);
+
+ if( nVersion > 10 )
+ {
+ hPCTDO = DescribeType( SDO_PC );
+ hPC_BLK_TDO = DescribeType( SDO_PC_BLK );
+ }
}
OWConnection::~OWConnection()
@@ -252,16 +259,9 @@
if( hSession )
OCIHandleFree((dvoid *) hSession, (ub4) OCI_HTYPE_SESSION);
-
- if (pszUser)
- CPLFree(pszUser);
- if (pszPassword)
- CPLFree(pszPassword);
- if (pszServer)
- CPLFree(pszServer);
}
-OCIType* OWConnection::DescribeType( char *pszTypeName )
+OCIType* OWConnection::DescribeType( const char *pszTypeName )
{
OCIParam* hParam = NULL;
OCIRef* hRef = NULL;
@@ -329,6 +329,53 @@
(ub2) 0), NULL );
}
+void OWConnection::CreateType( sdo_pc** pphData )
+{
+ CheckError( OCIObjectNew(
+ hEnv,
+ hError,
+ hSvcCtx,
+ OCI_TYPECODE_OBJECT,
+ hPCTDO,
+ (dvoid *) 0,
+ OCI_DURATION_CALL,
+ TRUE,
+ (dvoid **) pphData), hError );
+}
+
+void OWConnection::DestroyType( sdo_pc** pphData )
+{
+ CheckError( OCIObjectFree(
+ hEnv,
+ hError,
+ (dvoid*) *pphData,
+ (ub2) 0), NULL );
+}
+
+void OWConnection::CreateType( sdo_orgscl_type** pphData )
+{
+ CheckError( OCIObjectNew(
+ hEnv,
+ hError,
+ hSvcCtx,
+ OCI_TYPECODE_OBJECT,
+ hPCTDO,
+ (dvoid *) 0,
+ OCI_DURATION_CALL,
+ TRUE,
+ (dvoid **) pphData), hError );
+}
+
+void OWConnection::DestroyType( sdo_orgscl_type** pphData )
+{
+ CheckError( OCIObjectFree(
+ hEnv,
+ hError,
+ (dvoid*) *pphData,
+ (ub2) 0), NULL );
+}
+
+
void OWConnection::CreateType( OCIArray** phData, OCIType* otype)
{
CheckError( OCIObjectNew( hEnv,
@@ -565,7 +612,7 @@
if( nStmtType != OCI_STMT_SELECT )
{
- nStmtMode = OCI_DEFAULT;// OCI_COMMIT_ON_SUCCESS; //?? Transaction ??//
+ nStmtMode = OCI_DEFAULT;
}
CPLDebug("PL/SQL","\n%s\n", pszStatement);
@@ -626,6 +673,164 @@
return true;
}
+
+bool OWStatement::GetNextField(
+ int nIndex,
+ char* pszName,
+ int* pnType,
+ int* pnSize,
+ int* pnPrecision,
+ signed short* pnScale ,
+ char* pszTypeName)
+{
+ OCIParam* hParmDesc = NULL;
+
+ sword nStatus = 0;
+
+ nStatus = OCIParamGet(
+ hStmt,
+ (ub4) OCI_HTYPE_STMT,
+ hError,
+ (dvoid**) &hParmDesc, //Warning
+ (ub4) nIndex + 1 );
+
+ if( nStatus != OCI_SUCCESS )
+ {
+ return false;
+ }
+
+ char* pszFieldName = NULL;
+ ub4 nNameLength = 0;
+
+ CheckError( OCIAttrGet(
+ hParmDesc,
+ (ub4) OCI_DTYPE_PARAM,
+ (dvoid*) &pszFieldName,
+ (ub4*) &nNameLength,
+ (ub4) OCI_ATTR_NAME,
+ hError ), hError );
+
+ ub2 nOCIType = 0;
+
+ CheckError( OCIAttrGet(
+ hParmDesc,
+ (ub4) OCI_DTYPE_PARAM,
+ (dvoid*) &nOCIType,
+ (ub4*) NULL,
+ (ub4) OCI_ATTR_DATA_TYPE,
+ hError ), hError );
+
+ ub2 nOCILen = 0;
+
+ CheckError( OCIAttrGet(
+ hParmDesc,
+ (ub4) OCI_DTYPE_PARAM,
+ (dvoid*) &nOCILen,
+ (ub4*) NULL,
+ (ub4) OCI_ATTR_DATA_SIZE,
+ hError ), hError );
+
+ unsigned short nOCIPrecision = 0;
+ sb1 nOCIScale = 0;
+
+ if( nOCIType == SQLT_NUM )
+ {
+ CheckError( OCIAttrGet(
+ hParmDesc,
+ (ub4) OCI_DTYPE_PARAM,
+ (dvoid*) &nOCIPrecision,
+ (ub4*) 0,
+ (ub4) OCI_ATTR_PRECISION,
+ hError ), hError );
+
+ CheckError( OCIAttrGet(
+ hParmDesc,
+ (ub4) OCI_DTYPE_PARAM,
+ (dvoid*) &nOCIScale,
+ (ub4*) 0,
+ (ub4) OCI_ATTR_SCALE,
+ hError ), hError );
+
+ if( nOCIPrecision > 255 ) // Lesson learned from ogrocisession.cpp
+ {
+ nOCIPrecision = nOCIPrecision / 256;
+ }
+ }
+
+ if (nOCIType == SQLT_NTY)
+ {
+ OCIRef* type_ref;
+
+ OCIParam* typeParam = NULL;
+
+ CheckError( OCIAttrGet(
+ hParmDesc,
+ (ub4) OCI_DTYPE_PARAM,
+ (dvoid*) &type_ref,
+ (ub4*) NULL,
+ (ub4) OCI_ATTR_REF_TDO,
+ hError ), hError );
+
+ CheckError( OCIDescribeAny(
+ poConnection->hSvcCtx,
+ hError,
+ (dvoid*) type_ref,
+ 0,
+ (ub1) OCI_OTYPE_REF,
+ (ub1) OCI_DEFAULT,
+ (ub1) OCI_PTYPE_TYPE,
+ poConnection->hDescribe ), hError );
+
+ CheckError( OCIAttrGet(
+ poConnection->hDescribe,
+ (ub4) OCI_HTYPE_DESCRIBE,
+ (dvoid*) &typeParam,
+ (ub4*) 0,
+ (ub4) OCI_ATTR_PARAM,
+ hError ), hError );
+
+ text* pszFieldTypeName = NULL;
+ ub4 nFieldTypeNameSize = 0;
+
+ CheckError( OCIAttrGet(
+ typeParam,
+ (ub4) OCI_DTYPE_PARAM,
+ (dvoid*) &pszFieldTypeName,
+ (ub4*) &nFieldTypeNameSize,
+ (ub4) OCI_ATTR_SCHEMA_NAME,
+ hError ), hError );
+
+ // Get Type's name and set it to pszFieldTypeName
+ CheckError( OCIAttrGet(
+ typeParam,
+ (ub4) OCI_DTYPE_PARAM,
+ (dvoid*) &pszFieldTypeName,
+ (ub4*) &nFieldTypeNameSize,
+ (ub4) OCI_ATTR_NAME,
+ hError ), hError );
+
+ nFieldTypeNameSize = MIN(nFieldTypeNameSize, OWNAME);
+ strncpy( pszTypeName, (char*)pszFieldTypeName, nFieldTypeNameSize);
+ pszTypeName[nFieldTypeNameSize] = '\0';
+
+ }
+
+ nNameLength = MIN( nNameLength, OWNAME );
+
+
+ strncpy( pszName, pszFieldName, nNameLength);
+ pszName[nNameLength] = '\0';
+
+
+ *pnType = (int) nOCIType;
+ *pnSize = (int) nOCILen;
+ *pnPrecision = (int) nOCIPrecision;
+ *pnScale = (signed short) nOCIScale;
+
+ return true;
+
+}
+
void OWStatement::Bind( int* pnData )
{
OCIBind* hBind = NULL;
@@ -695,6 +900,29 @@
hError );
}
+void OWStatement::Bind( char* pData, long nData )
+{
+ OCIBind* hBind = NULL;
+
+ nNextBnd++;
More information about the Liblas-commits
mailing list