[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fdo-commits
Subject:    [fdo-commits] r7063 - in sandbox/adsk/3.9/Providers/KingOracle/src: . Overrides Provider UnitTest
From:       svn_fdo () osgeo ! org
Date:       2014-04-09 22:00:17
Message-ID: 20140409220017.6A5413903DB () trac ! osgeo ! org
[Download RAW message or body]

Author: gregboone
Date: 2014-04-09 15:00:17 -0700 (Wed, 09 Apr 2014)
New Revision: 7063

Added:
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_FdoOra_API3.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_FdoOra_API3.h
   sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/copy_debug_unittest.bat
Modified:
   sandbox/adsk/3.9/Providers/KingOracle/src/KingOracle.sln
   sandbox/adsk/3.9/Providers/KingOracle/src/Overrides/KingOracleOverrides.vcproj
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/KgOraProvider.rc
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/KingOracleProvider.vcproj
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/KingOracleProvider.vcxproj
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_FdoOra_API2.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_FdoOra_API2.h
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraApplySchema.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraConnection.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraConnection.h
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraCreateSpatialContext.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraDataReader.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraDelete.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraDescribeSchemaCommand.cpp
  sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraDescribeSchemaCommand.h
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraExpressionProcessor.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraExpressionProcessor.h
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraFeatureReader.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraFeatureReader.h
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraFeatureReaderInsert.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraFilterProcessor.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraFilterProcessor.h
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraInsert.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraReader.h
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSQLCommand.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSQLDataReader.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSchemaPool.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSelectAggregates.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSelectCommand.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSpatialContext.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSpatialContext.h
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSqlParamDesc.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSqlParamDesc.h
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraUpdate.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_LogAPI.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_OCI_API.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_OCI_API.h
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_Oci_Statement.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_Oci_Statement.h
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_Ora_API2.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_Ora_API2.h
   sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_SdoGeomToAGF2.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/Resource.h
   sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/UnitTest.vcproj
   sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/c_KgOraUtil.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/c_KgOraUtil.h
   sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/stdafx.h
   sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/ut_KgOraSchema.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/ut_KgOraSchema.h
   sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/ut_KgOraSdeSchema.cpp
   sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/ut_OCI.cpp
Log:
Ticket #887: Update KingOracle for FDO 3.9.0

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/KingOracle.sln
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/KingOracle.sln	2014-04-09 21:58:56 UTC \
                (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/KingOracle.sln	2014-04-09 22:00:17 UTC \
(rev 7063) @@ -142,7 +142,8 @@
 		{07E40766-1E29-499A-A333-76435DA1E7C0}.Release_FDO_3_5|Win32.Build.0 = \
Release_FDO_3_5|Win32  \
{07E40766-1E29-499A-A333-76435DA1E7C0}.Release_FDO_3_5|x64.ActiveCfg = \
Release_FDO_3_5|Win32  {07E40766-1E29-499A-A333-76435DA1E7C0}.Release|Win32.ActiveCfg \
                = Release|Win32
-		{07E40766-1E29-499A-A333-76435DA1E7C0}.Release|x64.ActiveCfg = Release|Win32
+		{07E40766-1E29-499A-A333-76435DA1E7C0}.Release|x64.ActiveCfg = Release|x64
+		{07E40766-1E29-499A-A333-76435DA1E7C0}.Release|x64.Build.0 = Release|x64
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Overrides/KingOracleOverrides.vcproj
 ===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Overrides/KingOracleOverrides.vcproj	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Overrides/KingOracleOverrides.vcproj	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -70,7 +70,6 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="FDO.lib FDOCommon.lib ProvidersCommon.lib"
-				LinkIncremental="2"
 				AdditionalLibraryDirectories="..\..\..\..\Fdo\Unmanaged\Lib\Win32\Debug\;..\..\..\..\Utilities\Common\Lib\Win32\Debug\"
  GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(OutDir)/$(ProjectName).pdb"
@@ -156,7 +155,6 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="FDO.lib FDOCommon.lib ProvidersCommon.lib"
-				LinkIncremental="2"
 				AdditionalLibraryDirectories="..\..\..\..\Fdo\Unmanaged\Lib\Win64\Debug\;..\..\..\..\Utilities\Common\Lib\Win64\Debug\"
  GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(OutDir)/$(ProjectName).pdb"
@@ -245,7 +243,6 @@
 				Name="VCLinkerTool"
 				AdditionalDependencies="FDO.lib FDOCommon.lib ProvidersCommon.lib"
 				OutputFile="$(OutDir)/$(ProjectName).dll"
-				LinkIncremental="0"
 				AdditionalLibraryDirectories="..\..\..\..\Fdo\Unmanaged\Lib\Win32\Release\;..\..\..\..\Utilities\Common\Lib\Win32\Release\"
  GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(OutDir)/$(ProjectName).pdb"
@@ -337,7 +334,6 @@
 				Name="VCLinkerTool"
 				AdditionalDependencies="FDO.lib FDOCommon.lib ProvidersCommon.lib"
 				OutputFile="$(OutDir)/$(ProjectName).dll"
-				LinkIncremental="0"
 				AdditionalLibraryDirectories="..\..\..\..\Fdo\Unmanaged\Lib\Win64\Release\;..\..\..\..\Utilities\Common\Lib\Win64\Release\"
  GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(OutDir)/$(ProjectName).pdb"

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/KgOraProvider.rc
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/KgOraProvider.rc	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/KgOraProvider.rc	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -65,8 +65,8 @@
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,8,28,0
- PRODUCTVERSION 0,8,28,0
+ FILEVERSION 0,8,29,0
+ PRODUCTVERSION 0,8,29,0
  FILEFLAGSMASK 0x17L
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -89,7 +89,7 @@
             VALUE "LegalCopyright", "Copyright SL-KingŠ 2010"
             VALUE "OriginalFilename", "KingOracleProvider.dll"
             VALUE "ProductName", "Feature Data Objects"
-            VALUE "ProductVersion", "0.8.28.0"
+            VALUE "ProductVersion", "0.8.29.0"
         END
     END
     BLOCK "VarFileInfo"

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/KingOracleProvider.vcproj
 ===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/KingOracleProvider.vcproj	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/KingOracleProvider.vcproj	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -45,7 +45,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories=".\;..\..\inc;..\..\..\..\FDO\Unmanaged\inc;..\..\.. \
\..\Utilities\Common\inc;..\..\..\..\Fdo\Unmanaged\inc\fdo\Expression;&quot;$(FDOORACLE)\include&quot;"
 +				AdditionalIncludeDirectories=".\;..\..\inc;..\..\..\..\FDO\Unmanaged\inc;..\..\. \
.\..\Utilities\Common\inc;..\..\..\..\Fdo\Unmanaged\inc\fdo\Expression;&quot;$(FDOORACLE32)\include&quot;"
                
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FDOKGORA_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_FDO_3_2;_FDO_3_5;_CRT_NON_CONFORMING_SWPRINTFS"
  GeneratePreprocessedFile="0"
 				MinimalRebuild="true"
@@ -68,7 +68,7 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="oci.lib FDO.lib FDOCommon.lib FDOGeometry.lib \
                FDOSpatial.lib FDONls.lib ProvidersCommon.lib \
                KingOracleOverrides.lib"
-				AdditionalLibraryDirectories="&quot;$(FDOORACLE)\lib\msvc&quot;;..\..\..\..\Fdo\U \
nmanaged\lib\win32\debug;..\..\..\..\Utilities\Common\lib\win32\debug;&quot;..\..\lib\Win32\$(ConfigurationName)&quot;"
 +				AdditionalLibraryDirectories="&quot;$(FDOORACLE32)\lib\msvc&quot;;..\..\..\..\Fd \
o\Unmanaged\lib\win32\debug;..\..\..\..\Utilities\Common\lib\win32\debug;&quot;..\..\lib\Win32\$(ConfigurationName)&quot;"
  GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(OutDir)/$(ProjectName).pdb"
 				RandomizedBaseAddress="1"
@@ -128,7 +128,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories=".\;..\..\inc;..\..\..\..\FDO\Unmanaged\inc;..\..\.. \
\..\Utilities\Common\inc;..\..\..\..\Fdo\Unmanaged\inc\fdo\Expression;&quot;$(FDOORACLE)\include&quot;"
 +				AdditionalIncludeDirectories=".\;..\..\inc;..\..\..\..\FDO\Unmanaged\inc;..\..\. \
.\..\Utilities\Common\inc;..\..\..\..\Fdo\Unmanaged\inc\fdo\Expression;&quot;$(FDOORACLE64)\include&quot;"
                
 				PreprocessorDefinitions="WIN32;_WIN64;_DEBUG;_WINDOWS;_USRDLL;FDOKGORA_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_FDO_3_2;_FDO_3_5;_CRT_NON_CONFORMING_SWPRINTFS"
  GeneratePreprocessedFile="0"
 				MinimalRebuild="true"
@@ -151,7 +151,7 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="oci.lib FDO.lib FDOCommon.lib FDOGeometry.lib \
                FDOSpatial.lib FDONls.lib ProvidersCommon.lib \
                KingOracleOverrides.lib"
-				AdditionalLibraryDirectories="&quot;$(FDOORACLE)\lib\msvc&quot;;..\..\..\..\Fdo\U \
nmanaged\lib\win64\debug;..\..\..\..\Utilities\Common\lib\win64\debug;&quot;..\..\lib\Win64\$(ConfigurationName)&quot;"
 +				AdditionalLibraryDirectories="&quot;$(FDOORACLE64)\lib\msvc&quot;;..\..\..\..\Fd \
o\Unmanaged\lib\win64\debug;..\..\..\..\Utilities\Common\lib\win64\debug;&quot;..\..\lib\Win64\$(ConfigurationName)&quot;"
  GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(OutDir)/$(ProjectName).pdb"
 				RandomizedBaseAddress="1"
@@ -209,7 +209,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories=".\;..\..\inc;..\..\..\..\FDO\Unmanaged\inc;..\..\.. \
\..\Utilities\Common\inc;..\..\..\..\Fdo\Unmanaged\inc\fdo\Expression;&quot;$(FDOORACLE)\include&quot;"
 +				AdditionalIncludeDirectories=".\;..\..\inc;..\..\..\..\FDO\Unmanaged\inc;..\..\. \
.\..\Utilities\Common\inc;..\..\..\..\Fdo\Unmanaged\inc\fdo\Expression;&quot;$(FDOORACLE32)\include&quot;"
                
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FDOKGORA_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_FDO_3_2;_FDO_3_5;_CRT_NON_CONFORMING_SWPRINTFS"
  RuntimeLibrary="2"
 				TreatWChar_tAsBuiltInType="true"
@@ -230,7 +230,7 @@
 				Name="VCLinkerTool"
 				LinkLibraryDependencies="false"
 				AdditionalDependencies="oci.lib FDO.lib FDOCommon.lib FDOGeometry.lib \
                FDOSpatial.lib FDONls.lib ProvidersCommon.lib \
                KingOracleOverrides.lib"
-				AdditionalLibraryDirectories="&quot;$(FDOORACLE)\lib\msvc&quot;;..\..\..\..\Fdo\U \
nmanaged\Lib\Win32\Release\;..\..\..\..\Utilities\Common\Lib\Win32\Release\;&quot;..\..\lib\Win32\$(ConfigurationName)&quot;"
 +				AdditionalLibraryDirectories="&quot;$(FDOORACLE32)\lib\msvc&quot;;..\..\..\..\Fd \
o\Unmanaged\Lib\Win32\Release\;..\..\..\..\Utilities\Common\Lib\Win32\Release\;&quot;..\..\lib\Win32\$(ConfigurationName)&quot;"
  GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(OutDir)/$(ProjectName).pdb"
 				RandomizedBaseAddress="1"
@@ -289,7 +289,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories=".\;..\..\inc;..\..\..\..\FDO\Unmanaged\inc;..\..\.. \
\..\Utilities\Common\inc;..\..\..\..\Fdo\Unmanaged\inc\fdo\Expression;&quot;$(FDOORACLE)\include&quot;"
 +				AdditionalIncludeDirectories=".\;..\..\inc;..\..\..\..\FDO\Unmanaged\inc;..\..\. \
.\..\Utilities\Common\inc;..\..\..\..\Fdo\Unmanaged\inc\fdo\Expression;&quot;$(FDOORACLE64)\include&quot;"
                
 				PreprocessorDefinitions="_WIN32;_WIN64;NDEBUG;_WINDOWS;_USRDLL;FDOKGORA_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_FDO_3_2;_FDO_3_5;_CRT_NON_CONFORMING_SWPRINTFS"
  RuntimeLibrary="2"
 				TreatWChar_tAsBuiltInType="true"
@@ -310,7 +310,7 @@
 				Name="VCLinkerTool"
 				LinkLibraryDependencies="false"
 				AdditionalDependencies="oci.lib FDO.lib FDOCommon.lib FDOGeometry.lib \
                FDOSpatial.lib FDONls.lib ProvidersCommon.lib \
                KingOracleOverrides.lib"
-				AdditionalLibraryDirectories="&quot;$(FDOORACLE)\lib\msvc&quot;;..\..\..\..\Fdo\U \
nmanaged\Lib\Win64\Release\;..\..\..\..\Utilities\Common\Lib\Win64\Release\;&quot;..\..\lib\Win64\$(ConfigurationName)&quot;"
 +				AdditionalLibraryDirectories="&quot;$(FDOORACLE64)\lib\msvc&quot;;..\..\..\..\Fd \
o\Unmanaged\Lib\Win64\Release\;..\..\..\..\Utilities\Common\Lib\Win64\Release\;&quot;..\..\lib\Win64\$(ConfigurationName)&quot;"
  GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(OutDir)/$(ProjectName).pdb"
 				RandomizedBaseAddress="1"
@@ -1323,6 +1323,14 @@
 			>
 		</File>
 		<File
+			RelativePath=".\c_FdoOra_API3.cpp"
+			>
+		</File>
+		<File
+			RelativePath=".\c_FdoOra_API3.h"
+			>
+		</File>
+		<File
 			RelativePath=".\c_FdoSde_API.cpp"
 			>
 		</File>

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/KingOracleProvider.vcxproj
 ===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/KingOracleProvider.vcxproj	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/KingOracleProvider.vcxproj	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -664,6 +664,7 @@
     </PostBuildEvent>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClInclude Include="c_FdoOra_API3.h" />
     <ClInclude Include="KgOraProvider.h" />
     <ClInclude Include="stdafx.h" />
     <ClInclude Include="c_KgOraCommandCapabilities.h" />
@@ -719,6 +720,7 @@
     <ClInclude Include="FDO_31_Types.h" />
   </ItemGroup>
   <ItemGroup>
+    <ClCompile Include="c_FdoOra_API3.cpp" />
     <ClCompile Include="stdafx.cpp">
       <PrecompiledHeader \
Condition="'$(Configuration)|$(Platform)'=='Debug_FDO_3_4|Win32'">Create</PrecompiledHeader>
                
       <PrecompiledHeader \
Condition="'$(Configuration)|$(Platform)'=='Debug_FDO_3_4|x64'">Create</PrecompiledHeader>


Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_FdoOra_API2.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_FdoOra_API2.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_FdoOra_API2.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -29,7 +29,35 @@
 #define D_CLASSNAME_DELIMITER L"~"
 //#define D_CLASSNAME_DELIMITER L"_"
 
+//#define D_TEST_SHEMASPEED
 
+class c_Timer
+{
+  public:
+    c_Timer()
+    {
+      elapsedtime=0;
+      QueryPerformanceFrequency(&frequency);
+    }
+    void Start()
+    {
+      QueryPerformanceCounter(&t1);
+    }
+    double Stop()
+    {
+      QueryPerformanceCounter(&t2);elapsedtime=(double)(t2.QuadPart-t1.QuadPart)/frequency.QuadPart;
 +      return elapsedtime;
+    }
+    double GetElapsedTime()
+    {
+      return elapsedtime;
+    }
+  protected:    
+    LARGE_INTEGER frequency;LARGE_INTEGER t1,t2;double elapsedtime;
+};
+
+
+
 c_FdoOra_API2::c_FdoOra_API2(void)
 {
 }
@@ -352,14 +380,14 @@
     {
       
       if( DataValue->IsNull() )
-        Statement->BindLong(SqlParamNum,NULL);
+        Statement->BindInt64(SqlParamNum,NULL);
       else
       {
         FdoInt64Value * dval = (FdoInt64Value*)DataValue;                        
         
         //long dval
         
-        Statement->BindLongValue(SqlParamNum,(long)dval->GetInt64());
+        Statement->BindInt64Value(SqlParamNum,dval->GetInt64());
       }
     }
     break;
@@ -549,14 +577,14 @@
     {
 
       if( DataValue->IsNull() )
-        Statement->BindLong(SqlParamName,NULL);
+        Statement->BindInt64(SqlParamName,NULL);
       else
       {
         FdoInt64Value * dval = (FdoInt64Value*)DataValue;                        
 
         //long dval
 
-        Statement->BindLongValue(SqlParamName,(long)dval->GetInt64());
+        Statement->BindInt64Value(SqlParamName,dval->GetInt64());
       }
     }
     break;
@@ -708,7 +736,7 @@
 /* 
   Utility function to create property definitions from table columns 
 */
-bool c_FdoOra_API2::DescribeTableProperties(c_Oci_Connection * OciConn,const \
wchar_t*Schema,const wchar_t*TableName,FdoPropertyDefinitionCollection* \
PropCollection) +bool c_FdoOra_API2::DescribeTableProperties(c_Oci_Connection * \
OciConn,const wchar_t*Schema,const wchar_t*TableName,FdoPropertyDefinitionCollection* \
PropCollection,c_KgOraSpatialContextCollection* SC_Collection)  {
   OCIParam *parmh = (OCIParam *) 0;         /* parameter handle */
   OCIParam *collsthd = (OCIParam *) 0;      /* handle to list of columns */
@@ -762,7 +790,7 @@
 
   /* go through the column list and retrieve the data-type of each column,
   and then recursively describe column types. */
-
+  
   for (int i = 1; i <= numcols; i++)
   {
     /* get parameter for column i */
@@ -778,7 +806,13 @@
     int col_name_len=0;
     OciConn->OciCheckError(OCIAttrGet((dvoid *)colhd, OCI_DTYPE_PARAM, (dvoid \
*)&col_name, (ub4 *)&col_name_len,  OCI_ATTR_NAME, OciConn->m_OciHpError));
-      
+    
+    // Retrieve the column type name attribute 
+    wchar_t* col_type_name=NULL;
+    int col_type_name_len = 0;
+    OciConn->OciCheckError(OCIAttrGet((dvoid*) colhd, (ub4) OCI_DTYPE_PARAM,
+      (dvoid**) &col_type_name, (ub4 *) &col_type_name_len, (ub4) \
OCI_ATTR_TYPE_NAME, +      (OCIError *) OciConn->m_OciHpError ));
 
     /* Retrieve the length semantics for the column */
     ub4 char_semantics = 0;
@@ -823,7 +857,29 @@
       dpd->SetScale(col_scale);
 
       PropCollection->Add(dpd);
-    }      
+    }  
+    else
+    {
+    // perhaps it is geometry
+      if( col_type_name && wcscmp(col_type_name,L"SDO_GEOMETRY") == 0 )
+      {
+        FdoPtr<FdoPropertyDefinition> f = PropCollection->FindItem(col_name);
+        if( !f.p )
+        {
+          FdoPtr<c_KgOraSpatialContext> spcontext  = \
CreateSpatialContext(OciConn,Schema,TableName,col_name,SC_Collection); +          \
FdoPtr<FdoGeometricPropertyDefinition> geomprop = \
FdoGeometricPropertyDefinition::Create(col_name,L""); +          
+          if( spcontext.p )
+          {
+            geomprop->SetSpatialContextAssociation(spcontext->GetName());
+          }
+          PropCollection->Add(geomprop);
+        }
+        
+        
+      }
+      
+    }    
   }
 
   if (dschp)
@@ -856,7 +912,8 @@
 //FdoPtr<FdoFeatureSchemaCollection> g_FeatureSchemas(NULL);
 //FdoPtr<FdoKgOraPhysicalSchemaMapping>  g_PhysicalSchemaMapping(NULL);
 
-c_KgOraSchemaDesc* c_FdoOra_API2::DescribeSchema(c_Oci_Connection* OciConn,const \
wchar_t* ConnectionOraSchema,const wchar_t* UseOraSchema,const wchar_t* \
KingFdoViews,const wchar_t* SdeSchema) +c_KgOraSchemaDesc* \
c_FdoOra_API2::DescribeSchema(c_Oci_Connection* OciConn,const wchar_t* \
ConnectionOraSchema,const wchar_t* UseOraSchema +                           ,const \
wchar_t* KingFdoViews,const wchar_t* SdeSchema)  {
       
         FdoPtr<FdoFeatureSchemaCollection> fschema;
@@ -1127,8 +1184,13 @@
     }
 
   
+    #ifdef D_TEST_SHEMASPEED
+      if(false)
+    #endif
+    {
+      c_FdoOra_API2::DescribeSchemaSQL(OciConn,sqlquery.c_str(),bind_owner,ConnectionOraSchema,UseOraSchema,classes,phys_classes,sc_collection,aliasnum,isoracle9);
 +    }
     
-    c_FdoOra_API2::DescribeSchemaSQL(OciConn,sqlquery.c_str(),bind_owner,ConnectionOraSchema,UseOraSchema,classes,phys_classes,sc_collection,aliasnum,isoracle9);
  
     
     
@@ -1399,12 +1461,129 @@
   
 */
 
+
+ // Test for coordinate system if exists and 
+c_KgOraSpatialContext* c_FdoOra_API2::CreateSpatialContext(c_Oci_Connection * \
OciConn,const wchar_t* Owner,const wchar_t* Table,const wchar_t* \
GeometryColumn,c_KgOraSpatialContextCollection* SC_Collection) +{
+  std::wstring sqlstring;
+  c_Oci_Statement * stm=NULL;
+  FdoPtr<c_KgOraSpatialContext> spatial_context;
+try
+{  
+  // select a.srid, a.diminfo, b.CS_NAME, b.WKTEXT  from all_sdo_geom_metadata a \
left join mdsys.cs_srs b on a.srid=b.srid   +  // where owner='DEEODB4' and \
table_name='EOTR_TRAFOSTANICE' and column_name = 'GEOMETRY'; +  \
sqlstring.append(L"select a.srid, a.diminfo, b.CS_NAME, b.WKTEXT  from \
all_sdo_geom_metadata a left join mdsys.cs_srs b on a.srid=b.srid where owner=:1 and \
table_name=:2 and column_name=:3 "); +  stm = OciConn->CreateStatement();
+  stm->Prepare(sqlstring.c_str());
+  
+  stm->BindString(1,Owner);
+  stm->BindString(2,Table);
+  stm->BindString(3,GeometryColumn);
+  
+  stm->ExecuteSelectAndDefine();
+  
+  
+  if( !stm->ReadNext() )
+  {
+    spatial_context = SC_Collection->GetDefaultSpatialContext();  
+  }
+  else
+  {
+  
+    std::wstring ora_coord_sys_name,ora_coord_sys_wktext;
+    
+    bool ora_srid_isnull;
+    long ora_srid;
+    ora_srid_isnull = stm->IsColumnNull(1);
+    if( !ora_srid_isnull ) ora_srid = stm->GetInteger(1);
+    else ora_srid = 0;
+
+    //std::vector< SDO_DIM_ELEMENT* > ora_dimlist;
+    c_SDO_DIM_ARRAY ora_dimlist;
+    if( !stm->IsColumnNull(2) ) 
+    {
+      ora_dimlist = stm->GetSdoDimArray(2);
+      //oracle::occi::getVector(occi_rs,5,ora_dimlist);
+    }
+
+    ora_coord_sys_name = stm->IsColumnNull(3) ? L"" : stm->GetString(3);
+    ora_coord_sys_wktext = stm->IsColumnNull(4) ? L"" : stm->GetString(4);
+
+    
+    if( (long)ora_srid >= 0 )
+    {
+      FdoStringP cname = FdoStringP::Format(L"OracleSrid%ld",(long)ora_srid);
+      spatial_context = SC_Collection->FindItem(cname);
+      if( !spatial_context )
+      {
+        spatial_context = new c_KgOraSpatialContext();
+        spatial_context->SetName(cname);
+            
+        FdoStringP csname = ora_coord_sys_name.c_str();
+        spatial_context->SetCoordSysName(csname);
+            
+        FdoStringP cswkt = ora_coord_sys_wktext.c_str();
+        spatial_context->SetCoordinateSystemWkt(cswkt);
+            
+            
+        c_KgOraSridDesc orasriddesc;
+        orasriddesc.m_OraSrid = (long)ora_srid;
+        orasriddesc.m_IsGeodetic = \
c_Ora_API2::IsGeodeticCoordSystem(ora_coord_sys_wktext.c_str());       +        \
spatial_context->SetOraSridDesc(orasriddesc); +            
+        long dimcount = ora_dimlist.GetSize();
+        for(long ind=0;ind<dimcount;ind++)
+        {
+          c_SDO_DIM_ELEMENT dimelem = ora_dimlist.GetDimElement(ind);
+              
+          std::wstring dimname;
+          if( !dimelem.IsNullDimName() )
+            dimname = dimelem.GetDimName(); 
+                            
+          double tol = dimelem.GetTolerance();
+          double lb = (double)dimelem.GetLB();
+          double ub = (double)dimelem.GetUB();
+        }
+            
+        SC_Collection->Insert(0,spatial_context);
+      }        
+    }
+    else
+    {
+      spatial_context = SC_Collection->GetDefaultSpatialContext();  
+    }
+  }
+}
+catch(c_Oci_Exception* ex)
+{
+  FdoStringP gstr = ex->GetErrorText();
+#ifdef _KGORA_EXTENDED_LOG  
+  D_KGORA_ELOG_WRITE1("c_FdoOra_API2::DescribeSchemaSQL.Error : '%s'",(const \
char*)gstr);       +#endif
+  delete ex;
+  if( stm )
+  {
+    OciConn->TerminateStatement(stm);
+
+  }
+
+  throw FdoException::Create( gstr );
+}  
+  
+  OciConn->TerminateStatement(stm);
+  return FDO_SAFE_ADDREF(spatial_context.p);
+}// end of c_FdoOra_API2::CreateSpatialContext
+
+
 void c_FdoOra_API2::DescribeSchemaSQL(c_Oci_Connection * OciConn,const wchar_t* \
SqlString,bool BindOwner  ,const wchar_t* ConnectionOraSchema,const wchar_t* Owner
             ,FdoClassCollection* FdoClasses,FdoKgOraClassCollection* PhysClasses
             ,c_KgOraSpatialContextCollection* SC_Collection,long& AliasNum,bool \
IsOracle9      )  {
   c_Oci_Statement * stm=NULL;
+  double time_total_columns=0.0,time_total_pkeys=0.0;
+  int class_count=0;
+  int rec_count=0;
   try
   {
     // Query Oracle for geometry tables 
@@ -1453,7 +1632,14 @@
     occi_rs->setMaxColumnSize(23,512);
     */
     
-    int rec_count=0;
+    
+    
+    #ifdef _DEBUG
+    c_Timer time_full;
+    time_full.Start();
+    #endif
+    
+    
     while( stm->ReadNext() )
     {
       rec_count++;
@@ -1480,9 +1666,16 @@
       {
         continue;
       }
+      
+      std::wstring nonver_tablename;
+      if( CheckIfVersionedTableName(OciConn,ora_tableowner,ora_tablename,nonver_tablename) \
) +      {
+        ora_tablename = nonver_tablename;
+      }
+      
             
       ora_srid_isnull = stm->IsColumnNull(4);
-      if( !ora_srid_isnull ) ora_srid = stm->GetLong(4);
+      if( !ora_srid_isnull ) ora_srid = stm->GetInteger(4);
       else ora_srid = 0;
       
       //std::vector< SDO_DIM_ELEMENT* > ora_dimlist;
@@ -1513,7 +1706,7 @@
       override_fdo_classname = stm->IsColumnNull(12) ? L"" : stm->GetString(12); // \
12. Override FDO Class Name ( varchar2, null ) - name of the class which will be used \
as fdo class  
       override_srid_isnull = stm->IsColumnNull(13);  // 13. Override SRID ( number, \
                null ) - override srid
-      if( !override_srid_isnull ) override_srid = stm->GetLong(13);
+      if( !override_srid_isnull ) override_srid = stm->GetInteger(13);
       else override_srid = 0;
       
       //OCCI_STD_NAMESPACE::vector< SDO_DIM_ELEMENT* > override_dimlist;
@@ -1607,7 +1800,7 @@
       // then I use DEFAULT spatial context
         if( ora_mbr )
         {
-          spatial_context = SC_Collection->FindItem(D_SPATIALCONTEXT_DEFAULT_NAME);  \
 +          spatial_context = SC_Collection->GetDefaultSpatialContext();       
         }
       }
       
@@ -1878,15 +2071,30 @@
         // catch erro returned
         bool table_exists=false;
         
-        table_exists = \
DescribeTableProperties(OciConn,ora_tableowner.c_str(),ora_tablename.c_str(),pdc); +
+        #ifdef _DEBUG
+           c_Timer time_columns;
+           time_columns.Start();
+        #endif
+        
+        
+        table_exists = \
DescribeTableProperties(OciConn,ora_tableowner.c_str(),ora_tablename.c_str(),pdc,SC_Collection);
 +        
+        
+        #ifdef _DEBUG
+          time_total_columns += time_columns.Stop();
+        #endif        
                 
                 
-                
     ////////////////////////////////////////////////////////////////////////////////////////////
  //  Check for primary keys
     //////////////////////////////////////////////////////////////////////////////////////////// \
  std::vector<std::wstring> pcols;
-        
+        #ifdef _DEBUG
+          c_Timer time_pkeys;
+          time_pkeys.Start();
+        #endif
+
         // ckeck for user defined column for identity
         // if defined use it - if not look for primary keys on table
         if( override_identity.length() > 0 )
@@ -1936,7 +2144,9 @@
               }
             }  
           }
-          
+        #ifdef _DEBUG
+          time_total_pkeys += time_pkeys.Stop();
+        #endif
        ////////////////////////////////////////////////////////////////////////////////////////////
  //  Set Oracle Sequence
        //////////////////////////////////////////////////////////////////////////////////////////// \
 @@ -1972,11 +2182,14 @@
       
     }
     
-    //g_FeatureSchemas = FDO_SAFE_ADDREF(m_FeatureSchemas.p);
-    //g_PhysicalSchemaMapping = FDO_SAFE_ADDREF(m_PhysicalSchemaMapping.p);
     
-    int class_count = FdoClasses->GetCount();
+    #ifdef _DEBUG
+        time_full.Stop();
+        printf(" Describe: %.4lf (cols: %.4lf , pkeys: %.2lf) \
",time_full.GetElapsedTime(),time_total_columns,time_total_pkeys); +    #endif
     
+    class_count = FdoClasses->GetCount();
+    
     OciConn->TerminateStatement(stm);
     
   }
@@ -2064,7 +2277,7 @@
       }
       else
       {
-        sde_layer_id = stm->GetLong(1);
+        sde_layer_id = stm->GetInteger(1);
       }
       
       if( stm->IsColumnNull(2) )
@@ -2097,15 +2310,15 @@
       sde_geom_owner = stm->IsColumnNull(5) ? L"" : stm->GetString(5);
       sde_geom_table = stm->IsColumnNull(6) ? L"" : stm->GetString(6);
       
-      sde_geom_type = stm->IsColumnNull(7) ? 0 : stm->GetLong(7);
-      sde_geom_coord_dim = stm->IsColumnNull(8) ? 0 : stm->GetLong(8);
+      sde_geom_type = stm->IsColumnNull(7) ? 0 : stm->GetInteger(7);
+      sde_geom_coord_dim = stm->IsColumnNull(8) ? 0 : stm->GetInteger(8);
 
       sde_full_geometry_table_name = sde_geom_owner + L"." + sde_geom_table;
       FdoStringP temp2 = \
FdoStringP::Format(L"%s.S%ld",sde_geom_owner.c_str(),sde_layer_id);  \
                sde_full_index_table_name = temp2;
       //sde_full_index_table_name = sde_geom_owner + sde_full_index_table_name;
 
-      sde_srid = stm->IsColumnNull(9) ? 0 : stm->GetLong(9);
+      sde_srid = stm->IsColumnNull(9) ? 0 : stm->GetInteger(9);
       sde_coord_sys_wktext = stm->IsColumnNull(10) ? L"" : stm->GetString(10);
 
       FdoStringP temp = FdoStringP::Format(L"SDE_SRID_%ld",sde_srid);
@@ -2177,7 +2390,7 @@
         // then I use DEFAULT spatial context
         if( ora_mbr )
         {
-          spatial_context = SC_Collection->FindItem(D_SPATIALCONTEXT_DEFAULT_NAME);  \
 +          spatial_context = SC_Collection->GetDefaultSpatialContext();       
         }
       }
 
@@ -2319,7 +2532,7 @@
         // catch erro returned
         bool table_exists=false;
 
-        table_exists = \
DescribeTableProperties(OciConn,ora_tableowner.c_str(),ora_tablename.c_str(),pdc); +  \
table_exists = DescribeTableProperties(OciConn,ora_tableowner.c_str(),ora_tablename.c_str(),pdc,SC_Collection);
  
 
 
@@ -2518,3 +2731,24 @@
 }//end of c_FdoOra_API2::FdoPropertyToOraDataType
 
 
+bool c_FdoOra_API2::CheckIfVersionedTableName(c_Oci_Connection * OciConn,const \
std::wstring& Owner,const std::wstring& ora_tablename,std::wstring& orig_tablename) \
+{ +  orig_tablename = ora_tablename;
+  
+  int length = ora_tablename.length();
+  if( length > 3 )
+  {    
+    //if( ora_tablename.rfind(L"_LT") != std::wstring::npos )
+    if( ora_tablename[length-1]==L'T' && ora_tablename[length-2]==L'L' && \
ora_tablename[length-3]==L'_' ) +    {
+      orig_tablename = ora_tablename.substr(0,length-3);
+      
+      std::wstring PhysicalTable;
+      if( c_Ora_API2::IsTableVersioned(OciConn,Owner.c_str(),orig_tablename.c_str(),PhysicalTable) \
) +      {
+        return true;     
+      }
+    }
+  }
+  return false;
+}//end of 
\ No newline at end of file

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_FdoOra_API2.h
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_FdoOra_API2.h	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_FdoOra_API2.h	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -23,6 +23,8 @@
 #include "c_KgOraSpatialContext.h"
 #include "c_KgOraSchemaDesc.h"
 
+#define CLASS_FDOORAPI c_FdoOra_API2
+
 class FDOKGORA_API c_FdoOra_API2
 {
 public:
@@ -49,10 +51,12 @@
   static void c_FdoOra_API2::DescribeSchemaSQL(oracle::occi::Connection * \
OraConn,oracle::occi::Statement* OraStm  ,FdoClassCollection* \
FdoClasses,FdoKgOraClassCollection* PhysClasses,c_KgOraSpatialContextCollection* \
                SC_Collection,long& AliasNum,bool IsOracle9=false);
 */                                              
-  static bool DescribeTableProperties(c_Oci_Connection * OciConn,const \
wchar_t*Schema,const wchar_t*TableName,FdoPropertyDefinitionCollection* \
PropCollection); +  static bool DescribeTableProperties(c_Oci_Connection * \
OciConn,const wchar_t*Schema,const wchar_t*TableName,FdoPropertyDefinitionCollection* \
PropCollection,c_KgOraSpatialContextCollection* SC_Collection);  //static void \
DescribeSchemaSQL(c_Oci_Connection * OciConn,FdoClassCollection* \
FdoClasses,FdoKgOraClassCollection* PhysClasses ,c_KgOraSpatialContextCollection* \
SC_Collection,long& AliasNum,bool IsOracle9 );  static void \
DescribeSchemaSQL(c_Oci_Connection * OciConn,const wchar_t* SqlString ,bool \
BindOwner,const wchar_t* ConnectionOraSchema,const wchar_t* Owner,FdoClassCollection* \
FdoClasses,FdoKgOraClassCollection* PhysClasses ,c_KgOraSpatialContextCollection* \
SC_Collection,long& AliasNum,bool IsOracle9 );  static void \
DescribeSchemaSDE(c_Oci_Connection * OciConn,const wchar_t* Owner \
,FdoClassCollection* FdoClasses,FdoKgOraClassCollection* PhysClasses \
,c_KgOraSpatialContextCollection* SC_Collection,long& AliasNum ); +  static bool \
CheckIfVersionedTableName(c_Oci_Connection * OciConn,const std::wstring& Owner,const \
std::wstring& ora_tablename,std::wstring& orig_tablename); +  static \
c_KgOraSpatialContext* CreateSpatialContext(c_Oci_Connection * OciConn,const wchar_t* \
Owner,const wchar_t* Table,const wchar_t* \
GeometryColumn,c_KgOraSpatialContextCollection* SC_Collection);  };
 
 #endif

Added: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_FdoOra_API3.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_FdoOra_API3.cpp	             \
                (rev 0)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_FdoOra_API3.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -0,0 +1,3307 @@
+/*
+* Copyright (C) 2009  SL-King d.o.o
+* 
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of version 2.1 of the GNU Lesser
+* General Public License as published by the Free Software Foundation.
+* 
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+* 
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+#include "stdafx.h"
+#include "c_OCI_API.h"
+//#include "c_Ora_API2.h"
+#include "KingOracle/FdoKgOraOverrides.h"
+#include "c_KgOraSridDesc.h"
+#include "c_KgOraSpatialContext.h"
+#include "c_KgOraSchemaDesc.h"
+#include "c_FdoOra_API3.h"
+#include "c_Ora_API2.h"
+#include "KgOraProvider.h"
+
+
+#define D_CLASSNAME_DELIMITER L"~"
+//#define D_CLASSNAME_DELIMITER L"_"
+
+//#define D_TEST_SHEMASPEED
+
+class c_Timer
+{
+  public:
+    c_Timer()
+    {
+      elapsedtime=0;
+      QueryPerformanceFrequency(&frequency);
+    }
+    void Start()
+    {
+      QueryPerformanceCounter(&t1);
+    }
+    double Stop()
+    {
+      QueryPerformanceCounter(&t2);elapsedtime=(double)(t2.QuadPart-t1.QuadPart)/frequency.QuadPart;
 +      return elapsedtime;
+    }
+    double GetElapsedTime()
+    {
+      return elapsedtime;
+    }
+  protected:    
+    LARGE_INTEGER frequency;LARGE_INTEGER t1,t2;double elapsedtime;
+};
+
+
+
+class c_MapOraNameToFdoClass
+{
+public:
+  struct s_data
+  {
+    s_data(const std::wstring& OraOwner,const std::wstring& OraTable,const \
std::wstring& OraGeomColumn,const std::wstring& OverFdoClassName +              \
,FdoClassDefinition* ClassDef,FdoKgOraClassDefinition* KgOraClassDef,const \
std::vector<std::wstring>& OverridePrimaryColumns +              ,const std::wstring& \
spatialowner,const std::wstring& spatialtable // used to connect to \
xxx_sdo_geom_metada to read srid +              )
+    { 
+      keyname=OraOwner;
+      keyname.append(OraTable);
+      keyname.append(OraGeomColumn);
+      keyname.append(OverFdoClassName);
+      
+      fdoclass=ClassDef;kgoraclass=KgOraClassDef; 
+      overprimary = OverridePrimaryColumns; 
+      
+      spatial_owner = spatialowner;
+      spatial_table = spatialtable;
+    }
+    std::wstring keyname;  
+    FdoClassDefinition* fdoclass;   // no ref count
+    FdoKgOraClassDefinition* kgoraclass;  // no ref count
+
+    std::vector<std::wstring> overprimary; // this one if set from meta view; \
applyied t to class +
+    std::vector<std::wstring> primarycolumns; // her areread from sql; colect them \
together; and  after finish reading apply to class +    
+    std::wstring spatial_owner;  // used to connect to xxx_sdo_geom_metada to read \
srid +    std::wstring spatial_table;
+  };
+  
+public:
+  c_MapOraNameToFdoClass()
+  {
+    m_LastFound=NULL;
+  }  
+public:
+  s_data* FindClassDef(const std::wstring& OraOwner,const std::wstring& \
OraTable,const std::wstring& OraGeomColumn,const std::wstring& OverFdoClassName) // \
no ref count +  {
+    if( OraOwner.empty() || OraTable.empty() )
+      return false;
+    
+    std::wstring keyname = OraOwner;
+    keyname.append(OraTable);
+    keyname.append(OraGeomColumn);
+    keyname.append(OverFdoClassName);
+      
+    if( keyname.compare(m_LasTriedName) == 0 && m_LastFound )
+    {
+      return m_LastFound;
+    }
+    m_LasTriedName = keyname;
+    m_LastFound=NULL; 
+    t_datavector::iterator itr = m_DataVector.begin();
+    while(itr != m_DataVector.end())
+    {
+      if( itr->keyname.compare(keyname)==0 )
+      {
+        m_LastFound=&*itr;
+        
+        return m_LastFound;
+      }
+      itr++;
+    }
+    
+    return m_LastFound;
+  }
+  
+  void Add(const std::wstring& OraOwner,const std::wstring& OraTableName,const \
std::wstring& OraGeomName,const std::wstring& OverFdoClassName +        
+          ,FdoClassDefinition* ClassDef,FdoKgOraClassDefinition* KgOraClassDef,const \
std::vector<std::wstring>& OverridePrimeryColumns // no ref count +          ,const \
std::wstring& spatial_owner,const std::wstring& spatial_table // used to connect to \
xxx_sdo_geom_metada to read srid +          )
+  {
+    m_DataVector.push_back(s_data(OraOwner,OraTableName,OraGeomName,OverFdoClassName,ClassDef,KgOraClassDef,OverridePrimeryColumns,spatial_owner,spatial_table));
 +  }
+
+  void SetKgOraSpatialContextCollection( c_KgOraSpatialContextCollection* \
SC_Collection ) +  {
+    m_SC_Collection=SC_Collection;
+  }
+  c_KgOraSpatialContextCollection* GetKgOraSpatialContextCollection( )
+  {
+    return m_SC_Collection;
+  }
+
+  int GetCount()
+  {
+    return m_DataVector.size();
+  }
+
+  c_MapOraNameToFdoClass::s_data* Get( int ind )
+  {
+    return &m_DataVector.at(ind);
+  }
+
+
+
+
+
+protected:
+  std::wstring m_LasTriedName;  
+  s_data* m_LastFound;
+  
+  c_KgOraSpatialContextCollection* m_SC_Collection;
+  
+  
+  typedef std::vector<s_data> t_datavector;
+  t_datavector m_DataVector;
+};
+
+
+c_FdoOra_API3::c_FdoOra_API3(void)
+{
+}
+
+c_FdoOra_API3::~c_FdoOra_API3(void)
+{
+}
+
+
+bool c_FdoOra_API3::OraTypeToFdoDataType(ub2 OCiDataType,int Precision,int Scale,int \
Length,FdoDataType & FdoType) +{
+  bool isfdotype=true;
+  switch( OCiDataType )
+  {
+    case OCI_TYPECODE_VARCHAR2:  // varchar2
+    case OCI_TYPECODE_VARCHAR:  // varchar2
+      FdoType = FdoDataType_String;   
+    break;
+    
+    case OCI_TYPECODE_NUMBER:  // NUMBER
+    case OCI_TYPECODE_DECIMAL:  // NUMBER
+      if( Scale <= 0 && Precision>=1 ) 
+      {
+        if( Precision <= 4 )
+        {
+          FdoType = FdoDataType_Int16;  
+        }
+        else 
+        {
+          if( Precision <= 9 )
+          {
+            FdoType = FdoDataType_Int32;  
+          }
+          else
+          {
+            if( Precision <= 19 ) // this is deliberately to be 19 so it stay as \
integer (not decimal) +              // even 19 places can exceed int64
+            {
+              FdoType = FdoDataType_Int64;  
+            }
+            else
+            {
+              FdoType = FdoDataType_Double;  
+            }
+
+          }
+
+        }
+      }
+      else FdoType = FdoDataType_Double;
+      
+    break;
+    
+    case OCI_TYPECODE_CHAR: // char
+      if( Length==1 ) FdoType = FdoDataType_Byte;
+      else FdoType = FdoDataType_String;
+    break;
+    
+    case OCI_TYPECODE_SIGNED16:
+        FdoType = FdoDataType_Int16;
+    break;
+        
+    case OCI_TYPECODE_INTEGER:
+    case OCI_TYPECODE_SIGNED32:
+      FdoType = FdoDataType_Int32;
+    break;
+    
+    case OCI_TYPECODE_SMALLINT:
+      FdoType = FdoDataType_Int16;
+    break;
+
+    case OCI_TYPECODE_BFLOAT:
+    case OCI_TYPECODE_FLOAT:
+      FdoType = FdoDataType_Single;  
+    break;
+    case OCI_TYPECODE_BDOUBLE:
+    case OCI_TYPECODE_DOUBLE:
+    case OCI_TYPECODE_REAL:
+      FdoType = FdoDataType_Double;  
+    break;    
+    
+    case OCI_TYPECODE_DATE:
+      FdoType = FdoDataType_DateTime;  
+    break;
+    case OCI_TYPECODE_BLOB:
+      FdoType = FdoDataType_BLOB;  
+    break;
+    case OCI_TYPECODE_CLOB:
+      FdoType = FdoDataType_CLOB;  
+    break;
+    default:
+      isfdotype = false;
+    break;
+  }
+  
+
+  
+  #ifdef _DEBUG
+  if( !isfdotype ) 
+  {
+    isfdotype =isfdotype;
+  }
+  #endif
+  
+  return isfdotype;
+}//end of c_FdoOra_API3::OraTypeToFdoDataType
+
+/*
+bool c_FdoOra_API3::FdoDataTypeToOraDataType(FdoDataType \
DataType,oracle::occi::Type& OraType) +{
+  switch( DataType )
+  {
+    case FdoDataType_Boolean:
+      OraType = oracle::occi::OCCISTRING;
+    break;
+
+    /// Represents unsigned 8-bit integers with values between 0 and 255.
+    case FdoDataType_Byte:
+      OraType = oracle::occi::OCCISTRING;
+    break;
+
+    /// Represents a date and time value.
+    case FdoDataType_DateTime:
+      OraType = oracle::occi::OCCIDATE;
+    break;
+
+    /// Represents values ranging from 1.0 x 10^-28 to approximately 7.9 x 10^28
+    /// with 28-29 significant digits.
+    case FdoDataType_Decimal:
+      OraType = oracle::occi::OCCINUMBER;
+    break;
+
+    /// Represents a floating point value ranging from approximately 5.0 
+    /// x 10^-324 to 1.7 x 10^308 with a precision of 15-16 digits.
+    case FdoDataType_Double:
+      OraType = oracle::occi::OCCIDOUBLE;
+    break;
+
+    /// Represents signed 16-bit integers with values between -32768 and 32767.
+    case FdoDataType_Int16:
+      OraType = oracle::occi::OCCIINT;
+    break;
+
+    /// Represents signed 32-bit integers with values between -2147483648 
+    /// and 2147483647.
+    case FdoDataType_Int32:
+      OraType = oracle::occi::OCCIINT;
+    break;
+
+    /// Represents signed 64-bit integers with values 
+    /// between -9223372036854775808 and 9223372036854775807.
+    case FdoDataType_Int64:
+      OraType = oracle::occi::OCCINUMBER;
+    break;
+
+    /// Represents floating point values ranging from approximately 1.5 x 10^-45
+    /// to 3.4 x 10^38, with a precision of 7 digits. 
+    case FdoDataType_Single:
+      OraType = oracle::occi::OCCIFLOAT;
+    break;
+
+    /// Represents a Unicode character strings.
+    case FdoDataType_String:
+      OraType = oracle::occi::OCCISTRING;
+    break;
+
+    /// Represents a binary large object stored as a collection of bytes.
+    case FdoDataType_BLOB:
+      OraType = oracle::occi::OCCIBLOB;
+    break;
+
+    /// Represents a character large object stored as a collection of
+    /// characters.
+    case FdoDataType_CLOB:
+      OraType = oracle::occi::OCCICLOB;
+    break;
+    
+    default:
+      return false;
+    break;    
+  }
+ 
+  return true;
+}//end of c_FdoOra_API3::FdoDataTypeToOraDataType
+*/
+
+
+
+
+bool c_FdoOra_API3::SetOracleStatementData(c_Oci_Statement*  Statement,int \
SqlParamNum,FdoDataValue* DataValue) +{
+  
+  switch( DataValue->GetDataType() )
+  {
+    case FdoDataType_Boolean:
+    {
+      
+      if( DataValue->IsNull() )
+        Statement->BindString(SqlParamNum,NULL);
+      else
+      {
+        FdoBooleanValue * boolval = (FdoBooleanValue*)DataValue;
+        string val;
+        if( boolval->GetBoolean() )
+          Statement->BindStringValue(SqlParamNum,L"1");          
+        else
+          Statement->BindStringValue(SqlParamNum,L"0");
+          
+        
+      }
+    }
+    break;
+
+    /// Represents unsigned 8-bit integers with values between 0 and 255.
+    case FdoDataType_Byte:      
+    {
+      
+      if( DataValue->IsNull() )
+        Statement->BindString(SqlParamNum,NULL);
+      else
+      {
+        FdoByteValue * byteval = (FdoByteValue*)DataValue;
+        wchar_t chstr[2];
+        chstr[0] = byteval->GetByte();
+        chstr[1] = 0;
+        
+        Statement->BindStringValue(SqlParamNum,chstr);
+      }
+    }  
+    break;
+
+    /// Represents a date and time value.
+    case FdoDataType_DateTime:      
+    {
+      
+      if( DataValue->IsNull() )
+        Statement->BindDate(SqlParamNum,NULL);
+      else
+      {
+        FdoDateTimeValue * dateval = (FdoDateTimeValue*)DataValue;
+        
+        FdoDateTime date = dateval->GetDateTime();
+        OCIDate val;
+        val.OCIDateYYYY = date.year;
+        val.OCIDateMM = date.month;
+        val.OCIDateDD = date.day;
+        val.OCIDateTime.OCITimeHH = date.hour;
+        val.OCIDateTime.OCITimeMI = date.minute;
+        val.OCIDateTime.OCITimeSS = (ub1)date.seconds;
+        
+        Statement->BindDateValue(SqlParamNum,val);
+      }
+    }
+    break;
+
+    /// Represents values ranging from 1.0 x 10^-28 to approximately 7.9 x 10^28
+    /// with 28-29 significant digits.
+    case FdoDataType_Decimal:      
+    {
+      
+      if( DataValue->IsNull() )
+        Statement->BindDouble(SqlParamNum,NULL);
+      else
+      {
+        FdoDecimalValue * dval = (FdoDecimalValue*)DataValue;
+        
+        Statement->BindDoubleValue(SqlParamNum,dval->GetDecimal());
+      }
+    }
+    break;
+
+    /// Represents a floating point value ranging from approximately 5.0 
+    /// x 10^-324 to 1.7 x 10^308 with a precision of 15-16 digits.
+    case FdoDataType_Double:      
+    {
+      
+      if( DataValue->IsNull() )
+        Statement->BindDouble(SqlParamNum,NULL);
+      else
+      {
+        FdoDoubleValue * dval = (FdoDoubleValue*)DataValue;                        
+        Statement->BindDoubleValue(SqlParamNum,dval->GetDouble());
+      }
+    }
+    break;
+
+    /// Represents signed 16-bit integers with values between -32768 and 32767.
+    case FdoDataType_Int16:      
+    {
+      
+      if( DataValue->IsNull() )
+        Statement->BindInt(SqlParamNum,NULL);
+      else
+      {
+        FdoInt16Value * dval = (FdoInt16Value*)DataValue;                        
+        Statement->BindIntValue(SqlParamNum,dval->GetInt16());
+      }
+    }
+    break;
+
+    /// Represents signed 32-bit integers with values between -2147483648 
+    /// and 2147483647.
+    case FdoDataType_Int32:      
+    {
+      
+      if( DataValue->IsNull() )
+        Statement->BindInt(SqlParamNum,NULL);
+      else
+      {
+        FdoInt32Value * dval = (FdoInt32Value*)DataValue;                        
+        Statement->BindIntValue(SqlParamNum,dval->GetInt32());
+      }
+    }
+    break;
+
+    /// Represents signed 64-bit integers with values 
+    /// between -9223372036854775808 and 9223372036854775807.
+    case FdoDataType_Int64:
+    {
+      
+      if( DataValue->IsNull() )
+        Statement->BindInt64(SqlParamNum,NULL);
+      else
+      {
+        FdoInt64Value * dval = (FdoInt64Value*)DataValue;                        
+        
+        //long dval
+        
+        Statement->BindInt64Value(SqlParamNum,dval->GetInt64());
+      }
+    }
+    break;
+
+    /// Represents floating point values ranging from approximately 1.5 x 10^-45
+    /// to 3.4 x 10^38, with a precision of 7 digits. 
+    case FdoDataType_Single:      
+    {
+      
+      if( DataValue->IsNull() )
+        Statement->BindDouble(SqlParamNum,NULL);
+      else
+      {
+        FdoSingleValue * dval = (FdoSingleValue*)DataValue;                        
+        Statement->BindDoubleValue(SqlParamNum,dval->GetSingle());
+      }
+    }
+    break;
+
+    /// Represents a Unicode character strings.
+    case FdoDataType_String:      
+    {
+      
+      if( DataValue->IsNull() )
+        Statement->BindString(SqlParamNum,NULL);
+      else
+      {
+        FdoStringValue * dval = (FdoStringValue*)DataValue;                        
+        
+        Statement->BindString(SqlParamNum,dval->GetString());
+      }
+    }
+    break;
+
+    /// Represents a binary large object stored as a collection of bytes.
+    case FdoDataType_BLOB:
+    {
+      Statement->BindBlob(SqlParamNum,NULL,0);
+    }
+    break;
+
+    /// Represents a character large object stored as a collection of
+    /// characters.
+    case FdoDataType_CLOB:
+    {
+      Statement->BindClob(SqlParamNum,NULL,0);
+    }
+    break;
+    
+    default:
+      return false;
+    break;    
+  }
+ 
+  return true;
+}//end of c_FdoOra_API3::SetOracleStatementData
+
+bool c_FdoOra_API3::SetOracleStatementData(c_Oci_Statement*  Statement,const \
wchar_t*SqlParamName,FdoDataValue* DataValue) +{
+
+  switch( DataValue->GetDataType() )
+  {
+  case FdoDataType_Boolean:
+    {
+
+      if( DataValue->IsNull() )
+        Statement->BindString(SqlParamName,NULL);
+      else
+      {
+        FdoBooleanValue * boolval = (FdoBooleanValue*)DataValue;
+        string val;
+        if( boolval->GetBoolean() )
+          Statement->BindStringValue(SqlParamName,L"1");          
+        else
+          Statement->BindStringValue(SqlParamName,L"0");
+
+
+      }
+    }
+    break;
+
+    /// Represents unsigned 8-bit integers with values between 0 and 255.
+  case FdoDataType_Byte:      
+    {
+
+      if( DataValue->IsNull() )
+        Statement->BindString(SqlParamName,NULL);
+      else
+      {
+        FdoByteValue * byteval = (FdoByteValue*)DataValue;
+        wchar_t chstr[2];
+        chstr[0] = byteval->GetByte();
+        chstr[1] = 0;
+
+        Statement->BindStringValue(SqlParamName,chstr);
+      }
+    }  
+    break;
+
+    /// Represents a date and time value.
+  case FdoDataType_DateTime:      
+    {
+
+      if( DataValue->IsNull() )
+        Statement->BindDate(SqlParamName,NULL);
+      else
+      {
+        FdoDateTimeValue * dateval = (FdoDateTimeValue*)DataValue;
+
+        FdoDateTime date = dateval->GetDateTime();
+        OCIDate val;
+        val.OCIDateYYYY = date.year;
+        val.OCIDateMM = date.month;
+        val.OCIDateDD = date.day;
+        val.OCIDateTime.OCITimeHH = date.hour;
+        val.OCIDateTime.OCITimeMI = date.minute;
+        val.OCIDateTime.OCITimeSS = (ub1)date.seconds;
+
+        Statement->BindDateValue(SqlParamName,val);
+      }
+    }
+    break;
+
+    /// Represents values ranging from 1.0 x 10^-28 to approximately 7.9 x 10^28
+    /// with 28-29 significant digits.
+  case FdoDataType_Decimal:      
+    {
+
+      if( DataValue->IsNull() )
+        Statement->BindDouble(SqlParamName,NULL);
+      else
+      {
+        FdoDecimalValue * dval = (FdoDecimalValue*)DataValue;
+
+        Statement->BindDoubleValue(SqlParamName,dval->GetDecimal());
+      }
+    }
+    break;
+
+    /// Represents a floating point value ranging from approximately 5.0 
+    /// x 10^-324 to 1.7 x 10^308 with a precision of 15-16 digits.
+  case FdoDataType_Double:      
+    {
+
+      if( DataValue->IsNull() )
+        Statement->BindDouble(SqlParamName,NULL);
+      else
+      {
+        FdoDoubleValue * dval = (FdoDoubleValue*)DataValue;                        
+        Statement->BindDoubleValue(SqlParamName,dval->GetDouble());
+      }
+    }
+    break;
+
+    /// Represents signed 16-bit integers with values between -32768 and 32767.
+  case FdoDataType_Int16:      
+    {
+
+      if( DataValue->IsNull() )
+        Statement->BindInt(SqlParamName,NULL);
+      else
+      {
+        FdoInt16Value * dval = (FdoInt16Value*)DataValue;                        
+        Statement->BindIntValue(SqlParamName,dval->GetInt16());
+      }
+    }
+    break;
+
+    /// Represents signed 32-bit integers with values between -2147483648 
+    /// and 2147483647.
+  case FdoDataType_Int32:      
+    {
+
+      if( DataValue->IsNull() )
+        Statement->BindInt(SqlParamName,NULL);
+      else
+      {
+        FdoInt32Value * dval = (FdoInt32Value*)DataValue;                        
+        Statement->BindIntValue(SqlParamName,dval->GetInt32());
+      }
+    }
+    break;
+
+    /// Represents signed 64-bit integers with values 
+    /// between -9223372036854775808 and 9223372036854775807.
+  case FdoDataType_Int64:
+    {
+
+      if( DataValue->IsNull() )
+        Statement->BindInt64(SqlParamName,NULL);
+      else
+      {
+        FdoInt64Value * dval = (FdoInt64Value*)DataValue;                        
+
+        //long dval
+
+        Statement->BindInt64Value(SqlParamName,dval->GetInt64());
+      }
+    }
+    break;
+
+    /// Represents floating point values ranging from approximately 1.5 x 10^-45
+    /// to 3.4 x 10^38, with a precision of 7 digits. 
+  case FdoDataType_Single:      
+    {
+
+      if( DataValue->IsNull() )
+        Statement->BindDouble(SqlParamName,NULL);
+      else
+      {
+        FdoSingleValue * dval = (FdoSingleValue*)DataValue;                        
+        Statement->BindDoubleValue(SqlParamName,dval->GetSingle());
+      }
+    }
+    break;
+
+    /// Represents a Unicode character strings.
+  case FdoDataType_String:      
+    {
+
+      if( DataValue->IsNull() )
+        Statement->BindString(SqlParamName,NULL);
+      else
+      {
+        FdoStringValue * dval = (FdoStringValue*)DataValue;                        
+
+        Statement->BindString(SqlParamName,dval->GetString());
+      }
+    }
+    break;
+
+    /// Represents a binary large object stored as a collection of bytes.
+  case FdoDataType_BLOB:
+    {
+      Statement->BindBlob(SqlParamName,NULL,0);
+    }
+    break;
+
+    /// Represents a character large object stored as a collection of
+    /// characters.
+  case FdoDataType_CLOB:
+    {
+      Statement->BindClob(SqlParamName,NULL,0);
+    }
+    break;
+
+  default:
+    return false;
+    break;    
+  }
+
+  return true;
+}//end of c_FdoOra_API3::SetOracleStatementData
+
+bool c_FdoOra_API3::OraTypeToFdoDataType(const char* OraType,int Precision,int \
Scale,int Length,FdoDataType & FdoType) +{
+  
+  bool isfdotype=false;
+  
+  if( FdoCommonOSUtil::stricmp(OraType,"VARCHAR2") == 0 )
+  {
+    FdoType = FdoDataType_String;      
+    isfdotype=true;
+  } else
+  if( FdoCommonOSUtil::stricmp(OraType,"VARCHAR") == 0 )
+  {
+    FdoType = FdoDataType_String;      
+    isfdotype=true;
+  } else
+  if( FdoCommonOSUtil::stricmp(OraType,"NUMBER") == 0 )
+  {            
+    if( Scale <= 0 && Precision>=1 ) 
+    {
+      if( Precision <= 4 )
+      {
+        FdoType = FdoDataType_Int16;  
+      }
+      else 
+      {
+        if( Precision <= 9 )
+        {
+          FdoType = FdoDataType_Int32;  
+        }
+        else
+        {
+          if( Precision <= 19 ) // this is deliberately to be 19 so it stay as \
integer (not decimal) +            // even 19 places can exceed int64
+          {
+            FdoType = FdoDataType_Int64;  
+          }
+          else
+          {
+            FdoType = FdoDataType_Double;  
+          }
+
+        }
+
+      }
+    }
+    else FdoType = FdoDataType_Double;
+    isfdotype=true;
+  } else
+  if( FdoCommonOSUtil::stricmp(OraType,"CHAR") == 0 )
+  {            
+    if( Length==1 ) FdoType = FdoDataType_Byte;
+    else FdoType = FdoDataType_String;
+    isfdotype=true;
+  } else
+  if( FdoCommonOSUtil::stricmp(OraType,"BINARY_FLOAT") == 0 || \
(FdoCommonOSUtil::stricmp(OraType,"FLOAT") == 0) ) +  {            
+    FdoType = FdoDataType_Single;    
+    isfdotype=true;
+  } else
+  if( FdoCommonOSUtil::stricmp(OraType,"BINARY_DOUBLE") == 0 || \
(FdoCommonOSUtil::stricmp(OraType,"DOUBLE") == 0) ) +  {            
+    FdoType = FdoDataType_Double;    
+    isfdotype=true;
+  } else
+  if( FdoCommonOSUtil::stricmp(OraType,"DATE") == 0 )
+  {            
+    FdoType = FdoDataType_DateTime;    
+    isfdotype=true;
+  } else
+  if( FdoCommonOSUtil::stricmp(OraType,"BLOB") == 0 )
+  {            
+    FdoType = FdoDataType_BLOB;    
+    isfdotype=true;
+  } else
+  if( FdoCommonOSUtil::stricmp(OraType,"CLOB") == 0 )
+  {            
+    FdoType = FdoDataType_CLOB;    
+    isfdotype=true;
+  }  
+  
+  #ifdef _DEBUG
+  if( !isfdotype ) 
+  {
+    isfdotype =isfdotype;
+  }
+  #endif
+  
+  return isfdotype;
+}//end of c_FdoOra_API3::OraTypeToFdoDataType
+
+bool c_FdoOra_API3::OraTypeToFdoDataType(const wchar_t* OraType,int Precision,int \
Scale,int Length,FdoDataType & FdoType) +{
+
+  bool isfdotype=false;
+
+  if( FdoCommonOSUtil::wcsicmp(OraType,L"VARCHAR2") == 0  || \
FdoCommonOSUtil::wcsicmp(OraType,L"VARCHAR") == 0 || \
FdoCommonOSUtil::wcsicmp(OraType,L"NVARCHAR") == 0 || \
FdoCommonOSUtil::wcsicmp(OraType,L"NVARCHAR2") == 0) +  {
+    FdoType = FdoDataType_String;      
+    isfdotype=true;
+  } else
+      if( FdoCommonOSUtil::wcsicmp(OraType,L"NUMBER") == 0 || \
FdoCommonOSUtil::wcsicmp(OraType,L"DECIMAL") == 0 ) +      {            
+        if( Scale <= 0 && Precision>=1 ) 
+        {
+          if( Precision <= 4 )
+          {
+            FdoType = FdoDataType_Int16;  
+          }
+          else 
+          {
+            if( Precision <= 9 )
+            {
+              FdoType = FdoDataType_Int32;  
+            }
+            else
+            {
+              if( Precision <= 19 ) // this is deliberately to be 19 so it stay as \
integer (not decimal) +                // even 19 places can exceed int64
+              {
+                FdoType = FdoDataType_Int64;  
+              }
+              else
+              {
+                FdoType = FdoDataType_Double;  
+              }
+
+            }
+
+          }
+        }
+        else FdoType = FdoDataType_Double;
+        isfdotype=true;
+      } else
+        if( FdoCommonOSUtil::wcsicmp(OraType,L"CHAR") == 0 )
+        {            
+          if( Length==1 ) FdoType = FdoDataType_Byte;
+          else FdoType = FdoDataType_String;
+          isfdotype=true;
+        } else
+        if( FdoCommonOSUtil::wcsicmp(OraType,L"INTEGER") == 0 )
+        {            
+          FdoType = FdoDataType_Int64;          
+        } else
+          if( FdoCommonOSUtil::wcsicmp(OraType,L"BINARY_FLOAT") == 0 )
+          {            
+            FdoType = FdoDataType_Single;    
+            isfdotype=true;
+          } else
+            if( FdoCommonOSUtil::wcsicmp(OraType,L"BINARY_DOUBLE") == 0 || \
(FdoCommonOSUtil::wcsicmp(OraType,L"DOUBLE") == 0) || \
(FdoCommonOSUtil::wcsicmp(OraType,L"FLOAT") == 0) ) +            {            
+              FdoType = FdoDataType_Double;    
+              isfdotype=true;
+            } else
+              if( FdoCommonOSUtil::wcsicmp(OraType,L"DATE") == 0 )
+              {            
+                FdoType = FdoDataType_DateTime;    
+                isfdotype=true;
+              } else
+                if( FdoCommonOSUtil::wcsicmp(OraType,L"BLOB") == 0 )
+                {            
+                  FdoType = FdoDataType_BLOB;    
+                  isfdotype=true;
+                } else
+                  if( FdoCommonOSUtil::wcsicmp(OraType,L"CLOB") == 0 )
+                  {            
+                    FdoType = FdoDataType_CLOB;    
+                    isfdotype=true;
+                  }  
+
+#ifdef _DEBUG
+                  if( !isfdotype ) 
+                  {
+                    isfdotype =isfdotype;
+                  }
+#endif
+
+                  return isfdotype;
+}//end of c_FdoOra_API3::OraTypeToFdoDataType
+
+bool c_FdoOra_API3::DescribeTableProperties(c_Oci_Connection * OciConn,const \
wchar_t*SqlColumns,bool BindOwner,const wchar_t* OraOwner +                           \
,c_MapOraNameToFdoClass& MapOraToClass) +{
+
+  int numcols=0;
+
+  c_Oci_Statement *stm = OciConn->CreateStatement(); 
+
+
+  if( BindOwner )
+  {
+    stm->Prepare(SqlColumns);
+
+    stm->BindString(1,OraOwner);
+    
+  }
+  else
+  {
+    stm->Prepare(SqlColumns);
+  }
+  
+  
+  c_MapOraNameToFdoClass::s_data * mapdata;
+  FdoClassDefinition* classdef;
+  //FdoKgOraClassDefinition* kgoraclassdef;
+  
+  std::wstring strnullable;
+  stm->ExecuteSelectAndDefine();
+  //ResultSet * rs = stm->executeQuery();
+  while( stm->ReadNext() )
+  {
+    //L" select a.owner, a.table_name, b.column_name, b.data_type, b.data_length, \
b.data_precision, b.data_scale "     +    std::wstring oraowner;
+    if( !stm->IsColumnNull(1) )
+     oraowner = stm->GetString(1);
+    else
+      oraowner=OraOwner ? OraOwner : L"";
+    
+    
+    if( !oraowner.empty() && !stm->IsColumnNull(2) && !stm->IsColumnNull(5) )
+    {      
+      
+      std::wstring oratable = stm->GetString(2);
+      std::wstring orageom = stm->IsColumnNull(3) ? L"" : stm->GetString(3);
+      std::wstring fdoclassname = stm->IsColumnNull(4) ? L"" : stm->GetString(4);
+      
+      
+      
+      mapdata = MapOraToClass.FindClassDef(oraowner,oratable,orageom,fdoclassname);
+      if( mapdata )
+      {
+        classdef = mapdata->fdoclass;
+        FdoPtr<FdoPropertyDefinitionCollection> propscoll = \
classdef->GetProperties(); +        
+        if( !stm->IsColumnNull(5) )
+        {
+          std::wstring columnname = stm->GetString(5);
+          
+          bool isfdotype=false;
+          FdoDataType fdotype;
+          
+         FdoInt32 length=0,precision=0,scale=0;
+
+          // length          
+          if( !stm->IsColumnNull(7) )          
+          {
+            length = stm->GetInteger(7);
+          }
+          else length = 0;
+
+          // precision          
+          if( !stm->IsColumnNull(8) )          
+          {
+            precision = stm->GetInteger(8);
+          }
+          else precision = 0;
+
+          // scale   
+          if( !stm->IsColumnNull(9) )          
+          {
+            scale = stm->GetInteger(9);
+          }
+          else 
+          {
+            scale = -1; // not null because if 0 then it wil become integer but \
should be decimal withundefined scale +          }
+
+          // nullable
+          bool isnullable=true;
+          if( !stm->IsColumnNull(10) )          
+          {
+            strnullable = stm->GetString(10);
+            if( !strnullable.empty() && strnullable.at(0)==L'N' )
+              isnullable=false;
+          }
+          
+
+          // data type
+          if( !stm->IsColumnNull(6) )
+          {
+            wstring datatype = stm->GetString(6);
+            
+
+            isfdotype = \
OraTypeToFdoDataType(datatype.c_str(),precision,scale,length,fdotype); +
+            if( isfdotype )
+            {            
+              try
+              {
+              
+                FdoPtr<FdoDataPropertyDefinition> dpd = \
FdoDataPropertyDefinition::Create(columnname.c_str(), L""); +                \
dpd->SetDataType(fdotype); +                dpd->SetLength(length);
+                dpd->SetPrecision(precision);
+                dpd->SetScale(scale);
+                dpd->SetNullable(isnullable);
+
+                propscoll->Add(dpd);
+              }
+              catch (FdoException* exp)
+              {
+                FdoStringP fstr = exp->GetExceptionMessage();
+                D_KGORA_ELOG_WRITE1("c_FdoOra_API3::DescribeSchemaSQL.Error : \
'%s'",(const char*)fstr);       +                exp->Release();
+              }
+            }
+            else
+            {
+              // perhaps it is geometry
+              if( wcscmp(datatype.c_str(),L"SDO_GEOMETRY") == 0 )
+              {
+                FdoPtr<FdoPropertyDefinition> f = \
propscoll->FindItem(columnname.c_str()); +                if( !f.p )
+                {
+                  try
+                  {
+                    FdoPtr<c_KgOraSpatialContext> spcontext;
+                    
+                    std::wstring sowner,stable;
+                    sowner = mapdata->spatial_owner;
+                    if( sowner.empty() )
+                      sowner = oraowner;
+                    stable = mapdata->spatial_table;
+                    if( stable.empty() )
+                      stable = oratable;
+                    
+                    
+                    bool isz,ism;  
+                    spcontext = \
CreateSpatialContext(OciConn,sowner.c_str(),stable.c_str(),columnname.c_str(),MapOraToClass.GetKgOraSpatialContextCollection(),isz,ism);
 +                    FdoPtr<FdoGeometricPropertyDefinition> geomprop = \
FdoGeometricPropertyDefinition::Create(columnname.c_str(),L""); +                    \
geomprop->SetHasElevation(isz); +                    geomprop->SetHasMeasure(ism);
+
+                    if( spcontext.p )
+                    {
+                      geomprop->SetSpatialContextAssociation(spcontext->GetName());
+                    }
+                    propscoll->Add(geomprop);
+                  }
+                  catch (FdoException* exp)
+                  {
+                    exp->Release();
+                  }
+                }
+
+
+              }
+            }
+          }
+        }
+      }
+    }
+    numcols++;
+  }
+
+  OciConn->TerminateStatement (stm);
+
+  return numcols;
+
+    
+}//end of c_FdoOra_API3::DescribeTableProperties
+
+
+bool c_FdoOra_API3::DescribeTablePrimaryKey(c_Oci_Connection * OciConn,const \
wchar_t*SqlPkey,bool BindOwner,const wchar_t* OraOwner +                              \
,c_MapOraNameToFdoClass& MapOraToClass) +{
+
+  int numcols=0;
+
+  
+// go read columns for primary key
+if( SqlPkey && *SqlPkey )
+{
+  c_Oci_Statement *stm = OciConn->CreateStatement(); 
+  if( BindOwner )
+  {
+    stm->Prepare(SqlPkey);
+
+    stm->BindString(1,OraOwner);
+
+  }
+  else
+  {
+    stm->Prepare(SqlPkey);
+  }
+
+  std::wstring fulltable;
+  FdoClassDefinition* classdef;
+  FdoKgOraClassDefinition* kgoraclassdef;
+
+  std::vector<std::wstring> primarycols;
+  std::wstring strnullable;
+  stm->ExecuteSelectAndDefine();
+  //ResultSet * rs = stm->executeQuery();
+  while( stm->ReadNext() )
+  {
+    std::wstring oraowner;
+    if( !stm->IsColumnNull(1) )
+      oraowner = stm->GetString(1);
+    else
+      oraowner=OraOwner ? OraOwner : L"";
+      
+    //L" select a.owner, a.table_name, b.column_name, b.data_type, b.data_length, \
b.data_precision, b.data_scale "     +    if( !oraowner.empty() && \
!stm->IsColumnNull(2) && !stm->IsColumnNull(5)  ) +    {      
+      std::wstring oratable = stm->GetString(2);
+      std::wstring orageom = stm->IsColumnNull(3) ? L"" : stm->GetString(3);
+      std::wstring fdoclassname = stm->IsColumnNull(4) ? L"" : stm->GetString(4);
+      
+      fulltable  = oraowner;  
+      fulltable.append(L".");
+      fulltable.append(oratable);
+      
+      std::wstring geomcolumn = stm->GetString(3);
+
+      std::wstring pkcolumn = stm->GetString(5);
+      c_MapOraNameToFdoClass::s_data *sdata = \
MapOraToClass.FindClassDef(oraowner,oratable,orageom,fdoclassname); +      if( sdata \
) +      {
+        sdata->primarycolumns.push_back(pkcolumn);        
+      }
+    }
+    numcols++;
+  }
+
+  OciConn->TerminateStatement (stm);
+}
+
+  // now walk throu classes and applied found primary key collumns or ones which \
ahve been overried in KingFdoClass table +  int cnt = MapOraToClass.GetCount();
+  for(int ind=0;ind<cnt;ind++)
+  {
+    c_MapOraNameToFdoClass::s_data* mapdata = MapOraToClass.Get(ind);
+    
+    std::vector<std::wstring> *pkcols=NULL;
+    if( mapdata && mapdata->overprimary.size()>0 )
+    {
+      pkcols = &mapdata->overprimary;
+    }
+    else
+    {
+      if( mapdata && mapdata->primarycolumns.size()>0 )
+      {
+        pkcols = &mapdata->primarycolumns;
+      }
+    }
+    
+    if( pkcols && pkcols->size() > 0 )
+    {
+      FdoPtr<FdoPropertyDefinitionCollection> fdoprops = \
mapdata->fdoclass->GetProperties(); +      bool isidentity_int=true;
+      std::vector<std::wstring>::iterator iter = pkcols->begin();
+      for ( iter = pkcols->begin( ) ; iter != pkcols->end( ) ; iter++ )
+      {
+        FdoStringP gstr = iter->c_str();
+        FdoPtr<FdoDataPropertyDefinition> entid = \
dynamic_cast<FdoDataPropertyDefinition*>(fdoprops->FindItem(gstr)); +        if( \
entid.p ) +        {            
+          entid->SetNullable(false);
+          FdoPtr<FdoDataPropertyDefinitionCollection> ic = \
mapdata->fdoclass->GetIdentityProperties(); +          ic->Add( entid );
+
+          FdoDataType datatype = entid->GetDataType();
+          if( (datatype == FdoDataType_Int16) || (datatype == FdoDataType_Int32) || \
(datatype == FdoDataType_Int64) ) +          {
+
+          }
+          else
+          {
+            isidentity_int = false;
+          }
+        }  
+      }
+    }    
+  }
+
+  return numcols;
+
+
+}//end of c_FdoOra_API3::DescribeTablePrimaryKey
+
+
+
+
+
+/*
+select a.srid, a.table_name as geomtablename, a.column_name as geomcolumnname, 
+b.cs_name, b.wktext, 
+c.sdo_dimname as dname, c.sdo_lb as dmin, c.sdo_ub as dmax, c.sdo_tolerance as dtol 
+from ALL_SDO_GEOM_METADATA a, MDSYS.CS_SRS b, table(a.diminfo) c 
+where a.srid = b.srid (+) and a.owner = :1 ;
+*/
+//FdoPtr<FdoFeatureSchemaCollection> g_FeatureSchemas(NULL);
+//FdoPtr<FdoKgOraPhysicalSchemaMapping>  g_PhysicalSchemaMapping(NULL);
+
+c_KgOraSchemaDesc* c_FdoOra_API3::DescribeSchema(c_Oci_Connection* OciConn,const \
wchar_t* ConnectionOraSchema,const wchar_t* UseOraSchema +                           \
,const wchar_t* KingFdoViews,const wchar_t* SdeSchema) +{
+      
+        FdoPtr<FdoFeatureSchemaCollection> fschema;
+        FdoPtr<FdoKgOraPhysicalSchemaMapping> phschema;
+        int alias_num=0;
+      
+  
+  bool isoracle9=false;    
+  fschema = FdoFeatureSchemaCollection::Create(NULL);
+  
+  phschema = FdoKgOraPhysicalSchemaMapping::Create();
+  long aliasnum=0;
+  
+  FdoPtr<c_KgOraSpatialContextCollection> sc_collection = new \
c_KgOraSpatialContextCollection(); +
+
+
+// Create FDO classes from SDE tables
+{
+  if( SdeSchema && *SdeSchema )
+  {
+    FdoPtr<FdoFeatureSchema> schema;
+    
+    schema = (FdoFeatureSchema*)fschema->FindItem(L"KingOra");
+    if( !schema.p)
+    {        
+      schema = FdoFeatureSchema::Create(L"KingOra", L"");          
+      fschema->Add(schema.p);
+    }
+    FdoPtr<FdoClassCollection> classes = schema->GetClasses();
+
+    FdoPtr<FdoKgOraClassCollection> phys_classes = phschema->GetClasses();
+    
+    bool bind_owner = false;
+    c_FdoOra_API3::DescribeSchemaSDE(OciConn,UseOraSchema, \
classes,phys_classes,sc_collection,aliasnum); +  }
+}
+
+// Create FDO classes from tables in SDO_GEOM_METADATA
+if( OciConn->IsSdoTypes() )
+{  
+  FdoPtr<FdoFeatureSchema> schema;
+
+  schema = (FdoFeatureSchema*)fschema->FindItem(L"KingOra");
+  if( !schema.p)
+  {        
+    schema = FdoFeatureSchema::Create(L"KingOra", L"");          
+    fschema->Add(schema.p);
+  }
+  
+  FdoPtr<FdoClassCollection> classes = schema->GetClasses();
+  
+  FdoPtr<FdoKgOraClassCollection> phys_classes = phschema->GetClasses();
+  
+  try
+  {
+    
+    
+    //occi_stm->setSQL("select owner, table_name,column_name,srid,diminfo from \
all_sdo_geom_metadata where owner=:1 order by owner,table_name"); +    \
//occi_stm->setString(1,"OSE"); +    
+    // this is for 10.2 only ( not for previous releases )
+    /*
+    occi_stm->setSQL(    
+      " select a.owner, a.table_name, a.column_name, a.srid, a.diminfo, \
b.COORD_REF_SYS_NAME, b.LEGACY_WKTEXT, c.index_name, d.SDO_ROOT_MBR" +      " from \
all_sdo_geom_metadata a, SDO_COORD_REF_SYS b, ALL_SDO_INDEX_INFO c, \
ALL_SDO_INDEX_METADATA d" +      " where a.srid = b.srid(+) and a.owner = \
c.table_owner " +      " and a.table_name = c.table_name and c.sdo_index_owner = \
d.sdo_index_owner and c.index_name = d.sdo_index_name " +      " order by a.owner, \
a.table_name " +    );
+    */
+    
+    std::wstring sqlquery,sqlquery_columns,sqlquery_pkey ;
+    int mainversion,subversion;
+    c_Ora_API2::GetOracleVersion(OciConn,mainversion,subversion);
+    
+    bool bind_owner = false;
+    
+    // this is for prior 10.2 version (works also with 10.2)
+    if( !UseOraSchema || (*UseOraSchema == 0) )
+    {
+      if( mainversion >= 10 )
+      {
+        /*
+        occi_stm->setSQL(  
+        " select a.owner, a.table_name, a.column_name, a.srid, a.diminfo, b.CS_NAME, \
b.WKTEXT , c.index_name, d.SDO_ROOT_MBR " +        " from all_sdo_geom_metadata a, \
MDSYS.CS_SRS b, ALL_SDO_INDEX_INFO c, ALL_SDO_INDEX_METADATA d " +        " where \
a.srid = b.srid(+) and a.owner = c.table_owner " +        " and a.table_name = \
c.table_name and c.sdo_index_owner = d.sdo_index_owner and c.index_name = \
d.sdo_index_name " +        " order by a.owner, a.table_name"
+        );
+        */
+        
+        /*
+        sqlquery = \
+        L" select a.owner, a.table_name, a.column_name, a.srid, a.diminfo, \
b.CS_NAME, b.WKTEXT, c.index_name, d.sdo_layer_gtype, s.sequence_name, d.SDO_ROOT_MBR \
" +        L" ,NULL o1 ,NULL o2 ,NULL o3 ,NULL o4 ,NULL o5 ,NULL o6 ,NULL o7 ,NULL o8 \
,NULL o9 ,NULL o10, NULL o111 ,NULL o12 " +        L" from all_tab_columns t, \
all_sdo_geom_metadata a " +        L" LEFT JOIN MDSYS.CS_SRS b ON  a.srid = b.srid "
+        L" LEFT JOIN ALL_SDO_INDEX_INFO c ON  a.owner = c.table_owner and \
a.table_name = c.table_name and a.COLUMN_NAME = c.COLUMN_NAME  " +        L" LEFT \
JOIN ALL_SDO_INDEX_METADATA d ON c.sdo_index_owner = d.sdo_index_owner and \
c.index_name = d.sdo_index_name " +        L" LEFT JOIN all_sequences s on \
s.sequence_name = CONCAT(a.table_name,'_FDOSEQ') " +        L" where t.owner = \
a.owner and t.table_name=a.table_name and t.column_name = a.column_name " +        L" \
order by a.owner, a.table_name "; +        */
+        sqlquery = \
+        L" select a.owner, a.table_name, a.column_name, a.srid, a.diminfo, \
b.CS_NAME, b.WKTEXT, c.index_name, d.sdo_layer_gtype, s.sequence_name, d.SDO_ROOT_MBR \
" +        L" ,NULL o1 ,NULL o2 ,NULL o3 ,NULL o4 ,NULL o5 ,NULL o6 ,NULL o7 ,NULL o8 \
,NULL o9 ,NULL o10, NULL o111 ,NULL o12, NULL o13, NULL o14 " +        L" from \
all_sdo_geom_metadata a " +        L" LEFT JOIN MDSYS.CS_SRS b ON  a.srid = b.srid "
+        L" LEFT JOIN ALL_SDO_INDEX_INFO c ON  a.owner = c.table_owner and \
a.table_name = c.table_name and a.COLUMN_NAME = c.COLUMN_NAME  " +        L" LEFT \
JOIN ALL_SDO_INDEX_METADATA d ON c.sdo_index_owner = d.sdo_index_owner and \
c.index_name = d.sdo_index_name " +        L" LEFT JOIN all_sequences s on \
s.sequence_name = CONCAT(a.table_name,'_FDOSEQ') ORDER BY a.owner, a.table_name "; +  \
 +        sqlquery_columns = \
+          L" select a.owner, a.table_name,a.column_name,NULL, b.column_name, \
b.data_type, b.data_length, b.data_precision, b.data_scale, b.nullable " +          \
L" from all_sdo_geom_metadata a " +          L" LEFT JOIN all_tab_cols b ON a.owner = \
b.owner and a.table_name = b.table_name WHERE b.hidden_column='NO'"; +          
+          
+
+        sqlquery_pkey = L"SELECT a.owner, a.table_name, a.column_name,NULL, \
cols.column_name" +          L" FROM all_sdo_geom_metadata a,all_constraints cons, \
all_cons_columns cols" +          L" WHERE cons.table_name = a.table_name and \
cons.owner = a.owner" +          L" AND cons.constraint_type = 'P' AND \
cons.constraint_name = cols.constraint_name AND cons.owner = cols.owner" +          \
L" ORDER BY a.owner, a.table_name"; +          
+       
+      }
+      else
+      {
+        /*
+        occi_stm->setSQL(  
+        " select a.owner, a.table_name, a.column_name, a.srid, a.diminfo, b.CS_NAME, \
b.WKTEXT , c.index_name " +        " from all_sdo_geom_metadata a, MDSYS.CS_SRS b, \
ALL_SDO_INDEX_INFO c, ALL_SDO_INDEX_METADATA d " +        " where a.srid = b.srid(+) \
"  // this line is different for oracle 10 nad 9 +        " and a.table_name = \
c.table_name and c.sdo_index_owner = d.sdo_index_owner and c.index_name = \
d.sdo_index_name " +        " order by a.owner, a.table_name"
+        );
+        */
+        /*
+        sqlquery=\
+        L" select a.owner, a.table_name, a.column_name, a.srid, a.diminfo, \
b.CS_NAME, b.WKTEXT, c.index_name, d.sdo_layer_gtype, s.sequence_name, NULL \
SDO_ROOT_MBR " +        L" ,NULL o1 ,NULL o2 ,NULL o3 ,NULL o4 ,NULL o5 ,NULL o6 \
,NULL o7 ,NULL o8 ,NULL o9 ,NULL o10, NULL o111 ,NULL o12 " +        L" from \
all_tab_columns t, all_sdo_geom_metadata a " +        L" LEFT JOIN MDSYS.CS_SRS b ON  \
a.srid = b.srid " +        L" LEFT JOIN ALL_SDO_INDEX_INFO c ON a.table_name = \
c.table_name " +        L" LEFT JOIN ALL_SDO_INDEX_METADATA d ON c.sdo_index_owner = \
d.sdo_index_owner and c.index_name = d.sdo_index_name " +        L" LEFT JOIN \
all_sequences s on s.sequence_name = CONCAT(a.table_name,'_FDOSEQ') " +        L" \
where t.owner = a.owner and t.table_name=a.table_name and t.column_name = \
a.column_name " +        L" order by a.owner, a.table_name ";
+        */
+        sqlquery=\
+        L" select a.owner, a.table_name, a.column_name, a.srid, a.diminfo, \
b.CS_NAME, b.WKTEXT, c.index_name, d.sdo_layer_gtype, s.sequence_name, NULL \
SDO_ROOT_MBR " +        L" ,NULL o1 ,NULL o2 ,NULL o3 ,NULL o4 ,NULL o5 ,NULL o6 \
,NULL o7 ,NULL o8 ,NULL o9 ,NULL o10, NULL o111 ,NULL o12, NULL o13, NULL o14 " +     \
L" from all_sdo_geom_metadata a " +        L" LEFT JOIN MDSYS.CS_SRS b ON  a.srid = \
b.srid " +        L" LEFT JOIN ALL_SDO_INDEX_INFO c ON a.table_name = c.table_name "
+        L" LEFT JOIN ALL_SDO_INDEX_METADATA d ON c.sdo_index_owner = \
d.sdo_index_owner and c.index_name = d.sdo_index_name " +        L" LEFT JOIN \
all_sequences s on s.sequence_name = CONCAT(a.table_name,'_FDOSEQ') order by a.owner, \
a.table_name"; +        
+        sqlquery_columns = \
+          L" select a.owner, a.table_name,a.column_name,NULL, b.column_name, \
b.data_type, b.data_length, b.data_precision, b.data_scale, b.nullable " +          \
L" from all_sdo_geom_metadata a " +          L" LEFT JOIN all_tab_cols b ON a.owner = \
b.owner and a.table_name = b.table_name WHERE b.hidden_column='NO'"; +          
+        sqlquery_pkey = L"SELECT a.owner, a.table_name,a.column_name,NULL, \
cols.column_name" +          L" FROM all_sdo_geom_metadata a,all_constraints cons, \
all_cons_columns cols" +          L" WHERE cons.table_name = a.table_name and \
cons.owner = a.owner" +          L" AND cons.constraint_type = 'P' AND \
cons.constraint_name = cols.constraint_name AND cons.owner = cols.owner" +          \
L" ORDER BY a.owner, a.table_name";           +          
+        isoracle9=true;
+      }
+      
+      // SELECT SDO_AGGR_MBR(geom) FROM curvepolygon
+    }
+    else
+    {
+      if( mainversion >= 10 )
+      {
+        /*
+        occi_stm->setSQL(  
+        " select a.owner, a.table_name, a.column_name, a.srid, a.diminfo, b.CS_NAME, \
b.WKTEXT , c.index_name, d.SDO_ROOT_MBR " +        " from all_sdo_geom_metadata a, \
MDSYS.CS_SRS b, ALL_SDO_INDEX_INFO c, ALL_SDO_INDEX_METADATA d " +        " where \
a.owner = :1 and a.srid = b.srid(+) and a.owner = c.table_owner " +        " and \
a.table_name = c.table_name and c.sdo_index_owner = d.sdo_index_owner and \
c.index_name = d.sdo_index_name " +        " order by a.owner, a.table_name"
+        );
+        */
+        
+        /*
+        sqlquery=\
+        L" select a.owner, a.table_name, a.column_name, a.srid, a.diminfo, \
b.CS_NAME, b.WKTEXT, c.index_name, d.sdo_layer_gtype, s.sequence_name, d.SDO_ROOT_MBR \
" +        L" ,NULL o1 ,NULL o2 ,NULL o3 ,NULL o4 ,NULL o5 ,NULL o6 ,NULL o7 ,NULL o8 \
,NULL o9 ,NULL o10, NULL o111 ,NULL o12 " +        L" from all_tab_columns t, \
all_sdo_geom_metadata a " +        L" LEFT JOIN MDSYS.CS_SRS b ON  a.srid = b.srid "
+        L" LEFT JOIN ALL_SDO_INDEX_INFO c ON  a.owner = c.table_owner and \
a.table_name = c.table_name and a.COLUMN_NAME = c.COLUMN_NAME  " +        L" LEFT \
JOIN ALL_SDO_INDEX_METADATA d ON c.sdo_index_owner = d.sdo_index_owner and \
c.index_name = d.sdo_index_name " +        L" LEFT JOIN all_sequences s on \
s.sequence_name = CONCAT(a.table_name,'_FDOSEQ') " +        L" where t.owner = \
a.owner and t.table_name=a.table_name and t.column_name = a.column_name and t.owner = \
:1 " +        L" order by a.owner, a.table_name ";
+        */
+        //if( _wcsicmp(ConnectionOraSchema,UseOraSchema) == 0 )
+        if( FdoCommonOSUtil::wcsicmp(ConnectionOraSchema, UseOraSchema)==0 )
+        {
+          sqlquery=\
+          L" select NULL, a.table_name, a.column_name, a.srid, a.diminfo, b.CS_NAME, \
b.WKTEXT, c.index_name, d.sdo_layer_gtype, s.sequence_name, d.SDO_ROOT_MBR  " +       \
L" ,NULL o1 ,NULL o2 ,NULL o3 ,NULL o4 ,NULL o5 ,NULL o6 ,NULL o7 ,NULL o8 ,NULL o9 \
,NULL o10, NULL o111 ,NULL o12, NULL o13, NULL o14 " +          L" from \
user_sdo_geom_metadata a " +          L" LEFT JOIN MDSYS.CS_SRS b ON  a.srid = b.srid \
" +          L" LEFT JOIN user_SDO_INDEX_INFO c ON  a.table_name = c.table_name and \
a.COLUMN_NAME = c.COLUMN_NAME  " +          L" LEFT JOIN user_SDO_INDEX_METADATA d ON \
c.index_name = d.sdo_index_name " +          L" LEFT JOIN user_sequences s on \
s.sequence_name = CONCAT(a.table_name,'_FDOSEQ') order by a.table_name"; +          
+          sqlquery_columns = \
+            L" select NULL, a.table_name, a.column_name,NULL, b.column_name, \
b.data_type, b.data_length, b.data_precision, b.data_scale, b.nullable " +            \
L" from user_sdo_geom_metadata a " +            L" LEFT JOIN user_tab_cols b ON \
a.table_name = b.table_name WHERE b.hidden_column='NO'"; +            
+          sqlquery_pkey = L"SELECT NULL, a.table_name, a.column_name,NULL, \
cols.column_name" +            L" FROM user_sdo_geom_metadata a,user_constraints \
cons, user_cons_columns cols" +            L" WHERE cons.table_name = a.table_name "
+            L" AND cons.constraint_type = 'P' AND cons.constraint_name = \
cols.constraint_name AND cons.owner = cols.owner" +            L" ORDER BY \
a.table_name";             +        }
+        else
+        {
+          sqlquery=\
+          L" select a.owner, a.table_name, a.column_name, a.srid, a.diminfo, \
b.CS_NAME, b.WKTEXT, c.index_name, d.sdo_layer_gtype, s.sequence_name, d.SDO_ROOT_MBR \
" +          L" ,NULL o1 ,NULL o2 ,NULL o3 ,NULL o4 ,NULL o5 ,NULL o6 ,NULL o7 ,NULL \
o8 ,NULL o9 ,NULL o10, NULL o111 ,NULL o12, NULL o13, NULL o14 " +          L" from \
all_sdo_geom_metadata a " +          L" LEFT JOIN MDSYS.CS_SRS b ON  a.srid = b.srid \
" +          L" LEFT JOIN ALL_SDO_INDEX_INFO c ON  a.owner = c.table_owner and \
a.table_name = c.table_name and a.COLUMN_NAME = c.COLUMN_NAME  " +          L" LEFT \
JOIN ALL_SDO_INDEX_METADATA d ON c.sdo_index_owner = d.sdo_index_owner and \
c.index_name = d.sdo_index_name " +          L" LEFT JOIN all_sequences s on \
s.sequence_name = CONCAT(a.table_name,'_FDOSEQ') " +          L" where a.owner = :1 \
order by a.owner, a.table_name"; +          
+          sqlquery_columns = \
+            L" select a.owner, a.table_name,a.column_name,NULL, b.column_name, \
b.data_type, b.data_length, b.data_precision, b.data_scale, b.nullable " +            \
L" from all_sdo_geom_metadata a " +            L" LEFT JOIN all_tab_cols b ON a.owner \
= b.owner and a.table_name = b.table_name " +            L" where a.owner = :1 AND \
b.hidden_column='NO'"; +            
+          sqlquery_pkey = L"SELECT a.owner, a.table_name, a.column_name,NULL, \
cols.column_name" +            L" FROM all_sdo_geom_metadata a,all_constraints cons, \
all_cons_columns cols" +            L" WHERE a.owner=:1 and cons.table_name = \
a.table_name and cons.owner = a.owner" +            L" AND cons.constraint_type = 'P' \
AND cons.constraint_name = cols.constraint_name AND cons.owner = cols.owner" +        \
L" ORDER BY a.owner, a.table_name";   +          
+          bind_owner = true;
+        }
+        
+        
+      }
+      else
+      {
+      //----------------------------------------------------------
+      // For Oracle version before 10 and UseOraSchema is set
+      //----------------------------------------------------------
+      /*
+          occi_stm->setSQL(  
+            " select a.owner, a.table_name, a.column_name, a.srid, a.diminfo, \
b.CS_NAME, b.WKTEXT , c.index_name " +            " from all_sdo_geom_metadata a, \
MDSYS.CS_SRS b, ALL_SDO_INDEX_INFO c, ALL_SDO_INDEX_METADATA d " +            " where \
a.owner = :1 and a.srid = b.srid(+) " // this line is different for oracle 10 nad 9 + \
" and a.table_name = c.table_name and c.sdo_index_owner = d.sdo_index_owner and \
c.index_name = d.sdo_index_name " +            " order by a.owner, a.table_name"
+            );
+      */
+      /*
+        sqlquery=\
+        L" select a.owner, a.table_name, a.column_name, a.srid, a.diminfo, \
b.CS_NAME, b.WKTEXT, c.index_name, d.sdo_layer_gtype, s.sequence_name, NULL \
SDO_ROOT_MBR " +        L" ,NULL o1 ,NULL o2 ,NULL o3 ,NULL o4 ,NULL o5 ,NULL o6 \
,NULL o7 ,NULL o8 ,NULL o9 ,NULL o10, NULL o111 ,NULL o12 " +        L" from \
all_tab_columns t, all_sdo_geom_metadata a " +        L" LEFT JOIN MDSYS.CS_SRS b ON  \
a.srid = b.srid " +        L" LEFT JOIN ALL_SDO_INDEX_INFO c ON a.table_name = \
c.table_name and a.COLUMN_NAME = c.COLUMN_NAME  " +        L" LEFT JOIN \
ALL_SDO_INDEX_METADATA d ON c.sdo_index_owner = d.sdo_index_owner and c.index_name = \
d.sdo_index_name " +        L" LEFT JOIN all_sequences s on s.sequence_name = \
CONCAT(a.table_name,'_FDOSEQ') " +        L" where t.owner = a.owner and \
t.table_name=a.table_name and t.column_name = a.column_name and t.owner = :1 " +      \
L" order by a.owner, a.table_name "; +        */
+        
+        //if( wcscmp(ConnectionOraSchema,UseOraSchema) == 0 )
+        if( FdoCommonOSUtil::wcsicmp(ConnectionOraSchema, UseOraSchema)==0 )
+        {
+          sqlquery=\
+          L" select NULL, a.table_name, a.column_name, a.srid, a.diminfo, b.CS_NAME, \
b.WKTEXT, c.index_name, d.sdo_layer_gtype, s.sequence_name, NULL SDO_ROOT_MBR " +     \
L" ,NULL o1 ,NULL o2 ,NULL o3 ,NULL o4 ,NULL o5 ,NULL o6 ,NULL o7 ,NULL o8 ,NULL o9 \
,NULL o10, NULL o111 ,NULL o12, NULL o13, NULL o14 " +          L" from \
user_sdo_geom_metadata a " +          L" LEFT JOIN MDSYS.CS_SRS b ON  a.srid = b.srid \
" +          L" LEFT JOIN user_SDO_INDEX_INFO c ON a.table_name = c.table_name and \
a.COLUMN_NAME = c.COLUMN_NAME  " +          L" LEFT JOIN user_SDO_INDEX_METADATA d ON \
c.index_name = d.sdo_index_name " +          L" LEFT JOIN user_sequences s on \
s.sequence_name = CONCAT(a.table_name,'_FDOSEQ') "; // order by a.table_name"; +      \
 +          sqlquery_columns = \
+            L" select NULL, a.table_name,a.column_name,NULL, b.column_name, \
b.data_type, b.data_length, b.data_precision, b.data_scale, b.nullable " +            \
L" from user_sdo_geom_metadata a " +            L" LEFT JOIN user_tab_cols b ON \
a.table_name = b.table_name WHERE b.hidden_column='NO' "; +            
+          sqlquery_pkey = L"SELECT NULL, a.table_name,a.column_name,NULL, \
cols.column_name" +            L" FROM user_sdo_geom_metadata a,user_constraints \
cons, user_cons_columns cols" +            L" WHERE cons.table_name = a.table_name "
+            L" AND cons.constraint_type = 'P' AND cons.constraint_name = \
cols.constraint_name AND cons.owner = cols.owner"; +            //L" ORDER BY \
a.table_name";  +            
+          bind_owner = false;
+        }
+        else
+        {
+          sqlquery=\
+          L" select a.owner, a.table_name, a.column_name, a.srid, a.diminfo, \
b.CS_NAME, b.WKTEXT, c.index_name, d.sdo_layer_gtype, s.sequence_name, NULL \
SDO_ROOT_MBR " +          L" ,NULL o1 ,NULL o2 ,NULL o3 ,NULL o4 ,NULL o5 ,NULL o6 \
,NULL o7 ,NULL o8 ,NULL o9 ,NULL o10, NULL o111 ,NULL o12, NULL o13, NULL o14 " +     \
L" from all_sdo_geom_metadata a " +          L" LEFT JOIN MDSYS.CS_SRS b ON  a.srid = \
b.srid " +          L" LEFT JOIN ALL_SDO_INDEX_INFO c ON a.table_name = c.table_name \
and a.COLUMN_NAME = c.COLUMN_NAME  " +          L" LEFT JOIN ALL_SDO_INDEX_METADATA d \
ON c.sdo_index_owner = d.sdo_index_owner and c.index_name = d.sdo_index_name " +      \
L" LEFT JOIN all_sequences s on s.sequence_name = CONCAT(a.table_name,'_FDOSEQ') " +  \
L" where a.owner = :1 order by a.owner, a.table_name"; +          
+          sqlquery_columns = \
+            L" select a.owner, a.table_name,a.column_name,NULL, b.column_name, \
b.data_type, b.data_length, b.data_precision, b.data_scale, b.nullable " +            \
L" from all_sdo_geom_metadata a " +            L" LEFT JOIN all_tab_cols b ON a.owner \
= b.owner and a.table_name = b.table_name " +            L" where a.owner = :1 AND \
b.hidden_column='NO'"; +            
+          sqlquery_pkey = L"SELECT a.owner, a.table_name,a.column_name,NULL, \
cols.column_name" +            L" FROM all_sdo_geom_metadata a,all_constraints cons, \
all_cons_columns cols" +            L" WHERE a.owner=:1 and cons.table_name = \
a.table_name and cons.owner = a.owner" +            L" AND cons.constraint_type = 'P' \
AND cons.constraint_name = cols.constraint_name AND cons.owner = cols.owner" +        \
L" ORDER BY a.owner, a.table_name";   +            
+          bind_owner = true;
+        }
+        isoracle9=true;
+      }
+      
+      
+    }
+
+  
+    #ifdef D_TEST_SHEMASPEED
+      if(false)
+    #endif
+    {
+      c_FdoOra_API3::DescribeSchemaSQL(OciConn,sqlquery.c_str(),sqlquery_columns.c_st \
r(),sqlquery_pkey.c_str(),bind_owner,ConnectionOraSchema,UseOraSchema,classes,phys_classes,sc_collection,aliasnum,isoracle9);
 +    }
+    
+    
+    
+    
+  }
+  /*
+  catch(FdoException* e)
+  {
+    FDO_SAFE_RELEASE(e);
+    
+    
+  }
+  */
+  catch(c_Oci_Exception* ea)
+  {
+    FdoStringP gstr = ea->GetErrorText();
+    delete ea;
+    throw FdoException::Create( gstr );
+  }
+ 
+}
+// Create FDO classes from tables in KingFDOViews table
+if( OciConn->IsSdoTypes() && KingFdoViews && *KingFdoViews )
+{ 
+  // FdoPtr<FdoFeatureSchema> schema = fschema->FindItem(L"KingFdoClass"); 
+  // If I set different schema than when selecting feature in MG, it will not select \
one feature +  // but it will render all features blue. Workaround was to have one \
just one schema +  
+  FdoPtr<FdoFeatureSchema> schema = fschema->FindItem(L"KingOra"); 
+  
+  if( schema.p == NULL )
+  {
+    schema = FdoFeatureSchema::Create(L"KingOra", L"");          
+    fschema->Add(schema.p);
+  }
+  
+  FdoPtr<FdoClassCollection> classes = schema->GetClasses();
+  
+  FdoPtr<FdoKgOraClassCollection> phys_classes = phschema->GetClasses();
+  
+  
+  
+  try
+  {
+    
+    
+    
+    int mainversion,subversion;
+    c_Ora_API2::GetOracleVersion(OciConn,mainversion,subversion);
+    std::wstring sqlstr,sqlstr_columns,sqlstr_pkey;
+    
+    // For FDO classes created from FDO View Table (king metadata table)
+    // Oracle Schema connection parameter is irrelevant and not used
+    //if( !OraSchema || (*OraSchema == 0) )
+    {
+      if( mainversion >= 10 )
+      {
+        std::wstring sqlfrom,sqljoin;
+        
+        sqlfrom = L" select k.fdo_ora_owner, k.fdo_ora_name, k.fdo_ora_geomcolumn, \
a.srid, a.diminfo, b.CS_NAME, b.WKTEXT, c.index_name, d.sdo_layer_gtype, \
s.sequence_name, d.SDO_ROOT_MBR  " +            L" ,k.fdo_class_name, k.fdo_srid, \
k.fdo_diminfo, k.fdo_cs_name, k.fdo_wktext, k.fdo_layer_gtype, k.fdo_sequence_name, \
k.fdo_identity, k.fdo_sdo_root_mbr " +            L" ,k.fdo_point_x_column \
,k.fdo_point_y_column ,k.fdo_point_z_column ,k.FDO_SPATIALTABLE_OWNER \
,k.FDO_SPATIALTABLE_NAME "; +        
+        FdoStringP fromtable = FdoStringP::Format(L" FROM %s k ", KingFdoViews);
+        
+        sqlfrom = sqlfrom + (FdoString*)fromtable;
+        
+        sqljoin = L" LEFT JOIN all_sdo_geom_metadata a ON  \
UPPER(k.FDO_SPATIALTABLE_OWNER) = a.owner and UPPER(k.FDO_SPATIALTABLE_NAME) = \
a.table_name and UPPER(k.FDO_SPATIALTABLE_GEOMCOLUMN) = a.column_name " +            \
L" LEFT JOIN MDSYS.CS_SRS b ON  a.srid = b.srid " +            L" LEFT JOIN \
ALL_SDO_INDEX_INFO c ON  a.owner = c.table_owner and a.table_name = c.table_name " +  \
L" LEFT JOIN ALL_SDO_INDEX_METADATA d ON c.sdo_index_owner = d.sdo_index_owner and \
c.index_name = d.sdo_index_name " +            L" LEFT JOIN all_sequences s on \
s.sequence_name = CONCAT(a.table_name,'_FDOSEQ') " +            L" order by \
k.fdo_ora_owner, k.fdo_ora_name "; +        
+        sqlstr = sqlfrom + sqljoin;
+        
+        // columns
+        sqlstr_columns = L" select k.fdo_ora_owner, \
k.fdo_ora_name,k.fdo_ora_geomcolumn, k.fdo_class_name, b.column_name, b.data_type, \
b.data_length, b.data_precision, b.data_scale, b.nullable ";         +        \
sqlstr_columns.append((FdoString*)fromtable);           +        \
sqlstr_columns.append(L" LEFT JOIN all_tab_cols b ON k.fdo_ora_owner = b.owner and \
k.fdo_ora_name = b.table_name AND b.hidden_column='NO'  "); +       
+       
+       // pkey query
+        sqlstr_pkey.clear(); // pkeys are read from main table
+        
+      }
+      else
+      {
+        std::wstring sqlfrom,sqljoin;
+        
+        sqlfrom = L" select k.fdo_ora_owner, k.fdo_ora_name, k.fdo_ora_geomcolumn, \
a.srid, a.diminfo, b.CS_NAME, b.WKTEXT, c.index_name, d.sdo_layer_gtype, \
s.sequence_name, NULL SDO_ROOT_MBR " +              L" ,k.fdo_class_name, k.fdo_srid, \
k.fdo_diminfo, k.fdo_cs_name, k.fdo_wktext, k.fdo_layer_gtype, k.fdo_sequence_name, \
k.fdo_identity, k.fdo_sdo_root_mbr " +              L" ,k.fdo_point_x_column \
,k.fdo_point_y_column ,k.fdo_point_z_column ,k.FDO_SPATIALTABLE_OWNER \
,k.FDO_SPATIALTABLE_NAME  "; +        
+        FdoStringP fromtable = FdoStringP::Format(L" FROM %s k ", KingFdoViews);
+        
+        sqlfrom = sqlfrom + (FdoString*)fromtable;
+        
+        sqljoin =  L" LEFT JOIN all_sdo_geom_metadata a ON  \
UPPER(k.FDO_SPATIALTABLE_OWNER) = a.owner and UPPER(k.FDO_SPATIALTABLE_NAME) = \
a.table_name and UPPER(k.FDO_SPATIALTABLE_GEOMCOLUMN) = a.column_name " +            \
L" LEFT JOIN MDSYS.CS_SRS b ON  a.srid = b.srid " +            L" LEFT JOIN \
ALL_SDO_INDEX_INFO c ON a.table_name = c.table_name " +            L" LEFT JOIN \
ALL_SDO_INDEX_METADATA d ON c.sdo_index_owner = d.sdo_index_owner and c.index_name = \
d.sdo_index_name " +            L" LEFT JOIN all_sequences s on s.sequence_name = \
CONCAT(a.table_name,'_FDOSEQ') " +            L" order by k.fdo_ora_owner, \
k.fdo_ora_name "; +        
+        sqlstr = sqlfrom + sqljoin;
+        
+        // columns
+        sqlstr_columns = L" select k.fdo_ora_owner, k.fdo_ora_name, \
k.fdo_ora_geomcolumn,k.fdo_class_name, b.column_name, b.data_type, b.data_length, \
b.data_precision, b.data_scale, b.nullable ";         +        \
sqlstr_columns.append((FdoString*)fromtable);           +        \
sqlstr_columns.append(L" LEFT JOIN all_tab_cols b ON k.fdo_ora_owner = b.owner and \
k.fdo_ora_name = b.table_name AND b.hidden_column='NO'"); +
+
+        // pkey query
+        sqlstr_pkey.clear(); // pkeys are read from main table
+      
+      }
+    }
+    
+      
+    c_FdoOra_API3::DescribeSchemaSQL(OciConn,sqlstr.c_str(),sqlstr_columns.c_str(),sqlstr_pkey.c_str(),false,ConnectionOraSchema,NULL, \
classes,phys_classes,sc_collection,aliasnum,isoracle9); +    
+    
+  }
+  catch(FdoException* e)
+  {
+    FDO_SAFE_RELEASE(e);
+    
+  }
+  catch(c_Oci_Exception* ea)
+  {
+    
+    
+    // Just ignore any errors
+    
+    FdoStringP gstr = ea->what();
+    //throw FdoException::Create( gstr );
+  }
+  
+   
+}  
+  
+  c_KgOraSchemaDesc* schemadata = c_KgOraSchemaDesc::Create();
+  
+  schemadata->SetDesc(fschema,phschema,sc_collection);
+  
+  
+  return schemadata;
+}//end of c_KgOraConnection::DescribeSchema
+
+
+
+/*
+void c_FdoOra_API3::DescribeSchemaSQL(c_Oci_Connection * OciConn,const \
wchar_t*SqlString,FdoClassCollection* FdoClasses,FdoKgOraClassCollection* PhysClasses \
+                                      ,c_KgOraSpatialContextCollection* \
SC_Collection,long& AliasNum,bool IsOracle9) +{
+  clock_t elog_t1=clock();
+  
+  // initialize stmthp 
+  //OCIStmt 		*stmthp=NULL;
+  //OciConn->OciCheckError( OCIHandleAlloc((dvoid *)OciConn->m_OciHpEnvironment, \
(dvoid **)&stmthp, (ub4)OCI_HTYPE_STMT, (size_t)0, (dvoid **)0)); +  c_Oci_Statement \
stm(OciConn); +  // parse query 
+  
+  std::wstring sql( L"SELECT owner,table_name FROM ALL_SDO_GEOM_METADATA " );
+  OciConn->OciCheckError( OCIStmtPrepare(stm.m_OciHpStm, OciConn->m_OciHpError, 
+    (text *)sql.c_str(), (ub4)wcslen(sql.c_str())*sizeof(wchar_t), 
+    (ub4)OCI_NTV_SYNTAX, (ub4)OCI_DEFAULT));
+    
+  // table name
+  wchar_t owner[128];
+  wchar_t table_name[128];
+  OCIDefine *defn1p;
+  OciConn->OciCheckError( OCIDefineByPos(stm.m_OciHpStm, &defn1p, \
OciConn->m_OciHpError, (ub4)1,  +    (dvoid *)&owner[0], 
+    (sb4)sizeof(owner), SQLT_STR,
+    (dvoid *)0, (ub2 *)0, (ub2 *)0, 
+    (ub4)OCI_DEFAULT));      
+  OCIDefine *defn2p;
+  OciConn->OciCheckError( OCIDefineByPos(stm.m_OciHpStm, &defn2p, \
OciConn->m_OciHpError, (ub4)2,  +    (dvoid *)&table_name[0], 
+    (sb4)sizeof(table_name), SQLT_STR,
+    (dvoid *)0, (ub2 *)0, (ub2 *)0, 
+    (ub4)OCI_DEFAULT));        
+    
+  // execute 
+  int status = OCIStmtExecute(OciConn->m_OciHpServiceContext, stm.m_OciHpStm, \
OciConn->m_OciHpError, (ub4)1, (ub4)0,  +    (OCISnapshot *)NULL, (OCISnapshot \
*)NULL,  +    (ub4)OCI_DEFAULT);
+
+  bool has_more_data;
+  int rows_fetched;
+  if (status == OCI_SUCCESS_WITH_INFO || status == OCI_NO_DATA)
+  {
+    has_more_data = FALSE;
+  }
+  else
+  {
+    has_more_data = TRUE;
+    OciConn->OciCheckError( status);
+  }
+  
+   
+  OciConn->OciCheckError( OCIAttrGet((dvoid *)stm.m_OciHpStm, (ub4)OCI_HTYPE_STMT,
+    (dvoid *)&rows_fetched, (ub4 *)0, 
+    (ub4)OCI_ATTR_ROW_COUNT, OciConn->m_OciHpError));
+  
+  
+  int tablenum = 0;
+  while( rows_fetched>0 )
+  {
+    tablenum++;
+    
+    FdoPtr<FdoPropertyDefinitionCollection> col_propdef = \
FdoPropertyDefinitionCollection::Create(NULL); +    \
DescribeTableProperties(OciConn,owner,table_name,col_propdef); +    status = \
OCIStmtFetch2(stm.m_OciHpStm, OciConn->m_OciHpError, (ub4)1,  +      \
(ub2)OCI_FETCH_NEXT, 1,(ub4)OCI_DEFAULT); +      
+    if( status == OCI_SUCCESS)      
+      OciConn->OciCheckError(OCIAttrGet((dvoid *)stm.m_OciHpStm, \
(ub4)OCI_HTYPE_STMT, +        (dvoid *)&rows_fetched, (ub4 *)0, 
+        (ub4)OCI_ATTR_ROW_COUNT, OciConn->m_OciHpError));          
+    else
+      rows_fetched = 0;
+          
+  }
+  
+
+  
+      
+}
+*/
+
+
+/*
+  Creates FDO classes and adds them into FdoClassCollection.
+  
+  Classes are created based on records returned by sql statement 'OcciStm'.
+  SQL statement is different in two cases (but returned columns are same):
+    1. SQL statement which combines tables from SDO_GEOM_METADATA with dat from \
spatial indexes, primarykeys etc.. +    2. SQL statement which combines data from \
table 'FdoViews' with other data from spatial index or +    
+    
+  Meaning of coulmns and they order as should returnd by SQL statement (OcciStm):
+  
+  1. Oracle Owner (varchar2, not null )  - oracle owner ftom table/view which is \
used for querying fdo class data +  2. Oracle Name (varchar2, not null ) - oracle \
name of table/view used to query fdo class data +  3. Oracle Geometry Column ( \
varchar2, null )  - oracle name of column used to retrieve geometry for fdo class,can \
be NULLL. +  
+  4. SRID ( number, null ) - SRID coming from SDO_GEOM_METADATA or NULL
+  5. Dimension list (SDO_DIM_INFO_ARRAY, null) - Dimension info coming from \
SDO_GEOM_METADATA or NULL +  
+  6. CS Name ( varchar2 , null )  - Coordinate system name coming from \
SDO_GEOM_METADATA or NULL +  7. CS WkText ( varchar2 , null )  - Coordinate system \
well known text coming from SDO_GEOM_METADATA or NULL +  
+  8. SpatialIndexName ( varchar2, null ) - name of spatial index created on table or \
null +  
+  9. LayerGType (varchar2, null ) - coming from spatial index metadata or null
+  
+  10. SequenceName ( varchar2, null ) - name of Oracle sequence is defined which is \
used for inserting new rows +  
+  11. MBR ( SDO_GEOMETRY, null ) - extent of geometry, comes from spatial index or \
null +  
+  < From FDOVIEWS Table >
+  
+  12. Override FDO Class Name ( varchar2, null ) - name of the class which will be \
used as fdo class +  
+  13. Override SRID ( number, null ) - override srid
+  
+  14. Override Dimension list ( number, null ) - override srid
+  
+  15. Override CS Name ( varchar2 , null )  - Coordinate system name or NULL
+  16. Override CS WkText ( varchar2 , null )  - Coordinate system or NULL
+  
+  17. Override LayerGType (varchar2, null ) - coming from spatial index metadata or \
null +  
+  18. Override SequenceName ( varchar2, null ) - name of Oracle sequence is defined \
which is used for inserting new rows +  
+  19. Override Identity Coolumns ( varchar2, null ) - list of columns to be used for \
as identiy for class +  
+  20. Override MBR ( SDO_GEOMETRY, null ) - extent of geometry or null
+  
+  21. FDO_POINT_X_COLUMN (varchar2, null ) this column defines names of column with \
values for point geometry where values are stored as numbers in columns +  22. \
FDO_POINT_Y_COLUMN (varchar2, null ) x,y must be define to be used  and "3. Oracle \
Geometry Column" must be NULL +  23. FDO_POINT_Z_COLUMN (varchar2, null ) if 3d point \
then it is defined +  
+*/
+
+
+ // Test for coordinate system if exists and 
+c_KgOraSpatialContext* c_FdoOra_API3::CreateSpatialContext(c_Oci_Connection * \
OciConn,const wchar_t* Owner,const wchar_t* Table,const wchar_t* GeometryColumn +     \
,c_KgOraSpatialContextCollection* SC_Collection +      ,bool& IsZ,bool& IsM)
+{
+  std::wstring sqlstring;
+  c_Oci_Statement * stm=NULL;
+  FdoPtr<c_KgOraSpatialContext> spatial_context;
+try
+{  
+  // select a.srid, a.diminfo, b.CS_NAME, b.WKTEXT  from all_sdo_geom_metadata a \
left join mdsys.cs_srs b on a.srid=b.srid   +  // where owner='DEEODB4' and \
table_name='EOTR_TRAFOSTANICE' and column_name = 'GEOMETRY'; +  \
sqlstring.append(L"select a.srid, a.diminfo, b.CS_NAME, b.WKTEXT  from \
all_sdo_geom_metadata a left join mdsys.cs_srs b on a.srid=b.srid where owner=:1 and \
table_name=:2 and column_name=:3 "); +  stm = OciConn->CreateStatement();
+  stm->Prepare(sqlstring.c_str());
+  
+  stm->BindString(1,Owner);
+  stm->BindString(2,Table);
+  stm->BindString(3,GeometryColumn);
+  
+  stm->ExecuteSelectAndDefine();
+  
+  IsZ=IsM=false;
+  
+  if( !stm->ReadNext() )
+  {
+    spatial_context = SC_Collection->GetDefaultSpatialContext();  
+  }
+  else
+  {
+  
+    std::wstring ora_coord_sys_name,ora_coord_sys_wktext;
+    
+    bool ora_srid_isnull;
+    int ora_srid;
+    ora_srid_isnull = stm->IsColumnNull(1);
+    if( !ora_srid_isnull ) ora_srid = stm->GetInteger(1);
+    else ora_srid = 0;
+
+    //std::vector< SDO_DIM_ELEMENT* > ora_dimlist;
+    c_SDO_DIM_ARRAY ora_dimlist;
+    if( !stm->IsColumnNull(2) ) 
+    {
+      ora_dimlist = stm->GetSdoDimArray(2);
+      //oracle::occi::getVector(occi_rs,5,ora_dimlist);
+      // set if Class has Z or M coordinate values
+      if( ora_dimlist.GetSize() >2 )
+      {
+        if( ora_dimlist.GetSize() == 3 )
+        {
+          c_SDO_DIM_ELEMENT dimelem = ora_dimlist.GetDimElement(2);
+          std::wstring dimname;
+          if( !dimelem.IsNullDimName() && \
(FdoCommonOSUtil::wcsicmp(dimelem.GetDimName(),L"M") == 0) ) +            IsM = true;
+          else
+            IsZ = true;  
+        }
+        else
+        {
+          IsZ = true;
+          IsM = true;
+        }
+      }
+    }
+
+    ora_coord_sys_name = stm->IsColumnNull(3) ? L"" : stm->GetString(3);
+    ora_coord_sys_wktext = stm->IsColumnNull(4) ? L"" : stm->GetString(4);
+
+    
+    if( (long)ora_srid >= 0 )
+    {
+      FdoStringP cname = FdoStringP::Format(L"OracleSrid%ld",(long)ora_srid);
+      spatial_context = SC_Collection->FindItem(cname);
+      if( !spatial_context )
+      {
+        spatial_context = new c_KgOraSpatialContext();
+        spatial_context->SetName(cname);
+            
+        FdoStringP csname = ora_coord_sys_name.c_str();
+        spatial_context->SetCoordSysName(csname);
+            
+        FdoStringP cswkt = ora_coord_sys_wktext.c_str();
+        spatial_context->SetCoordinateSystemWkt(cswkt);
+            
+            
+        c_KgOraSridDesc orasriddesc;
+        orasriddesc.m_OraSrid = (long)ora_srid;
+        orasriddesc.m_IsGeodetic = \
c_Ora_API2::IsGeodeticCoordSystem(ora_coord_sys_wktext.c_str());       +        \
spatial_context->SetOraSridDesc(orasriddesc); +            
+        long dimcount = ora_dimlist.GetSize();
+        for(long ind=0;ind<dimcount;ind++)
+        {
+          c_SDO_DIM_ELEMENT dimelem = ora_dimlist.GetDimElement(ind);
+              
+          std::wstring dimname;
+          if( !dimelem.IsNullDimName() )
+            dimname = dimelem.GetDimName(); 
+                            
+          double tol = dimelem.GetTolerance();
+          double lb = (double)dimelem.GetLB();
+          double ub = (double)dimelem.GetUB();
+        }
+            
+        SC_Collection->Insert(0,spatial_context);
+      }        
+    }
+    else
+    {
+      spatial_context = SC_Collection->GetDefaultSpatialContext();  
+    }
+  }
+}
+catch(c_Oci_Exception* ex)
+{
+  FdoStringP gstr = ex->GetErrorText();
+#ifdef _KGORA_EXTENDED_LOG  
+  D_KGORA_ELOG_WRITE1("c_FdoOra_API3::DescribeSchemaSQL.Error : '%s'",(const \
char*)gstr);       +#endif
+  delete ex;
+  if( stm )
+  {
+    OciConn->TerminateStatement(stm);
+
+  }
+
+  throw FdoException::Create( gstr );
+}  
+  
+  OciConn->TerminateStatement(stm);
+  return FDO_SAFE_ADDREF(spatial_context.p);
+}// end of c_FdoOra_API3::CreateSpatialContext
+
+
+void c_FdoOra_API3::DescribeSchemaSQL(c_Oci_Connection * OciConn
+            ,const wchar_t* SqlTable,const wchar_t* SqlColumns,const wchar_t* \
SqlPkey +            ,bool BindOwner
+            ,const wchar_t* ConnectionOraSchema,const wchar_t* Owner
+            ,FdoClassCollection* FdoClasses,FdoKgOraClassCollection* PhysClasses
+            ,c_KgOraSpatialContextCollection* SC_Collection,long& AliasNum,bool \
IsOracle9      ) +{
+  c_Oci_Statement * stm=NULL;
+  double time_total_columns=0.0,time_total_pkeys=0.0;
+  int class_count=0;
+  int rec_count=0;
+  c_MapOraNameToFdoClass maporatoclass;
+  maporatoclass.SetKgOraSpatialContextCollection(SC_Collection);
+  
+  try
+  {
+    // Query Oracle for geometry tables 
+
+    stm = OciConn->CreateStatement();
+    stm->Prepare(SqlTable);
+    if( BindOwner && Owner )
+    {
+      stm->BindString(1,Owner);
+    }
+    stm->ExecuteSelectAndDefine();
+    
+    bool ora_srid_isnull;
+    std::wstring ora_tablename,ora_geom_colname,ora_tableowner,ora_fdo_classname,ora_index_name;
 +    long ora_srid;
+    c_SDO_GEOMETRY *ora_mbr=NULL;
+    std::wstring ora_coord_sys_name,ora_coord_sys_wktext,ora_layer_gtype;
+    std::wstring ora_fullname,ora_sequence_name;
+    
+    // override's
+    std::wstring override_fdo_classname;
+    bool override_srid_isnull;
+    long override_srid;
+    SDO_GEOMETRY_TYPE *override_mbr;
+    std::wstring override_identity,override_sequence_name;
+    std::wstring override_coord_sys_name,override_coord_sys_wktext,override_layer_gtype;
 +    std::wstring override_point_x_col,override_point_y_col,override_point_z_col;
+   
+    std::wstring override_spatial_owner,override_spatial_table;
+    
+    #ifdef _DEBUG
+    c_Timer time_full;
+    time_full.Start();
+    #endif
+    
+    
+    while( stm->ReadNext() )
+    {
+      rec_count++;
+      if( stm->IsColumnNull(1) )
+      {
+        if( Owner )
+          ora_tableowner = Owner;
+        else
+          ora_tableowner = L"";
+      }
+      else
+      {
+        ora_tableowner = stm->GetString(1);
+      }
+      
+      ora_tablename = stm->IsColumnNull(2) ? L"" : stm->GetString(2);
+      ora_geom_colname = stm->IsColumnNull(3) ? L"" : stm->GetString(3);
+      
+      
+      // check if dot is in table or column name
+      // in this version of provider skip those tables because fdo doesn't allow \
dots in names +      // TODO: change table name or column name so it doen't have dots
+      if( (ora_tablename.find(L".") != std::wstring::npos) || \
(ora_geom_colname.find(L".") != std::wstring::npos) ) +      {
+        continue;
+      }
+      
+      std::wstring nonver_tablename;
+      if( CheckIfVersionedTableName(OciConn,ora_tableowner,ora_tablename,nonver_tablename) \
) +      {
+        ora_tablename = nonver_tablename;
+      }
+      
+            
+      ora_srid_isnull = stm->IsColumnNull(4);
+      if( !ora_srid_isnull ) ora_srid = stm->GetInteger(4);
+      else ora_srid = 0;
+      
+      //std::vector< SDO_DIM_ELEMENT* > ora_dimlist;
+      c_SDO_DIM_ARRAY ora_dimlist;
+      if( !stm->IsColumnNull(5) ) 
+      {
+        ora_dimlist = stm->GetSdoDimArray(5);
+        //oracle::occi::getVector(occi_rs,5,ora_dimlist);
+      }
+      
+      ora_coord_sys_name = stm->IsColumnNull(6) ? L"" : stm->GetString(6);
+      ora_coord_sys_wktext = stm->IsColumnNull(7) ? L"" : stm->GetString(7);
+      
+      ora_index_name = stm->IsColumnNull(8) ? L"" : stm->GetString(8);    
+      
+      ora_layer_gtype = stm->IsColumnNull(9) ? L"" : stm->GetString(9);    
+      
+      ora_sequence_name = stm->IsColumnNull(10) ? L"" : stm->GetString(10);    
+      
+      if( !stm->IsColumnNull(11) ) 
+        ora_mbr = stm->GetSdoGeom(11); 
+      else
+        ora_mbr = NULL;
+      if(ora_mbr )
+      {
+      }
+      
+      override_fdo_classname = stm->IsColumnNull(12) ? L"" : stm->GetString(12); // \
12. Override FDO Class Name ( varchar2, null ) - name of the class which will be used \
as fdo class +  
+      override_srid_isnull = stm->IsColumnNull(13);  // 13. Override SRID ( number, \
null ) - override srid +      if( !override_srid_isnull ) override_srid = \
stm->GetInteger(13); +      else override_srid = 0;
+      
+      //OCCI_STD_NAMESPACE::vector< SDO_DIM_ELEMENT* > override_dimlist;
+      c_SDO_DIM_ARRAY override_dimlist;
+      if( !stm->IsColumnNull(14) ) 
+      {
+        //oracle::occi::getVector(occi_rs,14,override_dimlist);  // 14. Override \
Dimension list ( number, null ) - override srid +        override_dimlist = \
stm->GetSdoDimArray(14); +      }
+            
+      override_coord_sys_name = stm->IsColumnNull(15) ? L"" : stm->GetString(15); // \
15. Override CS Name ( varchar2 , null )  - Coordinate system name or NULL +      \
override_coord_sys_wktext = stm->IsColumnNull(16) ? L"" : stm->GetString(16); // 16. \
Override CS WkText ( varchar2 , null )  - Coordinate system or NULL +      
+      override_layer_gtype = stm->IsColumnNull(17) ? L"" : stm->GetString(17);  // \
17. Override LayerGType (varchar2, null ) - coming from spatial index metadata or \
null +      
+      override_sequence_name = stm->IsColumnNull(18) ? L"" : stm->GetString(18); // \
18. Override SequenceName ( varchar2, null ) - name of Oracle sequence is defined \
which is used for inserting new rows +      
+      override_identity = stm->IsColumnNull(19) ? L"" : stm->GetString(19); // 19. \
Override Identity Coolumns ( varchar2, null ) - list of columns to be used for as \
identiy for class +      
+      if( !stm->IsColumnNull(20) )    // 20. Override MBR ( SDO_GEOMETRY, null ) - \
extent of geometry or null +        override_mbr = \
(SDO_GEOMETRY_TYPE*)stm->GetSdoGeom(20);  +      else
+        override_mbr = NULL;
+      
+      override_point_x_col = stm->IsColumnNull(21) ? L"" : stm->GetString(21); //21. \
FDO_POINT_X_COLUMN (varchar2, null ) this column defines names of column with values \
for point geometry where values are stored as numbers in columns +      \
override_point_y_col = stm->IsColumnNull(22) ? L"" : stm->GetString(22); //22. \
FDO_POINT_Y_COLUMN (varchar2, null ) x,y must be define to be used  and "3. Oracle \
Geometry Column" must be NULL +      override_point_z_col = stm->IsColumnNull(23) ? \
L"" : stm->GetString(23); //23. FDO_POINT_Z_COLUMN (varchar2, null ) if 3d point then \
it is defined +      
+      
+      // fdo class from MYFDOCLASS can be based on view (on top of spatial table) \
and then i need spatial table owner and name to be able to  +      // read spatial \
metada (user/all_sdo_geom_metadata) info for additional geometry fields in table +    \
override_spatial_owner = stm->IsColumnNull(24) ? L"" : stm->GetString(24); +      \
override_spatial_table = stm->IsColumnNull(25) ? L"" : stm->GetString(25); +      
+      
+      c_KgOraSridDesc orasriddesc;
+      
+      if( !override_srid_isnull ) 
+      {
+        ora_srid = override_srid;
+      }
+      if( override_coord_sys_wktext.length() > 0 )
+      {
+        ora_coord_sys_wktext = override_coord_sys_wktext;
+      }
+      if( override_coord_sys_name.length() > 0 )
+      {
+        ora_coord_sys_name = override_coord_sys_name;
+      }
+      
+      orasriddesc.m_OraSrid = (long)ora_srid;
+      orasriddesc.m_IsGeodetic = \
c_Ora_API2::IsGeodeticCoordSystem(ora_coord_sys_wktext.c_str()); +      
+      
+      // Test for coordinate system if exists and 
+      FdoPtr<c_KgOraSpatialContext> spatial_context;
+      if( (long)ora_srid >= 0 )
+      {
+        FdoStringP cname = FdoStringP::Format(L"OracleSrid%ld",(long)ora_srid);
+        spatial_context = SC_Collection->FindItem(cname);
+        if( !spatial_context )
+        {
+          spatial_context = new c_KgOraSpatialContext();
+          spatial_context->SetName(cname);
+          
+          FdoStringP csname = ora_coord_sys_name.c_str();
+          spatial_context->SetCoordSysName(csname);
+          
+          FdoStringP cswkt = ora_coord_sys_wktext.c_str();
+          spatial_context->SetCoordinateSystemWkt(cswkt);
+          
+          spatial_context->SetOraSridDesc(orasriddesc);
+          
+          long dimcount = ora_dimlist.GetSize();
+          for(long ind=0;ind<dimcount;ind++)
+          {
+            c_SDO_DIM_ELEMENT dimelem = ora_dimlist.GetDimElement(ind);
+            
+            std::wstring dimname;
+            if( !dimelem.IsNullDimName() )
+              dimname = dimelem.GetDimName(); 
+                          
+            double tol = dimelem.GetTolerance();
+            double lb = (double)dimelem.GetLB();
+            double ub = (double)dimelem.GetUB();
+          }
+          
+          SC_Collection->Insert(0,spatial_context);
+        }
+        
+      }
+      else
+      {
+      // this is no coordinate system
+      // then I use DEFAULT spatial context
+        if( ora_mbr )
+        {
+          spatial_context = SC_Collection->GetDefaultSpatialContext();       
+        }
+      }
+      
+      // Now set extents for spatial context
+      double minx,miny,maxx,maxy;
+      bool isminmax = false;
+      if( c_Ora_API2::IsGeodeticCoordSystem(ora_coord_sys_wktext.c_str()) 
+          ||
+          (ora_mbr == NULL)
+          //(KgOraConn->GetOracleMainVersion() < 10)
+        )
+      {
+      // read extents from user_sdo_geom_metada
+        if( ora_dimlist.GetSize() >= 2 )
+        {
+          c_SDO_DIM_ELEMENT dimelem;
+          dimelem = ora_dimlist.GetDimElement(0);
+          
+          minx = dimelem.GetLB();
+          maxx = dimelem.GetUB();
+          
+          dimelem = ora_dimlist.GetDimElement(1);
+          miny = dimelem.GetLB();
+          maxy = dimelem.GetUB();
+          
+          isminmax = true;
+        }
+      }
+      else
+      {     
+      // this is       
+        if( ora_mbr )
+        {
+        // extend 
+        // ora_geom should be of type 2003 elem_info_array (1,1003,3)
+        // and 4 ordinates for lower/upper bounds
+       
+          if( ( (long)ora_mbr->GetSdoGtype() == 2003) && \
((long)ora_mbr->GetSdoElemInfo(1) == 1003) ) +          {
+            minx = (double)ora_mbr->GetSdoOrdinate(0);
+            miny = (double)ora_mbr->GetSdoOrdinate(1);
+            maxx = (double)ora_mbr->GetSdoOrdinate(2);
+            maxy = (double)ora_mbr->GetSdoOrdinate(3);
+            
+            isminmax = true;         
+          }
+          else
+          {
+            if( ( (long)ora_mbr->GetSdoGtype() == 3003) && \
((long)ora_mbr->GetSdoElemInfo(1) == 1003) ) +            {
+              minx = (double)ora_mbr->GetSdoOrdinate(0);
+              miny = (double)ora_mbr->GetSdoOrdinate(1);
+              maxx = (double)ora_mbr->GetSdoOrdinate(3);
+              maxy = (double)ora_mbr->GetSdoOrdinate(4);
+              
+              isminmax = true;
+            }
+          }
+        }
+      }
+      
+      // Apply new extent
+      if( spatial_context.p && isminmax )
+      {
+        FdoPtr<FdoFgfGeometryFactory> gf = FdoFgfGeometryFactory::GetInstance();
+        FdoPtr<FdoIEnvelope> env = gf->CreateEnvelopeXY(minx, miny, maxx, maxy);
+        
+        spatial_context->ExpandExtent( env );
+      }
+
+      
+      if( ora_tableowner.length() > 0 )
+        ora_fullname = ora_tableowner + L"." + ora_tablename;
+      else
+        ora_fullname = ora_tablename;
+      
+      ora_fdo_classname = ora_tableowner + D_CLASSNAME_DELIMITER + ora_tablename + \
D_CLASSNAME_DELIMITER + ora_geom_colname; +      
+      FdoStringP w_fdo_classname = ora_fdo_classname.c_str();
+      
+      if( override_fdo_classname.length() > 0 )
+      {
+        w_fdo_classname = override_fdo_classname.c_str();
+      }
+      
+      
+      // check if class already exist
+      // the previous sql can return multiple rows for same table.column because of \
multiple indexes on same column +      // so I need to check not to duplicate classes
+      if( !FdoClasses->FindItem( w_fdo_classname ) )
+      {
+      
+        FdoPtr<FdoFeatureClass> fc_geom;
+        FdoPtr<FdoClass> fc_nogeom;
+        FdoClassDefinition* fc;
+        
+        if( (ora_geom_colname.length() >  0) 
+            || ( (override_point_x_col.length() > 0) && \
(override_point_y_col.length() > 0) ) +          )
+        {
+          fc_geom = FdoFeatureClass::Create(w_fdo_classname, L"");      
+          fc = fc_geom.p;
+        }
+        else
+        {
+          fc_nogeom = FdoClass::Create(w_fdo_classname, L"");      
+          fc = fc_nogeom.p;
+        }
+        
+        
+        // set class capabilities
+        // sde class is read-only and no locking
+        FdoPtr<FdoClassCapabilities> capab = FdoClassCapabilities::Create(*fc);
+        capab->SetSupportsWrite(true);
+        capab->SetSupportsLocking(false);
+        capab->SetSupportsLongTransactions(false);
+        fc->SetCapabilities(capab);
+        
+        FdoPtr<FdoKgOraClassDefinition> phys_class  = \
FdoKgOraClassDefinition::Create(); +        
+        
+        if( ora_mbr )
+        {
+          if( orasriddesc.m_IsGeodetic )
+          {
+          // for now I am setting spatial extent for geodetic layer maximum big
+          // beacuse SDO_ROOT_MBR has some special values for geodetic layers
+          // this will be changed when i know how to calculate it
+            phys_class->SetSdoRootMBR(L"MDSYS.SDO_GEOMETRY(2003,null,null,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),MDSYS.SDO_ORDINATE_ARRAY(-180,-90,180,90))");
 +          }
+          else
+          {
+            wchar_t* buff = c_Ora_API2::SdoGeomToStringW(ora_mbr);
+            phys_class->SetSdoRootMBR(buff);
+            delete []buff;
+          }
+        }
+        phys_class->SetName( w_fdo_classname );
+        phys_class->SetOracleFullTableName( FdoStringP(ora_fullname.c_str()) );
+        AliasNum++;
+        phys_class->SetOraTableAliasNum( AliasNum );
+      
+        FdoPtr<FdoPropertyDefinitionCollection> pdc = fc->GetProperties();
+        
+        
+    ////////////////////////////////////////////////////////////////////////////////////////////
 +    //  Create Geometry Property
+    //////////////////////////////////////////////////////////////////////////////////////////// \
 +        //
+        //  Define Layer Geometry Type  
+        //
+        FdoInt32 fdo_geom_type = \
FdoGeometricType_Point|FdoGeometricType_Curve|FdoGeometricType_Surface; +        
+        // check if layer type has been override
+        std::wstring comb_layer_gtype;        
+        comb_layer_gtype = ora_layer_gtype;
+        if( override_layer_gtype.length() > 0 ) comb_layer_gtype = \
override_layer_gtype; +        
+        if( (comb_layer_gtype.compare(L"POINT")==0) || \
(comb_layer_gtype.compare(L"MULTIPOINT")==0) ) +        {
+          fdo_geom_type = FdoGeometricType_Point;
+        }
+        else
+        {
+          if( (comb_layer_gtype.compare(L"LINE")==0) || \
(comb_layer_gtype.compare(L"MULTILINE")==0)  +              || \
(comb_layer_gtype.compare(L"CURVE")==0) || \
(comb_layer_gtype.compare(L"MULTICURVE")==0)  +            )
+          {
+            fdo_geom_type = FdoGeometricType_Curve;
+          }
+          else
+          {
+            if( (comb_layer_gtype.compare(L"POLYGON")==0) || \
(comb_layer_gtype.compare(L"MULTIPOLYGON")==0) ) +            {
+              fdo_geom_type = FdoGeometricType_Surface;
+            }
+          }  
+        }
+        if( ora_geom_colname.length() > 0 )
+        {
+          FdoPtr<FdoGeometricPropertyDefinition> gpd = \
FdoGeometricPropertyDefinition::Create(FdoStringP(ora_geom_colname.c_str()), L"");    \
 +        
+        // set if Class has Z or M coordinate values
+          if( ora_dimlist.GetSize() >2 )
+          {
+            if( ora_dimlist.GetSize() == 3 )
+            {
+              c_SDO_DIM_ELEMENT dimelem = ora_dimlist.GetDimElement(2);
+              std::wstring dimname;
+              if( !dimelem.IsNullDimName() && \
(FdoCommonOSUtil::wcsicmp(dimelem.GetDimName(),L"M") == 0) ) +                \
gpd->SetHasMeasure(true); +              else
+                gpd->SetHasElevation(true);  
+            }
+            else
+            {
+              gpd->SetHasElevation(true);
+              gpd->SetHasMeasure(true);
+            }
+          }
+          gpd->SetGeometryTypes(fdo_geom_type);  
+          
+          if( spatial_context )
+          {
+            gpd->SetSpatialContextAssociation( spatial_context->GetName() );
+          }
+          
+          pdc->Add(gpd);
+          
+          if( fc_geom.p ) fc_geom->SetGeometryProperty(gpd);
+        }
+        else
+        {
+        // Geometry property is not defined - check if x,y columns are
+          if( (override_point_x_col.length() > 0) && (override_point_y_col.length() \
> 0) ) +          {
+            FdoStringP pointproperty = L"KING_FDO_POINT";
+            FdoPtr<FdoGeometricPropertyDefinition> gpd = \
FdoGeometricPropertyDefinition::Create(pointproperty, L"");                         + \
 +            fdo_geom_type = FdoGeometricType_Point;
+            gpd->SetGeometryTypes(fdo_geom_type);  
+            
+            if( spatial_context )
+            {
+              gpd->SetSpatialContextAssociation( spatial_context->GetName() );
+            }
+            
+            pdc->Add(gpd);
+            
+            if( fc_geom.p ) fc_geom->SetGeometryProperty(gpd);
+            
+            FdoStringP xcol = override_point_x_col.c_str();
+            FdoStringP ycol = override_point_y_col.c_str();
+            FdoStringP zcol = override_point_z_col.c_str();
+            phys_class->SetPointGeometry(pointproperty,xcol,ycol,zcol);
+          }
+          else
+          {
+          // it is non-feature class
+          }
+        }
+    ////////////////////////////////////////////////////////////////////////////////////////////
 +    //  Add other non-geometry attributes from table  
+    //////////////////////////////////////////////////////////////////////////////////////////// \
 +    
+        // Because there could be table names in sdo_geom_metadata which doesn't \
exists as tables or views +        // catch erro returned
+        bool table_exists=false;
+        
+
+       
+        
+        ////////////////////////////////////////////////////////////////////////////////////////////
 +        //  Set Oracle Sequence
+        //////////////////////////////////////////////////////////////////////////////////////////// \
 +        // If primary ky is one int column and if there is sequence \
TableName_FDOSEQ +        // then this sequence will be use to populate identity id \
during inserts +        std::wstring comb_sequence_name;        
+        comb_sequence_name = ora_sequence_name;
+        if( override_sequence_name.length() > 0 ) comb_sequence_name = \
override_sequence_name; +
+        if( (comb_sequence_name.length()>0) )
+        {
+          FdoStringP fdostr = comb_sequence_name.c_str();
+          phys_class->SetUseSequenceForIdentity(fdostr);
+        }          
+        
+        /*else
+        {  
+                                                          
+          FdoPtr<FdoDataPropertyDefinition> entid = \
dynamic_cast<FdoDataPropertyDefinition*>(pdc->FindItem(L"ENTITYID")); +          if( \
entid.p ) +          {
+            FdoPtr<FdoDataPropertyDefinitionCollection> ic = \
fc->GetIdentityProperties(); +            ic->Add( entid );
+          }      
+        }*/
+        
+        FdoClasses->Add(fc);
+        PhysClasses->Add( phys_class );
+        
+        std::vector<std::wstring> override_primarycolumns;
+        if( override_identity.length() > 0 )
+        {
+          // transfering from string to FdoStrinCollection and then back to string
+          // this was written in a hurry - could be better
+          FdoPtr<FdoStringCollection> strcol = \
FdoStringCollection::Create(override_identity.c_str(),L","); +          long cnt = \
strcol->GetCount(); +          for(long ind=0;ind<cnt;ind++)
+          {
+            std::wstring ss = strcol->GetString(ind);
+            override_primarycolumns.push_back(ss);
+          }     
+        }
+        
+        // map oracle owner.table.geomcolumn (fdo_overriden_class_name ) to \
generated geometry +        \
maporatoclass.Add(ora_tableowner,ora_tablename,ora_geom_colname,override_fdo_classname
 +                          \
,fc,phys_class,override_primarycolumns,override_spatial_owner,override_spatial_table);
 +      }
+      
+      if(ora_mbr )
+        delete ora_mbr;
+      
+    }
+    
+    
+    #ifdef _DEBUG
+        time_full.Stop();
+        printf(" Describe: %.4lf (cols: %.4lf , pkeys: %.2lf) \
",time_full.GetElapsedTime(),time_total_columns,time_total_pkeys); +    #endif
+    
+    class_count = FdoClasses->GetCount();
+    
+    
+    
+    // table describe
+    {
+      #ifdef _DEBUG
+            c_Timer time_columns;
+            time_columns.Start();
+      #endif
+            DescribeTableProperties(OciConn,SqlColumns, BindOwner,Owner \
,maporatoclass); +      #ifdef _DEBUG
+            time_total_columns += time_columns.Stop();
+      #endif        
+    }
+  // primary key describe
+    {
+    
+      std::vector<std::wstring> pcols;
+      #ifdef _DEBUG
+        c_Timer time_pkeys;
+        time_pkeys.Start();
+      #endif
+      DescribeTablePrimaryKey(OciConn,SqlPkey,BindOwner,Owner,maporatoclass);
+    #ifdef _DEBUG
+      time_total_pkeys += time_pkeys.Stop();
+    #endif        
+    }
+    
+    OciConn->TerminateStatement(stm);
+  }
+  catch(c_Oci_Exception* ex)
+  {
+    FdoStringP gstr = ex->GetErrorText();
+     #ifdef _KGORA_EXTENDED_LOG  
+      D_KGORA_ELOG_WRITE1("c_FdoOra_API3::DescribeSchemaSQL.Error : '%s'",(const \
char*)gstr);       +     #endif
+    delete ex;
+    if( stm )
+    {
+      OciConn->TerminateStatement(stm);
+      
+    }
+    
+    throw FdoException::Create( gstr );
+  }
+}//end of c_FdoOra_API3::DescribeSchemaSQL
+
+void c_FdoOra_API3::DescribeSchemaSDE(c_Oci_Connection * OciConn,const wchar_t* \
Owner +                                      ,FdoClassCollection* \
FdoClasses,FdoKgOraClassCollection* PhysClasses +                                     \
,c_KgOraSpatialContextCollection* SC_Collection,long& AliasNum ) +{
+  c_Oci_Statement * stm=NULL;
+  try
+  {
+    // Run Query for layers fdo SDE.layers table 
+    std::wstring sqlquery = \
+    L"SELECT l.layer_id, l.owner, l.table_name, l.spatial_column"
+    L" ,g.g_table_schema,g.g_table_name,g.geometry_type,g.coord_dimension"
+    L" ,r.srid,r.srtext,r.falsex,r.falsey,r.xyunits,r.falsez,r.zunits,r.falsem,r.munits" \
 +	// 1SPATIAL START
+	L" ,l.gsize1, l.gsize2"
+	// 1SPATIAL END
+    L" FROM sde.layers l INNER JOIN (sde.geometry_columns g INNER JOIN \
sde.spatial_references r ON g.srid = r.srid)"  +    L" ON l.table_name = \
g.f_table_name and l.owner = g.f_table_schema"; +
+    if( Owner && *Owner )
+    {
+      sqlquery = sqlquery + L" where l.owner='";
+      sqlquery = sqlquery + Owner;
+      sqlquery = sqlquery + L"'";
+      //stm->BindString(1,Owner);
+    }
+    
+    stm = OciConn->CreateStatement();
+    stm->Prepare(sqlquery.c_str());
+    
+
+	// 1SPATIAL START
+	#ifdef _KGORA_EXTENDED_LOG 
+		FdoStringP szSQLQuery = sqlquery.c_str();
+		D_KGORA_ELOG_WRITE1("c_FdoOra_API3::DescribeSchemaSDE.Execute SQL: '%s'",(const \
char*)szSQLQuery);         +	#endif
+	// 1SPATIAL END
+
+    
+    stm->ExecuteSelectAndDefine();
+
+    std::wstring ora_tablename,ora_geom_colname,ora_tableowner,ora_fdo_classname,ora_index_name;
 +    long sde_srid;
+    c_SDO_GEOMETRY *ora_mbr=NULL;
+    std::wstring sde_coord_sys_name,sde_coord_sys_wktext;
+    double sde_falsex,sde_falsey,sde_falsez,sde_falsem;
+    double sde_xyunits,sde_zunits,sde_munits;
+    std::wstring ora_fullname,ora_sequence_name;
+
+    
+    
+    long sde_layer_id;
+    std::wstring sde_geom_owner,sde_geom_table,sde_featurekey_colname;
+    std::wstring  sde_full_geometry_table_name,sde_full_index_table_name;
+    long sde_geom_type,sde_geom_coord_dim;
+    
+    int duplicate_rec=0;
+    int rec_count=0;
+    while( stm->ReadNext() )
+    {
+      rec_count++;
+      
+      if( stm->IsColumnNull(1) )
+      {      
+        continue;
+      }
+      else
+      {
+        sde_layer_id = stm->GetInteger(1);
+      }
+      
+      if( stm->IsColumnNull(2) )
+      {
+        if( Owner )
+          ora_tableowner = Owner;
+        else
+          ora_tableowner = L"";
+      }
+      else
+      {
+        ora_tableowner = stm->GetString(2);
+      }
+
+      ora_tablename = stm->IsColumnNull(3) ? L"" : stm->GetString(3);
+      sde_featurekey_colname = stm->IsColumnNull(4) ? L"" : stm->GetString(4);
+      ora_geom_colname = L"FdoGeom";
+      
+      if( ora_tablename.empty() || ora_geom_colname.empty() ) continue;
+
+      // check if dot is in table or column name
+      // in this version of provider skip those tables because fdo doesn't allow \
dots in names +      // TODO: change table name or column name so it doen't have dots
+      if( (ora_tablename.find(L".") != std::wstring::npos) || \
(ora_geom_colname.find(L".") != std::wstring::npos) ) +      {
+        continue;
+      }
+
+
+      sde_geom_owner = stm->IsColumnNull(5) ? L"" : stm->GetString(5);
+      sde_geom_table = stm->IsColumnNull(6) ? L"" : stm->GetString(6);
+      
+      sde_geom_type = stm->IsColumnNull(7) ? 0 : stm->GetInteger(7);
+      sde_geom_coord_dim = stm->IsColumnNull(8) ? 0 : stm->GetInteger(8);
+
+      sde_full_geometry_table_name = sde_geom_owner + L"." + sde_geom_table;
+      FdoStringP temp2 = \
FdoStringP::Format(L"%s.S%ld",sde_geom_owner.c_str(),sde_layer_id); +      \
sde_full_index_table_name = temp2; +      //sde_full_index_table_name = \
sde_geom_owner + sde_full_index_table_name; +
+      sde_srid = stm->IsColumnNull(9) ? 0 : stm->GetInteger(9);
+      sde_coord_sys_wktext = stm->IsColumnNull(10) ? L"" : stm->GetString(10);
+
+      FdoStringP temp = FdoStringP::Format(L"SDE_SRID_%ld",sde_srid);
+      sde_coord_sys_name = temp;
+      
+      sde_falsex = stm->IsColumnNull(11) ? 0 : stm->GetDouble(11);
+      sde_falsey = stm->IsColumnNull(12) ? 0 : stm->GetDouble(12);
+      sde_xyunits = stm->IsColumnNull(13) ? 1 : stm->GetDouble(13);
+      
+      sde_falsez = stm->IsColumnNull(14) ? 0 : stm->GetDouble(14);
+      sde_zunits = stm->IsColumnNull(15) ? 1 : stm->GetDouble(15);
+      
+      sde_falsem = stm->IsColumnNull(16) ? 0 : stm->GetDouble(16);
+      
+		// 1SPATIAL START
+      //sde_munits = stm->IsColumnNull(17) ? 1 : stm->GetDouble(16);
+		sde_munits = stm->IsColumnNull(17) ? 1 : stm->GetDouble(17);
+		double gsize1 = stm->IsColumnNull(18) ? 1 : stm->GetDouble(18);
+		double gsize2 = stm->IsColumnNull(19) ? 1 : stm->GetDouble(19);
+		// 1SPATIAL END
+      
+
+      
+      ora_sequence_name = FdoStringP::Format(L"I%ld",sde_srid);
+
+     
+
+      c_KgOraSridDesc orasriddesc;
+
+      
+
+      orasriddesc.m_OraSrid = (long)sde_srid;
+      orasriddesc.m_IsGeodetic = \
c_Ora_API2::IsGeodeticCoordSystem(sde_coord_sys_wktext.c_str()); +      \
orasriddesc.m_SDE_FalseX = sde_falsex; +      orasriddesc.m_SDE_FalseY = sde_falsey;
+      orasriddesc.m_SDE_XYUnit = sde_xyunits;
+      orasriddesc.m_SDE_FalseZ = sde_falsez;
+      orasriddesc.m_SDE_ZUnit = sde_zunits;
+      orasriddesc.m_SDE_FalseM = sde_falsem;
+      orasriddesc.m_SDE_MUnit = sde_munits;
+
+      // Test for coordinate system if exists and 
+      FdoPtr<c_KgOraSpatialContext> spatial_context;
+      if( (long)sde_srid >= 0 )
+      {
+        FdoStringP cname = FdoStringP::Format(L"SdeSrid%ld",(long)sde_srid);
+        spatial_context = SC_Collection->FindItem(cname);
+        if( !spatial_context )
+        {
+          spatial_context = new c_KgOraSpatialContext();
+          spatial_context->SetName(cname);
+
+          FdoStringP csname = sde_coord_sys_name.c_str();
+          spatial_context->SetCoordSysName(csname);
+
+          FdoStringP cswkt = sde_coord_sys_wktext.c_str();
+          spatial_context->SetCoordinateSystemWkt(cswkt);
+
+          spatial_context->SetOraSridDesc(orasriddesc);
+
+         
+          SC_Collection->Insert(0,spatial_context);
+        }
+
+      }
+      else
+      {
+        // this is no coordinate system
+        // then I use DEFAULT spatial context
+        if( ora_mbr )
+        {
+          spatial_context = SC_Collection->GetDefaultSpatialContext();       
+        }
+      }
+
+      // Now set extents for spatial context
+      double minx=D_SPATIALCONTEXT_DEFAULT_MINX,miny=D_SPATIALCONTEXT_DEFAULT_MINY;
+      double maxx=D_SPATIALCONTEXT_DEFAULT_MAXX,maxy=D_SPATIALCONTEXT_DEFAULT_MAXY;
+      
+      bool isminmax = false;
+      
+
+      // Apply new extent
+      if( spatial_context.p && isminmax )
+      {
+        FdoPtr<FdoFgfGeometryFactory> gf = FdoFgfGeometryFactory::GetInstance();
+        FdoPtr<FdoIEnvelope> env = gf->CreateEnvelopeXY(minx, miny, maxx, maxy);
+
+        spatial_context->ExpandExtent( env );
+      }
+
+
+      // Delete ora objects as there are not needed any more
+
+
+
+      if( ora_tableowner.length() > 0 )
+        ora_fullname = ora_tableowner + L"." + ora_tablename;
+      else
+        ora_fullname = ora_tablename;
+
+      ora_fdo_classname = ora_tableowner + D_CLASSNAME_DELIMITER + ora_tablename + \
D_CLASSNAME_DELIMITER + ora_geom_colname; +
+      FdoStringP w_fdo_classname = ora_fdo_classname.c_str();
+
+      
+
+      // check if class already exist
+      // the previous sql can return multiple rows for same table.column because of \
multiple indexes on same column +      // so I need to check not to duplicate classes
+      if( !FdoClasses->FindItem( w_fdo_classname ) )
+      {
+
+        FdoPtr<FdoFeatureClass> fc = FdoFeatureClass::Create(w_fdo_classname, L"");  \
 +        // set class capabillities
+        // sde class is read-only and no locking
+        FdoPtr<FdoClassCapabilities> capab = FdoClassCapabilities::Create(*fc);
+        capab->SetSupportsWrite(false);
+        capab->SetSupportsLocking(false);
+        capab->SetSupportsLongTransactions(false);
+        fc->SetCapabilities(capab);
+
+        FdoPtr<FdoKgOraClassDefinition> phys_class  = \
FdoKgOraClassDefinition::Create(); +
+
+        if( ora_mbr )
+        {
+          if( orasriddesc.m_IsGeodetic )
+          {
+            // for now I am setting spatial extent for geodetic layer maximum big
+            // beacuse SDO_ROOT_MBR has some special values for geodetic layers
+            // this will be changed when i know how to calculate it
+            phys_class->SetSdoRootMBR(L"MDSYS.SDO_GEOMETRY(2003,null,null,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),MDSYS.SDO_ORDINATE_ARRAY(-180,-90,180,90))");
 +          }
+          else
+          {
+            wchar_t* buff = c_Ora_API2::SdoGeomToStringW(ora_mbr);
+            phys_class->SetSdoRootMBR(buff);
+            delete []buff;
+          }
+        }
+        phys_class->SetName( w_fdo_classname );
+        phys_class->SetOracleFullTableName( FdoStringP(ora_fullname.c_str()) );
+        AliasNum++;
+        phys_class->SetOraTableAliasNum( AliasNum );
+      
+		// 1SPATIAL START
+        //phys_class->SetSdeClass(true,sde_featurekey_colname.c_str(),sde_full_geometry_table_name.c_str(),sde_geom_type,sde_full_index_table_name.c_str());
 +		phys_class->SetSdeClass(true,sde_featurekey_colname.c_str(),sde_full_geometry_table_name.c_str(),sde_geom_type,sde_full_index_table_name.c_str(), \
gsize1,gsize2); +		// 1SPATIAL END
+
+        FdoPtr<FdoPropertyDefinitionCollection> pdc = fc->GetProperties();
+
+
+        ////////////////////////////////////////////////////////////////////////////////////////////
 +        //  Create Geometry Property
+        //////////////////////////////////////////////////////////////////////////////////////////// \
 +        //
+        //  Define Layer Geometry Type  
+        //
+        FdoInt32 fdo_geom_type = \
FdoGeometricType_Point|FdoGeometricType_Curve|FdoGeometricType_Surface; +        \
switch(sde_geom_type) +        {
+          case 0: // 0 = Geometry
+          case 6: // 6 = collection
+            fdo_geom_type = \
FdoGeometricType_Point|FdoGeometricType_Curve|FdoGeometricType_Surface; +          \
break; +          case 1: // 1 = point
+          case 7: // 7 = multipoint
+            fdo_geom_type = FdoGeometricType_Point;
+          break;
+          case 2: // 2 = curve
+          case 3: // 3 = linestring
+          case 8: // 8 = multicurve
+          case 9: // 9 = multilinestring
+            fdo_geom_type = FdoGeometricType_Curve;
+          break;
+          
+          case 4: // 4 = surface
+          case 5: // 5 = polygon
+          case 10: // 10 = multisurface
+          case 11: // 11 = multipolygon
+            fdo_geom_type = FdoGeometricType_Surface;
+          break;
+        }
+
+        
+        
+        if( ora_geom_colname.length() > 0 )
+        {
+          //FdoPtr<FdoGeometricPropertyDefinition> gpd = \
FdoGeometricPropertyDefinition::Create(FdoStringP(ora_geom_colname.c_str()), L""); +  \
FdoPtr<FdoGeometricPropertyDefinition> gpd = \
FdoGeometricPropertyDefinition::Create(ora_geom_colname.c_str(), L"");                \
 +
+          gpd->SetGeometryTypes(fdo_geom_type);  
+
+          if( spatial_context )
+          {
+            gpd->SetSpatialContextAssociation( spatial_context->GetName() );
+          }
+
+          pdc->Add(gpd);
+
+          fc->SetGeometryProperty(gpd);
+        }
+        
+        ////////////////////////////////////////////////////////////////////////////////////////////
 +        //  Add other non-geometry sttributes from table  
+        //////////////////////////////////////////////////////////////////////////////////////////// \
 +
+        // Because there could be table names in sdo_geom_metadata which doesn't \
exists as tables or views +        // catch erro returned
+        bool table_exists=false;
+
+        table_exists = \
DescribeTableProperties(OciConn,ora_tableowner.c_str(),ora_tablename.c_str(),pdc,SC_Collection);
 +
+
+
+        ////////////////////////////////////////////////////////////////////////////////////////////
 +        //  Check for primary keys
+        //////////////////////////////////////////////////////////////////////////////////////////// \
 +        /*
+        std::vector<std::wstring> pcols;
+
+        if( BindOwner )
+          c_OCI_API::GetTablePkeyColumns(OciConn,ora_tableowner.c_str(),ora_tablename.c_str(),pcols);
 +        else
+          c_OCI_API::GetTablePkeyColumns(OciConn,NULL,ora_tablename.c_str(),pcols);
+        
+        if( pcols.size() > 0 )
+        */
+        {
+          bool isidentity_int=true;
+          
+          FdoPtr<FdoDataPropertyDefinition> entid = \
dynamic_cast<FdoDataPropertyDefinition*>(pdc->FindItem(sde_featurekey_colname.c_str()));
 +          if( entid.p )
+          {
+            FdoPtr<FdoDataPropertyDefinitionCollection> ic = \
fc->GetIdentityProperties(); +            ic->Add( entid );
+          }     
+          
+          
+          
+          ////////////////////////////////////////////////////////////////////////////////////////////
 +          //  Set Oracle Sequence
+          //////////////////////////////////////////////////////////////////////////////////////////// \
 +          // If primary ky is one int column and if there is sequence \
TableName_FDOSEQ +          // then this sequence will be use to populate identity id \
during inserts +          std::wstring comb_sequence_name;        
+          comb_sequence_name = ora_sequence_name;
+          /*
+          if( (pcols.size() == 1) && (isidentity_int = true) && \
(comb_sequence_name.length()>0) ) +          {
+            FdoStringP fdostr = comb_sequence_name.c_str();
+            phys_class->SetUseSequenceForIdentity(fdostr);
+          } 
+          */         
+        }
+       
+
+        FdoClasses->Add(fc);
+        PhysClasses->Add( phys_class );
+      }
+      else
+      {
+        duplicate_rec++;
+      
+      }
+      
+      if(ora_mbr )
+        delete ora_mbr;
+
+    }
+
+    //g_FeatureSchemas = FDO_SAFE_ADDREF(m_FeatureSchemas.p);
+    //g_PhysicalSchemaMapping = FDO_SAFE_ADDREF(m_PhysicalSchemaMapping.p);
+
+    int class_count = FdoClasses->GetCount();
+
+    OciConn->TerminateStatement(stm);
+
+  }
+  catch(c_Oci_Exception* ex)
+  {
+    FdoStringP gstr = ex->GetErrorText();
+#ifdef _KGORA_EXTENDED_LOG  
+    D_KGORA_ELOG_WRITE1("c_FdoOra_API3::DescribeSchemaSQL.Error : '%s'",(const \
char*)gstr);       +#endif
+    delete ex;
+    if( stm )
+    {
+      OciConn->TerminateStatement(stm);
+
+    }
+
+    throw FdoException::Create( gstr );
+  }
+}//end of c_FdoOra_API3::DescribeSchemaSDE
+
+
+bool c_FdoOra_API3::FdoPropertyToOraDataType(FdoPropertyDefinition* \
Property,FdoStringP& OraType) +{
+  switch( Property->GetPropertyType() )
+  {
+    case FdoPropertyType_GeometricProperty:
+    {
+      OraType = L"MDSYS.SDO_GEOMETRY";
+    }
+    break;
+    case FdoPropertyType_DataProperty:
+    {
+      FdoDataPropertyDefinition * propdata = (FdoDataPropertyDefinition *)Property;
+      switch( propdata->GetDataType() )
+      {
+        case FdoDataType_String:
+        {
+          FdoInt32 len = propdata->GetLength();
+          if( len <= 0  ) len = 4000;
+          OraType = FdoStringP::Format(L"%s(%ld)",L"VARCHAR2",len);
+        }
+        break;
+        case FdoDataType_Decimal:
+        {
+          FdoInt32 prec = propdata->GetPrecision();
+          FdoInt32 scale = propdata->GetScale();
+          // 	ORACLE:
+          //If you specify a negative scale, then Oracle rounds the actual data to
+          //the specified number of places to the left of the decimal point. For
+          //example, specifying (7,-2) means Oracle rounds to the nearest
+          //hundredths.
+          //
+          //,456,123.89
+          //NUMBER(7,-2)
+          //7456100 
+          
+          if( (prec>=1) && (prec<=38) )
+          {
+            if( (scale>=0) && (scale<=127) ) // Oracle supposrt from -84 but I thing \
that in FDO -1 means not defined +            {
+              OraType = FdoStringP::Format(L"%s(%ld,%ld)",L"NUMBER",prec,scale);
+            }
+            else
+            {
+              OraType = FdoStringP::Format(L"%s(%ld,*)",L"NUMBER",prec);
+            }
+          }
+          else
+          {
+            if( (scale>=0) && (scale<=127) )
+            {
+              OraType = FdoStringP::Format(L"%s(*,%ld)",L"NUMBER",scale);
+            }
+            else
+            {
+              OraType = FdoStringP::Format(L"%s",L"NUMBER");
+            }
+          }
+        }
+        break;
+        case FdoDataType_Byte:
+          OraType = L"CHAR(1)";
+        break;
+        case FdoDataType_Single:
+          OraType = L"BINARY_FLOAT";
+        break;
+        case FdoDataType_Double:
+          OraType = L"BINARY_DOUBLE";
+        break;
+        case FdoDataType_DateTime:
+          OraType = L"DATE";
+        break;
+        
+        case FdoDataType_Boolean:
+          OraType = L"VARCHAR(5)";
+        break;
+        
+        case FdoDataType_Int16:
+          OraType = L"NUMBER(5,0)";
+        break;
+
+        case FdoDataType_Int32:
+          OraType = L"NUMBER(10,0)";
+        break;
+
+        case FdoDataType_Int64:
+          OraType = L"NUMBER(19,0)";
+        break;
+        
+        case FdoDataType_BLOB:
+          OraType = L"BLOB";
+        break;
+        
+        case FdoDataType_CLOB:
+          OraType = L"CLOB";
+        break;
+        
+        default:
+          return false;
+        break;
+      }
+    }
+    break;
+    default:
+      return false;
+    break;
+  }
+  
+  
+  
+  return true;
+}//end of c_FdoOra_API3::FdoPropertyToOraDataType
+
+
+bool c_FdoOra_API3::CheckIfVersionedTableName(c_Oci_Connection * OciConn,const \
std::wstring& Owner,const std::wstring& ora_tablename,std::wstring& orig_tablename) \
+{ +  orig_tablename = ora_tablename;
+  
+  int length = ora_tablename.length();
+  if( length > 3 )
+  {    
+    //if( ora_tablename.rfind(L"_LT") != std::wstring::npos )
+    if( ora_tablename[length-1]==L'T' && ora_tablename[length-2]==L'L' && \
ora_tablename[length-3]==L'_' ) +    {
+      orig_tablename = ora_tablename.substr(0,length-3);
+      
+      std::wstring PhysicalTable;
+      if( c_Ora_API2::IsTableVersioned(OciConn,Owner.c_str(),orig_tablename.c_str(),PhysicalTable) \
) +      {
+        return true;     
+      }
+    }
+  }
+  return false;
+}//end of 
+
+/* 
+  Utility function to create property definitions from table columns 
+*/
+bool c_FdoOra_API3::DescribeTableProperties(c_Oci_Connection * OciConn,const \
wchar_t*Schema,const wchar_t*TableName,FdoPropertyDefinitionCollection* \
PropCollection,c_KgOraSpatialContextCollection* SC_Collection) +{
+  OCIParam *parmh = (OCIParam *) 0;         /* parameter handle */
+  OCIParam *collsthd = (OCIParam *) 0;      /* handle to list of columns */
+  OCIParam *colhd = (OCIParam *) 0;         /* column handle */
+  OCIDescribe *dschp = (OCIDescribe *)0;      /* describe handle */
+
+try
+{
+
+  OCIHandleAlloc((dvoid *)OciConn->m_OciHpEnvironment, (dvoid **)&dschp,
+    (ub4)OCI_HTYPE_DESCRIBE, (size_t)0, (dvoid **)0);
+
+  /* get the describe handle for the table */
+  std::wstring fullname(Schema);
+  fullname.append(L".");
+  fullname.append(TableName);
+  //int namelen = strlen(fullname.c_str());
+  
+  int status = OCIDescribeAny(OciConn->m_OciHpServiceContext, OciConn->m_OciHpError, \
(dvoid *)fullname.c_str(), wcslen(fullname.c_str())*sizeof(wchar_t), OCI_OTYPE_NAME, \
0, +    OCI_PTYPE_TABLE, dschp);
+    
+  if( status != OCI_SUCCESS )
+  {
+    int status =  OCIDescribeAny(OciConn->m_OciHpServiceContext, \
OciConn->m_OciHpError, (dvoid *)fullname.c_str(), \
wcslen(fullname.c_str())*sizeof(wchar_t), OCI_OTYPE_NAME, 0, +    OCI_PTYPE_VIEW, \
dschp); +    
+    if( status != OCI_SUCCESS )
+    {
+      return false;
+    }
+  }
+    
+
+  /* get the parameter handle */
+  OciConn->OciCheckError(OCIAttrGet((dvoid *)dschp, OCI_HTYPE_DESCRIBE, (dvoid \
*)&parmh, (ub4 *)0, +    OCI_ATTR_PARAM, OciConn->m_OciHpError));
+    
+
+  /* The type information of the object, in this case, OCI_PTYPE_TABLE,
+  is obtained from the parameter descriptor returned by the OCIAttrGet(). */
+  /* get the number of columns in the table */
+  int numcols = 0;
+  OciConn->OciCheckError(OCIAttrGet((dvoid *)parmh, OCI_DTYPE_PARAM, (dvoid \
*)&numcols, (ub4 *)0, +    OCI_ATTR_NUM_COLS, OciConn->m_OciHpError));
+    
+
+  /* get the handle to the column list of the table */
+  OciConn->OciCheckError(OCIAttrGet((dvoid *)parmh, OCI_DTYPE_PARAM, (dvoid \
*)&collsthd, (ub4 *)0, +    OCI_ATTR_LIST_COLUMNS, \
OciConn->m_OciHpError)==OCI_NO_DATA); +    
+
+  /* go through the column list and retrieve the data-type of each column,
+  and then recursively describe column types. */
+  
+  for (int i = 1; i <= numcols; i++)
+  {
+    /* get parameter for column i */
+    OciConn->OciCheckError(OCIParamGet((dvoid *)collsthd, OCI_DTYPE_PARAM, \
OciConn->m_OciHpError, (dvoid **)&colhd, (ub4)i)); +      
+
+    ub2 col_type;
+      OciConn->OciCheckError(OCIAttrGet((dvoid *)colhd, OCI_DTYPE_PARAM, (dvoid \
*)&col_type, (ub4 *)0, +      OCI_ATTR_DATA_TYPE, OciConn->m_OciHpError));
+
+    /* for example, get datatype for ith column */
+    wchar_t *col_name=NULL;
+    int col_name_len=0;
+    OciConn->OciCheckError(OCIAttrGet((dvoid *)colhd, OCI_DTYPE_PARAM, (dvoid \
*)&col_name, (ub4 *)&col_name_len, +      OCI_ATTR_NAME, OciConn->m_OciHpError));
+    
+    // Retrieve the column type name attribute 
+    wchar_t* col_type_name=NULL;
+    int col_type_name_len = 0;
+    OciConn->OciCheckError(OCIAttrGet((dvoid*) colhd, (ub4) OCI_DTYPE_PARAM,
+      (dvoid**) &col_type_name, (ub4 *) &col_type_name_len, (ub4) \
OCI_ATTR_TYPE_NAME, +      (OCIError *) OciConn->m_OciHpError ));
+
+    /* Retrieve the length semantics for the column */
+    ub4 char_semantics = 0;
+    OCIAttrGet((dvoid*) colhd, (ub4) OCI_DTYPE_PARAM,
+      (dvoid*) &char_semantics,(ub4 *) 0, (ub4) OCI_ATTR_CHAR_USED,
+      (OCIError *) OciConn->m_OciHpError);
+
+    ub4 col_width = 0;
+    if (char_semantics)
+      /* Retrieve the column width in characters */
+      OCIAttrGet((dvoid*) colhd, (ub4) OCI_DTYPE_PARAM,
+      (dvoid*) &col_width, (ub4 *) 0, (ub4) OCI_ATTR_CHAR_SIZE,
+      (OCIError *) OciConn->m_OciHpError);
+    else
+      /* Retrieve the column width in bytes */
+      OCIAttrGet((dvoid*) colhd, (ub4) OCI_DTYPE_PARAM,
+      (dvoid*) &col_width,(ub4 *) 0, (ub4) OCI_ATTR_DATA_SIZE,
+      (OCIError *) OciConn->m_OciHpError);
+      
+    // Retrieve the column precision
+    ub1 col_precision=0;
+    OCIAttrGet((dvoid*) colhd, (ub4) OCI_DTYPE_PARAM,
+      (dvoid*) &col_precision,(ub4 *) 0, (ub4) OCI_ATTR_PRECISION,
+      (OCIError *) OciConn->m_OciHpError);
+      
+    // Retrieve the column size
+    ub1 col_scale=0;
+    OCIAttrGet((dvoid*) colhd, (ub4) OCI_DTYPE_PARAM,
+      (dvoid*) &col_scale,(ub4 *) 0, (ub4) OCI_ATTR_SCALE,
+      (OCIError *) OciConn->m_OciHpError);
+      
+    FdoDataType fdotype;      
+    bool isfdotype = \
c_FdoOra_API3::OraTypeToFdoDataType(col_type,col_precision,col_scale,col_width,fdotype);
 +
+    if( isfdotype )
+    {            
+      
+      FdoPtr<FdoDataPropertyDefinition> dpd = \
FdoDataPropertyDefinition::Create(col_name, L""); +      dpd->SetDataType(fdotype);
+      dpd->SetLength(col_width);
+      dpd->SetPrecision(col_precision);
+      dpd->SetScale(col_scale);
+
+      PropCollection->Add(dpd);
+    }  
+    else
+    {
+    // perhaps it is geometry
+      if( col_type_name && wcscmp(col_type_name,L"SDO_GEOMETRY") == 0 )
+      {
+        FdoPtr<FdoPropertyDefinition> f = PropCollection->FindItem(col_name);
+        if( !f.p )
+        {
+          bool isz,ism;
+          FdoPtr<c_KgOraSpatialContext> spcontext  = \
CreateSpatialContext(OciConn,Schema,TableName,col_name,SC_Collection,isz,ism); +      \
FdoPtr<FdoGeometricPropertyDefinition> geomprop = \
FdoGeometricPropertyDefinition::Create(col_name,L""); +          \
geomprop->SetHasElevation(isz); +          geomprop->SetHasMeasure(ism);
+          if( spcontext.p )
+          {
+            geomprop->SetSpatialContextAssociation(spcontext->GetName());
+          }
+          PropCollection->Add(geomprop);
+        }
+        
+        
+      }
+      
+    }    
+  }
+
+  if (dschp)
+    OCIHandleFree((dvoid *) dschp, OCI_HTYPE_DESCRIBE);
+
+
+    
+}
+catch(c_Oci_Exception* exc)
+{
+  if (dschp)
+    OCIHandleFree((dvoid *) dschp, OCI_HTYPE_DESCRIBE);
+  FdoStringP gstr = exc->GetErrorText();
+  delete exc;
+  throw FdoException::Create( gstr );
+}
+  return true;
+}//end of c_FdoOra_API3::DescribeTableProperties
+

Added: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_FdoOra_API3.h
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_FdoOra_API3.h	               \
                (rev 0)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_FdoOra_API3.h	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -0,0 +1,67 @@
+/*
+* Copyright (C) 2008  SL-King d.o.o
+* 
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of version 2.1 of the GNU Lesser
+* General Public License as published by the Free Software Foundation.
+* 
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+* 
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#ifndef _c_FdoOra_API3_h
+#define _c_FdoOra_API3_h
+
+#include "KingOracle/FdoKgOraOverrides.h"
+#include "c_KgOraSridDesc.h"
+#include "c_KgOraSpatialContext.h"
+#include "c_KgOraSchemaDesc.h"
+
+class c_MapOraNameToFdoClass;
+
+class FDOKGORA_API c_FdoOra_API3
+{
+public:
+  c_FdoOra_API3(void);
+public:
+  ~c_FdoOra_API3(void);
+  
+  //static c_KgOraSchemaDesc* c_FdoOra_API3::DescribeSchema(c_Oci_Connection* \
OciConn,const char* OraSchema,const char* KingFdoViews); +  
+  static c_KgOraSchemaDesc* DescribeSchema(c_Oci_Connection* OciConn,const wchar_t* \
ConnectionOraSchema,const wchar_t* UseOraSchema,const wchar_t* KingFdoViews,const \
wchar_t* SdeSchema); +
+  static bool OraTypeToFdoDataType(const char* OraType,int Precision,int Scale,int \
Length,FdoDataType & FdoType); +  
+  static bool OraTypeToFdoDataType(ub2 OCiDataType,int Precision,int Scale,int \
Length,FdoDataType & FdoType); +  static bool OraTypeToFdoDataType(const wchar_t* \
OraType,int Precision,int Scale,int Length,FdoDataType & FdoType); +  static bool \
FdoPropertyToOraDataType(FdoPropertyDefinition* Property,FdoStringP& OraType); +  \
//static bool FdoDataTypeToOraDataType(FdoDataType DataTape,oracle::occi::Type& \
OraType); +  
+  static bool SetOracleStatementData(c_Oci_Statement* Statement,int \
SqlParamNum,FdoDataValue* DataValue); +  static bool \
SetOracleStatementData(c_Oci_Statement* Statement,const \
wchar_t*SqlParamName,FdoDataValue* DataValue); +
+protected:
+/*
+  static void c_FdoOra_API3::DescribeSchemaSQL(oracle::occi::Connection * \
OraConn,oracle::occi::Statement* OraStm +                                             \
,FdoClassCollection* FdoClasses,FdoKgOraClassCollection* \
PhysClasses,c_KgOraSpatialContextCollection* SC_Collection,long& AliasNum,bool \
IsOracle9=false); +*/                                              
+  static bool DescribeTableProperties(c_Oci_Connection * OciConn,const \
wchar_t*Schema,const wchar_t*TableName,FdoPropertyDefinitionCollection* \
PropCollection,c_KgOraSpatialContextCollection* SC_Collection); +  static bool \
DescribeTableProperties(c_Oci_Connection * OciConn,const wchar_t*SqlColumns,bool \
BindOwner,const wchar_t* OraOwner ,c_MapOraNameToFdoClass& MapOraToClass); +  static \
bool DescribeTablePrimaryKey(c_Oci_Connection * OciConn,const wchar_t*SqlPkey,bool \
BindOwner,const wchar_t* OraOwner ,c_MapOraNameToFdoClass& MapOraToClass); +  \
//static void DescribeSchemaSQL(c_Oci_Connection * OciConn,FdoClassCollection* \
FdoClasses,FdoKgOraClassCollection* PhysClasses ,c_KgOraSpatialContextCollection* \
SC_Collection,long& AliasNum,bool IsOracle9 ); +  static void \
DescribeSchemaSQL(c_Oci_Connection * OciConn,const wchar_t* SqlStringTables, const \
wchar_t* SqlStringColumns,const wchar_t* SqlStringPkey +                ,bool \
BindOwner,const wchar_t* ConnectionOraSchema,const wchar_t* Owner,FdoClassCollection* \
FdoClasses,FdoKgOraClassCollection* PhysClasses ,c_KgOraSpatialContextCollection* \
SC_Collection,long& AliasNum,bool IsOracle9 ); +  static void \
DescribeSchemaSDE(c_Oci_Connection * OciConn,const wchar_t* Owner \
,FdoClassCollection* FdoClasses,FdoKgOraClassCollection* PhysClasses \
,c_KgOraSpatialContextCollection* SC_Collection,long& AliasNum ); +  static bool \
CheckIfVersionedTableName(c_Oci_Connection * OciConn,const std::wstring& Owner,const \
std::wstring& ora_tablename,std::wstring& orig_tablename); +  static \
c_KgOraSpatialContext* CreateSpatialContext(c_Oci_Connection * OciConn,const wchar_t* \
Owner,const wchar_t* Table,const wchar_t* GeometryColumn +                            \
,c_KgOraSpatialContextCollection* SC_Collection,bool& IsZ,bool& IsM); +  
+};
+
+#endif

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraApplySchema.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraApplySchema.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraApplySchema.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -1,35 +1,35 @@
-/*
-* Copyright (C) 2009  SL-King d.o.o
-* 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of version 2.1 of the GNU Lesser
-* General Public License as published by the Free Software Foundation.
-* 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
-* 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-*/
-#include "stdafx.h"
-#include "c_KgOraApplySchema.h"
-#include "c_FdoOra_API2.h"
-#include "c_Ora_API2.h"
-
-c_KgOraApplySchema::c_KgOraApplySchema(c_KgOraConnection *Conn)
-  : c_KgOraFdoCommand<FdoIApplySchema>(Conn)
-{
-  m_IngoreStates = true;
-}
-
-c_KgOraApplySchema::~c_KgOraApplySchema(void)
-{
-}
-
+/*
+* Copyright (C) 2009  SL-King d.o.o
+* 
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of version 2.1 of the GNU Lesser
+* General Public License as published by the Free Software Foundation.
+* 
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+* 
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+#include "stdafx.h"
+#include "c_KgOraApplySchema.h"
+#include "c_FdoOra_API3.h"
+#include "c_Ora_API2.h"
 
+c_KgOraApplySchema::c_KgOraApplySchema(c_KgOraConnection *Conn)
+  : c_KgOraFdoCommand<FdoIApplySchema>(Conn)
+{
+  m_IngoreStates = true;
+}
+
+c_KgOraApplySchema::~c_KgOraApplySchema(void)
+{
+}
+
+
 /// \brief
 /// Gets the name of the schema to create.
 /// 
@@ -144,7 +144,7 @@
     
   if( !m_FeatureSchema.p ) return;
  
-c_Oci_Statement* occi_stm=NULL;
+c_Oci_Statement* occi_stm=NULL;
 //oracle::occi::ResultSet* occi_rset=NULL;    
 
 //    
@@ -174,7 +174,7 @@
         FdoPtr<FdoPropertyDefinition> propdef = props->GetItem(propind);
         
         proporatype = L"";
-        if( !c_FdoOra_API2::FdoPropertyToOraDataType(propdef.p,proporatype) )
+        if( !c_FdoOra_API3::FdoPropertyToOraDataType(propdef.p,proporatype) )
         {
           if( occi_stm ) m_Connection->OCI_TerminateStatement(occi_stm);
           throw FdoCommandException::Create( L"c_KgOraApplySchema::Execute: Unkown \
Property Definition ");   @@ -211,7 +211,7 @@
             InsertSdoGeomMetadata(tablename,geomprop);
           }
         }
-        catch(c_Oci_Exception* ea) // ignore this error, suspect many time will \
metada left and doesn't want to bother user +        catch(c_Oci_Exception* ea) // \
ignore this error, suspect many time will metada left and doesn't want to bother user \
{          delete ea;
         }
@@ -228,7 +228,7 @@
             CreateIndex(tablename,geomprop);
           }
         }
-        catch(c_Oci_Exception* ea) // ignore this error, suspect many time will \
metada left and doesn't want to bother user +        catch(c_Oci_Exception* ea) // \
ignore this error, suspect many time will metada left and doesn't want to bother user \
{          delete ea;
         }
@@ -261,7 +261,7 @@
                 {
                   CreateTableSequence(tablename);
                 }
-                catch(c_Oci_Exception* ea) // ignore this error, suspect many time \
will metada left and doesn't want to bother user +                \
catch(c_Oci_Exception* ea) // ignore this error, suspect many time will metada left \
and doesn't want to bother user  {        
                   delete ea;
                 }
@@ -274,7 +274,7 @@
           }
         }
       }
-      catch(c_Oci_Exception* ea) // ignore this error, suspect many time will metada \
left and doesn't want to bother user +      catch(c_Oci_Exception* ea) // ignore this \
error, suspect many time will metada left and doesn't want to bother user  {        
         delete ea;
       }
@@ -286,14 +286,14 @@
   }
   
   m_Connection->OCI_TerminateStatement(occi_stm);
-}
-catch(c_Oci_Exception* ea)
-{
-  if( occi_stm ) m_Connection->OCI_TerminateStatement(occi_stm);
-  
-  FdoStringP gstr = ea->what();
-  delete ea;
-  throw FdoCommandException::Create( gstr );    
+}
+catch(c_Oci_Exception* ea)
+{
+  if( occi_stm ) m_Connection->OCI_TerminateStatement(occi_stm);
+  
+  FdoStringP gstr = ea->what();
+  delete ea;
+  throw FdoCommandException::Create( gstr );    
 }  
     
 }//endof c_KgOraApplySchema::Execute
@@ -430,12 +430,12 @@
   
   m_Connection->OCI_TerminateStatement(occi_stm);
 }
-catch(oracle::occi::SQLException& ea)
-{
-  if( occi_stm ) m_Connection->OCI_TerminateStatement(occi_stm);
-  
-  FdoStringP gstr = ea.what();
-  throw FdoCommandException::Create( gstr );    
+catch(oracle::occi::SQLException& ea)
+{
+  if( occi_stm ) m_Connection->OCI_TerminateStatement(occi_stm);
+  
+  FdoStringP gstr = ea.what();
+  throw FdoCommandException::Create( gstr );    
 }    
 
 }//end of c_KgOraApplySchema::InsertSdoGeomMetadata
@@ -638,13 +638,13 @@
   
   m_Connection->OCI_TerminateStatement(occi_stm);
 }
-catch(c_Oci_Exception* ea)
-{
-  if( occi_stm ) m_Connection->OCI_TerminateStatement(occi_stm);
-  
-  FdoStringP gstr = ea->what();
-  delete ea;
-  throw FdoCommandException::Create( gstr );    
+catch(c_Oci_Exception* ea)
+{
+  if( occi_stm ) m_Connection->OCI_TerminateStatement(occi_stm);
+  
+  FdoStringP gstr = ea->what();
+  delete ea;
+  throw FdoCommandException::Create( gstr );    
 }    
 
 }//end of c_KgOraApplySchema::InsertSdoGeomMetadata
@@ -707,13 +707,13 @@
   
   m_Connection->OCI_TerminateStatement(occi_stm);
 }
-catch(c_Oci_Exception* ea)
-{
-  if( occi_stm ) m_Connection->OCI_TerminateStatement(occi_stm);
-  
-  FdoStringP gstr = ea->what();
-  delete ea;
-  throw FdoCommandException::Create( gstr );    
+catch(c_Oci_Exception* ea)
+{
+  if( occi_stm ) m_Connection->OCI_TerminateStatement(occi_stm);
+  
+  FdoStringP gstr = ea->what();
+  delete ea;
+  throw FdoCommandException::Create( gstr );    
 }    
 
 }//end of c_KgOraApplySchema::CreateIndex
@@ -740,9 +740,9 @@
     sep = L",";
   }
   
-  FdoStringP pkeyname;
-  pkeyname = TableName;
-  pkeyname = pkeyname.Upper() + "_PK";
+  FdoStringP pkeyname;
+  pkeyname = TableName;
+  pkeyname = pkeyname.Upper() + "_PK";
   sqlstr = sqlstr.Format(L"ALTER TABLE %s ADD CONSTRAINT %s primary key \
(%s)",(FdoString*)TableName,(FdoString*)pkeyname,(FdoString*)cnames);  
  
@@ -760,13 +760,13 @@
   
   m_Connection->OCI_TerminateStatement(occi_stm);
 }
-catch(c_Oci_Exception* ea)
-{
-  if( occi_stm ) m_Connection->OCI_TerminateStatement(occi_stm);
-  
-  FdoStringP gstr = ea->what();
-  delete ea;
-  throw FdoCommandException::Create( gstr );    
+catch(c_Oci_Exception* ea)
+{
+  if( occi_stm ) m_Connection->OCI_TerminateStatement(occi_stm);
+  
+  FdoStringP gstr = ea->what();
+  delete ea;
+  throw FdoCommandException::Create( gstr );    
 }    
 
 }//end of c_KgOraApplySchema::CreatePrimaryKey
@@ -795,13 +795,13 @@
   
   m_Connection->OCI_TerminateStatement(occi_stm);
 }
-catch(c_Oci_Exception* ea)
-{
-  if( occi_stm ) m_Connection->OCI_TerminateStatement(occi_stm);
-  
-  FdoStringP gstr = ea->what();
-  delete ea;
-  throw FdoCommandException::Create( gstr );    
+catch(c_Oci_Exception* ea)
+{
+  if( occi_stm ) m_Connection->OCI_TerminateStatement(occi_stm);
+  
+  FdoStringP gstr = ea->what();
+  delete ea;
+  throw FdoCommandException::Create( gstr );    
 }    
 
 }//end of c_KgOraApplySchema::CreateTableSequence

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraConnection.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraConnection.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraConnection.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -19,7 +19,7 @@
 
 #include "c_OCI_API.h"
 #include "c_Ora_API2.h"
-#include "c_FdoOra_API2.h"
+#include "c_FdoOra_API3.h"
 #include "c_KgOraSchemaDesc.h"
 #include "c_KgOraSchemaPool.h"
 #include "c_LogAPI.h"
@@ -31,6 +31,7 @@
 
 #include <../Message/KgOraMessageStatic.h>
 #include <../Message/inc/KgOraMessage.h>
+#include "c_FdoOra_API3.h"
 
 #ifdef _WIN32
 
@@ -38,7 +39,11 @@
 static wchar_t g_HomeDir[MAX_PATH];
 wchar_t g_LogFileName[MAX_PATH];
 
-#define D_ENABLE_SCHEMA_POOL 1
+//#ifdef _DEBUG
+//  #define D_ENABLE_SCHEMA_POOL 1
+//#else
+//  #define D_ENABLE_SCHEMA_POOL 1
+//#endif
 
 //wchar_t g_WcharBuff1024[1024+1];
 
@@ -82,8 +87,8 @@
 
     return (ret);
 }
-#else // _WIN32
-wchar_t* g_LogFileName = L"/tmp/kingora.log";
+#else // _WIN32
+wchar_t* g_LogFileName = L"/tmp/kingora.log";
 #endif // _WIN32
 
 
@@ -158,8 +163,7 @@
 /// <returns>Returns schema capabilities</returns> 
 FdoISchemaCapabilities* c_KgOraConnection::GetSchemaCapabilities ()
 {
-  //D_KGORA_ELOG_WRITE("c_KgOraConnection::GetSchemaCapabilities");
-  D_KGORA_ELOG_WRITE1("c_KgOraConnection%d::GetSchemaCapabilities",m_ConnNo);
+  // D_KGORA_ELOG_WRITE1("c_KgOraConnection%d::GetSchemaCapabilities",m_ConnNo);
     return (new c_KgOraSchemaCapabilities ());
 }
 
@@ -167,7 +171,7 @@
 /// <returns>Returns the command capabilities</returns> 
 FdoICommandCapabilities* c_KgOraConnection::GetCommandCapabilities ()
 {
-  D_KGORA_ELOG_WRITE("c_KgOraConnection::GetCommandCapabilities");
+  // D_KGORA_ELOG_WRITE1("c_KgOraConnection::GetCommandCapabilities",m_ConnNo);
     return (new c_KgOraCommandCapabilities ());
 }
 
@@ -175,7 +179,7 @@
 /// <returns>Returns the filter capabilities</returns> 
 FdoIFilterCapabilities* c_KgOraConnection::GetFilterCapabilities ()
 {
-  D_KGORA_ELOG_WRITE("c_KgOraConnection::GetFilterCapabilities");
+  //D_KGORA_ELOG_WRITE("c_KgOraConnection::GetFilterCapabilities");
     return (new c_KgOraFilterCapabilities ());
 }
 
@@ -183,7 +187,7 @@
 /// <returns>Returns the expression capabilities</returns> 
 FdoIExpressionCapabilities* c_KgOraConnection::GetExpressionCapabilities ()
 {
-  D_KGORA_ELOG_WRITE("c_KgOraConnection::GetExpressionCapabilities");
+  //D_KGORA_ELOG_WRITE("c_KgOraConnection::GetExpressionCapabilities");
     return (new c_KgOraExpressionCapabilities ());
 }
 
@@ -191,7 +195,7 @@
 /// <returns>Returns the raster capabilities</returns> 
 FdoIRasterCapabilities* c_KgOraConnection::GetRasterCapabilities (void)
 {
-  D_KGORA_ELOG_WRITE("c_KgOraConnection::GetRasterCapabilities");
+  //D_KGORA_ELOG_WRITE("c_KgOraConnection::GetRasterCapabilities");
     return (new c_KgOraRasterCapabilities ());
 }
 
@@ -215,8 +219,8 @@
 /// <returns>Returns the connection string</returns> 
 FdoString* c_KgOraConnection::GetConnectionString ()
 {
-  //D_KGORA_ELOG_WRITE("c_KgOraConnection::GetConnectionString");
-  D_KGORA_ELOG_WRITE1("c_KgOraConnection%d::GetConnectionString",m_ConnNo);
+  
+  // D_KGORA_ELOG_WRITE1("c_KgOraConnection%d::GetConnectionString",m_ConnNo);
     return (m_ConnectionString);
 }
 
@@ -246,8 +250,8 @@
 /// <returns>Returns the connection info</returns> 
 FdoIConnectionInfo* c_KgOraConnection::GetConnectionInfo ()
 {
-  //D_KGORA_ELOG_WRITE("c_KgOraConnection::GetConnectionInfo ");
-  D_KGORA_ELOG_WRITE1("c_KgOraConnection%d::GetConnectionInfo",m_ConnNo);
+  
+  // D_KGORA_ELOG_WRITE1("c_KgOraConnection%d::GetConnectionInfo",m_ConnNo);
     if( m_ConnectionInfo == NULL )
         m_ConnectionInfo = new c_KgOraConnectionInfo ( this );
     return FDO_SAFE_ADDREF(m_ConnectionInfo.p);
@@ -258,7 +262,7 @@
 FdoConnectionState c_KgOraConnection::GetConnectionState ()
 {
   //D_KGORA_ELOG_WRITE("c_KgOraConnection::GetConnectionState ");
-  D_KGORA_ELOG_WRITE1("c_KgOraConnection%d::GetConnectionState",m_ConnNo);
+  //D_KGORA_ELOG_WRITE1("c_KgOraConnection%d::GetConnectionState",m_ConnNo);
     return (m_ConnectionState);
 }
 
@@ -617,16 +621,52 @@
 }
 
 
-bool c_KgOraConnection::GetOracleSridDesc(FdoGeometricPropertyDefinition* \
GeomProp,c_KgOraSridDesc& OraSridDesc) +bool \
c_KgOraConnection::GetOracleSridDesc(FdoGeometricPropertyDefinition* \
GeomProp,c_KgOraSridDesc& OraSrid)  {
   FdoString *csname = GeomProp->GetSpatialContextAssociation();
+  if( !csname )
+    return false;
+    
   FdoPtr<c_KgOraSpatialContextCollection> sccol = GetSpatialContexts();
   
   FdoPtr<c_KgOraSpatialContext> sc = sccol->FindItem(csname);
   
-  if( !sc.p ) return false;
+  if( !sc.p ) 
+  {
+    // Now test if
+    FdoStringP name = csname;
+    FdoStringP temp = name.Mid(0,10);
+    if( (temp.ICompare("OracleSrid") == 0) )
+    {
+      FdoStringP temp = name.Mid(10,name.GetLength()-10);
+      OraSrid.m_OraSrid = temp.ToLong();
+
+
+      FdoStringP wkt =  sc->GetCoordinateSystemWkt();        
+      OraSrid.m_IsGeodetic = c_Ora_API2::IsGeodeticCoordSystem(wkt); // TODO: it \
should return real value +    }
+    else
+    {
+      FdoStringP name = sc->GetCoordinateSystem();
+      FdoStringP temp = name.Mid(0,10);
+      if( (temp.ICompare("OracleSrid") == 0) )
+      {
+        FdoStringP temp = name.Mid(10,name.GetLength()-10);
+        OraSrid.m_OraSrid = temp.ToLong();
+
+        FdoStringP wkt =  sc->GetCoordinateSystemWkt();                   
+        OraSrid.m_IsGeodetic = c_Ora_API2::IsGeodeticCoordSystem(wkt); // TODO: it \
should return real value +      }
+      else
+      {
+        return false;
+      }
+    }
+  }
+  else
+    OraSrid = sc->GetOraSridDesc();
   
-  OraSridDesc = sc->GetOraSridDesc();
+  
   return true;
   
 }//end of c_KgOraConnection::GetOracleSridDesc
@@ -644,52 +684,22 @@
   
   if( !geomprop.p ) return false;
   
+  return GetOracleSridDesc(geomprop,OraSrid);
   
-  FdoString *csname = geomprop->GetSpatialContextAssociation();
-  FdoPtr<c_KgOraSpatialContextCollection> sccol = GetSpatialContexts();
-  
-  
-  
-    
-  FdoPtr<c_KgOraSpatialContext> sc = sccol->FindItem(csname);
-  
-  if( !sc.p ) 
+}//end of c_KgOraConnection::GetOracleSrid
+
+bool c_KgOraConnection::GetOracleSridDesc( FdoClassDefinition* ClassDef,FdoString* \
PropName,c_KgOraSridDesc& OraSrid ) +{
+  FdoPtr<FdoPropertyDefinitionCollection> props = ClassDef->GetProperties();
+  FdoPtr<FdoPropertyDefinition> prop = props->FindItem(PropName);
+  if( prop.p && prop->GetPropertyType()==FdoPropertyType_GeometricProperty )
   {
-    // Now test if
-    FdoStringP name = csname;
-    FdoStringP temp = name.Mid(0,10);
-    if( (temp.ICompare("OracleSrid") == 0) )
-    {
-      FdoStringP temp = name.Mid(10,name.GetLength()-10);
-      OraSrid.m_OraSrid = temp.ToLong();
-      
-         
-      FdoStringP wkt =  sc->GetCoordinateSystemWkt();        
-      OraSrid.m_IsGeodetic = c_Ora_API2::IsGeodeticCoordSystem(wkt); // TODO: it \
                should return real value
-    }
-    else
-    {
-      FdoStringP name = sc->GetCoordinateSystem();
-      FdoStringP temp = name.Mid(0,10);
-      if( (temp.ICompare("OracleSrid") == 0) )
-      {
-        FdoStringP temp = name.Mid(10,name.GetLength()-10);
-        OraSrid.m_OraSrid = temp.ToLong();
-           
-        FdoStringP wkt =  sc->GetCoordinateSystemWkt();                   
-        OraSrid.m_IsGeodetic = c_Ora_API2::IsGeodeticCoordSystem(wkt); // TODO: it \
                should return real value
-      }
-      else
-      {
-        return false;
-      }
-    }
+    FdoGeometricPropertyDefinition* geompropdef = \
(FdoGeometricPropertyDefinition*)prop.p; +    return \
GetOracleSridDesc(geompropdef,OraSrid);  }
-  else
-    OraSrid = sc->GetOraSridDesc();
-  return true;
   
-}//end of c_KgOraConnection::GetOracleSrid
+  return false;
+}//end of c_KgOraConnection::GetOracleSridDesc
 
 c_Oci_Statement* c_KgOraConnection::OCI_CreateStatement()
 {
@@ -729,11 +739,11 @@
   // Bug is in MgServerGetFeatures::SerializeToXml(FdoClassDefinition* classDef) \
which will remove class from schema   // and move class to temporary schema to be \
serialized.  // Problem also could happen when provider enables multiple commands per \
                connection or when schemas are shared across connections (schema \
                pooling).
-  #ifdef false // D_ENABLE_SCHEMA_POOL
+  #ifdef D_ENABLE_SCHEMA_POOL  // - disabled again - it seems problems with \
FindClass in multithread; I have enabled again schema for use provider in geosx  \
m_SchemaDesc = c_KgOraSchemaPool::GetSchemaData(this);  if( !m_SchemaDesc.p )
     {
-      m_SchemaDesc = \
c_FdoOra_API2::DescribeSchema(this->GetOciConnection(),m_OraConnectionUserName.c_str(),m_OraSchemaName.c_str()
 +      m_SchemaDesc = \
c_FdoOra_API3::DescribeSchema(this->GetOciConnection(),m_OraConnectionUserName.c_str(),m_OraSchemaName.c_str()
  ,m_FdoViewsTable.c_str(),m_SdeSchema.c_str());
       if( m_SchemaDesc.p )
       {
@@ -741,8 +751,8 @@
       }
     }
   
-  #else
-    m_SchemaDesc = c_FdoOra_API2::DescribeSchema(this->GetOciConnection(),m_OraConnec \
tionUserName.c_str(),m_OraSchemaName.c_str(),m_FdoViewsTable.c_str(),m_SdeSchema.c_str());
 +  #else    
+    m_SchemaDesc = c_FdoOra_API3::DescribeSchema(this->GetOciConnection(),m_OraConnec \
tionUserName.c_str(),m_OraSchemaName.c_str(),m_FdoViewsTable.c_str(),m_SdeSchema.c_str());
  #endif
   }
   return FDO_SAFE_ADDREF(m_SchemaDesc.p);

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraConnection.h
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraConnection.h	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraConnection.h	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -29,9 +29,9 @@
 
 #include <FdoCommonThreadMutex.h>
 
-#ifndef OCI_ORACLE
-#include <oci.h>
-#include <oci1.h>
+#ifndef OCI_ORACLE
+#include <oci.h>
+#include <oci1.h>
 #endif
 
 #include "c_OCI_API.h"
@@ -246,6 +246,7 @@
     
     bool GetOracleSridDesc(FdoGeometricPropertyDefinition* GeomProp,c_KgOraSridDesc& \
                OraSridDesc);
     bool GetOracleSridDesc(FdoClassDefinition* ClassDef,c_KgOraSridDesc& OraSrid);
+    bool GetOracleSridDesc(FdoClassDefinition* ClassDef,FdoString* \
PropName,c_KgOraSridDesc& OraSrid);  
     int GetOracleMainVersion() { return m_OracleMainVersion; };
 	  int GetOracleSubVersion() { return m_OracleSubVersion; }

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraCreateSpatialContext.cpp
 ===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraCreateSpatialContext.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraCreateSpatialContext.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -1,46 +1,46 @@
-/*
-* Copyright (C) 2009  SL-King d.o.o
-* 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of version 2.1 of the GNU Lesser
-* General Public License as published by the Free Software Foundation.
-* 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
-* 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-*/
-#include "stdafx.h"
-
-#include "c_FdoOra_API2.h"
-#include "c_Ora_API2.h"
-
-c_KgOraCreateSpatialContext::c_KgOraCreateSpatialContext(c_KgOraConnection *Conn)
-  : c_KgOraFdoCommand<FdoICreateSpatialContext>(Conn)
-{
-    m_Name = D_SPATIALCONTEXT_DEFAULT_NAME;    
-    m_Description = "";    
-    
-    m_CoordinateSystem = D_SPATIALCONTEXT_CSYS_DEFAULT_NAME;
-    m_CoordinateSystemWkt = D_SPATIALCONTEXT_CSYS_DEFAULT_WKT;
-    
-    m_SpatialContextExtentType = FdoSpatialContextExtentType_Dynamic;
-    
-    //FdoPtr<FdoByteArray> m_Extent;
-    
-    m_XYTolerance = D_SPATIALCONTEXT_DEFAULT_XY_TOLERANCE;
-    m_ZTolerance = D_SPATIALCONTEXT_DEFAULT_Z_TOLERANCE;
-    m_UpdateExisting = false;
-}
-
-c_KgOraCreateSpatialContext::~c_KgOraCreateSpatialContext(void)
-{
-}
-
+/*
+* Copyright (C) 2009  SL-King d.o.o
+* 
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of version 2.1 of the GNU Lesser
+* General Public License as published by the Free Software Foundation.
+* 
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+* 
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+#include "stdafx.h"
+
+#include "c_FdoOra_API3.h"
+#include "c_Ora_API2.h"
+
+c_KgOraCreateSpatialContext::c_KgOraCreateSpatialContext(c_KgOraConnection *Conn)
+  : c_KgOraFdoCommand<FdoICreateSpatialContext>(Conn)
+{
+    m_Name = D_SPATIALCONTEXT_DEFAULT_NAME;    
+    m_Description = "";    
+    
+    m_CoordinateSystem = D_SPATIALCONTEXT_CSYS_DEFAULT_NAME;
+    m_CoordinateSystemWkt = D_SPATIALCONTEXT_CSYS_DEFAULT_WKT;
+    
+    m_SpatialContextExtentType = FdoSpatialContextExtentType_Dynamic;
+    
+    //FdoPtr<FdoByteArray> m_Extent;
+    
+    m_XYTolerance = D_SPATIALCONTEXT_DEFAULT_XY_TOLERANCE;
+    m_ZTolerance = D_SPATIALCONTEXT_DEFAULT_Z_TOLERANCE;
+    m_UpdateExisting = false;
+}
+
+c_KgOraCreateSpatialContext::~c_KgOraCreateSpatialContext(void)
+{
+}
+
  /// \brief
 /// Gets the name of the context to create as a string.
 /// 
@@ -371,12 +371,12 @@
           orig_wkt = wkt.c_str();
         }
         orasrid.m_IsGeodetic = c_Ora_API2::IsGeodeticCoordSystem(wkt.c_str());
-      }
-      catch(c_Oci_Exception* ea)
-      {
-        FdoStringP gstr = ea->what();
-        delete ea;
-        //throw FdoCommandException::Create( gstr );    
+      }
+      catch(c_Oci_Exception* ea)
+      {
+        FdoStringP gstr = ea->what();
+        delete ea;
+        //throw FdoCommandException::Create( gstr );    
       }    
     }
     else
@@ -389,13 +389,13 @@
         std::wstring wkt = (FdoString*)tempname;
         orasrid.m_OraSrid = \
                c_Ora_API2::GetSrid(m_Connection->GetOciConnection(),csname.c_str());
         orasrid.m_IsGeodetic = c_Ora_API2::IsGeodeticCoordSystem(wkt.c_str());
-      }
-      catch(c_Oci_Exception* ea)
-      {
-        FdoStringP gstr = ea->what();
-        delete ea;
-        throw FdoCommandException::Create( gstr );    
       }
+      catch(c_Oci_Exception* ea)
+      {
+        FdoStringP gstr = ea->what();
+        delete ea;
+        throw FdoCommandException::Create( gstr );    
+      }
       
       if( !orasrid.m_OraSrid )
       {

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraDataReader.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraDataReader.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraDataReader.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -20,7 +20,7 @@
 #include <time.h>
 
 #include "c_KgOraDataReader.h"
-#include "c_FdoOra_API2.h"
+#include "c_FdoOra_API3.h"
 #include "c_SdoGeomToAGF2.h"
 #include "c_LogAPI.h"
 
@@ -81,7 +81,7 @@
   int oraprecision = m_OciStatement->GetColumnPrecision(ind);
 
   FdoDataType fdotype;
-  c_FdoOra_API2::OraTypeToFdoDataType(dtype,oraprecision,orascale,length,fdotype);
+  c_FdoOra_API3::OraTypeToFdoDataType(dtype,oraprecision,orascale,length,fdotype);
   
   return fdotype;
 }

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraDelete.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraDelete.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraDelete.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -28,59 +28,59 @@
 {
 }
 
-
-
-
-/// \brief
-/// Executes the update command and returns the number of modified 
-/// instances.
-/// 
-/// \return
-/// Returns nothing
-/// 
-FdoInt32 c_KgOraDelete::Execute()
-{
-  FdoPtr<c_KgOraSchemaDesc> schemadesc = m_Connection->GetSchemaDesc();
-  
-  FdoPtr<FdoIdentifier> classid = GetFeatureClassName();
+
+
+
+/// \brief
+/// Executes the update command and returns the number of modified 
+/// instances.
+/// 
+/// \return
+/// Returns nothing
+/// 
+FdoInt32 c_KgOraDelete::Execute()
+{
+  FdoPtr<c_KgOraSchemaDesc> schemadesc = m_Connection->GetSchemaDesc();
+  
+  FdoPtr<FdoIdentifier> classid = GetFeatureClassName();
   FdoPtr<FdoClassDefinition> classdef = schemadesc->FindClassDefinition(classid);
-  if( !classdef.p ) return NULL;
-  
-  
+  if( !classdef.p ) return NULL;
+  
+  
   FdoPtr<FdoKgOraClassDefinition> phys_class = \
schemadesc->FindClassMapping(classid);  FdoStringP fultablename = \
                phys_class->GetOracleFullTableName();
-  FdoStringP table_alias = phys_class->GetOraTableAlias();
-  
-  
-  c_KgOraSridDesc orasrid;
-  m_Connection->GetOracleSridDesc(classdef,orasrid);
-  
-  
-  c_FilterStringBuffer sqlstr;
-  sqlstr.AppendString(L"DELETE ");
-  sqlstr.AppendString(fultablename);
-  sqlstr.AppendString(L" ");
-  sqlstr.AppendString(table_alias);
-  
-  
-  // process filter
+  FdoStringP table_alias = phys_class->GetOraTableAlias();
+  
+  
+  c_KgOraSridDesc orasrid;
+  m_Connection->GetOracleSridDesc(classdef,orasrid);
+  
+  
+  c_FilterStringBuffer sqlstr;
+  sqlstr.AppendString(L"DELETE ");
+  sqlstr.AppendString(fultablename);
+  sqlstr.AppendString(L" ");
+  sqlstr.AppendString(table_alias);
+  
+  
+  // process filter
   const wchar_t* filtertext=NULL;
-  c_KgOraFilterProcessor \
fproc(m_Connection->GetOracleMainVersion(),schemadesc,classid,orasrid); +  \
c_KgOraFilterProcessor fproc(m_Connection,schemadesc,classdef,orasrid);  if( m_Filter \
)  {      
     m_Filter->Process( &fproc );
   
     filtertext = fproc.GetFilterText();
   }
-  else filtertext = NULL;
-  
+  else filtertext = NULL;
+  
   if( filtertext && *filtertext )
   {
     sqlstr.AppendString(L" WHERE ");
     sqlstr.AppendString(filtertext);
-  }
-  
-  int delete_num=0;
+  }
+  
+  int delete_num=0;
   c_Oci_Statement* oci_stm=NULL;
   
   try
@@ -95,7 +95,7 @@
     
     oci_stm->Prepare(sqlstr.GetString());
     
-    fproc.GetExpressionProcessor().ApplySqlParameters(oci_stm,orasrid.m_IsGeodetic,orasrid.m_OraSrid);
 +    fproc.GetExpressionProcessor().ApplySqlParameters(oci_stm);
     
 
     delete_num = oci_stm->ExecuteNonQuery();
@@ -113,13 +113,13 @@
     delete ea;
     throw FdoCommandException::Create( gstr );    
   }
-
-
-  
-  return delete_num;
-}//end of c_KgOraDelete::Execute
-
-FdoILockConflictReader* c_KgOraDelete::GetLockConflicts()
-{
-  return NULL;
-}
+
+
+  
+  return delete_num;
+}//end of c_KgOraDelete::Execute
+
+FdoILockConflictReader* c_KgOraDelete::GetLockConflicts()
+{
+  return NULL;
+}

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraDescribeSchemaCommand.cpp
 ===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraDescribeSchemaCommand.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraDescribeSchemaCommand.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -20,6 +20,9 @@
 #include "c_LogAPI.h"
 #include "c_KgOraSchemaPool.h"
 
+
+FdoCommonThreadMutex c_KgOraDescribeSchemaCommand::g_DeepCopyMutex;
+
 c_KgOraDescribeSchemaCommand::c_KgOraDescribeSchemaCommand (c_KgOraConnection* \
Connection)   
 {
@@ -121,7 +124,9 @@
     // If I create a copy and for every request return copy than it is OK.
     // and some other callers (FME) may change it and that is nt ok for us then
     
-    FdoFeatureSchemaCollection* ret2 = \
FdoCommonSchemaUtil::DeepCopyFdoFeatureSchemas(ret); +    g_DeepCopyMutex.Enter();
+    FdoFeatureSchemaCollection* ret2 = \
FdoCommonSchemaUtil::DeepCopyFdoFeatureSchemas(ret); // deep copy is not thread safe \
+    g_DeepCopyMutex.Leave();  return ret2;  
     
     //return FDO_SAFE_ADDREF(ret.p);
@@ -148,13 +153,13 @@
 {
 }
 
-/// \brief
-/// Gets the number of milliseconds to wait before terminating the attempt
-/// to execute a command and generating an error. If the provider does not
-/// support the timeout capability, 0 is returned.
-/// 
-/// \return
-/// Returns the time (in milliseconds)
+/// \brief
+/// Gets the number of milliseconds to wait before terminating the attempt
+/// to execute a command and generating an error. If the provider does not
+/// support the timeout capability, 0 is returned.
+/// 
+/// \return
+/// Returns the time (in milliseconds)
 ///
 FdoInt32 c_KgOraDescribeSchemaCommand::GetCommandTimeout()
 { 
@@ -164,19 +169,19 @@
   throw FdoException::Create (FdoException::NLSGetMessage (FDO_NLSID \
(FDO_100_COMMAND_TIMEOUT_NOT_SUPPORTED)));  #endif
 }
-
-/// \brief
-/// Sets the number of milliseconds to wait before terminating the attempt
-/// to execute a command and generating an error. If the provider does not
-/// support the timeout capability, then attempting to set a timeout will
-/// result in an exception.
-/// 
-/// \param value 
-/// Input the time (in milliseconds)
-/// 
-/// \return
-/// Returns nothing
+
+/// \brief
+/// Sets the number of milliseconds to wait before terminating the attempt
+/// to execute a command and generating an error. If the provider does not
+/// support the timeout capability, then attempting to set a timeout will
+/// result in an exception.
 /// 
+/// \param value 
+/// Input the time (in milliseconds)
+/// 
+/// \return
+/// Returns nothing
+/// 
 void c_KgOraDescribeSchemaCommand::SetCommandTimeout(FdoInt32 Timeout)
 {
   #ifdef _FDO_3_1
@@ -186,14 +191,14 @@
   #endif
 }
 
-/// \brief
-/// Returns an FdoParameterValueCollection. If the command requires parameters, the 
-/// literal values to bind to each of those named parameters must be added to
-/// this collection.
-/// 
-/// \return
-/// Returns the list of parameters and their respective values
+/// \brief
+/// Returns an FdoParameterValueCollection. If the command requires parameters, the 
+/// literal values to bind to each of those named parameters must be added to
+/// this collection.
 /// 
+/// \return
+/// Returns the list of parameters and their respective values
+/// 
 FdoParameterValueCollection* c_KgOraDescribeSchemaCommand::GetParameterValues()
 {
   #ifdef _FDO_3_1
@@ -203,29 +208,29 @@
   #endif
 }
 
-/// \brief
-/// Validates and optimizes the command for execution. Calling this method is
-/// optional, but recommended if bound to different sets of parameters and
-/// executed multiple times.
-/// 
-/// \return
-/// Returns nothing
-/// 
-void c_KgOraDescribeSchemaCommand::Prepare()
-{
-}
-
-/// \brief
-/// Attempts to cancel command execution. Cancel may be called on a separate
-/// thread after the commands Execute method has been called and before 
-/// Execute has returned. If successful, an exception is thrown from the
-/// Execute method. If there is nothing to cancel, nothing happens. If
-/// command execution is in process, and the attempt to cancel fails or is
-/// not supported, an exception is thrown.
-/// 
-/// \return
-/// Returns nothing
-/// 
-void c_KgOraDescribeSchemaCommand::Cancel()
-{
-}
+/// \brief
+/// Validates and optimizes the command for execution. Calling this method is
+/// optional, but recommended if bound to different sets of parameters and
+/// executed multiple times.
+/// 
+/// \return
+/// Returns nothing
+/// 
+void c_KgOraDescribeSchemaCommand::Prepare()
+{
+}
+
+/// \brief
+/// Attempts to cancel command execution. Cancel may be called on a separate
+/// thread after the commands Execute method has been called and before 
+/// Execute has returned. If successful, an exception is thrown from the
+/// Execute method. If there is nothing to cancel, nothing happens. If
+/// command execution is in process, and the attempt to cancel fails or is
+/// not supported, an exception is thrown.
+/// 
+/// \return
+/// Returns nothing
+/// 
+void c_KgOraDescribeSchemaCommand::Cancel()
+{
+}

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraDescribeSchemaCommand.h
 ===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraDescribeSchemaCommand.h	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraDescribeSchemaCommand.h	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -28,7 +28,10 @@
   FdoPtr<c_KgOraConnection> m_KgOraConnection;
   FdoStringP m_SchemaName;
   FdoStringCollection* m_ClassNames;
-
+  
+public:  
+  static	FdoCommonThreadMutex g_DeepCopyMutex;
+  
 private:
    
     // Constructs an instance of a DescribeSchema command using the given \
connection.

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraExpressionProcessor.cpp
 ===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraExpressionProcessor.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraExpressionProcessor.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -31,16 +31,24 @@
 #define D_FILTER_ARITHMETIC_DIV     L" / "
 
 
-c_KgOraExpressionProcessor::c_KgOraExpressionProcessor(c_FilterStringBuffer* \
StrBuff,c_KgOraSchemaDesc *KgOraSchemaDesc,FdoIdentifier* ClassId,const \
c_KgOraSridDesc& OraSridDesc,int ParamNumberOffset) \
+c_KgOraExpressionProcessor::c_KgOraExpressionProcessor(c_FilterStringBuffer* \
StrBuff,c_KgOraSchemaDesc *KgOraSchemaDesc,FdoClassDefinition* ClassDef +             \
,const c_KgOraSridDesc& OraSridDesc,int ParamNumberOffset)  {
   m_StringBuff = StrBuff;
   
   m_KgOraSchemaDesc = KgOraSchemaDesc;
   FDO_SAFE_ADDREF(m_KgOraSchemaDesc.p);
   
-  m_ClassId = ClassId;
-  FDO_SAFE_ADDREF(m_ClassId.p);
   
+  FdoPtr<FdoKgOraPhysicalSchemaMapping> phschemamapping;
+  FdoPtr<FdoKgOraClassDefinition> phys_class;
+  if( KgOraSchemaDesc && ClassDef )
+  {
+    phschemamapping = KgOraSchemaDesc->GetPhysicalSchemaMapping();
+    m_phys_class = phschemamapping->FindByClassName( ClassDef->GetName() );
+
+  }
+  
   m_OraSridDesc = OraSridDesc;
   
   m_DoAsParameters = true;
@@ -138,29 +146,24 @@
   {
     FdoPtr<FdoKgOraPhysicalSchemaMapping> phschemamapping;
     FdoPtr<FdoKgOraClassDefinition> phys_class;
-    if( m_KgOraSchemaDesc.p && m_ClassId.p )
-    {
-      phschemamapping = m_KgOraSchemaDesc->GetPhysicalSchemaMapping();
-      phys_class = phschemamapping->FindByClassName( m_ClassId->GetName() );
-
-    }
     
-    if( phys_class && phys_class->GetIsSdeClass() )
+    
+    if( m_phys_class.p && m_phys_class->GetIsSdeClass() )
     {
       AppendString( L"min(" );
-      AppendString( phys_class->GetSdeGeomTableAlias() );
+      AppendString( m_phys_class->GetSdeGeomTableAlias() );
       AppendString( L".eminx)" );
       
       AppendString( L",min(" );
-      AppendString( phys_class->GetSdeGeomTableAlias() );
+      AppendString( m_phys_class->GetSdeGeomTableAlias() );
       AppendString( L".eminy)" );
       
       AppendString( L",max(" );
-      AppendString( phys_class->GetSdeGeomTableAlias() );
+      AppendString( m_phys_class->GetSdeGeomTableAlias() );
       AppendString( L".emaxx)" );
 
       AppendString( L",max(" );
-      AppendString( phys_class->GetSdeGeomTableAlias() );
+      AppendString( m_phys_class->GetSdeGeomTableAlias() );
       AppendString( L".emaxy) " );
       
       return;
@@ -230,29 +233,24 @@
       {
         FdoPtr<FdoKgOraPhysicalSchemaMapping> phschemamapping;
         FdoPtr<FdoKgOraClassDefinition> phys_class;
-        if( m_KgOraSchemaDesc.p && m_ClassId.p )
-        {
-          phschemamapping = m_KgOraSchemaDesc->GetPhysicalSchemaMapping();
-          phys_class = phschemamapping->FindByClassName( m_ClassId->GetName() );
+        
 
-        }
-
-        if( phys_class && phys_class->GetIsSdeClass() )
+        if( m_phys_class.p && m_phys_class->GetIsSdeClass() )
         {
           AppendString( L"min(" );
-          AppendString( phys_class->GetSdeGeomTableAlias() );
+          AppendString( m_phys_class->GetSdeGeomTableAlias() );
           AppendString( L".eminx)" );
 
           AppendString( L",min(" );
-          AppendString( phys_class->GetSdeGeomTableAlias() );
+          AppendString( m_phys_class->GetSdeGeomTableAlias() );
           AppendString( L".eminy)" );
 
           AppendString( L",max(" );
-          AppendString( phys_class->GetSdeGeomTableAlias() );
+          AppendString( m_phys_class->GetSdeGeomTableAlias() );
           AppendString( L".emaxx)" );
 
           AppendString( L",max(" );
-          AppendString( phys_class->GetSdeGeomTableAlias() );
+          AppendString( m_phys_class->GetSdeGeomTableAlias() );
           AppendString( L".emaxy) " );
 
 
@@ -274,17 +272,13 @@
 {
   
   
-  if( m_KgOraSchemaDesc.p && m_ClassId.p )
-  {
-    FdoPtr<FdoKgOraPhysicalSchemaMapping> phschemamapping = \
                m_KgOraSchemaDesc->GetPhysicalSchemaMapping();
-    FdoPtr<FdoKgOraClassDefinition> phys_class = phschemamapping->FindByClassName( \
                m_ClassId->GetName() );
-    
-    if( phys_class && !phys_class->GetIsPointGeometry() )
-    {      
-      AppendString( phys_class->GetOraTableAlias() );
-      AppendString( L"." );
-    }
+  
+  if( m_phys_class && !m_phys_class->GetIsPointGeometry() )
+  {      
+    AppendString( m_phys_class->GetOraTableAlias() );
+    AppendString( L"." );
   }
+
   
   
   
@@ -607,25 +601,25 @@
 
 void c_KgOraExpressionProcessor::ProcessGeometryValue(FdoGeometryValue& Expr)
 {
+  long size = m_ParamList.size() + m_ParamNumberOffset;
+  size++;
+  FdoStringP chbuff = FdoStringP::Format(L"%ld",size);
+  AppendString( L":" );
+  AppendString( (FdoString*)chbuff );
+  
+  
   if( Expr.IsNull() )
   {  
     c_KgOraSqlParamDesc* pdesc = new c_KgOraSqlParamDesc();
-    pdesc->SetGeometry(NULL);
-    m_ParamList.push_back( pdesc );  
-    
-    return; 
+    pdesc->SetGeometry(NULL,m_OraSridDesc);
+    m_ParamList.push_back( pdesc );      
   }
- 
-  FdoPtr<FdoByteArray> fgf = Expr.GetGeometry();    
+  else
+  {
+    FdoPtr<FdoByteArray> fgf = Expr.GetGeometry();          
+    m_ParamList.push_back( new c_KgOraSqlParamDesc(fgf,m_OraSridDesc) );  
+  }
   
-    long size = m_ParamList.size() + m_ParamNumberOffset;
-    size++;
-    FdoStringP chbuff = FdoStringP::Format(L"%ld",size);
-    AppendString( L":" );
-    AppendString( (FdoString*)chbuff );
-      
-      
-    m_ParamList.push_back( new c_KgOraSqlParamDesc(fgf) );  
   
   
   
@@ -638,10 +632,16 @@
 // If geometry used in spatial filter is Rectangle then query will return correct \
features  void c_KgOraExpressionProcessor::ProcessGeometryValueRect(FdoGeometryValue& \
Expr)  {
+  long size = m_ParamList.size() + m_ParamNumberOffset;
+  size++;
+  FdoStringP chbuff = FdoStringP::Format(L"%ld",size);
+  AppendString( L":" );
+  AppendString( (FdoString*)chbuff );
+  
   if( Expr.IsNull() )
   {  
     c_KgOraSqlParamDesc* pdesc = new c_KgOraSqlParamDesc();
-    pdesc->SetGeometry(NULL);
+    pdesc->SetGeometry(NULL,m_OraSridDesc);
     m_ParamList.push_back( pdesc );  
     
     return; 
@@ -681,14 +681,10 @@
   //SDO_GEOMETRY *sdorect = \
c_Ora_API2::CreateOptimizedRect(m_OraSridDesc.m_OraSrid,minx,miny,maxx,maxy);  
          
-    long size = m_ParamList.size() + m_ParamNumberOffset;
-    size++;
-    FdoStringP chbuff = FdoStringP::Format(L"%ld",size);
-    AppendString( L":" );
-    AppendString( (FdoString*)chbuff );
+   
       
       
-   m_ParamList.push_back( new \
c_KgOraSqlParamDesc(m_OraSridDesc.m_OraSrid,minx,miny,maxx,maxy) );   +   \
m_ParamList.push_back( new c_KgOraSqlParamDesc(m_OraSridDesc,minx,miny,maxx,maxy) );  \
  
   
 }//end of c_KgOraExpressionProcessor::ProcessGeometryValueRect
@@ -699,7 +695,7 @@
       
 }//end of c_KgOraExpressionProcessor::GetSqlParametersCount
 
-void c_KgOraExpressionProcessor::ApplySqlParameters(c_Oci_Statement* OciStm,bool \
IsGeodeticCS,long OraSrid,int ParamOffest/*=0*/) +void \
c_KgOraExpressionProcessor::ApplySqlParameters(c_Oci_Statement* OciStm,int \
ParamOffest/*=0*/)  {
   if( m_ParamList.size() > 0 )
   {
@@ -708,7 +704,7 @@
     {
       FdoStringP paramname = FdoStringP::Format(L"%d",pind+1+ParamOffest);
       //m_ParamList[pind]->ApplySqlParameter(OciStm,IsGeodeticCS,OraSrid,pind+1+ParamOffest); \
                
-      m_ParamList[pind]->ApplySqlParameter(OciStm,IsGeodeticCS,OraSrid,paramname);   \
 +      m_ParamList[pind]->ApplySqlParameter(OciStm,paramname);      
     }
   }
       
@@ -718,3 +714,8 @@
 {
   m_ConstantSpatialExtent=ConstantSpatialExtent ? ConstantSpatialExtent : L"";
 }
+
+void c_KgOraExpressionProcessor::SetOracleSrid( const c_KgOraSridDesc& orasrid )
+{ 
+  m_OraSridDesc=orasrid;
+}

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraExpressionProcessor.h
 ===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraExpressionProcessor.h	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraExpressionProcessor.h	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -16,12 +16,12 @@
 */
 
 #ifndef _c_KgOraExpressionProcessor_h
-#define _c_KgOraExpressionProcessor_h
-
-#include "c_FilterStringBuffer.h"
-#include "c_KgOraSqlParamDesc.h"
-
-
+#define _c_KgOraExpressionProcessor_h
+
+#include "c_FilterStringBuffer.h"
+#include "c_KgOraSqlParamDesc.h"
+
+
 /// \brief
 /// The FdoIExpressionProcessor interface can be used to process the nodes in an
 /// Expression tree. It declares an process operation for each concrete class in
@@ -29,32 +29,35 @@
 /// classes that realize this interface to do something meaningful with an
 /// FdoExpression hierarchy. For example, an RDBMS feature provider implements a
 /// processor class to convert an FdoExpression hierarchy to the SQL equivalent
-/// syntax.
-class c_KgOraExpressionProcessor : public virtual FdoIExpressionProcessor
-{
-public:
-  c_KgOraExpressionProcessor(c_FilterStringBuffer* StringBuff,c_KgOraSchemaDesc \
*KgOraSchemaDesc,FdoIdentifier* ClassDef,const c_KgOraSridDesc& OraSrid,int \
                ParamNumberOffset=0);
-public:
-  ~c_KgOraExpressionProcessor(void);
-  virtual void Dispose() { delete this; }
-  
-protected:
-  FdoPtr<c_KgOraSchemaDesc> m_KgOraSchemaDesc;
-  FdoPtr<FdoIdentifier> m_ClassId;    
-  c_FilterStringBuffer* m_StringBuff; // pointer to buffer set in constructor; so it \
                can share buffer with expresion processor
-  c_KgOraSridDesc m_OraSridDesc; // when converting geomerty need to have this one
-  
-  
-  FdoStringP m_ConstantSpatialExtent;
-  
-  int m_ParamNumberOffset;
-  bool m_DoAsParameters;
-  
-  int m_ParamCount; 
-  
-  std::vector<c_KgOraSqlParamDesc*> m_ParamList; // how many parameters was created \
inside string ( geometry + parameters expressions) +/// syntax.
+class c_KgOraExpressionProcessor : public virtual FdoIExpressionProcessor
+{
+public:
+  c_KgOraExpressionProcessor(c_FilterStringBuffer* StringBuff,c_KgOraSchemaDesc \
*KgOraSchemaDesc,FdoClassDefinition* ClassDef,const c_KgOraSridDesc& OraSrid,int \
ParamNumberOffset=0); +public:
+  ~c_KgOraExpressionProcessor(void);
+  virtual void Dispose() { delete this; }
+  
+protected:
+  FdoPtr<c_KgOraSchemaDesc> m_KgOraSchemaDesc;
+  //FdoPtr<FdoIdentifier> m_ClassId;    
+     
+  FdoPtr<FdoKgOraClassDefinition> m_phys_class;
+  c_FilterStringBuffer* m_StringBuff; // pointer to buffer set in constructor; so it \
can share buffer with expresion processor +  
+  c_KgOraSridDesc m_OraSridDesc; // when converting geomerty need to have this one
+  
+  
+  FdoStringP m_ConstantSpatialExtent;
+  
+  int m_ParamNumberOffset;
+  bool m_DoAsParameters;
+  
+  int m_ParamCount; 
+  
+  std::vector<c_KgOraSqlParamDesc*> m_ParamList; // how many parameters was created \
inside string ( geometry + parameters expressions)  bool m_UsedConstantSpatialExtent;
-
+
   public:
 
     /// \brief
@@ -264,30 +267,33 @@
     /// \return
     /// Returns nothing
     /// 
-    virtual void ProcessGeometryValue(FdoGeometryValue& expr);
-    
-    virtual void ProcessGeometryValueRect(FdoGeometryValue& expr);
-  
-public:
-  //const std::vector<c_KgOraSqlParamDesc*> GetParamList() const { return \
                m_ParamList; }
-  void SetConstantSpatialExtent(const wchar_t* ConstantSpatialExtent);
-  bool GetUsedConstantSpatialExtent() { return m_UsedConstantSpatialExtent; }
-    
-  void SetParamNumberOffset(int ParamNumOffset) { \
                m_ParamNumberOffset=ParamNumOffset; }
-  void ApplySqlParameters(c_Oci_Statement* OciStm,bool IsGeodeticCS,long OraSrid,int \
                ParamOffest=0);
-  int GetSqlParametersCount();
-  
-  // adds parameter into list of parameters to be applied
-  // and returns string to be used for that parameter in SQL, example return: ":1" \
                or ":5" etc..
-  FdoStringP PushParameter(FdoDataValue& Value);
-  
-protected:
-  
-  void AddAsParameter(FdoDataValue& Value);
-  void ProcessExpresion( FdoExpression* Expr);
-  void AppendString(const wchar_t *Str);
-  void PrependString(const wchar_t *Str);
+    virtual void ProcessGeometryValue(FdoGeometryValue& expr);
+    
+    virtual void ProcessGeometryValueRect(FdoGeometryValue& expr);
   
-};
-
-#endif
+public:
+  
+  void SetOracleSrid(const c_KgOraSridDesc& orasrid);
+  
+  //const std::vector<c_KgOraSqlParamDesc*> GetParamList() const { return \
m_ParamList; } +  void SetConstantSpatialExtent(const wchar_t* \
ConstantSpatialExtent); +  bool GetUsedConstantSpatialExtent() { return \
m_UsedConstantSpatialExtent; } +    
+  void SetParamNumberOffset(int ParamNumOffset) { \
m_ParamNumberOffset=ParamNumOffset; } +  void ApplySqlParameters(c_Oci_Statement* \
OciStm,int ParamOffest=0); +  int GetSqlParametersCount();
+  
+  // adds parameter into list of parameters to be applied
+  // and returns string to be used for that parameter in SQL, example return: ":1" \
or ":5" etc.. +  FdoStringP PushParameter(FdoDataValue& Value);
+  
+protected:
+  
+  void AddAsParameter(FdoDataValue& Value);
+  void ProcessExpresion( FdoExpression* Expr);
+  void AppendString(const wchar_t *Str);
+  void PrependString(const wchar_t *Str);
+  
+};
+
+#endif

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraFeatureReader.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraFeatureReader.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraFeatureReader.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -69,38 +69,48 @@
     {
       if( m_Props && (m_Props->GetCount() > 0 ) )
       {
-        FdoClassDefinition* newclass = \
                FdoCommonSchemaUtil::DeepCopyFdoClassDefinition(m_ClassDef);
-        if( newclass )
+        if( m_ChangedClassDef.p )
         {
-          FdoPtr<FdoPropertyDefinitionCollection> ids = newclass->GetProperties();
-          long count = ids->GetCount();
-          long ind =0;
-          while(ind<count)
+          return FDO_SAFE_ADDREF(m_ChangedClassDef.p);
+        }
+        else
+        {
+        
+          c_KgOraDescribeSchemaCommand::g_DeepCopyMutex.Enter();
+          m_ChangedClassDef = \
FdoCommonSchemaUtil::DeepCopyFdoClassDefinition(m_ClassDef); +          \
c_KgOraDescribeSchemaCommand::g_DeepCopyMutex.Leave(); +          if( \
m_ChangedClassDef.p )  {
-            FdoPtr<FdoPropertyDefinition> classprop = ids->GetItem(ind);
-            bool found=false;
-            for(long ind2 =0;ind2<m_Props->GetCount();ind2++)
+            FdoPtr<FdoPropertyDefinitionCollection> ids = \
m_ChangedClassDef->GetProperties(); +            long count = ids->GetCount();
+            long ind =0;
+            while(ind<count)
             {
-              FdoPtr<FdoIdentifier> prop2 = m_Props->GetItem(ind2);
-              if( wcscmp(classprop->GetName(),prop2->GetName()) == 0 )
+              FdoPtr<FdoPropertyDefinition> classprop = ids->GetItem(ind);
+              bool found=false;
+              for(long ind2 =0;ind2<m_Props->GetCount();ind2++)
               {
-                found=true;
-                break;
+                FdoPtr<FdoIdentifier> prop2 = m_Props->GetItem(ind2);
+                if( wcscmp(classprop->GetName(),prop2->GetName()) == 0 )
+                {
+                  found=true;
+                  break;
+                }
               }
+              if( !found )
+              {
+                ids->RemoveAt(ind);
+                count = ids->GetCount();
+              }
+              else
+              {
+                ind++;
+              }                          
             }
-            if( !found )
-            {
-              ids->RemoveAt(ind);
-              count = ids->GetCount();
-            }
-            else
-            {
-              ind++;
-            }                          
           }
+          
+          return FDO_SAFE_ADDREF(m_ChangedClassDef.p);
         }
-        
-        return newclass;
       }
       else
       {

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraFeatureReader.h
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraFeatureReader.h	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraFeatureReader.h	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -110,6 +110,8 @@
         FdoIdentifierCollection* m_Props;
         
         FdoPtr<FdoClassDefinition> m_ClassDef;
+        
+        FdoPtr<FdoClassDefinition> m_ChangedClassDef; // class def with changed \
proeprties if neede  
         
 };

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraFeatureReaderInsert.cpp
 ===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraFeatureReaderInsert.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraFeatureReaderInsert.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -1,19 +1,19 @@
-/*
-* Copyright (C) 2006  SL-King d.o.o
-* 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of version 2.1 of the GNU Lesser
-* General Public License as published by the Free Software Foundation.
-* 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
-* 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-*/
+/*
+* Copyright (C) 2006  SL-King d.o.o
+* 
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of version 2.1 of the GNU Lesser
+* General Public License as published by the Free Software Foundation.
+* 
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+* 
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
 
 #include "stdafx.h"
 
@@ -347,11 +347,14 @@
     if( m_IsFirstReadNext || m_FeatureValues == NULL )
       throw FdoCommandException::Create( L"c_KgOraFeatureReaderInsert::IsNull End of \
recordset!" );  
+   
     try
     {
-        propval =  m_FeatureValues->GetItem( PropName );
-        if( propval == NULL )
-            throw FdoCommandException::Create( L"c_KgOraFeatureReaderInsert::IsNull \
Property not found!" ); +        propval =  m_FeatureValues->FindItem( PropName );
+        if( propval.p == NULL )
+        {
+          return true;
+        }
     }
     catch( FdoException *e )
     {
@@ -359,13 +362,24 @@
         throw FdoCommandException::Create( L"c_KgOraFeatureReaderInsert::IsNull \
Property not found!" );  }
 
-    FdoPtr<FdoValueExpression> val = propval->GetValue();
-    
+    // if not value in list for that proeprty name - consider as it is NULL value
+    FdoPtr<FdoValueExpression> val = propval->GetValue();    
     if( val.p == NULL )
         return true;
 
+    if( val->GetExpressionType() == FdoExpressionItemType_DataValue )
+    {
+      FdoDataValue* dataval = (FdoDataValue*)val.p;
+      return dataval->IsNull();
+    }
     
-    return false;
+    if( val->GetExpressionType() == FdoExpressionItemType_GeometryValue)
+    {
+      FdoGeometryValue* dataval = (FdoGeometryValue*)val.p;
+      return dataval->IsNull();
+    }
+        
+    return true;
 }
 
 

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraFilterProcessor.cpp
 ===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraFilterProcessor.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraFilterProcessor.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -1,18 +1,18 @@
-/*
-* Copyright (C) 2009  SL-King d.o.o
-* 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of version 2.1 of the GNU Lesser
-* General Public License as published by the Free Software Foundation.
-* 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
-* 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+/*
+* Copyright (C) 2009  SL-King d.o.o
+* 
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of version 2.1 of the GNU Lesser
+* General Public License as published by the Free Software Foundation.
+* 
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+* 
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
 
 #include "stdafx.h"
@@ -20,11 +20,11 @@
 #include "c_FgfToSdoGeom.h"
 #include "c_Ora_API2.h"
 
-// 1SPATIAL START
-#include "math.h"
-// 1SPATIAL END
+// 1SPATIAL START
+#include "math.h"
+// 1SPATIAL END
 
-
+
 #define D_FILTER_OPEN_PARENTH L" ( "
 #define D_FILTER_CLOSE_PARENTH L" ) "
 
@@ -48,32 +48,26 @@
 
 
 
-c_KgOraFilterProcessor::c_KgOraFilterProcessor(int \
OracleMainVersion,c_KgOraSchemaDesc *KgOraSchemaDesc,FdoIdentifier* ClassId,const \
                c_KgOraSridDesc& OraSridDesc)
-  : m_ExpressionProcessor( &m_StringBuff,KgOraSchemaDesc,ClassId,OraSridDesc ) // \
they will share same string buffer \
+c_KgOraFilterProcessor::c_KgOraFilterProcessor(c_KgOraConnection* \
KgOraConn,c_KgOraSchemaDesc *KgOraSchemaDesc,FdoClassDefinition* ClassDef,const \
c_KgOraSridDesc& OraSrid) +  : m_ExpressionProcessor( \
&m_StringBuff,KgOraSchemaDesc,ClassDef,OraSrid ) // they will share same string \
buffer  {
-  m_OracleMainVersion = OracleMainVersion;
+  m_KgOraConn=KgOraConn;
+  
   m_KgOraSchemaDesc = KgOraSchemaDesc;
   FDO_SAFE_ADDREF(m_KgOraSchemaDesc.p);
   
-  m_ClassId = ClassId;
-  FDO_SAFE_ADDREF(m_ClassId.p);
   
-  if( m_KgOraSchemaDesc.p && m_ClassId.p )
+  m_ClassDef = FDO_SAFE_ADDREF(ClassDef);
+  
+  FdoPtr<FdoKgOraPhysicalSchemaMapping> phschemamapping;
+  FdoPtr<FdoKgOraClassDefinition> phys_class;
+  if( KgOraSchemaDesc && ClassDef )
   {
-    FdoPtr<FdoKgOraPhysicalSchemaMapping> phschemamapping = \
                m_KgOraSchemaDesc->GetPhysicalSchemaMapping();
-    m_ClassDef = phschemamapping->FindByClassName( m_ClassId->GetName() );
-    
-    /*
-    if( phys_class && phys_class->GetIsPointGeometry() )
-    {      
-      AppendString( phys_class->GetOraTableAlias() );
-      AppendString( "." );
-    }
-    */
+    phschemamapping = KgOraSchemaDesc->GetPhysicalSchemaMapping();
+    m_phys_class = phschemamapping->FindByClassName( ClassDef->GetName() );
+
   }
   
-  m_OraSridDesc = OraSridDesc;
-  
 }
 
 c_KgOraFilterProcessor::~c_KgOraFilterProcessor(void)
@@ -86,13 +80,19 @@
   Filter->Process(this);
 }//end of c_KgOraFilterProcessor::ProcessFilter
 
-void c_KgOraFilterProcessor::ProcessExpresion( FdoExpression* Expr,bool \
IsSpatialCondition,bool IsEnvelopeIntersect) +void \
c_KgOraFilterProcessor::ProcessGeomExpresion( FdoExpression* Expr,c_KgOraSridDesc& \
OraSrid)  {  
-  Expr->Process( &m_ExpressionProcessor );
-   
+  m_ExpressionProcessor.SetOracleSrid(OraSrid);
+  Expr->Process( &m_ExpressionProcessor );   
 }
 
+void c_KgOraFilterProcessor::ProcessExpresion( FdoExpression* Expr )
+{  
+  //m_ExpressionProcessor.SetOracleSrid(OraSrid);
+  Expr->Process( &m_ExpressionProcessor );   
+}
 
+
 //
 // Add a string to the end of the buffer
 void c_KgOraFilterProcessor::AppendString(const wchar_t *Str)
@@ -110,19 +110,19 @@
 
 
 
-/// \brief
-/// Processes the FdoBinaryLogicalOperator passed in as an argument.
-/// 
-/// \param Filter 
-/// Input the FdoBinaryLogicalOperator
-/// 
-/// \return
-/// Returns nothing
-/// 
-void c_KgOraFilterProcessor::ProcessBinaryLogicalOperator(FdoBinaryLogicalOperator& \
                Filter)
-{
+/// \brief
+/// Processes the FdoBinaryLogicalOperator passed in as an argument.
+/// 
+/// \param Filter 
+/// Input the FdoBinaryLogicalOperator
+/// 
+/// \return
+/// Returns nothing
+/// 
+void c_KgOraFilterProcessor::ProcessBinaryLogicalOperator(FdoBinaryLogicalOperator& \
Filter) +{
   FdoPtr<FdoFilter>leftop = Filter.GetLeftOperand();
-  FdoPtr<FdoFilter>rightop = Filter.GetRightOperand();
+  FdoPtr<FdoFilter>rightop = Filter.GetRightOperand();
   AppendString(D_FILTER_OPEN_PARENTH);
   if( Filter.GetOperation() == FdoBinaryLogicalOperations_And )
   {
@@ -138,10 +138,10 @@
     ProcessFilter( rightop );
   }
 
-  AppendString(D_FILTER_CLOSE_PARENTH);
-  
-}//end of c_KgOraFilterProcessor::ProcessBinaryLogicalOperator
-
+  AppendString(D_FILTER_CLOSE_PARENTH);
+  
+}//end of c_KgOraFilterProcessor::ProcessBinaryLogicalOperator
+
 void c_KgOraFilterProcessor::ProcessUnaryLogicalOperator(FdoUnaryLogicalOperator& \
Filter)  {
     FdoPtr<FdoFilter>unaryop = Filter.GetOperand();
@@ -256,8 +256,11 @@
 
 FdoPtr<FdoExpression> geomexp = Filter.GetGeometry();
 
+c_KgOraSridDesc orasrid;
+m_KgOraConn->GetOracleSridDesc(m_ClassDef,geomprop->GetName(),orasrid);
+
 // If class is from SDE then need to apply only primary check of min max
-if( m_ClassDef.p && m_ClassDef->GetIsSdeClass() )
+if( m_phys_class.p && m_phys_class->GetIsSdeClass() )
 {
   FdoGeometryValue* geomval = dynamic_cast<FdoGeometryValue*>(geomexp.p);
   if (geomval)
@@ -293,21 +296,21 @@
     double maxy = envelope->GetMaxY();
     
     // convert min max to sde integers
-    minx = (minx - m_OraSridDesc.m_SDE_FalseX) * m_OraSridDesc.m_SDE_XYUnit;
-    maxx = (maxx - m_OraSridDesc.m_SDE_FalseX) * m_OraSridDesc.m_SDE_XYUnit;
+    minx = (minx - orasrid.m_SDE_FalseX) * orasrid.m_SDE_XYUnit;
+    maxx = (maxx - orasrid.m_SDE_FalseX) * orasrid.m_SDE_XYUnit;
     
-    miny = (miny - m_OraSridDesc.m_SDE_FalseY) * m_OraSridDesc.m_SDE_XYUnit;
-    maxy = (maxy - m_OraSridDesc.m_SDE_FalseY) * m_OraSridDesc.m_SDE_XYUnit;
-
-	// 1SPATIAL START
-	// for index
-	double gxmin = floor( minx / (m_OraSridDesc.m_SDE_XYUnit * \
                m_ClassDef->GetSdeGSize1()));
-	double gxmax = floor( maxx / (m_OraSridDesc.m_SDE_XYUnit * \
                m_ClassDef->GetSdeGSize1()));
-	double gymin = floor( miny / (m_OraSridDesc.m_SDE_XYUnit * \
                m_ClassDef->GetSdeGSize1()));
-	double gymax = floor( maxy / (m_OraSridDesc.m_SDE_XYUnit * \
                m_ClassDef->GetSdeGSize1()));
-	// 1SPATIAL END
-
-    wstring indexname = m_ClassDef->GetSdeIndexTableName();
+    miny = (miny - orasrid.m_SDE_FalseY) * orasrid.m_SDE_XYUnit;
+    maxy = (maxy - orasrid.m_SDE_FalseY) * orasrid.m_SDE_XYUnit;
+
+	// 1SPATIAL START
+	// for index
+	double gxmin = floor( minx / (orasrid.m_SDE_XYUnit * \
m_phys_class->GetSdeGSize1())); +	double gxmax = floor( maxx / (orasrid.m_SDE_XYUnit \
* m_phys_class->GetSdeGSize1())); +	double gymin = floor( miny / \
(orasrid.m_SDE_XYUnit * m_phys_class->GetSdeGSize1())); +	double gymax = floor( maxy \
/ (orasrid.m_SDE_XYUnit * m_phys_class->GetSdeGSize1())); +	// 1SPATIAL END
+
+    wstring indexname = m_phys_class->GetSdeIndexTableName();
     indexname += L"_IX1";
     
     
@@ -326,12 +329,12 @@
     
       	// 1SPATIAL START
       	FdoStringP szORFilter;
-    	if (m_ClassDef->GetSdeGSize2() > 0)
+    	if (m_phys_class->GetSdeGSize2() > 0)
       	{
-        		double gxmin2 = 16777216 + floor( minx / (m_OraSridDesc.m_SDE_XYUnit * \
                m_ClassDef->GetSdeGSize2()));
-        		double gxmax2 = 16777216 + floor( maxx / (m_OraSridDesc.m_SDE_XYUnit * \
                m_ClassDef->GetSdeGSize2()));
-        		double gymin2 = 16777216 + floor( miny / (m_OraSridDesc.m_SDE_XYUnit * \
                m_ClassDef->GetSdeGSize2()));
-        		double gymax2 = 16777216 + floor( maxy / (m_OraSridDesc.m_SDE_XYUnit * \
m_ClassDef->GetSdeGSize2())); +        		double gxmin2 = 16777216 + floor( minx / \
(orasrid.m_SDE_XYUnit * m_phys_class->GetSdeGSize2())); +        		double gxmax2 = \
16777216 + floor( maxx / (orasrid.m_SDE_XYUnit * m_phys_class->GetSdeGSize2())); +    \
double gymin2 = 16777216 + floor( miny / (orasrid.m_SDE_XYUnit * \
m_phys_class->GetSdeGSize2())); +        		double gymax2 = 16777216 + floor( maxy / \
(orasrid.m_SDE_XYUnit * m_phys_class->GetSdeGSize2()));  
           		FdoPtr<FdoDoubleValue> fval_gxmin2 = FdoDoubleValue::Create(gxmin2);
         		FdoStringP param_gxmin2 = \
m_ExpressionProcessor.PushParameter(*fval_gxmin2); @@ -347,7 +350,7 @@
         
           		szORFilter = FdoStringP::Format(L" OR  (SP_.gx >= %s  AND  SP_.gx <= %s  \
                AND  SP_.gy >= %s AND SP_.gy <= %s  /* GSize2=%.0lf */) "
           										,(const wchar_t*)param_gxmin2,(const \
                wchar_t*)param_gxmax2,(const wchar_t*)param_gymin2,(const \
                wchar_t*)param_gymax2
-          										, m_ClassDef->GetSdeGSize2() );
+          										, m_phys_class->GetSdeGSize2() );
         
           //		szORFilter = FdoStringP::Format(L" OR  (SP_.gx >= %.0lf  AND  SP_.gx \
                <= %.0lf  AND  SP_.gy >= %.0lf AND SP_.gy <= %.0lf "
           //										L" /* minx2=%.0lf  m_OraSridDesc.m_SDE_XYUnit=%.0lf  RES=%.0lf \
GSize2=%.0lf */ " @@ -386,26 +389,26 @@
         		L"  /* XYUnit=%.0lf  GSize1=%.0lf  GSize2=%.0lf */) "
         		L" %s "
         		L" )"        
-        // 1SPATIAL END
+        // 1SPATIAL END
         L" AND SP_.eminx <= %s AND SP_.eminy <= %s AND"
         L" SP_.emaxx >= %s AND SP_.emaxy >= %s) S_",
-        		indexname.c_str(),(const wchar_t*)m_ClassDef->GetSdeIndexTableName()
+        		indexname.c_str(),(const wchar_t*)m_phys_class->GetSdeIndexTableName()
         		// 1SPATIAL START
                 // ,maxx,maxy,minx,miny
         		// ,minx,maxx,miny,maxy,maxx,maxy,minx,miny
         		,(const wchar_t*)param_gxmin,(const wchar_t*)param_gxmax,(const \
                wchar_t*)param_gymin,(const wchar_t*)param_gymax
-        		,m_OraSridDesc.m_SDE_XYUnit,m_ClassDef->GetSdeGSize1()
-        		,m_ClassDef->GetSdeGSize2()
+        		,orasrid.m_SDE_XYUnit,m_phys_class->GetSdeGSize1()
+        		,m_phys_class->GetSdeGSize2()
         		,(const wchar_t*)szORFilter
         		,(const wchar_t*)param_maxx,(const wchar_t*)param_maxy,(const \
                wchar_t*)param_minx,(const wchar_t*)param_miny
-        		// 1SPATIAL END
+        		// 1SPATIAL END
        );
        
     m_SDE_SelectSpatialIndex = sbuff;   
 
 
     // this goes into WHERE part of SQL
-    sbuff = FdoStringP::Format(L"S_.sp_fid = \
%s.fid",m_ClassDef->GetSdeGeomTableAlias()); +    sbuff = \
FdoStringP::Format(L"S_.sp_fid = %s.fid",m_phys_class->GetSdeGeomTableAlias());  \
m_SDE_WhereSpatialIndex = sbuff;  
     AppendString(L"1=1"); // just to satisfy boolean operator. Spatial condition can \
be combined with other filters and  @@ -451,14 +454,23 @@
   return;
 }
 
+
+
+FdoPtr<FdoPropertyDefinitionCollection> props = m_ClassDef->GetProperties();
+FdoPtr<FdoPropertyDefinition>  propdef = props->FindItem(geomprop->GetName());
+if( propdef.p && propdef->GetPropertyType()==FdoPropertyType_GeometricProperty )
+{
+  FdoGeometricPropertyDefinition* geompropdef = \
(FdoGeometricPropertyDefinition*)propdef.p; +}
+
 switch( Filter.GetOperation() )
 {
   case FdoSpatialOperations_EnvelopeIntersects:
   {
-    if( m_ClassDef.p &&  m_ClassDef->GetIsPointGeometry() )
+    if( m_phys_class.p &&  m_phys_class->GetIsPointGeometry() )
     {
-      FdoStringP str_xcol =  m_ClassDef->GetPointXOraColumn();
-      FdoStringP str_ycol =  m_ClassDef->GetPointYOraColumn();
+      FdoStringP str_xcol =  m_phys_class->GetPointXOraColumn();
+      FdoStringP str_ycol =  m_phys_class->GetPointYOraColumn();
       
       FdoGeometryValue* geomval = dynamic_cast<FdoGeometryValue*>(geomexp.p);
       if (geomval)
@@ -512,7 +524,7 @@
      
       AppendString(D_FILTER_OPEN_PARENTH);
       AppendString(L"SDO_FILTER(");
-      ProcessExpresion( geomprop );
+      ProcessGeomExpresion( geomprop,orasrid );
       AppendString(L",");
       
       FdoGeometryValue* geomval = dynamic_cast<FdoGeometryValue*>(geomexp.p);
@@ -522,10 +534,10 @@
       }
       else
       {
-        ProcessExpresion( geomexp,true );
+        ProcessGeomExpresion( geomexp,orasrid );
       }
          
-      if( m_OracleMainVersion < 10 )
+      if( m_KgOraConn->GetOracleMainVersion() < 10 )
       {
         AppendString(L",'querytype = WINDOW')='TRUE'");
       }
@@ -540,10 +552,10 @@
   break;
   case FdoSpatialOperations_Intersects:
   {
-    if( m_ClassDef.p &&  m_ClassDef->GetIsPointGeometry() )
+    if( m_phys_class.p &&  m_phys_class->GetIsPointGeometry() )
     {
-      FdoStringP str_xcol =  m_ClassDef->GetPointXOraColumn();
-      FdoStringP str_ycol =  m_ClassDef->GetPointYOraColumn();
+      FdoStringP str_xcol =  m_phys_class->GetPointXOraColumn();
+      FdoStringP str_ycol =  m_phys_class->GetPointYOraColumn();
       
       FdoGeometryValue* geomval = dynamic_cast<FdoGeometryValue*>(geomexp.p);
       if (geomval)
@@ -595,9 +607,9 @@
     else
     {    
       AppendString(D_FILTER_OPEN_PARENTH);
-
-	    
-      if( m_OracleMainVersion >= 10 )
+
+	    
+      if( m_KgOraConn->GetOracleMainVersion() >= 10 )
       {
         
         AppendString(L"SDO_ANYINTERACT(");
@@ -605,154 +617,154 @@
       else
       {
         AppendString(L"SDO_RELATE(");
-      }
-      
-	  
-      ProcessExpresion( geomprop );
+      }
+      
+	  
+      ProcessGeomExpresion( geomprop,orasrid );
       AppendString(L",");
       
-      ProcessExpresion( geomexp,true );
+      ProcessGeomExpresion( geomexp,orasrid);
       
       
-      if( m_OracleMainVersion >= 10 )
+      if( m_KgOraConn->GetOracleMainVersion() >= 10 )
       {
         AppendString(L")='TRUE'");
       }
       else
       {
         AppendString(L",'mask=ANYINTERACT')='TRUE'");
-      }
-      
-	 
-
+      }
+      
+	 
+
       AppendString(D_FILTER_CLOSE_PARENTH);
     }
   }
   break;
-  
-  
-  /// Test to see if the geometric property value spatially contains the
-  /// literal geometric value.
-  case FdoSpatialOperations_Contains:
-  {
+  
+  
+  /// Test to see if the geometric property value spatially contains the
+  /// literal geometric value.
+  case FdoSpatialOperations_Contains:
+  {
     AppendString(D_FILTER_OPEN_PARENTH);
     AppendString(L"SDO_RELATE(");
-    ProcessExpresion( geomprop );
+    ProcessGeomExpresion( geomprop,orasrid );
     AppendString(L",");
-    ProcessExpresion( geomexp,true );
+    ProcessGeomExpresion( geomexp,orasrid );
     AppendString(L",'mask=CONTAINS')='TRUE'");
-    AppendString(D_FILTER_CLOSE_PARENTH);
-  }
-  break;
-
-  /// Test to see if the geometric property value spatially crosses the given
-  /// geometry.
-  case FdoSpatialOperations_Crosses:
-  {
+    AppendString(D_FILTER_CLOSE_PARENTH);
+  }
+  break;
+
+  /// Test to see if the geometric property value spatially crosses the given
+  /// geometry.
+  case FdoSpatialOperations_Crosses:
+  {
     AppendString(D_FILTER_OPEN_PARENTH);
     AppendString(L"SDO_RELATE(");
-    ProcessExpresion( geomprop );
+    ProcessGeomExpresion( geomprop,orasrid );
     AppendString(L",");
-    ProcessExpresion( geomexp,true );
+    ProcessGeomExpresion( geomexp,orasrid );
     AppendString(L",'mask=OVERLAPBDYDISJOINT')='TRUE'");
-    AppendString(D_FILTER_CLOSE_PARENTH);
-  }
-  break;
-
-  case FdoSpatialOperations_Disjoint:
-  {
+    AppendString(D_FILTER_CLOSE_PARENTH);
+  }
+  break;
+
+  case FdoSpatialOperations_Disjoint:
+  {
     AppendString(D_FILTER_OPEN_PARENTH);
     AppendString(L"SDO_RELATE(");
-    ProcessExpresion( geomprop );
+    ProcessGeomExpresion( geomprop,orasrid );
     AppendString(L",");
-    ProcessExpresion( geomexp,true );
+    ProcessGeomExpresion( geomexp,orasrid );
     AppendString(L",'mask=ANYINTERACT')='FALSE'");
-    AppendString(D_FILTER_CLOSE_PARENTH);
-  }
-  break;
-  /// Test to see if the geometric property value spatially overlaps the given
-  /// geometry
-  case FdoSpatialOperations_Overlaps:
-    {
+    AppendString(D_FILTER_CLOSE_PARENTH);
+  }
+  break;
+  /// Test to see if the geometric property value spatially overlaps the given
+  /// geometry
+  case FdoSpatialOperations_Overlaps:
+    {
     AppendString(D_FILTER_OPEN_PARENTH);
     AppendString(L"SDO_RELATE(");
-    ProcessExpresion( geomprop );
+    ProcessGeomExpresion( geomprop,orasrid );
     AppendString(L",");
-    ProcessExpresion( geomexp,true );
+    ProcessGeomExpresion( geomexp,orasrid );
     AppendString(L",'mask=OVERLAPBDYINTERSECT')='TRUE'");
-    AppendString(D_FILTER_CLOSE_PARENTH);
-  }
-  break;
-
-    /// Test to see if the geometric property value spatially touches the given
-    /// geometry.
-  case FdoSpatialOperations_Touches:
-  {
+    AppendString(D_FILTER_CLOSE_PARENTH);
+  }
+  break;
+
+    /// Test to see if the geometric property value spatially touches the given
+    /// geometry.
+  case FdoSpatialOperations_Touches:
+  {
     AppendString(D_FILTER_OPEN_PARENTH);
     AppendString(L"SDO_RELATE(");
-    ProcessExpresion( geomprop );
+    ProcessGeomExpresion( geomprop,orasrid );
     AppendString(L",");
-    ProcessExpresion( geomexp,true );
+    ProcessGeomExpresion( geomexp,orasrid );
     AppendString(L",'mask=TOUCH')='TRUE'");
-    AppendString(D_FILTER_CLOSE_PARENTH);
-  }
-  break;
-
-    /// Test to see if the geometric property value is spatially within the
-    /// given geometry.
-  case FdoSpatialOperations_Within:
-  {
+    AppendString(D_FILTER_CLOSE_PARENTH);
+  }
+  break;
+
+    /// Test to see if the geometric property value is spatially within the
+    /// given geometry.
+  case FdoSpatialOperations_Within:
+  {
     AppendString(D_FILTER_OPEN_PARENTH);
     AppendString(L"SDO_RELATE(");
-    ProcessExpresion( geomprop );
+    ProcessGeomExpresion( geomprop,orasrid );
     AppendString(L",");
-    ProcessExpresion( geomexp,true );
+    ProcessGeomExpresion( geomexp,orasrid );
     AppendString(L",'mask=COVERS')='TRUE'");
-    AppendString(D_FILTER_CLOSE_PARENTH);
-  }
-  break;
-
-    /// Test to see if the geometric property value is covered by the interior
-    /// and boundary of the given geometry.
-  case FdoSpatialOperations_CoveredBy:
-  {
+    AppendString(D_FILTER_CLOSE_PARENTH);
+  }
+  break;
+
+    /// Test to see if the geometric property value is covered by the interior
+    /// and boundary of the given geometry.
+  case FdoSpatialOperations_CoveredBy:
+  {
     AppendString(D_FILTER_OPEN_PARENTH);
     AppendString(L"SDO_RELATE(");
-    ProcessExpresion( geomprop );
+    ProcessGeomExpresion( geomprop,orasrid );
     AppendString(L",");
-    ProcessExpresion( geomexp,true );
+    ProcessGeomExpresion( geomexp,orasrid );
     AppendString(L",'mask=COVERDBY')='TRUE'");
-    AppendString(D_FILTER_CLOSE_PARENTH);
-  }
-  break;
-
-  /// Test to see if the geometric property value is inside the interior
-  /// of the given geometry, not touching the boundary.
-  case FdoSpatialOperations_Inside:
-  {
+    AppendString(D_FILTER_CLOSE_PARENTH);
+  }
+  break;
+
+  /// Test to see if the geometric property value is inside the interior
+  /// of the given geometry, not touching the boundary.
+  case FdoSpatialOperations_Inside:
+  {
       AppendString(D_FILTER_OPEN_PARENTH);
       AppendString(L"SDO_RELATE(");
-      ProcessExpresion( geomprop );
+      ProcessGeomExpresion( geomprop,orasrid );
       AppendString(L",");
-      ProcessExpresion( geomexp,true );
+      ProcessGeomExpresion( geomexp,orasrid );
       AppendString(L",'mask=INSIDE')='TRUE'");
-      AppendString(D_FILTER_CLOSE_PARENTH);
-    }
-  break;
-
-  
-
-    /// Test to see if the geometric property value is spatially equal to the
-    /// given geometry.
+      AppendString(D_FILTER_CLOSE_PARENTH);
+    }
+  break;
+
+  
+
+    /// Test to see if the geometric property value is spatially equal to the
+    /// given geometry.
     case FdoSpatialOperations_Equals:
-    {
+    {
       AppendString(D_FILTER_OPEN_PARENTH);
       AppendString(L"SDO_RELATE(");
-      ProcessExpresion( geomprop );
+      ProcessGeomExpresion( geomprop,orasrid );
       AppendString(L",");
-      ProcessExpresion( geomexp,true );
+      ProcessGeomExpresion( geomexp,orasrid );
       AppendString(L",'mask=EQUAL')='TRUE'");
-      AppendString(D_FILTER_CLOSE_PARENTH);
+      AppendString(D_FILTER_CLOSE_PARENTH);
     }
     break;
     
@@ -767,6 +779,9 @@
 {
 FdoPtr<FdoIdentifier> geomprop = Filter.GetPropertyName();
 
+c_KgOraSridDesc orasrid;
+m_KgOraConn->GetOracleSridDesc(m_ClassDef,geomprop->GetName(),orasrid);
+
 FdoPtr<FdoExpression> geomval = Filter.GetGeometry();
 double dist = Filter.GetDistance();
 switch( Filter.GetOperation() )
@@ -779,7 +794,7 @@
     AppendString(L"SDO_WITHIN_DISTANCE(");
     ProcessExpresion( geomprop );
     AppendString(L",");
-    ProcessExpresion( geomval );
+    ProcessGeomExpresion( geomval,orasrid );
     FdoStringP tmpbuff = FdoStringP::Format(L",'distance=%.6lf'",dist);
     AppendString((FdoString*)tmpbuff);
     AppendString(L")='TRUE'");
@@ -792,7 +807,7 @@
     AppendString(L"SDO_WITHIN_DISTANCE(");
     ProcessExpresion( geomprop );
     AppendString(L",");
-    ProcessExpresion( geomval );
+    ProcessGeomExpresion( geomval,orasrid );
     FdoStringP tmpbuff = FdoStringP::Format(L",'distance=%.6lf'",dist);
     AppendString((FdoString*)tmpbuff);
     AppendString(L")='FALSE'");

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraFilterProcessor.h
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraFilterProcessor.h	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraFilterProcessor.h	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -16,47 +16,50 @@
 */
 
 #ifndef _c_KgOraFilterProcessor_h
-#define _c_KgOraFilterProcessor_h
-
-#include "c_FilterStringBuffer.h"
-#include "c_KgOraExpressionProcessor.h"
-
-
-
+#define _c_KgOraFilterProcessor_h
+
+#include "c_FilterStringBuffer.h"
+#include "c_KgOraExpressionProcessor.h"
+
+
+
 /// \brief
 /// The FdoIFilterProcessor interface can be used to process the nodes in a Filter
 /// tree. It declares a process operation for each concrete class in the Filter
 /// hierarchy. Providers or client applications can create classes that realize
 /// this interface to do something meaningful with a Filter hierarchy. For
 /// example, a RDBMS feature provider can implement a processor class to convert a
-/// Filter hierarchy to the SQL equivalent syntax.
-class c_KgOraFilterProcessor : public virtual FdoIFilterProcessor 
-{
-public:
-  c_KgOraFilterProcessor(int OracleMainVersion,c_KgOraSchemaDesc \
                *KgOraSchemaDesc,FdoIdentifier* ClassId,const c_KgOraSridDesc& \
                OraSrid);
-public:
-  ~c_KgOraFilterProcessor(void);
-  virtual void Dispose() { delete this; }  
-
-protected:
-  FdoPtr<c_KgOraSchemaDesc> m_KgOraSchemaDesc;
-  FdoPtr<FdoIdentifier> m_ClassId;  
-  
-  FdoPtr<FdoKgOraClassDefinition> m_ClassDef;  
-  c_KgOraSridDesc m_OraSridDesc;
-  
-  int m_OracleMainVersion;
-  
-public:  
-  std::wstring m_SDE_SelectSpatialIndex; // this is where select sql is stored for \
                spatial index when filter encounters spatial condition 
-                                        // (SELECT  /*+ INDEX(SP_ S2008_IX1) */ \
                DISTINCT sp_fid, eminx, eminy, emaxx,
-                                        //  emaxy FROM OSMASTERMAP.S2008 SP_  WHERE \
                SP_.gx >= :1 AND SP_.gx <= :2 AND
-                                        //  SP_.gy >= :3 AND SP_.gy <= :4 AND \
                SP_.eminx <= :5 AND SP_.eminy <= :6 AND
-                                        //  SP_.emaxx >= :7 AND SP_.emaxy >= :8) S_
-                                        
-  std::wstring m_SDE_WhereSpatialIndex;                                        
-  
+/// Filter hierarchy to the SQL equivalent syntax.
+class c_KgOraFilterProcessor : public virtual FdoIFilterProcessor 
+{
 public:
+  c_KgOraFilterProcessor(c_KgOraConnection* KgOraConn,c_KgOraSchemaDesc \
*KgOraSchemaDesc,FdoClassDefinition* ClassDef,const c_KgOraSridDesc& OraSrid); \
+public: +  ~c_KgOraFilterProcessor(void);
+  virtual void Dispose() { delete this; }  
+
+protected:
+  c_KgOraConnection* m_KgOraConn;
+  FdoPtr<c_KgOraSchemaDesc> m_KgOraSchemaDesc;
+  //FdoPtr<FdoIdentifier> m_ClassId;  
+  
+  FdoPtr<FdoKgOraClassDefinition> m_phys_class;  
+  FdoPtr<FdoClassDefinition> m_ClassDef;    
+  //FdoPtr<FdoKgOraClassDefinition> m_phys_class;
+  
+  //c_KgOraSridDesc m_OraSridDesc;  
+  //int m_OracleMainVersion;
+  
+public:  
+  std::wstring m_SDE_SelectSpatialIndex; // this is where select sql is stored for \
spatial index when filter encounters spatial condition  +                             \
// (SELECT  /*+ INDEX(SP_ S2008_IX1) */ DISTINCT sp_fid, eminx, eminy, emaxx, +       \
//  emaxy FROM OSMASTERMAP.S2008 SP_  WHERE SP_.gx >= :1 AND SP_.gx <= :2 AND +       \
//  SP_.gy >= :3 AND SP_.gy <= :4 AND SP_.eminx <= :5 AND SP_.eminy <= :6 AND +       \
//  SP_.emaxx >= :7 AND SP_.emaxy >= :8) S_ +                                        
+  std::wstring m_SDE_WhereSpatialIndex;                                        
+  
+public:
     /// \brief
     /// Processes the FdoBinaryLogicalOperator passed in as an argument.
     /// 
@@ -132,27 +135,28 @@
     /// \return
     /// Returns nothing
     /// 
-    virtual void ProcessDistanceCondition(FdoDistanceCondition& Filter);  
-    
-    
-public:
-  const wchar_t* GetFilterText() { return m_StringBuff.GetString(); };   
-  void ClearFilterText() { m_StringBuff.ClearBuffer(); };   
-  
-  c_KgOraExpressionProcessor& GetExpressionProcessor() { return \
                m_ExpressionProcessor; };   
-  c_KgOraExpressionProcessor* GetExpressionProcessorPtr() { return \
                &m_ExpressionProcessor; };   
-    
-protected:
-    c_KgOraExpressionProcessor m_ExpressionProcessor;
-    c_FilterStringBuffer m_StringBuff;
-    
-    void ProcessFilter(FdoFilter* Filter); 
-    void ProcessExpresion( FdoExpression* Expr,bool IsSpatialCondition=false,bool \
                IsEnvelopeIntersect=false);
-    
-    void AppendString(const wchar_t *Str);
-
-    void PrependString(const wchar_t *Str);
-	  
-};
-
-#endif
+    virtual void ProcessDistanceCondition(FdoDistanceCondition& Filter);  
+    
+    
+public:
+  const wchar_t* GetFilterText() { return m_StringBuff.GetString(); };   
+  void ClearFilterText() { m_StringBuff.ClearBuffer(); };   
+  
+  c_KgOraExpressionProcessor& GetExpressionProcessor() { return \
m_ExpressionProcessor; };    +  c_KgOraExpressionProcessor* \
GetExpressionProcessorPtr() { return &m_ExpressionProcessor; };    +    
+protected:
+    c_KgOraExpressionProcessor m_ExpressionProcessor;
+    c_FilterStringBuffer m_StringBuff;
+    
+    void ProcessFilter(FdoFilter* Filter); 
+    void ProcessGeomExpresion( FdoExpression* Expr,c_KgOraSridDesc& OraSrid);
+    void ProcessExpresion( FdoExpression* Expr );
+
+    void AppendString(const wchar_t *Str);
+
+    void PrependString(const wchar_t *Str);
+	  
+};
+
+#endif

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraInsert.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraInsert.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraInsert.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -16,7 +16,7 @@
 */
 #include "stdafx.h"
 #include "c_KgOraInsert.h"
-#include "c_FdoOra_API2.h"
+#include "c_FdoOra_API3.h"
 #include "c_Ora_API2.h"
 #include "c_FgfToSdoGeom.h"
 
@@ -227,13 +227,15 @@
     
   // then process thos values which    
     c_FilterStringBuffer strbuff;
-    c_KgOraExpressionProcessor expproc(&strbuff,schemadesc,m_ClassId,orasrid);
+    c_KgOraExpressionProcessor expproc(&strbuff,schemadesc,classdef,orasrid);
     
     
     FdoStringP colnames;
     FdoStringP colvalues;
     FdoStringP sep;
     
+    
+    
     count = batch_propvalcol->GetCount();
     for(unsigned int ind=0;ind<count;ind++)
     {
@@ -246,6 +248,10 @@
       FdoPtr<FdoValueExpression> expr = propval->GetValue();
       
       strbuff.ClearBuffer();
+      if( m_Connection->GetOracleSridDesc(classdef, propid->GetName(),orasrid ) )
+      {
+        expproc.SetOracleSrid(orasrid);
+      }
       expr->Process( &expproc );
       
       colvalues += sep + strbuff.GetString();
@@ -279,15 +285,15 @@
       {
         // do aply of literal values
         // this apply witll skip parameter values
-        expproc.ApplySqlParameters(oci_stm,orasrid.m_IsGeodetic,orasrid.m_OraSrid);
+        expproc.ApplySqlParameters(oci_stm);
         
         // now i need to aply batch values
         int ora_batch_parameter = 1; // number of parameter in oracle sql statament 
         if( added_new_batch_parameter_for_sequence_identity )
         {
-          long seqval = \
                c_Ora_API2::GetSequenceNextVal(m_Connection->GetOciConnection(),seqname);
                
-          FdoPtr<FdoDataValue> dataval = FdoDataValue::Create((FdoInt32)seqval);
-          c_FdoOra_API2::SetOracleStatementData( \
oci_stm,ora_batch_parameter,dataval); +          FdoInt64 seqval = \
c_Ora_API2::GetSequenceNextVal(m_Connection->GetOciConnection(),seqname); +          \
FdoPtr<FdoDataValue> dataval = FdoDataValue::Create((FdoInt64)seqval); +          \
c_FdoOra_API3::SetOracleStatementData( oci_stm,ora_batch_parameter,dataval);  \
ora_batch_parameter++;  }
         
@@ -312,18 +318,18 @@
               {
                 if( dataval->IsNull() )
                 {                
-                  long seqval = \
                c_Ora_API2::GetSequenceNextVal(m_Connection->GetOciConnection(),seqname);
                
-                  FdoPtr<FdoDataValue> dataval = \
                FdoDataValue::Create((FdoInt32)seqval);
-                  c_FdoOra_API2::SetOracleStatementData(oci_stm,ora_batch_parameter,dataval);
 +                  FdoInt64 seqval = \
c_Ora_API2::GetSequenceNextVal(m_Connection->GetOciConnection(),seqname); +           \
FdoPtr<FdoDataValue> dataval = FdoDataValue::Create((FdoInt64)seqval); +              \
c_FdoOra_API3::SetOracleStatementData(oci_stm,ora_batch_parameter,dataval);  }
                 else
                 {
-                  c_FdoOra_API2::SetOracleStatementData(oci_stm,ora_batch_parameter,dataval);
 +                  c_FdoOra_API3::SetOracleStatementData(oci_stm,ora_batch_parameter,dataval);
  }
               }
               else
               {
-                c_FdoOra_API2::SetOracleStatementData(oci_stm,ora_batch_parameter,dataval);
 +                c_FdoOra_API3::SetOracleStatementData(oci_stm,ora_batch_parameter,dataval);
  }
             }
             else
@@ -380,7 +386,25 @@
       throw FdoCommandException::Create( gstr );    
     }
     
-    return new c_KgOraFeatureReaderInsert(m_PropertyValues,classdef);
+    
+    // copy id values only - beacue others like geomtry cant be read from \
c_KgOraFeatureReaderInsert +    FdoPtr<FdoClass> insclass = \
FdoClass::Create(L"idvaluse",L""); +    FdoPtr<FdoPropertyDefinitionCollection> \
insclass_pdef = insclass->GetProperties(); +    FdoPtr<FdoPropertyValueCollection> \
idvalues = FdoPropertyValueCollection::Create(); +    \
FdoPtr<FdoDataPropertyDefinitionCollection> idprops = \
classdef->GetIdentityProperties(); +    for(int id=0;id<idprops->GetCount();id++)
+    {
+      FdoPtr<FdoDataPropertyDefinition> prop = idprops->GetItem(id);
+      FdoPtr<FdoPropertyValue> propval = \
m_PropertyValues->FindItem(prop->GetName()); +      if( propval.p )
+      {
+        idvalues->Add(propval);
+        FdoPtr<FdoDataPropertyDefinition> propcopy = \
FdoCommonSchemaUtil::DeepCopyFdoDataPropertyDefinition(prop); +        \
insclass_pdef->Add(propcopy); +      }
+    }
+    
+    return new c_KgOraFeatureReaderInsert(idvalues,insclass);
   }
   else
   {
@@ -388,7 +412,7 @@
     if( m_PropertyValues.p )
     {
       c_FilterStringBuffer strbuff;
-      c_KgOraExpressionProcessor expproc(&strbuff,schemadesc,m_ClassId,orasrid,0);
+      c_KgOraExpressionProcessor expproc(&strbuff,schemadesc,classdef,orasrid,0);
         
       FdoStringP colnames;
       FdoStringP colvalues;
@@ -413,8 +437,8 @@
           FdoPtr<FdoIdentifier> propid = propval->GetName();
           if( wcscmp(propid->GetName(),ident_for_seq->GetName()) == 0 )
           {
-            long seqval = \
                c_Ora_API2::GetSequenceNextVal(m_Connection->GetOciConnection(),seqname);
                
-            FdoPtr<FdoDataValue> newval = FdoDataValue::Create((FdoInt32)seqval);
+            FdoInt64 seqval = \
c_Ora_API2::GetSequenceNextVal(m_Connection->GetOciConnection(),seqname); +           \
FdoPtr<FdoDataValue> newval = FdoDataValue::Create((FdoInt64)seqval);  \
propval->SetValue(newval);  found_identity = true;
             break;
@@ -424,8 +448,8 @@
         if( !found_identity )
         {
           
-          long seqval = \
                c_Ora_API2::GetSequenceNextVal(m_Connection->GetOciConnection(),seqname);
                
-          FdoPtr<FdoDataValue> newval = FdoDataValue::Create((FdoInt32)seqval);
+          FdoInt64 seqval = \
c_Ora_API2::GetSequenceNextVal(m_Connection->GetOciConnection(),seqname); +          \
FdoPtr<FdoDataValue> newval = FdoDataValue::Create((FdoInt64)seqval);  
           FdoPtr<FdoPropertyValue> propval = \
FdoPropertyValue::Create(ident_for_seq->GetName(),newval);  \
m_PropertyValues->Insert(0,propval); @@ -474,6 +498,11 @@
         if( !prop_in_seq )
         {
           strbuff.ClearBuffer();
+          c_KgOraSridDesc orasrid;
+          if( m_Connection->GetOracleSridDesc(classdef,propid->GetName(),orasrid) )
+          {
+            expproc.SetOracleSrid(orasrid);
+          }
           expr->Process( &expproc );
           colvalues += sep + strbuff.GetString();              
         }
@@ -504,7 +533,7 @@
         
         oci_stm->Prepare(sqlstr.GetString());
         
-        expproc.ApplySqlParameters(oci_stm,orasrid.m_IsGeodetic,orasrid.m_OraSrid);
+        expproc.ApplySqlParameters(oci_stm);
         
 
         int update_num = oci_stm->ExecuteNonQuery();
@@ -525,8 +554,29 @@
       }
 
       
-      return new c_KgOraFeatureReaderInsert(m_PropertyValues,classdef);
+      // copy id values only - beacue others like geomtry cant be read from \
c_KgOraFeatureReaderInsert +      FdoPtr<FdoClass> insclass = \
FdoClass::Create(L"idvaluse",L""); +      FdoPtr<FdoPropertyDefinitionCollection> \
insclass_pdef = insclass->GetProperties(); +      FdoPtr<FdoPropertyValueCollection> \
idvalues = FdoPropertyValueCollection::Create(); +      \
FdoPtr<FdoDataPropertyDefinitionCollection> idprops = \
classdef->GetIdentityProperties(); +      for(int id=0;id<idprops->GetCount();id++)
+      {
+        FdoPtr<FdoDataPropertyDefinition> prop = idprops->GetItem(id);
+        FdoPtr<FdoPropertyValue> propval = \
m_PropertyValues->FindItem(prop->GetName()); +        if( propval.p )
+        {
+          idvalues->Add(propval);
+          FdoPtr<FdoDataPropertyDefinition> propcopy = \
FdoCommonSchemaUtil::DeepCopyFdoDataPropertyDefinition(prop); +          \
insclass_pdef->Add(propcopy); +        }
+        
+        
+      }
+
+      return new c_KgOraFeatureReaderInsert(idvalues,insclass);
       
+      
+      
     }
   }
   

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraReader.h
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraReader.h	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraReader.h	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -486,7 +486,7 @@
   if( m_OciStatement && (oraind >= 1) )
   {
     //long val = m_OciStatement->getInt(oraind);    
-    long val = m_OciStatement->GetLong(oraind);    
+    FdoInt64 val = m_OciStatement->GetInt64(oraind);    
     return val;
   }
   

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSQLCommand.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSQLCommand.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSQLCommand.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -16,7 +16,7 @@
 */
 #include "stdafx.h"
 #include "c_KgOraSQLCommand.h"
-#include "c_FdoOra_API2.h"
+#include "c_FdoOra_API3.h"
 
 
 c_KgOraSQLCommand::c_KgOraSQLCommand(c_KgOraConnection* Connection) : \
c_KgOraFdoCommand<FdoISQLCommand>(Connection) @@ -26,43 +26,43 @@
 c_KgOraSQLCommand::~c_KgOraSQLCommand(void)
 {
 }
-
-
-/// \brief
-/// Gets the SQL statement to be executed as a string.
-/// 
-/// \return
-/// Returns the SQL statement.
-/// 
-FdoString* c_KgOraSQLCommand::GetSQLStatement()
-{
-  return m_SqlStr;
-}//end of c_KgOraSQLCommand::GetSQLStatement
-
-/// \brief
-/// Sets the SQL statement to be executed as a string.
-/// 
-/// \param value 
-/// Input the SQL statement.
-/// 
-/// \return
-/// Returns nothing
-/// 
-void c_KgOraSQLCommand::SetSQLStatement(FdoString* SqlStr)
-{
-  m_SqlStr =SqlStr;
-}
-
-/// \brief
-/// Executes the SQL statement against the connection object and returns
-/// the number of rows affected.
-/// 
-/// \return
-/// Returns the number of rows affected.
-/// 
-FdoInt32 c_KgOraSQLCommand::ExecuteNonQuery()
-{
-  unsigned int ret;
+
+
+/// \brief
+/// Gets the SQL statement to be executed as a string.
+/// 
+/// \return
+/// Returns the SQL statement.
+/// 
+FdoString* c_KgOraSQLCommand::GetSQLStatement()
+{
+  return m_SqlStr;
+}//end of c_KgOraSQLCommand::GetSQLStatement
+
+/// \brief
+/// Sets the SQL statement to be executed as a string.
+/// 
+/// \param value 
+/// Input the SQL statement.
+/// 
+/// \return
+/// Returns nothing
+/// 
+void c_KgOraSQLCommand::SetSQLStatement(FdoString* SqlStr)
+{
+  m_SqlStr =SqlStr;
+}
+
+/// \brief
+/// Executes the SQL statement against the connection object and returns
+/// the number of rows affected.
+/// 
+/// \return
+/// Returns the number of rows affected.
+/// 
+FdoInt32 c_KgOraSQLCommand::ExecuteNonQuery()
+{
+  unsigned int ret;
   c_Oci_Statement* oci_stm=NULL;
   try
   {
@@ -87,7 +87,7 @@
         FdoDataValue* dataval = dynamic_cast<FdoDataValue*>(lval.p);
         if( dataval )
         {    
-          c_FdoOra_API2::SetOracleStatementData(oci_stm,ind+1, dataval);
+          c_FdoOra_API3::SetOracleStatementData(oci_stm,ind+1, dataval);
         }
       }
     }
@@ -106,18 +106,18 @@
     
     delete ea;
     throw FdoCommandException::Create( gstr );    
-  }
-  
-  return ret;
-}
-
-/// \brief
-/// Executes the SQL statement against the connection object and returns
-/// an FdoISQLDataReader.
-/// 
-/// \return
-/// Returns the data reader.
-/// 
+  }
+  
+  return ret;
+}
+
+/// \brief
+/// Executes the SQL statement against the connection object and returns
+/// an FdoISQLDataReader.
+/// 
+/// \return
+/// Returns the data reader.
+/// 
 FdoISQLDataReader* c_KgOraSQLCommand::ExecuteReader()
 {
   c_Oci_Statement* oci_stm=NULL;
@@ -142,7 +142,7 @@
         FdoDataValue* dataval = dynamic_cast<FdoDataValue*>(lval.p);
         if( dataval )
         {    
-          c_FdoOra_API2::SetOracleStatementData(oci_stm,ind+1, dataval);
+          c_FdoOra_API3::SetOracleStatementData(oci_stm,ind+1, dataval);
         }
       }
     }

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSQLDataReader.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSQLDataReader.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSQLDataReader.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -16,7 +16,7 @@
 */
 #include "stdafx.h"
 #include "c_KgOraSQLDataReader.h"
-#include "c_FdoOra_API2.h"
+#include "c_FdoOra_API3.h"
 
 c_KgOraSQLDataReader::c_KgOraSQLDataReader(c_KgOraConnection * Connection
                         ,c_Oci_Statement* OciStatement )
@@ -52,7 +52,7 @@
     int oraprecision = OciStatement->GetColumnPrecision(ind+1); \
//m_MetaData[ind].getInt(oracle::occi::MetaData::ATTR_SCALE);  
     FdoDataType fdotype;
-    if( c_FdoOra_API2::OraTypeToFdoDataType(dtype,oraprecision,orascale,length,fdotype) \
) +    if( c_FdoOra_API3::OraTypeToFdoDataType(dtype,oraprecision,orascale,length,fdotype) \
)  {  
       m_SqlColumns->Add(cname);
       m_SqlColIndex.push_back(ind);
@@ -97,52 +97,52 @@
     delete this;
 }
 
- /// \brief
-/// Gets the number of columns in the result set.
-/// 
-/// \return
-/// Returns the number of columns.
-/// 
-FdoInt32 c_KgOraSQLDataReader::GetColumnCount()
-{
-  return m_OciStatement->GetColumnsSize(); //m_MetaData.size();
-}
-
-/// \brief
-/// Gets the name of the column at the given ordinal position.
-/// 
-/// \param index 
-/// Input the position of the column.
-/// 
-/// \return
-/// Returns the column name
-/// 
-FdoString* c_KgOraSQLDataReader::GetColumnName(FdoInt32 Index)
-{
-  return m_OciStatement->GetColumnName(Index+1);
+ /// \brief
+/// Gets the number of columns in the result set.
+/// 
+/// \return
+/// Returns the number of columns.
+/// 
+FdoInt32 c_KgOraSQLDataReader::GetColumnCount()
+{
+  return m_OciStatement->GetColumnsSize(); //m_MetaData.size();
+}
+
+/// \brief
+/// Gets the name of the column at the given ordinal position.
+/// 
+/// \param index 
+/// Input the position of the column.
+/// 
+/// \return
+/// Returns the column name
+/// 
+FdoString* c_KgOraSQLDataReader::GetColumnName(FdoInt32 Index)
+{
+  return m_OciStatement->GetColumnName(Index+1);
   /*
   string cname = m_MetaData[Index].getString(oracle::occi::MetaData::ATTR_NAME);    
   
   m_ColName = cname.c_str();
   
   return m_ColName;
-  */
-}
-
-FdoInt32 c_KgOraSQLDataReader::GetColumnIndex(FdoString* columnName)
-{
-    return ColumnNameToColumnIndex(columnName);
-}
-
-/// \brief
-/// Gets the data type of the column with the specified name.
-/// 
-/// \param columnName 
-/// Input the column name.
-/// 
-/// \return
-/// Returns the type of the column.
-/// 
+  */
+}
+
+FdoInt32 c_KgOraSQLDataReader::GetColumnIndex(FdoString* columnName)
+{
+    return ColumnNameToColumnIndex(columnName);
+}
+
+/// \brief
+/// Gets the data type of the column with the specified name.
+/// 
+/// \param columnName 
+/// Input the column name.
+/// 
+/// \return
+/// Returns the type of the column.
+/// 
 FdoDataType c_KgOraSQLDataReader::GetColumnType(FdoString* ColumnName)
 {
   int ind = ColumnNameToColumnIndex(ColumnName);
@@ -154,21 +154,21 @@
   int oraprecision = m_OciStatement->GetColumnPrecision(ind+1); // \
m_MetaData[ind].getInt(oracle::occi::MetaData::ATTR_SCALE);  
   FdoDataType fdotype;
-  c_FdoOra_API2::OraTypeToFdoDataType(dtype,oraprecision,orascale,length,fdotype);
+  c_FdoOra_API3::OraTypeToFdoDataType(dtype,oraprecision,orascale,length,fdotype);
   
   return fdotype;
   
 }//end of c_KgOraSQLDataReader::GetColumnType
 
-/// \brief
-/// Gets the data type of the column with the specified name.
-/// 
-/// \param columnName 
-/// Input the column name.
-/// 
-/// \return
-/// Returns the type of the column.
-/// 
+/// \brief
+/// Gets the data type of the column with the specified name.
+/// 
+/// \param columnName 
+/// Input the column name.
+/// 
+/// \return
+/// Returns the type of the column.
+/// 
 FdoPropertyType c_KgOraSQLDataReader::GetPropertyType(FdoString* ColumnName)
 {
   int ind = ColumnNameToColumnIndex(ColumnName);
@@ -295,7 +295,7 @@
   if( ind >= 0 )
   {
     //long val = m_OcciResultSet->getInt(ind+1);    
-    return m_OciStatement->GetLong(ind+1);
+    return m_OciStatement->GetInt64(ind+1);
   }
   
     throw FdoCommandException::Create(L"Int64");

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSchemaPool.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSchemaPool.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSchemaPool.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -18,7 +18,7 @@
 #include "c_KgOraSchemaPool.h"
 
   
-#include "c_FdoOra_API2.h"
+#include "c_FdoOra_API3.h"
 
 vector<t_SchemaPoolDesc> c_KgOraSchemaPool::g_SchemaPoolDesc;
 

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSelectAggregates.cpp
 ===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSelectAggregates.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSelectAggregates.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -125,49 +125,11 @@
     int geom_sqlcol_index;
     FdoPtr<FdoStringCollection> sqlcols = FdoStringCollection::Create();
     
-    
     c_KgOraSridDesc orasrid;
     m_Connection->GetOracleSridDesc(classdef,orasrid);
-    /*
-    if( !m_PropertyNames.p || (m_PropertyNames->GetCount()==0) )
-    {
-      FdoPtr<FdoPropertyDefinition> propdef;        
-      FdoPtr<FdoPropertyDefinitionCollection> propcol = classdef->GetProperties();
-      int count = propcol->GetCount();
-      for( int ind = 0; ind < count; ind++ )
-      {
-        propdef = propcol->GetItem(ind);
-        FdoString* propname = propdef->GetName();
-              
-        if( propdef->GetPropertyType() == FdoPropertyType_GeometricProperty )
-        {
-          FdoGeometricPropertyDefinition* geomprop = \
                (FdoGeometricPropertyDefinition*)propdef.p;
-          
-          m_Connection->GetOracleSridDesc(geomprop,orasrid);
-          
-          
-        }
-      }
-    }
-    else
-    {
-      int propcount = -1; 
-      if( m_PropertyNames.p )
-        propcount = m_PropertyNames->GetCount();
-        
-      FdoPtr<FdoIdentifier> ident = m_PropertyNames->GetItem(0);
-      //ident->
-      FdoComputedIdentifier *compident = \
                dynamic_cast<FdoComputedIdentifier*>(ident.p);
-      if( compident )
-      {
-        FdoString * pstr = compident->ToString();
-        FdoString * pstr2 = compident->ToString();
-      }
-    }
-    */
     
     FdoStringP sdespatialextent_columnname;
-    c_KgOraFilterProcessor \
fproc(m_Connection->GetOracleMainVersion(),schemadesc,classid,orasrid); +    \
                c_KgOraFilterProcessor \
                fproc(m_Connection,schemadesc,classdef,orasrid);
     std::wstring sqlstr = \
CreateSqlString(fproc,geom_sqlcol_index,sqlcols,sdespatialextent_columnname);  
     D_KGORA_ELOG_WRITE3("c_KgOraSelectAggregates%d::Execute class_name = '%s' \
PropCount=%d",m_Connection->m_ConnNo,(const char*)FdoStringP(class_name),propcount); \
@@ -189,7 +151,7 @@  //occi_stm->setPrefetchRowCount(400);
       //occi_stm->setPrefetchMemorySize(64*1024);
       
-      fproc.GetExpressionProcessor().ApplySqlParameters(oci_stm,orasrid.m_IsGeodetic,orasrid.m_OraSrid);
 +      fproc.GetExpressionProcessor().ApplySqlParameters(oci_stm);
       
       if( phys_class && phys_class->GetIsSdeClass() )
         oci_stm->ExecuteSelectAndDefine(4);
@@ -267,9 +229,8 @@
     FdoStringP sdegeom_fultablename = phys_class->GetSdeGeometryTableName();
     FdoStringP sde_featurekey_column = phys_class->GetSdeFeatureKeyColumn();
     
-    c_KgOraSridDesc orasrid;
-    m_Connection->GetOracleSridDesc(classdef,orasrid);
     
+    
     // Define properties to be included in SELECT statement 
     FdoPtr<FdoPropertyDefinition> propdef;
     FdoStringP sql_select_columns_part;
@@ -282,7 +243,9 @@
     if( m_PropertyNames && (m_PropertyNames->GetCount() > 0))
     {
       c_FilterStringBuffer strbuff;
-      c_KgOraExpressionProcessor expproc(&strbuff,schemadesc,classid,orasrid,0);
+      c_KgOraSridDesc orasrid;
+      m_Connection->GetOracleSridDesc(classdef,orasrid);
+      c_KgOraExpressionProcessor expproc(&strbuff,schemadesc,classdef,orasrid,0);
       
       // Now, I need to check for special case of SpatialExtent function.
       // This is necessary because Autodesk MAP 3D is calling SpatialExtent function \
to get extent of all class @@ -338,6 +301,11 @@
         }
         
         // standard case: It is not SDE class 
+        c_KgOraSridDesc orasrid;
+        if( m_Connection->GetOracleSridDesc(classdef,ident->GetName(),orasrid) )
+        {
+          expproc.SetOracleSrid(orasrid);
+        }
         ident->Process(&expproc);
         
         if( expproc.GetUsedConstantSpatialExtent() )
@@ -548,12 +516,18 @@
       FdoStringP sql_groupby_columns;
       c_FilterStringBuffer strbuff;
       
-      
-      c_KgOraExpressionProcessor expproc(&strbuff,schemadesc,classid,orasrid,0);
+      c_KgOraSridDesc orasrid;
+      m_Connection->GetOracleSridDesc(classdef,orasrid);
+      c_KgOraExpressionProcessor expproc(&strbuff,schemadesc,classdef,orasrid,0);
       int count = m_Grouping->GetCount();
       for( int ind = 0; ind < count; ind++ )
       {
         FdoPtr<FdoIdentifier> ident = m_Grouping->GetItem(ind);
+        c_KgOraSridDesc orasrid;
+        if( m_Connection->GetOracleSridDesc(classdef,ident->GetName(),orasrid) )
+        {
+          expproc.SetOracleSrid(orasrid);
+        }
         ident->Process(&expproc);
         
         if( ind > 0 )

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSelectCommand.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSelectCommand.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSelectCommand.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -168,48 +168,8 @@
     c_KgOraSridDesc orasrid;
     m_Connection->GetOracleSridDesc(classdef,orasrid);
     
-    /*
-    if( !m_PropertyNames.p || (m_PropertyNames->GetCount()==0) )
-    {
-      FdoPtr<FdoPropertyDefinition> propdef;        
-      FdoPtr<FdoPropertyDefinitionCollection> propcol = classdef->GetProperties();
-      int count = propcol->GetCount();
-      for( int ind = 0; ind < count; ind++ )
-      {
-        propdef = propcol->GetItem(ind);
-        FdoString* propname = propdef->GetName();
-              
-        if( propdef->GetPropertyType() == FdoPropertyType_GeometricProperty )
-        {
-          FdoGeometricPropertyDefinition* geomprop = \
                (FdoGeometricPropertyDefinition*)propdef.p;
-          
-          m_Connection->GetOracleSridDesc(geomprop,orasrid);
-          
-          
-        }
-      }
-    }
-    /*
-    else
-    {
-      int propcount = -1; 
-      if( m_PropertyNames.p )
-        propcount = m_PropertyNames->GetCount();
-        
-      FdoPtr<FdoIdentifier> ident = m_PropertyNames->GetItem(0);
-      //ident->
-      FdoComputedIdentifier *compident = \
                dynamic_cast<FdoComputedIdentifier*>(ident.p);
-      if( compident )
-      {
-        FdoString * pstr = compident->ToString();
-        FdoString * pstr2 = compident->ToString();
-      }
-    }
-    */
     
-    
-    
-    c_KgOraFilterProcessor \
fproc(m_Connection->GetOracleMainVersion(),schemadesc,classid,orasrid); +    \
                c_KgOraFilterProcessor \
                fproc(m_Connection,schemadesc,classdef,orasrid);
     std::wstring sqlstr = CreateSqlString(fproc,geom_sqlcol_index,sqlcols);
     
     D_KGORA_ELOG_WRITE2("c_KgOraSelectCommand%d::Execute class_name = \
'%s'",m_Connection->m_ConnNo,(const char*)FdoStringP(class_name)); @@ -232,7 +192,7 \
@@  //occi_stm->setPrefetchRowCount(400);
       //occi_stm->setPrefetchMemorySize(64*1024);
       
-      fproc.GetExpressionProcessor().ApplySqlParameters(oci_stm,orasrid.m_IsGeodetic,orasrid.m_OraSrid);
 +      fproc.GetExpressionProcessor().ApplySqlParameters(oci_stm);
       
       if( phys_class && phys_class->GetIsSdeClass() )
         oci_stm->ExecuteSelectAndDefine(4);

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSpatialContext.cpp
 ===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSpatialContext.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSpatialContext.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -1,18 +1,18 @@
-/*
-* Copyright (C) 2006  SL-King d.o.o
-* 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of version 2.1 of the GNU Lesser
-* General Public License as published by the Free Software Foundation.
-* 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
-* 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+/*
+* Copyright (C) 2006  SL-King d.o.o
+* 
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of version 2.1 of the GNU Lesser
+* General Public License as published by the Free Software Foundation.
+* 
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+* 
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
 
 
@@ -174,3 +174,16 @@
 {
   m_OraSridDesc = SridDesc;
 }//end of c_KgOraSpatialContext::SetOraSridDesc
+
+c_KgOraSpatialContext* c_KgOraSpatialContextCollection::GetDefaultSpatialContext()
+{
+  c_KgOraSpatialContext* spctx; 
+  spctx = FindItem(D_SPATIALCONTEXT_DEFAULT_NAME);
+  if( !spctx )
+  {
+    spctx = new c_KgOraSpatialContext();
+    Add(spctx);
+  }
+  
+  return spctx;
+}

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSpatialContext.h
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSpatialContext.h	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSpatialContext.h	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -1,18 +1,18 @@
-/*
-* Copyright (C) 2006-2009  SL-King d.o.o
-* 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of version 2.1 of the GNU Lesser
-* General Public License as published by the Free Software Foundation.
-* 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
-* 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+/*
+* Copyright (C) 2006-2009  SL-King d.o.o
+* 
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of version 2.1 of the GNU Lesser
+* General Public License as published by the Free Software Foundation.
+* 
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+* 
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
 
 
@@ -78,6 +78,7 @@
 public:
     c_KgOraSpatialContextCollection(void) {}
 
+    c_KgOraSpatialContext* GetDefaultSpatialContext();
     virtual ~c_KgOraSpatialContextCollection() {}
 
     virtual void Dispose() 

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSqlParamDesc.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSqlParamDesc.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSqlParamDesc.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -20,7 +20,7 @@
 #include "c_FilterStringBuffer.h"
 #include "c_FgfToSdoGeom.h"
 #include "c_Ora_API2.h"
-#include "c_FdoOra_API2.h"
+#include "c_FdoOra_API3.h"
 #include "c_KgOraSqlParamDesc.h"
 
 c_KgOraSqlParamDesc::c_KgOraSqlParamDesc() 
@@ -38,7 +38,7 @@
   m_ParamType=e_UserParam;m_UserParamName=UserName; 
 }
 
-c_KgOraSqlParamDesc::c_KgOraSqlParamDesc(FdoByteArray* Geom) 
+c_KgOraSqlParamDesc::c_KgOraSqlParamDesc(FdoByteArray* Geom,const c_KgOraSridDesc& \
Srid)   { 
   m_ParamType=e_Uknown;
   m_ParamGeometry=NULL; 
@@ -49,6 +49,7 @@
   m_ParamGeometry=Geom; 
   
   Geom->AddRef();
+  m_OracleSrid=Srid;
 }
 
 c_KgOraSqlParamDesc::c_KgOraSqlParamDesc(FdoDataValue* DataValue) 
@@ -63,7 +64,7 @@
   
   m_ParamDataValue->AddRef();
 }
-c_KgOraSqlParamDesc::c_KgOraSqlParamDesc(long Srid,double MinX,double MinY,double \
MaxX,double MaxY)  +c_KgOraSqlParamDesc::c_KgOraSqlParamDesc(const c_KgOraSridDesc& \
Srid,double MinX,double MinY,double MaxX,double MaxY)   { 
   m_ParamType=e_Uknown;
   m_ParamGeometry=NULL; 
@@ -76,6 +77,7 @@
   m_OptimizedRect.m_MaxX=MaxX;
   m_OptimizedRect.m_MaxY=MaxY;
   
+  m_OracleSrid=Srid;
   
   
 }
@@ -106,13 +108,13 @@
 { 
   return m_ParamGeometry; 
 }
-void c_KgOraSqlParamDesc::SetGeometry(FdoByteArray* Geom) 
+void c_KgOraSqlParamDesc::SetGeometry(FdoByteArray* Geom,const c_KgOraSridDesc& \
Srid)   { 
   SetNull();
   
   m_ParamType=e_Geometry;
   m_ParamGeometry =  Geom; 
-  
+  m_OracleSrid=Srid;
   if(m_ParamGeometry) m_ParamGeometry->AddRef();
 }
   
@@ -136,7 +138,7 @@
   m_UserParamName =  Name; 
 }
 
-void c_KgOraSqlParamDesc::ApplySqlParameter(c_Oci_Statement* OraStm,bool \
IsGeodeticCS,long OraSrid,int SqlParamNum)  +void \
c_KgOraSqlParamDesc::ApplySqlParameter(c_Oci_Statement* OraStm,int SqlParamNum)   { 
   switch( m_ParamType )
   {
@@ -149,14 +151,17 @@
         
         c_FgfToSdoGeom fgftosdo;
         
-        if( fgftosdo.ToSdoGeom((int*)m_ParamGeometry->GetData(),OraSrid,sdogeom) == \
c_FgfToSdoGeom::e_Ok ) +        
+        
+        
+        if( fgftosdo.ToSdoGeom((int*)m_ParamGeometry->GetData(),m_OracleSrid.m_OraSrid,sdogeom) \
== c_FgfToSdoGeom::e_Ok )  {
           OraStm->BindSdoGeomValue(SqlParamNum,sdogeom);  
         }
         else
         {
           delete sdogeom;
-          OraStm->BindSdoGeom(SqlParamNum,NULL);  
+          OraStm->BindSdoGeomValue(SqlParamNum,NULL);  
         }
       
         #ifdef _KGORA_EXTENDED_LOG
@@ -170,7 +175,8 @@
       }
       else
       {
-        OraStm->BindSdoGeom( SqlParamNum,NULL );
+        
+        OraStm->BindSdoGeomValue( SqlParamNum,NULL);
         #ifdef _KGORA_EXTENDED_LOG
         {
         D_KGORA_ELOG_WRITE1("SQL Param %d Geometry=NULL",SqlParamNum);
@@ -182,7 +188,7 @@
     break;
     case e_OptimizedRect:
     {
-      c_SDO_GEOMETRY *sdorect = \
c_Ora_API2::CreateOptimizedRect(OraStm->m_OciConn,IsGeodeticCS,OraSrid,m_OptimizedRect.m_MinX,m_OptimizedRect.m_MinY,m_OptimizedRect.m_MaxX,m_OptimizedRect.m_MaxY);
 +      c_SDO_GEOMETRY *sdorect = \
c_Ora_API2::CreateOptimizedRect(OraStm->m_OciConn,m_OracleSrid.m_IsGeodetic,m_OracleSr \
id.m_OraSrid,m_OptimizedRect.m_MinX,m_OptimizedRect.m_MinY,m_OptimizedRect.m_MaxX,m_OptimizedRect.m_MaxY);
  OraStm->BindSdoGeomValue(SqlParamNum,sdorect);   
       #ifdef _KGORA_EXTENDED_LOG
         {
@@ -198,7 +204,7 @@
     {
       
       
-      if( c_FdoOra_API2::SetOracleStatementData(OraStm,SqlParamNum,m_ParamDataValue) \
) +      if( c_FdoOra_API3::SetOracleStatementData(OraStm,SqlParamNum,m_ParamDataValue) \
)  {
       }
       
@@ -214,7 +220,7 @@
   }
 }//end of  c_KgOraSqlParamDesc::ApplySqlParameters
 
-void c_KgOraSqlParamDesc::ApplySqlParameter(c_Oci_Statement* OraStm,bool \
IsGeodeticCS,long OraSrid,const wchar_t* SqlParamName)  +void \
c_KgOraSqlParamDesc::ApplySqlParameter(c_Oci_Statement* OraStm,const wchar_t* \
SqlParamName)   { 
   switch( m_ParamType )
   {
@@ -227,14 +233,14 @@
 
         c_FgfToSdoGeom fgftosdo;
 
-        if( fgftosdo.ToSdoGeom((int*)m_ParamGeometry->GetData(),OraSrid,sdogeom) == \
c_FgfToSdoGeom::e_Ok ) +        if( \
fgftosdo.ToSdoGeom((int*)m_ParamGeometry->GetData(),m_OracleSrid.m_OraSrid,sdogeom) \
== c_FgfToSdoGeom::e_Ok )  {
           OraStm->BindSdoGeomValue(SqlParamName,sdogeom);  
         }
         else
         {
           delete sdogeom;
-          OraStm->BindSdoGeom(SqlParamName,NULL);  
+          OraStm->BindSdoGeomValue(SqlParamName,NULL);  
         }
 
 #ifdef _KGORA_EXTENDED_LOG
@@ -250,7 +256,8 @@
       }
       else
       {
-        OraStm->BindSdoGeom( SqlParamName,NULL );
+        
+        OraStm->BindSdoGeomValue( SqlParamName,NULL );
 #ifdef _KGORA_EXTENDED_LOG
         {
           FdoStringP sval(SqlParamName); 
@@ -263,7 +270,7 @@
     break;
   case e_OptimizedRect:
     {
-      c_SDO_GEOMETRY *sdorect = \
c_Ora_API2::CreateOptimizedRect(OraStm->m_OciConn,IsGeodeticCS,OraSrid,m_OptimizedRect.m_MinX,m_OptimizedRect.m_MinY,m_OptimizedRect.m_MaxX,m_OptimizedRect.m_MaxY);
 +      c_SDO_GEOMETRY *sdorect = \
c_Ora_API2::CreateOptimizedRect(OraStm->m_OciConn,m_OracleSrid.m_IsGeodetic,m_OracleSr \
id.m_OraSrid,m_OptimizedRect.m_MinX,m_OptimizedRect.m_MinY,m_OptimizedRect.m_MaxX,m_OptimizedRect.m_MaxY);
  OraStm->BindSdoGeomValue(SqlParamName,sdorect);   
 #ifdef _KGORA_EXTENDED_LOG
       {
@@ -280,7 +287,7 @@
     {
 
 
-      if( c_FdoOra_API2::SetOracleStatementData(OraStm,SqlParamName,m_ParamDataValue) \
) +      if( c_FdoOra_API3::SetOracleStatementData(OraStm,SqlParamName,m_ParamDataValue) \
)  {
       }
 
@@ -288,7 +295,7 @@
       {
         FdoStringP sval(SqlParamName); 
         FdoStringP fdostr = m_ParamDataValue->ToString();
-        D_KGORA_ELOG_WRITE2("SQL Param %s Data='%s'",(const \
char*)SqlParamName,(const char*)fdostr); +        D_KGORA_ELOG_WRITE2("SQL Param %s \
Data='%s'",(const char*)sval,(const char*)fdostr);  
       }
 #endif

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSqlParamDesc.h
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSqlParamDesc.h	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraSqlParamDesc.h	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -1,21 +1,21 @@
-/*
-* Copyright (C) 2006  SL-King d.o.o
-* 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of version 2.1 of the GNU Lesser
-* General Public License as published by the Free Software Foundation.
-* 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
-* 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-*/
-
-#ifndef _c_KgOraSqlParamDesc_h
+/*
+* Copyright (C) 2006  SL-King d.o.o
+* 
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of version 2.1 of the GNU Lesser
+* General Public License as published by the Free Software Foundation.
+* 
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+* 
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#ifndef _c_KgOraSqlParamDesc_h
 #define _c_KgOraSqlParamDesc_h
 
 
@@ -38,9 +38,9 @@
 public:
   c_KgOraSqlParamDesc();
   c_KgOraSqlParamDesc(FdoString* UserName);
-  c_KgOraSqlParamDesc(FdoByteArray* Geom);
+  c_KgOraSqlParamDesc(FdoByteArray* Geom,const c_KgOraSridDesc& Srid );
   c_KgOraSqlParamDesc(FdoDataValue* DataValue) ;
-  c_KgOraSqlParamDesc(long Srid,double MinX,double MinY,double MaxX,double MaxY);
+  c_KgOraSqlParamDesc(const c_KgOraSridDesc& Srid,double MinX,double MinY,double \
MaxX,double MaxY);  
   ~c_KgOraSqlParamDesc();
 
@@ -51,6 +51,7 @@
     FdoStringP m_UserParamName;
     //c_SDO_GEOMETRY* m_ParamGeometry;
     FdoByteArray* m_ParamGeometry;
+    c_KgOraSridDesc m_OracleSrid;
     FdoDataValue *m_ParamDataValue;
     t_OptimizedRect m_OptimizedRect;
     
@@ -60,15 +61,15 @@
   //c_SDO_GEOMETRY* GetGeometry() const;
   //void SetGeometry(c_SDO_GEOMETRY* Geom);
   FdoByteArray* GetGeometry() const;
-  void SetGeometry(FdoByteArray* Geom);
+  void SetGeometry(FdoByteArray* Geom,const c_KgOraSridDesc& Srid);
   
   void SetDataValue(FdoDataValue* DataValue);
   
   FdoString* GetUserParamName() const;
   void SetUserParamName(FdoString* Name);
    
-  void ApplySqlParameter(c_Oci_Statement* OraStm,bool IsGeodeticCS,long OraSrid,int \
                SqlParamNum);
-  void ApplySqlParameter(c_Oci_Statement* OraStm,bool IsGeodeticCS,long \
OraSrid,const wchar_t* SqlParamName); +  void ApplySqlParameter(c_Oci_Statement* \
OraStm,int SqlParamNum); +  void ApplySqlParameter(c_Oci_Statement* OraStm,const \
wchar_t* SqlParamName);  protected:
   void SetNull();  
     

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraUpdate.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraUpdate.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_KgOraUpdate.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -1,33 +1,33 @@
-/*
-* Copyright (C) 2009  SL-King d.o.o
-* 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of version 2.1 of the GNU Lesser
-* General Public License as published by the Free Software Foundation.
-* 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
-* 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-*/
-#include "stdafx.h"
-#include "c_KgOraFilterProcessor.h"
-
-c_KgOraUpdate::c_KgOraUpdate(c_KgOraConnection *Conn)
-  : c_KgOraFdoFeatureCommand<FdoIUpdate>(Conn)
-{
-}
-
-c_KgOraUpdate::~c_KgOraUpdate(void)
-{
-}
-
+/*
+* Copyright (C) 2009  SL-King d.o.o
+* 
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of version 2.1 of the GNU Lesser
+* General Public License as published by the Free Software Foundation.
+* 
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+* 
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+#include "stdafx.h"
+#include "c_KgOraFilterProcessor.h"
 
+c_KgOraUpdate::c_KgOraUpdate(c_KgOraConnection *Conn)
+  : c_KgOraFdoFeatureCommand<FdoIUpdate>(Conn)
+{
+}
 
+c_KgOraUpdate::~c_KgOraUpdate(void)
+{
+}
+
+
+
 /// \brief
 /// Gets the FdoPropertyValueCollection that specifies the names and values
 /// of the properties for the instance to be inserted.
@@ -41,7 +41,7 @@
   {
     m_PropertyValues = FdoPropertyValueCollection::Create();
   }
-
+
   return FDO_SAFE_ADDREF( m_PropertyValues.p );
 }
 
@@ -64,12 +64,12 @@
   FdoPtr<c_KgOraSchemaDesc> schemadesc = m_Connection->GetSchemaDesc();
   
   FdoPtr<FdoIdentifier> classid = GetFeatureClassName();
-  FdoPtr<FdoClassDefinition> classdef = schemadesc->FindClassDefinition(classid);
+  FdoPtr<FdoClassDefinition> classdef = schemadesc->FindClassDefinition(classid);
   if( !classdef.p ) return NULL;
   
   
-  FdoPtr<FdoKgOraClassDefinition> phys_class = \
                schemadesc->FindClassMapping(classid);
-  FdoStringP fultablename = phys_class->GetOracleFullTableName();
+  FdoPtr<FdoKgOraClassDefinition> phys_class = \
schemadesc->FindClassMapping(classid); +  FdoStringP fultablename = \
phys_class->GetOracleFullTableName();  FdoStringP table_alias = \
phys_class->GetOraTableAlias();  
   c_KgOraSridDesc orasrid;
@@ -78,7 +78,7 @@
   if( m_PropertyValues.p )
   {
     c_FilterStringBuffer strbuff;
-    c_KgOraExpressionProcessor expproc(&strbuff,schemadesc,classid,orasrid);
+    c_KgOraExpressionProcessor expproc(&strbuff,schemadesc,classdef,orasrid);
     
     
     FdoStringP colupdates;
@@ -93,6 +93,13 @@
       FdoPtr<FdoValueExpression> expr = propval->GetValue();
                        
       strbuff.ClearBuffer();
+      
+      c_KgOraSridDesc orasrid;
+      if( m_Connection->GetOracleSridDesc(classdef,propid->GetName(),orasrid) )
+      {
+        expproc.SetOracleSrid(orasrid);
+      }
+      
       expr->Process( &expproc );
       
       colupdates += sep + propid->GetName() + L" = " + strbuff.GetString();      
@@ -110,64 +117,64 @@
     sqlstr.AppendString( L" ");
     
     // process filter
-    const wchar_t* filtertext=NULL;
-    c_KgOraFilterProcessor \
                fproc(m_Connection->GetOracleMainVersion(),schemadesc,classid,orasrid);
                
-    fproc.GetExpressionProcessor().SetParamNumberOffset(expproc.GetSqlParametersCount());
                
-    if( m_Filter )
-    {      
-      m_Filter->Process( &fproc );
-    
-      filtertext = fproc.GetFilterText();
-    }
+    const wchar_t* filtertext=NULL;
+    c_KgOraFilterProcessor fproc(m_Connection,schemadesc,classdef,orasrid);
+    fproc.GetExpressionProcessor().SetParamNumberOffset(expproc.GetSqlParametersCount());
 +    if( m_Filter )
+    {      
+      m_Filter->Process( &fproc );
+    
+      filtertext = fproc.GetFilterText();
+    }
     else filtertext = NULL;
     
-    if( filtertext && *filtertext )
-    {
-      sqlstr.AppendString( L" WHERE ");
-      sqlstr.AppendString(filtertext);
+    if( filtertext && *filtertext )
+    {
+      sqlstr.AppendString( L" WHERE ");
+      sqlstr.AppendString(filtertext);
     }
     
     int update_num=0;
-    c_Oci_Statement* oci_stm=NULL;
-    
-    try
-    {
-      oci_stm = m_Connection->OCI_CreateStatement();
-      
-      oci_stm->Prepare(sqlstr.GetString());
-      
-      #ifdef _KGORA_EXTENDED_LOG
-        FdoStringP s1 = sqlstr.GetString();
-        D_KGORA_ELOG_WRITE1("Execute Update: '%s'",(const char*)s1);
-      #endif
-      
-      // fist apply binds from update values
-      expproc.ApplySqlParameters(oci_stm,orasrid.m_IsGeodetic,orasrid.m_OraSrid);
-      // then apply sql binds from filter expresion
-      fproc.GetExpressionProcessor().ApplySqlParameters(oci_stm,orasrid.m_IsGeodetic,orasrid.m_OraSrid,expproc.GetSqlParametersCount());
                
-      
-      
-      update_num = oci_stm->ExecuteNonQuery();
-      
-      
-      
-      if( oci_stm ) m_Connection->OCI_TerminateStatement(oci_stm);
-      
-      
-    }
-    catch(c_Oci_Exception* ea)
-    {
-      
-      if( oci_stm ) m_Connection->OCI_TerminateStatement(oci_stm);
-      FdoStringP gstr = ea->what();
-      
-      D_KGORA_ELOG_WRITE2("c_KgOraUpdate::Execute%d Exception \
                '%s'",m_Connection->m_ConnNo,(const char*)gstr);
-      
-      delete ea;
-      throw FdoCommandException::Create( gstr );    
-    }
-
-    
+    c_Oci_Statement* oci_stm=NULL;
+    
+    try
+    {
+      oci_stm = m_Connection->OCI_CreateStatement();
+      
+      oci_stm->Prepare(sqlstr.GetString());
+      
+      #ifdef _KGORA_EXTENDED_LOG
+        FdoStringP s1 = sqlstr.GetString();
+        D_KGORA_ELOG_WRITE1("Execute Update: '%s'",(const char*)s1);
+      #endif
+      
+      // fist apply binds from update values
+      expproc.ApplySqlParameters(oci_stm);
+      // then apply sql binds from filter expresion
+      fproc.GetExpressionProcessor().ApplySqlParameters(oci_stm,expproc.GetSqlParametersCount());
 +      
+      
+      update_num = oci_stm->ExecuteNonQuery();
+      
+      
+      
+      if( oci_stm ) m_Connection->OCI_TerminateStatement(oci_stm);
+      
+      
+    }
+    catch(c_Oci_Exception* ea)
+    {
+      
+      if( oci_stm ) m_Connection->OCI_TerminateStatement(oci_stm);
+      FdoStringP gstr = ea->what();
+      
+      D_KGORA_ELOG_WRITE2("c_KgOraUpdate::Execute%d Exception \
'%s'",m_Connection->m_ConnNo,(const char*)gstr); +      
+      delete ea;
+      throw FdoCommandException::Create( gstr );    
+    }
+
+    
     return update_num;
     
   }

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_LogAPI.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_LogAPI.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_LogAPI.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -1,30 +1,30 @@
-/*
-* Copyright (C) 2006  SL-King d.o.o
-* 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of version 2.1 of the GNU Lesser
-* General Public License as published by the Free Software Foundation.
-* 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
-* 
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+/*
+* Copyright (C) 2006  SL-King d.o.o
+* 
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of version 2.1 of the GNU Lesser
+* General Public License as published by the Free Software Foundation.
+* 
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+* 
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
 
-#include "stdafx.h"
+#include "stdafx.h"
 #include "time.h"
 #include <stdarg.h>
 #include "c_LogAPI.h"
 
 #ifdef _WIN32
 extern wchar_t g_LogFileName[MAX_PATH];
-#else
-extern wchar_t* g_LogFileName;
-#endif
+#else
+extern wchar_t* g_LogFileName;
+#endif
 
 FdoCommonThreadMutex c_LogAPI::m_Mutex;
 
@@ -41,23 +41,24 @@
   
     
     m_Mutex.Enter();
-    
+    
 #ifdef _WIN32
-    FILE * GisDebugFile = _wfopen(g_LogFileName, L"a+");
-#else
-    char *mb_fn = NULL;
-    wide_to_multibyte(mb_fn, g_LogFileName);
-    FILE * GisDebugFile = fopen(mb_fn, "a+");
+    FILE * GisDebugFile = _wfopen(g_LogFileName, L"a+");
+#else
+    char *mb_fn = NULL;
+    wide_to_multibyte(mb_fn, g_LogFileName);
+    FILE * GisDebugFile = fopen(mb_fn, "a+");
 #endif
     if( GisDebugFile )
     {
       // add new line date and time
       struct tm newtime;
       FdoCommonOSUtil::getsystime(&newtime);
-
+
       fprintf(GisDebugFile, "\n<%d-%d-%d \
%d:%d:%d>",newtime.tm_yday,newtime.tm_mon,newtime.tm_mday,newtime.tm_hour,newtime.tm_min,newtime.tm_sec);
  
-      fprintf(GisDebugFile, Text);
+      //fprintf(GisDebugFile, Text);
+      fputs(Text,GisDebugFile);
       fclose(GisDebugFile);
       
       
@@ -88,15 +89,15 @@
     va_start(args,text);
 
     m_Mutex.Enter();
-
+
 #ifdef _WIN32
-    FILE * GisDebugFile = _wfopen(g_LogFileName, L"a+");
-#else
-    char *mb_fn = NULL;
-    wide_to_multibyte(mb_fn, g_LogFileName);
-    FILE * GisDebugFile = fopen(mb_fn, "a+");
+    FILE * GisDebugFile = _wfopen(g_LogFileName, L"a+");
+#else
+    char *mb_fn = NULL;
+    wide_to_multibyte(mb_fn, g_LogFileName);
+    FILE * GisDebugFile = fopen(mb_fn, "a+");
 #endif
-
+
     if( GisDebugFile )
     {
       // add new line date and time
@@ -108,7 +109,8 @@
       cbuff[2047]=0;
       vsnprintf(cbuff,2040,text,args);
       
-      fprintf(GisDebugFile, cbuff);
+      //fprintf(GisDebugFile, cbuff);
+      fputs(cbuff,GisDebugFile);
       fclose(GisDebugFile);
       
       delete cbuff;

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_OCI_API.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_OCI_API.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_OCI_API.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -29,8 +29,8 @@
 
 //#define USE_OCII_CONNECTION_POOLING
 
-OCIEnv 		*c_OCI_API::m_OciHpEnvironment=NULL;                       /* OCI general \
                handles */
-OCIError 	*c_OCI_API::m_OciHpError=NULL;
+OCIEnv 		*c_OCI_API::g_OciHpEnvironment=NULL;                       /* OCI general \
handles */ +OCIError 	*c_OCI_API::g_OciHpError=NULL;
 
 c_OCI_API::c_OCI_API(void)
 {
@@ -49,74 +49,74 @@
 
 
 
-/*******************************************************************************
-**
-** Routine:     c_OCI_API::OciCheckError
-**
-** Description: Error message routine
-**
-*******************************************************************************/
-void c_OCI_API::OciCheckError(OCIError *errhp, sword status)
-{
-  switch (status)
-  {
-    case OCI_SUCCESS:
-      break;
-    case OCI_SUCCESS_WITH_INFO:
-      //fprintf(stderr, "OCI_SUCCESS_WITH_INFO\n");
-      
-      break;
-    case OCI_ERROR:
-    {
-      c_Oci_Exception *ociexc = new c_Oci_Exception(status);
-      OCIErrorGet((dvoid *)errhp, (ub4)1, (text *)NULL, ociexc->GetErrorCodePtr(), 
-        ociexc->GetErrorTextBuffPtr(), (ub4)ociexc->GetErrorTextBuffSize(), \
                OCI_HTYPE_ERROR);
-      throw ociexc;
-    }
-    break;
-    case OCI_NEED_DATA:
-    {
-      c_Oci_Exception *ociexc = new c_Oci_Exception(status,0,L"OCI_NEED_DATA");
-      throw ociexc;      
-    }
-    break;
-    case OCI_NO_DATA:
-    {
-      c_Oci_Exception *ociexc = new c_Oci_Exception(status,0,L"OCI_NO_DATA");
-      throw ociexc;
-    }
-    break;
-    case OCI_INVALID_HANDLE:
-    {
-      c_Oci_Exception *ociexc = new c_Oci_Exception(status,0,L"OCI_INVALID_HANDLE");
-      throw ociexc;
-    }
-    break;
-    
-    case OCI_STILL_EXECUTING:
-    {
-      c_Oci_Exception *ociexc = new \
                c_Oci_Exception(status,0,L"OCI_STILL_EXECUTING");
-      throw ociexc;
-    }
-    break;
-    case OCI_CONTINUE:
-    {
-      c_Oci_Exception *ociexc = new c_Oci_Exception(status,0,L"OCI_CONTINUE");
-      throw ociexc;
-    }
-    break;
-    default:
-    {
-      c_Oci_Exception *ociexc = new c_Oci_Exception(status,0,L"UNKNOWN OCI ERROR \
                STATUS");
-      throw ociexc;
-    }
-    break;
-  }
-
-  if (status != OCI_SUCCESS && status != OCI_SUCCESS_WITH_INFO)
-  {
-    //disconnect();
-  }
+/*******************************************************************************
+**
+** Routine:     c_OCI_API::OciCheckError
+**
+** Description: Error message routine
+**
+*******************************************************************************/
+void c_OCI_API::OciCheckError(OCIError *errhp, sword status)
+{
+  switch (status)
+  {
+    case OCI_SUCCESS:
+      break;
+    case OCI_SUCCESS_WITH_INFO:
+      //fprintf(stderr, "OCI_SUCCESS_WITH_INFO\n");
+      
+      break;
+    case OCI_ERROR:
+    {
+      c_Oci_Exception *ociexc = new c_Oci_Exception(status);
+      OCIErrorGet((dvoid *)errhp, (ub4)1, (text *)NULL, ociexc->GetErrorCodePtr(), 
+        ociexc->GetErrorTextBuffPtr(), (ub4)ociexc->GetErrorTextBuffSize(), \
OCI_HTYPE_ERROR); +      throw ociexc;
+    }
+    break;
+    case OCI_NEED_DATA:
+    {
+      c_Oci_Exception *ociexc = new c_Oci_Exception(status,0,L"OCI_NEED_DATA");
+      throw ociexc;      
+    }
+    break;
+    case OCI_NO_DATA:
+    {
+      c_Oci_Exception *ociexc = new c_Oci_Exception(status,0,L"OCI_NO_DATA");
+      throw ociexc;
+    }
+    break;
+    case OCI_INVALID_HANDLE:
+    {
+      c_Oci_Exception *ociexc = new c_Oci_Exception(status,0,L"OCI_INVALID_HANDLE");
+      throw ociexc;
+    }
+    break;
+    
+    case OCI_STILL_EXECUTING:
+    {
+      c_Oci_Exception *ociexc = new \
c_Oci_Exception(status,0,L"OCI_STILL_EXECUTING"); +      throw ociexc;
+    }
+    break;
+    case OCI_CONTINUE:
+    {
+      c_Oci_Exception *ociexc = new c_Oci_Exception(status,0,L"OCI_CONTINUE");
+      throw ociexc;
+    }
+    break;
+    default:
+    {
+      c_Oci_Exception *ociexc = new c_Oci_Exception(status,0,L"UNKNOWN OCI ERROR \
STATUS"); +      throw ociexc;
+    }
+    break;
+  }
+
+  if (status != OCI_SUCCESS && status != OCI_SUCCESS_WITH_INFO)
+  {
+    //disconnect();
+  }
 }
 
 
@@ -130,12 +130,12 @@
 
 void c_OCI_API::OciInit()
 {
-  if(!m_OciHpEnvironment) 
+  if(!g_OciHpEnvironment) 
     //OCIEnvNlsCreate (&m_OciHpEnvironment, OCI_THREADED | OCI_OBJECT, (dvoid *)0,  \
                NULL, NULL, NULL, 0, (dvoid **)0,OCI_UTF16ID,OCI_UTF16ID);
-    OCIEnvNlsCreate (&m_OciHpEnvironment, OCI_THREADED | OCI_OBJECT, (dvoid *)0,  \
NULL, NULL, NULL, 0, (dvoid **)0,OCI_UTF16ID,OCI_UTF16ID); +    OCIEnvNlsCreate \
(&g_OciHpEnvironment, OCI_THREADED | OCI_OBJECT, (dvoid *)0,  NULL, NULL, NULL, 0, \
(dvoid **)0,OCI_UTF16ID,OCI_UTF16ID);  
-  if( !m_OciHpError ) 
-    OCIHandleAlloc((dvoid *) m_OciHpEnvironment, (dvoid **) &m_OciHpError, \
OCI_HTYPE_ERROR,(size_t) 0, (dvoid **) 0); +  if( !g_OciHpError ) 
+    OCIHandleAlloc((dvoid *) g_OciHpEnvironment, (dvoid **) &g_OciHpError, \
OCI_HTYPE_ERROR,(size_t) 0, (dvoid **) 0);  
 /*
   (void) OCIHandleAlloc((dvoid *) m_OciHpEnvironment, (dvoid **) &m_OciHpPool, \
OCI_HTYPE_CPOOL, @@ -163,8 +163,8 @@
 {
   
 
-  if( !m_OciHpError ) OCIHandleFree((dvoid *)m_OciHpError, OCI_HTYPE_ERROR);
-  if( !m_OciHpEnvironment ) OCIHandleFree((dvoid *)m_OciHpEnvironment, \
OCI_HTYPE_ENV); +  if( !g_OciHpError ) OCIHandleFree((dvoid *)g_OciHpError, \
OCI_HTYPE_ERROR); +  if( !g_OciHpEnvironment ) OCIHandleFree((dvoid \
*)g_OciHpEnvironment, OCI_HTYPE_ENV);  
 
   /*
@@ -191,7 +191,7 @@
 
 bool c_OCI_API::IsInit() 
 { 
-  return m_OciHpEnvironment != NULL; 
+  return g_OciHpEnvironment != NULL; 
   
 }
 
@@ -201,9 +201,25 @@
 
 c_Oci_Connection* c_OCI_API::CreateConnection(const wchar_t*User,const \
wchar_t*Password,const wchar_t* DbLink)  {
-  
-  c_Oci_Connection* newconn = new c_Oci_Connection(m_OciHpEnvironment,m_OciHpError);
+  OCIEnv 		*ocienv=NULL;  
+  sword status;   
+  status = OCIEnvNlsCreate (&ocienv, OCI_THREADED | OCI_OBJECT, (dvoid *)0,  NULL, \
NULL, NULL, 0, (dvoid **)0,OCI_UTF16ID,OCI_UTF16ID); +  if( status  != OCI_SUCCESS )
+  {
+    c_Oci_Exception *ociexc = new c_Oci_Exception(status,0,L"OCIEnvNlsCreate Unable \
to Create Environment");     +    throw ociexc;
+  }
 
+  OCIError 	*ocierror=NULL;
+  status = OCIHandleAlloc((dvoid *) ocienv, (dvoid **) &ocierror, \
OCI_HTYPE_ERROR,(size_t) 0, (dvoid **) 0); +  if( status  != OCI_SUCCESS )
+  {
+    c_Oci_Exception *ociexc = new c_Oci_Exception(status,0,L"OCIHandleAlloc Unable \
to Create OCIError");     +    throw ociexc;
+  }
+
+  c_Oci_Connection* newconn = new c_Oci_Connection(ocienv,ocierror);
+
 try
 {
   newconn->LogOn(User,Password,DbLink);
@@ -294,8 +310,8 @@
 
 void c_Oci_Connection::LogOn( const wchar_t* UserName,const wchar_t* Password,const \
wchar_t* DbLink )  {
-    /*
-    sword lstat;
+    /*
+    sword lstat;
     // Logon in Connection Pool mode 
     if (lstat = OCILogon2(m_OciHpEnvironment, m_OciHpError, &m_OciHpServiceContext,
       (CONST OraText *)UserName, (ub4)strlen((const char *)UserName),
@@ -305,43 +321,43 @@
     {
       c_OCI_API::OciCheckError(errhp,lstat);
       exit(1);
-    }
-    */
-    
-
-  ub4 plen = wcslen(Password)*sizeof(wchar_t);
-  /*
+    }
+    */
+    
+
+  ub4 plen = wcslen(Password)*sizeof(wchar_t);
+  /*
     c_OCI_API::OciCheckError(m_OciHpError, \
OCILogon2(m_OciHpEnvironment,m_OciHpError,&m_OciHpServiceContext,(CONST OraText \
                *)UserName, (ub4)wcslen(UserName)*sizeof(wchar_t),
-      (CONST OraText *)Password, (ub4)wcslen(Password)*sizeof(wchar_t),(CONST \
                OraText *)DbLink, (ub4)wcslen(DbLink)*sizeof(wchar_t),OCI_DEFAULT));
-  */
+      (CONST OraText *)Password, (ub4)wcslen(Password)*sizeof(wchar_t),(CONST \
OraText *)DbLink, (ub4)wcslen(DbLink)*sizeof(wchar_t),OCI_DEFAULT)); +  */
   c_OCI_API::OciCheckError(m_OciHpError, \
OCILogon(m_OciHpEnvironment,m_OciHpError,&m_OciHpServiceContext,(CONST OraText \
                *)UserName, (ub4)wcslen(UserName)*sizeof(wchar_t),
-    (CONST OraText *)Password, (ub4)wcslen(Password)*sizeof(wchar_t),(CONST OraText \
                *)DbLink, (ub4)wcslen(DbLink)*sizeof(wchar_t)));
-    
-    // describe spatial object types 
-    c_OCI_API::OciCheckError(m_OciHpError, OCIHandleAlloc(m_OciHpEnvironment, (dvoid \
                **)&m_OciHpDescribe, 
-      (ub4)OCI_HTYPE_DESCRIBE, (size_t)0,
-      (dvoid **)0));
-
-
-    m_OciType_SdoGeometry = NULL;
-    m_OciType_SdoDimArray = NULL;
-    m_OciType_SdoDimElement = NULL;
-    
-    // Ignore error of missing SDO_GEMETRY TYPES
+    (CONST OraText *)Password, (ub4)wcslen(Password)*sizeof(wchar_t),(CONST OraText \
*)DbLink, (ub4)wcslen(DbLink)*sizeof(wchar_t))); +    
+    // describe spatial object types 
+    c_OCI_API::OciCheckError(m_OciHpError, OCIHandleAlloc(m_OciHpEnvironment, (dvoid \
**)&m_OciHpDescribe,  +      (ub4)OCI_HTYPE_DESCRIBE, (size_t)0,
+      (dvoid **)0));
+
+
+    m_OciType_SdoGeometry = NULL;
+    m_OciType_SdoDimArray = NULL;
+    m_OciType_SdoDimElement = NULL;
+    
+    // Ignore error of missing SDO_GEMETRY TYPES
     try
     {
-      m_OciType_SdoGeometry = GetOciType(D_OCI_SDO_GEOMETRY);
-      
-      // describe spatial object types 
-     
-      m_OciType_SdoDimArray = GetOciType(D_OCI_SDO_DIM_ARRAY);
-     
-      m_OciType_SdoDimElement = GetOciType(D_OCI_SDO_DIM_ELEMENT);
+      m_OciType_SdoGeometry = GetOciType(D_OCI_SDO_GEOMETRY);
+      
+      // describe spatial object types 
+     
+      m_OciType_SdoDimArray = GetOciType(D_OCI_SDO_DIM_ARRAY);
+     
+      m_OciType_SdoDimElement = GetOciType(D_OCI_SDO_DIM_ELEMENT);
     }
     catch (c_Oci_Exception* e)
     {
       delete e; // ignore error
-    }
+    }
 
 }
 
@@ -350,44 +366,44 @@
 {
   //c_OCI_API::OciCheckError(m_OciHpError, OCIObjectUnpin(m_OciHpEnvironment, \
m_OciHpError, (dvoid *)m_OciType_SdoGeometry));  
-  /* finalize type descriptor */
+  /* finalize type descriptor */
   if(m_OciHpDescribe) OCIHandleFree((dvoid *)m_OciHpDescribe, \
(ub4)OCI_HTYPE_DESCRIBE);  
   OCILogoff(m_OciHpServiceContext,m_OciHpError);
 }
 
-/******************************************************************************
-**
-** Routine:     get_tdo
-**
-** Description: Returns the 
-**
-******************************************************************************/
-OCIType *c_Oci_Connection::GetOciType(const wchar_t *TypeName)
-{
-  OCIParam *paramp = NULL;
-  OCIRef *type_ref = NULL;
-  OCIType *tdo = NULL;
-
-  c_OCI_API::OciCheckError(m_OciHpError, OCIDescribeAny(m_OciHpServiceContext, \
                m_OciHpError, (text *)TypeName, 
-    (ub4)wcslen(TypeName)*sizeof(wchar_t), 
-    OCI_OTYPE_NAME, (ub1)1,  (ub1)OCI_PTYPE_TYPE, m_OciHpDescribe));
-  c_OCI_API::OciCheckError(m_OciHpError, OCIAttrGet((dvoid *)m_OciHpDescribe, \
                (ub4)OCI_HTYPE_DESCRIBE,
-    (dvoid *)&paramp, (ub4 *)0, 
-    (ub4)OCI_ATTR_PARAM, m_OciHpError));
-  c_OCI_API::OciCheckError(m_OciHpError, OCIAttrGet((dvoid *)paramp, \
                (ub4)OCI_DTYPE_PARAM,
-    (dvoid *)&type_ref, (ub4 *)0, 
-    (ub4)OCI_ATTR_REF_TDO, m_OciHpError));
-  c_OCI_API::OciCheckError(m_OciHpError, OCIObjectPin(m_OciHpEnvironment, \
                m_OciHpError, type_ref, (OCIComplexObject *)0, 
-    OCI_PIN_ANY, OCI_DURATION_SESSION, 
-    OCI_LOCK_NONE, (dvoid **)&tdo));
-    
-  if (!tdo)
-  {
-    return NULL;
-  }
-
-  return tdo;
+/******************************************************************************
+**
+** Routine:     get_tdo
+**
+** Description: Returns the 
+**
+******************************************************************************/
+OCIType *c_Oci_Connection::GetOciType(const wchar_t *TypeName)
+{
+  OCIParam *paramp = NULL;
+  OCIRef *type_ref = NULL;
+  OCIType *tdo = NULL;
+
+  c_OCI_API::OciCheckError(m_OciHpError, OCIDescribeAny(m_OciHpServiceContext, \
m_OciHpError, (text *)TypeName,  +    (ub4)wcslen(TypeName)*sizeof(wchar_t), 
+    OCI_OTYPE_NAME, (ub1)1,  (ub1)OCI_PTYPE_TYPE, m_OciHpDescribe));
+  c_OCI_API::OciCheckError(m_OciHpError, OCIAttrGet((dvoid *)m_OciHpDescribe, \
(ub4)OCI_HTYPE_DESCRIBE, +    (dvoid *)&paramp, (ub4 *)0, 
+    (ub4)OCI_ATTR_PARAM, m_OciHpError));
+  c_OCI_API::OciCheckError(m_OciHpError, OCIAttrGet((dvoid *)paramp, \
(ub4)OCI_DTYPE_PARAM, +    (dvoid *)&type_ref, (ub4 *)0, 
+    (ub4)OCI_ATTR_REF_TDO, m_OciHpError));
+  c_OCI_API::OciCheckError(m_OciHpError, OCIObjectPin(m_OciHpEnvironment, \
m_OciHpError, type_ref, (OCIComplexObject *)0,  +    OCI_PIN_ANY, \
OCI_DURATION_SESSION,  +    OCI_LOCK_NONE, (dvoid **)&tdo));
+    
+  if (!tdo)
+  {
+    return NULL;
+  }
+
+  return tdo;
 }
 
 void c_Oci_Connection::OciCheckError( sword status )

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_OCI_API.h
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_OCI_API.h	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_OCI_API.h	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -20,9 +20,9 @@
 
 
 
-#ifndef OCI_ORACLE
-#include <oci.h>
-#include <oci1.h>
+#ifndef OCI_ORACLE
+#include <oci.h>
+#include <oci1.h>
 #endif
 
 #include "OCI_SDO_GEOM_TYPES.h"
@@ -31,29 +31,29 @@
 #include "c_Oci_Statement.h"
 
 
-/*---------------------------------------------------------------------------
-PUBLIC TYPES AND CONSTANTS
----------------------------------------------------------------------------*/
-
-#define D_OCI_ARRAY_SIZE                 32
-#define D_OCI_TYPE_OWNER                 L"MDSYS"
-#define D_OCI_SDO_GEOMETRY               L"MDSYS.SDO_GEOMETRY"
-#define D_OCI_SDO_DIM_ARRAY            L"MDSYS.SDO_DIM_ARRAY"
-#define D_OCI_SDO_DIM_ELEMENT            L"MDSYS.SDO_DIM_ELEMENT"
-
-
-/*******************************************************************************
-**                        PRIVATE GLOBALS
-*******************************************************************************/
-
-//static OCIServer 	*srvhp;
-//static OCISvcCtx 	*svchp;
-//static OCISession 	*usrhp;
-//static OCIStmt 		*stmthp;
-//static OCIDescribe	*dschp = NULL;
-
-//static OCINumber         global_gid[D_OCI_ARRAY_SIZE];
-//static SDO_GEOMETRY_TYPE *global_geom_obj[D_OCI_ARRAY_SIZE];/* spatial object \
buffer */ +/*---------------------------------------------------------------------------
 +PUBLIC TYPES AND CONSTANTS
+---------------------------------------------------------------------------*/
+
+#define D_OCI_ARRAY_SIZE                 32
+#define D_OCI_TYPE_OWNER                 L"MDSYS"
+#define D_OCI_SDO_GEOMETRY               L"MDSYS.SDO_GEOMETRY"
+#define D_OCI_SDO_DIM_ARRAY            L"MDSYS.SDO_DIM_ARRAY"
+#define D_OCI_SDO_DIM_ELEMENT            L"MDSYS.SDO_DIM_ELEMENT"
+
+
+/*******************************************************************************
+**                        PRIVATE GLOBALS
+*******************************************************************************/
+
+//static OCIServer 	*srvhp;
+//static OCISvcCtx 	*svchp;
+//static OCISession 	*usrhp;
+//static OCIStmt 		*stmthp;
+//static OCIDescribe	*dschp = NULL;
+
+//static OCINumber         global_gid[D_OCI_ARRAY_SIZE];
+//static SDO_GEOMETRY_TYPE *global_geom_obj[D_OCI_ARRAY_SIZE];/* spatial object \
buffer */  //static SDO_GEOMETRY_ind  *global_geom_ind[D_OCI_ARRAY_SIZE]; /* Object \
indicator */  
 class c_Oci_Connection;
@@ -83,7 +83,7 @@
 
   public:
   
-    OCIEnv 		*m_OciHpEnvironment;  // do not free in destructor
+    OCIEnv 		*m_OciHpEnvironment;  // do not free in destructor
     OCIError 	*m_OciHpError;        // do not free in destructor
   
   // Next handlers are allocated in  c_Oci_Connection 
@@ -184,11 +184,11 @@
   
 public:
   //static oracle::occi::StatelessConnectionPool* c_OCI_API::GetConnPool(const \
                char*User,const char*Password,const char* DbLink,int& IndCpDesc);
-  /*******************************************************************************
-  **                        PUBLIC GLOBALS
-  *******************************************************************************/
-  static OCIEnv 		*m_OciHpEnvironment;                       /* OCI general handles \
                */
-  static OCIError 	*m_OciHpError;
+  /*******************************************************************************
+  **                        PUBLIC GLOBALS
+  *******************************************************************************/
+  static OCIEnv 		*g_OciHpEnvironment;                       /* OCI general handles \
*/ +  static OCIError 	*g_OciHpError;
   //static OCICPool   *m_OciHpPool;
  
   

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_Oci_Statement.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_Oci_Statement.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_Oci_Statement.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -80,9 +80,9 @@
   ClearColumnData();
   DeleteBindValues();
     
-  /* parse query */
-  m_OciConn->OciCheckError( OCIStmtPrepare(m_OciHpStm, m_OciConn->m_OciHpError, 
-    (OraText *)Sql, (ub4)wcslen(Sql)*sizeof(wchar_t), 
+  /* parse query */
+  m_OciConn->OciCheckError( OCIStmtPrepare(m_OciHpStm, m_OciConn->m_OciHpError, 
+    (OraText *)Sql, (ub4)wcslen(Sql)*sizeof(wchar_t), 
     (ub4)OCI_NTV_SYNTAX, (ub4)OCI_DEFAULT));
     
   m_OciConn->OciCheckError(OCIAttrSet \
(m_OciHpStm,OCI_HTYPE_STMT,&Prefetch,sizeof(Prefetch),OCI_ATTR_PREFETCH_ROWS,m_OciConn->m_OciHpError));
 @@ -108,17 +108,17 @@
 */
 int c_Oci_Statement::ExecuteNonQuery(int Mode)
 {
-  /* execute */
-  int status = OCIStmtExecute(m_OciConn->m_OciHpServiceContext, m_OciHpStm, \
                m_OciConn->m_OciHpError, (ub4)1, (ub4)0, 
-    (OCISnapshot *)NULL, (OCISnapshot *)NULL, 
+  /* execute */
+  int status = OCIStmtExecute(m_OciConn->m_OciHpServiceContext, m_OciHpStm, \
m_OciConn->m_OciHpError, (ub4)1, (ub4)0,  +    (OCISnapshot *)NULL, (OCISnapshot \
*)NULL,   (ub4)Mode);
     
   if( status == OCI_SUCCESS)    
   {
     // get the number of rows processed
     int rows;      
-    m_OciConn->OciCheckError( OCIAttrGet((dvoid *)m_OciHpStm, (ub4)OCI_HTYPE_STMT,
-      (dvoid *)&rows, (ub4 *)0, 
+    m_OciConn->OciCheckError( OCIAttrGet((dvoid *)m_OciHpStm, (ub4)OCI_HTYPE_STMT,
+      (dvoid *)&rows, (ub4 *)0, 
       (ub4)OCI_ATTR_ROW_COUNT, m_OciConn->m_OciHpError));
     return rows;      
   }
@@ -238,7 +238,7 @@
                
   
      /// Retrieve the column width in bytes 
-  ub4 col_precision;     
+  ub4 col_precision=0;     
   m_OciConn->OciCheckError(OCIAttrGet((dvoid*) param, (ub4) OCI_DTYPE_PARAM,
              (dvoid*) &col_precision,(ub4 *) 0, (ub4) OCI_ATTR_PRECISION,
              (OCIError *) m_OciConn->m_OciHpError  ));    
@@ -255,7 +255,7 @@
                
   
      /// Retrieve the column width in bytes 
-  ub4 col_scale;     
+  ub4 col_scale=0;     
   m_OciConn->OciCheckError(OCIAttrGet((dvoid*) param, (ub4) OCI_DTYPE_PARAM,
              (dvoid*) &col_scale,(ub4 *) 0, (ub4) OCI_ATTR_SCALE,
              (OCIError *) m_OciConn->m_OciHpError  ));    
@@ -347,8 +347,8 @@
 
 
 int fetched;
-m_OciConn->OciCheckError( OCIAttrGet((dvoid *)m_OciHpStm, (ub4)OCI_HTYPE_STMT,
-      (dvoid *)&fetched, (ub4 *)0, 
+m_OciConn->OciCheckError( OCIAttrGet((dvoid *)m_OciHpStm, (ub4)OCI_HTYPE_STMT,
+      (dvoid *)&fetched, (ub4 *)0, 
       (ub4)OCI_ATTR_ROW_COUNT, m_OciConn->m_OciHpError));
 
 return fetched;
@@ -380,8 +380,8 @@
 
 
 int fetched;
-m_OciConn->OciCheckError( OCIAttrGet((dvoid *)m_OciHpStm, (ub4)OCI_HTYPE_STMT,
-      (dvoid *)&fetched, (ub4 *)0, 
+m_OciConn->OciCheckError( OCIAttrGet((dvoid *)m_OciHpStm, (ub4)OCI_HTYPE_STMT,
+      (dvoid *)&fetched, (ub4 *)0, 
       (ub4)OCI_ATTR_ROW_COUNT, m_OciConn->m_OciHpError));
 
 return fetched;
@@ -403,7 +403,7 @@
   coldata->Set(m_OciConn,ColNumber,DataType,TypeName,ColSize,FetchSize);
   
   
-  OCIDefine *defn1p;
+  OCIDefine *defn1p;
   
     
 
@@ -411,24 +411,24 @@
   
     if( coldata->GetDataDefineType() == SQLT_NTY )
     {
-      m_OciConn->OciCheckError( OCIDefineByPos(m_OciHpStm, &defn1p, \
                m_OciConn->m_OciHpError, (ub4)ColNumber, 
-      (dvoid *)0, 
-      0,SQLT_NTY,
-      (dvoid *)0, (ub2 *)0, (ub2 *)0, 
+      m_OciConn->OciCheckError( OCIDefineByPos(m_OciHpStm, &defn1p, \
m_OciConn->m_OciHpError, (ub4)ColNumber,  +      (dvoid *)0, 
+      0,SQLT_NTY,
+      (dvoid *)0, (ub2 *)0, (ub2 *)0, 
       (ub4)OCI_DEFAULT));
       
-      m_OciConn->OciCheckError( OCIDefineObject(defn1p, m_OciConn->m_OciHpError, \
                coldata->GetDataOciType(), 
-          (dvoid **)coldata->GetDataDefineBuffer(), (ub4 *)0, 
+      m_OciConn->OciCheckError( OCIDefineObject(defn1p, m_OciConn->m_OciHpError, \
coldata->GetDataOciType(),  +          (dvoid **)coldata->GetDataDefineBuffer(), (ub4 \
*)0,   (dvoid **)coldata->GetDataIndDefineBuffer(), (ub4 *)0));    
           
     }
     else
     {
-      m_OciConn->OciCheckError( OCIDefineByPos(m_OciHpStm, &defn1p, \
                m_OciConn->m_OciHpError, (ub4)ColNumber, 
-      (dvoid *)coldata->GetDataDefineBuffer(), 
-      //(sb4)sizeof(OCINumber), SQLT_VNU,
-      coldata->GetDataDefineSize(),coldata->GetDataDefineType(),
-      (dvoid *)coldata->GetDataIndDefineBuffer(), (ub2 \
*)coldata->GetDataRealLengthBuffer(), (ub2 *)0,  +      m_OciConn->OciCheckError( \
OCIDefineByPos(m_OciHpStm, &defn1p, m_OciConn->m_OciHpError, (ub4)ColNumber,  +      \
(dvoid *)coldata->GetDataDefineBuffer(),  +      //(sb4)sizeof(OCINumber), SQLT_VNU,
+      coldata->GetDataDefineSize(),coldata->GetDataDefineType(),
+      (dvoid *)coldata->GetDataIndDefineBuffer(), (ub2 \
*)coldata->GetDataRealLengthBuffer(), (ub2 *)0,   (ub4)OCI_DEFAULT));
     }
   
@@ -455,26 +455,26 @@
     if( !m_HasMoreData ) return false;
     
     
-    int status = OCIStmtFetch2(m_OciHpStm, m_OciConn->m_OciHpError, \
                (ub4)m_FetchArraySize, 
-        (ub2)OCI_FETCH_NEXT, 1,(ub4)OCI_DEFAULT);
-      //status = OCIStmtFetch(stmthp, ociconn->m_OciHpError, (ub4)D_OCI_ARRAY_SIZE, 
-      //  (ub2)OCI_FETCH_NEXT, (ub4)OCI_DEFAULT);
-    
-    if( status == OCI_NO_DATA ) 
-    {
-      m_HasMoreData = FALSE; // no more to fetch
-    }
-    else
-    {
-      if( status != OCI_SUCCESS )
-      {
-        m_OciConn->OciCheckError( status);
-      }
-    }
-    m_OciConn->OciCheckError( OCIAttrGet((dvoid *)m_OciHpStm, (ub4)OCI_HTYPE_STMT,
-        (dvoid *)&m_RowsFetched, (ub4 *)0, 
-        (ub4)OCI_ATTR_ROW_COUNT, m_OciConn->m_OciHpError));      
-
+    int status = OCIStmtFetch2(m_OciHpStm, m_OciConn->m_OciHpError, \
(ub4)m_FetchArraySize,  +        (ub2)OCI_FETCH_NEXT, 1,(ub4)OCI_DEFAULT);
+      //status = OCIStmtFetch(stmthp, ociconn->m_OciHpError, (ub4)D_OCI_ARRAY_SIZE, 
+      //  (ub2)OCI_FETCH_NEXT, (ub4)OCI_DEFAULT);
+    
+    if( status == OCI_NO_DATA ) 
+    {
+      m_HasMoreData = FALSE; // no more to fetch
+    }
+    else
+    {
+      if( status != OCI_SUCCESS )
+      {
+        m_OciConn->OciCheckError( status);
+      }
+    }
+    m_OciConn->OciCheckError( OCIAttrGet((dvoid *)m_OciHpStm, (ub4)OCI_HTYPE_STMT,
+        (dvoid *)&m_RowsFetched, (ub4 *)0, 
+        (ub4)OCI_ATTR_ROW_COUNT, m_OciConn->m_OciHpError));      
+
     //if ((status != OCI_SUCCESS) || m_RowsFetched<=m_RowsProcessed)
     if( m_RowsFetched<=m_RowsProcessed )
     {        
@@ -502,22 +502,28 @@
   
   int data;
   
-  m_OciConn->OciCheckError( OCINumberToInt(m_OciConn->m_OciHpError, \
                coldata->GetOciNumber(), 
-        (uword)sizeof(int),OCI_NUMBER_UNSIGNED,(dvoid *)&data));
+  //m_OciConn->OciCheckError( OCINumberToInt(m_OciConn->m_OciHpError, \
coldata->GetOciNumber(),  +  //      (uword)sizeof(int),OCI_NUMBER_UNSIGNED,(dvoid \
*)&data));  
+  m_OciConn->OciCheckError( OCINumberToInt(m_OciConn->m_OciHpError, \
coldata->GetOciNumber(),  +        (uword)sizeof(int),OCI_NUMBER_SIGNED,(dvoid \
*)&data)); +  
   return data;
 }
-long c_Oci_Statement::GetLong( int ColNumber )
+FdoInt64 c_Oci_Statement::GetInt64( int ColNumber )
 {
   c_Oci_ColumnData*coldata;
   if( ColNumber<=0 || ColNumber>m_ColumnDataSize ) throw new \
c_Oci_Exception(0,0,L"c_Oci_Statement:: Invalid ColumnNumber");  coldata = \
m_ColumnDataPtrArray[ColNumber-1];  
-  long data;
+  FdoInt64 data;
   
-  m_OciConn->OciCheckError( OCINumberToInt(m_OciConn->m_OciHpError, \
                coldata->GetOciNumber(), 
-        (uword)sizeof(long),OCI_NUMBER_UNSIGNED,(dvoid *)&data));
+  //m_OciConn->OciCheckError( OCINumberToInt(m_OciConn->m_OciHpError, \
coldata->GetOciNumber(),  +  //      (uword)sizeof(long),OCI_NUMBER_UNSIGNED,(dvoid \
*)&data));  
+  m_OciConn->OciCheckError( OCINumberToInt(m_OciConn->m_OciHpError, \
coldata->GetOciNumber(),  +        (uword)sizeof(FdoInt64),OCI_NUMBER_SIGNED,(dvoid \
*)&data)); +  
   return data;
 }
 double c_Oci_Statement::GetDouble( int ColNumber )
@@ -527,7 +533,7 @@
   coldata = m_ColumnDataPtrArray[ColNumber-1];
   
   double data;
-  m_OciConn->OciCheckError( OCINumberToReal(m_OciConn->m_OciHpError, \
coldata->GetOciNumber(),  +  m_OciConn->OciCheckError( \
OCINumberToReal(m_OciConn->m_OciHpError, coldata->GetOciNumber(),   \
(uword)sizeof(double),(dvoid *)&data));  
   return data;
@@ -685,33 +691,33 @@
 
 }//end of c_Oci_Statement::BindIntValue
 
-void c_Oci_Statement::BindLong( int ColNumber,long* ValuePtr )
+void c_Oci_Statement::BindInt64( int ColNumber,FdoInt64* ValuePtr )
 {
-  Bind(ColNumber,ValuePtr,sizeof(long),SQLT_INT);
+  Bind(ColNumber,ValuePtr,sizeof(FdoInt64),SQLT_INT);
 }
-void c_Oci_Statement::BindLongValue( int ColNumber,long  Value )
+void c_Oci_Statement::BindInt64Value( int ColNumber,FdoInt64  Value )
 {
    c_BindValueBuffer* newbuffer = new c_BindValueBuffer(Value);
     m_VectorBindValue.push_back(newbuffer);
     
-    BindLong(ColNumber,&newbuffer->m_Long);  
+    BindInt64(ColNumber,&newbuffer->m_Int64);  
  
 
-}//end of c_Oci_Statement::BindLongValue
+}//end of c_Oci_Statement::BindInt64Value
 
-void c_Oci_Statement::BindLong( const wchar_t* Name,long* ValuePtr )
+void c_Oci_Statement::BindInt64( const wchar_t* Name,FdoInt64* ValuePtr )
 {
-  Bind(Name,ValuePtr,sizeof(long),SQLT_INT);
+  Bind(Name,ValuePtr,sizeof(FdoInt64),SQLT_INT);
 }
-void c_Oci_Statement::BindLongValue( const wchar_t* Name,long  Value )
+void c_Oci_Statement::BindInt64Value( const wchar_t* Name,FdoInt64  Value )
 {
   c_BindValueBuffer* newbuffer = new c_BindValueBuffer(Value);
   m_VectorBindValue.push_back(newbuffer);
 
-  BindLong(Name,&newbuffer->m_Long);  
+  BindInt64(Name,&newbuffer->m_Int64);  
 
 
-}//end of c_Oci_Statement::BindLongValue
+}//end of c_Oci_Statement::BindInt64
 
 
 
@@ -868,10 +874,10 @@
 
 }//end of c_Oci_Statement::BindDateValue
 
-void c_Oci_Statement::BindSdoGeom( int ColNumber,c_SDO_GEOMETRY* ValuePtr )
+void c_Oci_Statement::BindSdoGeomNoNull( int ColNumber,c_SDO_GEOMETRY* ValuePtr )
 {
   OCIBind  *bnd1p; 
-  //if( ValuePtr )
+  if( ValuePtr )
   {
     
     m_OciConn->OciCheckError( OCIBindByPos(m_OciHpStm, &bnd1p, \
m_OciConn->m_OciHpError,  @@ -881,12 +887,15 @@
     m_OciConn->OciCheckError( OCIBindObject(bnd1p, m_OciConn->m_OciHpError, 
               m_OciConn->m_OciType_SdoGeometry,  \
(void**)&ValuePtr->m_SdoGeom,0,(void**)&ValuePtr->m_SdoGeomInd,0));                 }
-  
+  else
+  {
+   
+  }
 }
-void c_Oci_Statement::BindSdoGeom( const wchar_t* Name,c_SDO_GEOMETRY* ValuePtr )
+void c_Oci_Statement::BindSdoGeomNoNull( const wchar_t* Name,c_SDO_GEOMETRY* \
ValuePtr )  {
   OCIBind  *bnd1p; 
-  //if( ValuePtr )
+  if( ValuePtr )
   {
 
     m_OciConn->OciCheckError( OCIBindByName(m_OciHpStm, &bnd1p, \
m_OciConn->m_OciHpError  @@ -896,20 +905,32 @@
     m_OciConn->OciCheckError( OCIBindObject(bnd1p, m_OciConn->m_OciHpError, 
       m_OciConn->m_OciType_SdoGeometry,  \
(void**)&ValuePtr->m_SdoGeom,0,(void**)&ValuePtr->m_SdoGeomInd,0));                 }
+  else
+  {
+  
+  }
 
 }
 
 void c_Oci_Statement::BindSdoGeomValue( int ColNumber,c_SDO_GEOMETRY* Value )
 {
+  if( !Value )
+  {
+    Value = c_SDO_GEOMETRY::CreateNull(m_OciConn);
+  }
   c_BindValueBuffer* newbuffer = new c_BindValueBuffer(Value);
   m_VectorBindValue.push_back(newbuffer);  
-  BindSdoGeom(ColNumber,newbuffer->m_SdoGeom);  
+  BindSdoGeomNoNull(ColNumber,newbuffer->m_SdoGeom);  
 }
 void c_Oci_Statement::BindSdoGeomValue( const wchar_t* Name,c_SDO_GEOMETRY* Value )
 {
+  if( !Value )
+  {
+    Value = c_SDO_GEOMETRY::CreateNull(m_OciConn);
+  }
   c_BindValueBuffer* newbuffer = new c_BindValueBuffer(Value);
   m_VectorBindValue.push_back(newbuffer);  
-  BindSdoGeom(Name,newbuffer->m_SdoGeom);  
+  BindSdoGeomNoNull(Name,newbuffer->m_SdoGeom);  
 }
 
 void c_Oci_Statement::BindSdoDimElement( int ColNumber,c_SDO_DIM_ELEMENT* ValuePtr )

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_Oci_Statement.h
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_Oci_Statement.h	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_Oci_Statement.h	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -20,9 +20,9 @@
 
 
 
-#ifndef OCI_ORACLE
-#include <oci.h>
-#include <oci1.h>
+#ifndef OCI_ORACLE
+#include <oci.h>
+#include <oci1.h>
 #endif
 
 #include "OCI_SDO_GEOM_TYPES.h"
@@ -43,7 +43,7 @@
   c_BindValueBuffer(double Val) { m_String=NULL;m_SdoGeom=NULL; m_Double=Val; }
   c_BindValueBuffer(OCIDate Val) { m_String=NULL;m_SdoGeom=NULL; m_Date=Val; }
   c_BindValueBuffer(OCINumber Val) { m_String=NULL;m_SdoGeom=NULL; m_OciNumber=Val; \
                }
-  c_BindValueBuffer(long Val) { m_String=NULL;m_SdoGeom=NULL; m_Long=Val; }
+  c_BindValueBuffer(FdoInt64 Val) { m_String=NULL;m_SdoGeom=NULL; m_Int64=Val; }
   c_BindValueBuffer(int Val) { m_String=NULL;m_SdoGeom=NULL; m_Int=Val; }
   c_BindValueBuffer(const wchar_t*Val) { m_String=NULL;m_SdoGeom=NULL; \
m_String=FdoCommonOSUtil::wcsdup((wchar_t*)Val); }  \
c_BindValueBuffer(c_SDO_GEOMETRY*Val) { m_String=NULL;m_SdoGeom=NULL; m_SdoGeom=Val; \
} @@ -55,7 +55,7 @@
     double m_Double;
     OCIDate m_Date;
     OCINumber m_OciNumber;
-    long m_Long;
+    FdoInt64 m_Int64;
     int m_Int;
     
   };
@@ -100,10 +100,10 @@
     void BindIntValue( int ColNumber,int Value );
     void BindIntValue( const wchar_t* Name,int Value );
 
-    void BindLong( int ColNumber,long* ValuePtr );
-    void BindLong( const wchar_t* Name,long* ValuePtr );
-    void BindLongValue( int ColNumber,long Value );
-    void BindLongValue( const wchar_t* Name,long Value );
+    void BindInt64( int ColNumber,FdoInt64* ValuePtr );
+    void BindInt64( const wchar_t* Name,FdoInt64* ValuePtr );
+    void BindInt64Value( int ColNumber,FdoInt64 Value );
+    void BindInt64Value( const wchar_t* Name,FdoInt64 Value );
 
     void BindOciNumber( int ColNumber,OCINumber* ValuePtr );
     void BindOciNumber( const wchar_t* Name,OCINumber* ValuePtr );
@@ -123,8 +123,8 @@
     void BindDateValue( int ColNumber,OCIDate Value );
     void BindDateValue( const wchar_t* Name,OCIDate Value );
 
-    void BindSdoGeom( int ColNumber,c_SDO_GEOMETRY* ValuePtr ); // pointer will not \
                be deleted, caller is responsible for pointer
-    void BindSdoGeom( const wchar_t* Name,c_SDO_GEOMETRY* ValuePtr );
+    void BindSdoGeomNoNull( int ColNumber,c_SDO_GEOMETRY* ValuePtr ); // pointer \
will not be deleted, caller is responsible for pointer +    void BindSdoGeomNoNull( \
                const wchar_t* Name,c_SDO_GEOMETRY* ValuePtr );
     void BindSdoGeomValue( int ColNumber,c_SDO_GEOMETRY* Value ); // pointer will be \
deleted by statement  void BindSdoGeomValue( const wchar_t* Name,c_SDO_GEOMETRY* \
Value );  
@@ -156,7 +156,7 @@
     bool IsColumnNull(int ColNumber);
     
     int GetInteger(int ColNumber);
-    long GetLong( int ColNumber );
+    FdoInt64 GetInt64( int ColNumber );
     double GetDouble(int ColNumber);
     OCIDate* GetOciDate(int ColNumber);
     const wchar_t* GetString( int ColNumber );
@@ -233,6 +233,6 @@
 
 
 };
-
 
+
 #endif

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_Ora_API2.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_Ora_API2.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_Ora_API2.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -263,10 +263,10 @@
 }//end of c_Ora_API2::CreateOptimizedRect
 
 
-long c_Ora_API2::GetSrid(c_Oci_Connection*Conn,const wchar_t* CoordSysName)
+int c_Ora_API2::GetSrid(c_Oci_Connection*Conn,const wchar_t* CoordSysName)
 {
   c_Oci_Statement* oci_stm=NULL;
-  long srid = 0;
+  int srid = 0;
 
   oci_stm = Conn->CreateStatement();  
   
@@ -296,7 +296,7 @@
 }//end of c_Ora_API2::GetSrid
 
 
-bool c_Ora_API2::GetCoordinateSystemWkt(c_Oci_Connection*Conn,long \
Srid,std::wstring& Wkt) +bool \
c_Ora_API2::GetCoordinateSystemWkt(c_Oci_Connection*Conn,int Srid,std::wstring& Wkt)  \
{  c_Oci_Statement* oci_stm=NULL;
   
@@ -307,7 +307,7 @@
   sqlstr = L" select WKTEXT,CS_NAME,SRID from MDSYS.cs_srs where SRID = :1";
   
   oci_stm->Prepare(sqlstr.c_str());
-  oci_stm->BindLong(1,&Srid);
+  oci_stm->BindInt(1,&Srid);
   
   oci_stm->ExecuteSelectAndDefine();
   
@@ -328,11 +328,11 @@
   
 }//end of c_Ora_API2::GetCoordinateSystemWkt
 
-long c_Ora_API2::GetSequenceNextVal(c_Oci_Connection*Conn,const wchar_t* \
SequenceName) +FdoInt64 c_Ora_API2::GetSequenceNextVal(c_Oci_Connection*Conn,const \
wchar_t* SequenceName)  {
   c_Oci_Statement* oci_stm=NULL;
   
-  long nextval = 0;
+  FdoInt64 nextval = 0;
 
   oci_stm = Conn->CreateStatement();  
   
@@ -349,7 +349,7 @@
   {
     if( !oci_stm->IsColumnNull(1) )
     {
-      nextval = oci_stm->GetInteger(1);
+      nextval = oci_stm->GetInt64(1);
     }      
   }
   
@@ -398,18 +398,18 @@
       {
         if( !oci_stm->IsColumnNull(1) )
         {
-          long currval;
+          FdoInt64 currval;
           
-          currval = oci_stm->GetLong(1);
+          currval = oci_stm->GetInt64(1);
           
           
           
-          long inc;
+          FdoInt64 inc;
           inc = maxid -  currval;
           // now calculate increment
-          if( (long)inc > 0 )
+          if( inc > 0 )
           {
-            FdoStringP buff = FdoStringP::Format(L"%ld",inc);
+            FdoStringP buff = FdoStringP::Format(L"%lld",inc);
             std::wstring incstr = (FdoString*)buff;
            
             sql = L"ALTER SEQUENCE " + strseq + L" INCREMENT BY " + incstr + L" \
MINVALUE 0";   @@ -541,13 +541,13 @@
   cswkt = CoordSysWkt;
   
   
-  if( cswkt.length() > 6 )
-  {
-    std::wstring substr = cswkt.substr(0,6);
-    if( substr.compare(L"GEOGCS")==0 )
-    {
-      return true;
-    }
+  if( cswkt.length() > 6 )
+  {
+    std::wstring substr = cswkt.substr(0,6);
+    if( substr.compare(L"GEOGCS")==0 )
+    {
+      return true;
+    }
   }
   
   return false;
@@ -582,3 +582,47 @@
         
   return numcols;
 }//end of SdoGeom->GetTablePkeyColumns
+
+
+
+bool c_Ora_API2::IsTableVersioned(c_Oci_Connection*OciConn,const wchar_t* \
Owner,const wchar_t* TableName,std::wstring& PhysicalTable) +{
+
+  bool isver=false;
+  c_Oci_Statement *oci_stm = NULL;
+try
+{
+
+    oci_stm = OciConn->CreateStatement(); 
+
+
+    oci_stm->Prepare(L"SELECT DBMS_WM.GetPhysicalTableName(:1, :2) FROM DUAL");
+      
+
+    oci_stm->BindString(1,Owner);
+    oci_stm->BindString(2,TableName);
+
+    oci_stm->ExecuteSelectAndDefine();
+    //ResultSet * rs = stm->executeQuery();
+    if( oci_stm->ReadNext() )
+    {
+      PhysicalTable=oci_stm->GetString(1);
+      
+      isver = PhysicalTable.compare(TableName) != 0; // ce imena nista enaka potem \
je tabela versionirana +    }
+
+    OciConn->TerminateStatement (oci_stm);
+
+    return isver;
+  }
+  catch(c_Oci_Exception* ex )
+  {
+    if( oci_stm )
+    {    
+      OciConn->TerminateStatement(oci_stm);  
+    }    
+  }  
+
+  return false;
+
+}//end of c_Ora_API2::GetSrid

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_Ora_API2.h
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_Ora_API2.h	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_Ora_API2.h	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -41,16 +41,18 @@
   
   static c_SDO_GEOMETRY* CreateOptimizedRect(c_Oci_Connection*Con,bool \
IsGeodeticCS,long OraSrid,double MinX,double MinY,double MaxX,double MaxY);  
-  static long GetSrid(c_Oci_Connection* Conn,const wchar_t* CoordSysName);
-  static long GetSequenceNextVal(c_Oci_Connection*Conn,const wchar_t* SequenceName);
+  static int GetSrid(c_Oci_Connection* Conn,const wchar_t* CoordSysName);
+  static FdoInt64 GetSequenceNextVal(c_Oci_Connection*Conn,const wchar_t* \
SequenceName);  static bool ResetSequence(c_Oci_Connection*Conn,const wchar_t* \
SequenceName,const wchar_t* FullTableName,const wchar_t* ColumnName);  static bool \
GetOracleVersion(c_Oci_Connection*Conn,int& MainVersion,int& SubVersion);  
   static bool IsGeodeticCoordSystem(const wchar_t* CoordSysWkt);
 
-  static bool GetCoordinateSystemWkt(c_Oci_Connection*Conn,long Srid,std::wstring& \
Wkt); +  static bool GetCoordinateSystemWkt(c_Oci_Connection*Conn,int \
Srid,std::wstring& Wkt);  static int GetTablePkeyColumns(c_Oci_Connection * \
OciConn,const wchar_t* Owner, const wchar_t* TableName,std::vector<std::wstring>& \
ColNames);  
+  
+  static bool IsTableVersioned(c_Oci_Connection*OciConn,const wchar_t* Owner,const \
wchar_t* TableName,std::wstring& PhysicalTable);  };
 
 #endif

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_SdoGeomToAGF2.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_SdoGeomToAGF2.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/Provider/c_SdoGeomToAGF2.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -48,14 +48,14 @@
   OCINumber *oci_number;
   int val;
   
-  c_OCI_API::OciCheckError(c_OCI_API::m_OciHpError, \
                OCICollGetElem(c_OCI_API::m_OciHpEnvironment, \
                c_OCI_API::m_OciHpError, 
-    (OCIColl *)(m_SdoGeom->sdo_elem_info), 
-    (sb4)(Index), 
-    (boolean *)&exists, 
-    (dvoid **)&oci_number, (dvoid **)0));
-  c_OCI_API::OciCheckError(c_OCI_API::m_OciHpError, \
                OCINumberToInt(c_OCI_API::m_OciHpError, 
-    oci_number, 
-    (uword)sizeof(int), OCI_NUMBER_SIGNED,
+  c_OCI_API::OciCheckError(c_OCI_API::g_OciHpError, \
OCICollGetElem(c_OCI_API::g_OciHpEnvironment, c_OCI_API::g_OciHpError,  +    (OCIColl \
*)(m_SdoGeom->sdo_elem_info),  +    (sb4)(Index), 
+    (boolean *)&exists, 
+    (dvoid **)&oci_number, (dvoid **)0));
+  c_OCI_API::OciCheckError(c_OCI_API::g_OciHpError, \
OCINumberToInt(c_OCI_API::g_OciHpError,  +    oci_number, 
+    (uword)sizeof(int), OCI_NUMBER_SIGNED,
     (dvoid *)&val));
     
   return val;    
@@ -65,7 +65,7 @@
 {
   int size;
   
-  OCICollSize(c_OCI_API::m_OciHpEnvironment,c_OCI_API::m_OciHpError,m_SdoGeom->sdo_ordinates,&size);
 +  OCICollSize(c_OCI_API::g_OciHpEnvironment,c_OCI_API::g_OciHpError,m_SdoGeom->sdo_ordinates,&size);
  
   
 
@@ -76,8 +76,8 @@
 {
   double val;
 
-  c_OCI_API::OciCheckError(c_OCI_API::m_OciHpError, \
                OCINumberToReal(c_OCI_API::m_OciHpError, 
-    &m_SdoGeom->sdo_point.x, 
+  c_OCI_API::OciCheckError(c_OCI_API::g_OciHpError, \
OCINumberToReal(c_OCI_API::g_OciHpError,  +    &m_SdoGeom->sdo_point.x, 
     (uword)sizeof(double), (dvoid *)&val));
   return val;    
 }
@@ -85,8 +85,8 @@
 {
   double val;
 
-  c_OCI_API::OciCheckError(c_OCI_API::m_OciHpError, \
                OCINumberToReal(c_OCI_API::m_OciHpError, 
-    &m_SdoGeom->sdo_point.y, 
+  c_OCI_API::OciCheckError(c_OCI_API::g_OciHpError, \
OCINumberToReal(c_OCI_API::g_OciHpError,  +    &m_SdoGeom->sdo_point.y, 
     (uword)sizeof(double), (dvoid *)&val));
   return val;    
 }
@@ -94,8 +94,8 @@
 {
   double val;
 
-  c_OCI_API::OciCheckError(c_OCI_API::m_OciHpError, \
                OCINumberToReal(c_OCI_API::m_OciHpError, 
-    &m_SdoGeom->sdo_point.z, 
+  c_OCI_API::OciCheckError(c_OCI_API::g_OciHpError, \
OCINumberToReal(c_OCI_API::g_OciHpError,  +    &m_SdoGeom->sdo_point.z, 
     (uword)sizeof(double), (dvoid *)&val));
   return val;    
 }
@@ -106,13 +106,13 @@
   OCINumber *oci_number;
   double val;
 
-  c_OCI_API::OciCheckError(c_OCI_API::m_OciHpError, \
                OCICollGetElem(c_OCI_API::m_OciHpEnvironment, \
                c_OCI_API::m_OciHpError, 
-    (OCIColl *)(m_SdoGeom->sdo_ordinates), 
-    (sb4)(Index), 
-    (boolean *)&exists, 
-    (dvoid **)&oci_number, (dvoid **)0));
-  c_OCI_API::OciCheckError(c_OCI_API::m_OciHpError, \
                OCINumberToReal(c_OCI_API::m_OciHpError, 
-    oci_number, 
+  c_OCI_API::OciCheckError(c_OCI_API::g_OciHpError, \
OCICollGetElem(c_OCI_API::g_OciHpEnvironment, c_OCI_API::g_OciHpError,  +    (OCIColl \
*)(m_SdoGeom->sdo_ordinates),  +    (sb4)(Index), 
+    (boolean *)&exists, 
+    (dvoid **)&oci_number, (dvoid **)0));
+  c_OCI_API::OciCheckError(c_OCI_API::g_OciHpError, \
OCINumberToReal(c_OCI_API::g_OciHpError,  +    oci_number, 
     (uword)sizeof(double), (dvoid *)&val));
 
   return val;    
@@ -127,18 +127,24 @@
   
   
   //m_ElemInfoSize = m_SdoGeom->getSdo_elem_info().size();
-  OCICollSize(c_OCI_API::m_OciHpEnvironment,c_OCI_API::m_OciHpError,m_SdoGeom->sdo_elem_info,&m_ElemInfoSize); \
 +  if( m_SdoGeomInd->sdo_elem_info != OCI_IND_NULL )
+    OCICollSize(c_OCI_API::g_OciHpEnvironment,c_OCI_API::g_OciHpError,m_SdoGeom->sdo_elem_info,&m_ElemInfoSize); \
 +  else
+    m_ElemInfoSize = 0;
   
   //m_OrdinatesSize = m_SdoGeom->getSdo_ordinates().size();
-  OCICollSize(c_OCI_API::m_OciHpEnvironment,c_OCI_API::m_OciHpError,m_SdoGeom->sdo_ordinates,&m_OrdinatesSize);
 +  if( m_SdoGeomInd->sdo_ordinates != OCI_IND_NULL )
+    OCICollSize(c_OCI_API::g_OciHpEnvironment,c_OCI_API::g_OciHpError,m_SdoGeom->sdo_ordinates,&m_OrdinatesSize);
 +  else
+    m_OrdinatesSize=0;
   
   //if( m_SdoGeom->getSdo_gtype().isNull() ) return 0;
   if( m_SdoGeomInd->sdo_gtype == OCI_IND_NULL ) return 0;
   
   //int ora_gtype = ((int)m_SdoGeom->getSdo_gtype()) % 100;
   int sdo_gtype;
-  c_OCI_API::OciCheckError( c_OCI_API::m_OciHpError, \
                OCINumberToInt(c_OCI_API::m_OciHpError, &(m_SdoGeom->sdo_gtype),
-    (uword)sizeof(int), OCI_NUMBER_SIGNED,
+  c_OCI_API::OciCheckError( c_OCI_API::g_OciHpError, \
OCINumberToInt(c_OCI_API::g_OciHpError, &(m_SdoGeom->sdo_gtype), +    \
(uword)sizeof(int), OCI_NUMBER_SIGNED,  (dvoid *)&sdo_gtype));
     
   int ora_gtype = sdo_gtype % 100 ;    

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/Resource.h
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/Resource.h	2014-04-09 21:58:56 \
                UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/Resource.h	2014-04-09 22:00:17 \
UTC (rev 7063) @@ -7,6 +7,7 @@
 #define IDD_ABOUTBOX					100
 #define IDS_ABOUTBOX					101
 #define IDD_UNITTEST_DIALOG				102
+#define IDC_STATIC				1000
 
 // Next default values for new objects
 // 

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/UnitTest.vcproj
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/UnitTest.vcproj	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/UnitTest.vcproj	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -72,7 +72,6 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="oci.lib cppunit.lib testrunner.lib fdo.lib FdoCommon.lib \
ProvidersCommon.lib FdoGeometry.lib FdoSpatial.lib KingOracleOverrides.lib \
                KingOracleProvider.lib"
-				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;..\..\lib\Win32\$(ConfigurationName)&quot;;.. \
\..\..\..\Fdo\Unmanaged\lib\win32\Release;..\..\..\..\Utilities\Common\lib\win32\Relea \
se;&quot;$(FDOORACLE)\lib\msvc&quot;;&quot;$(FDOTHIRDPARTY)\CppUnit\Lib\Win32&quot;"  \
GenerateDebugInformation="true"  SubSystem="2"
@@ -133,7 +132,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\Provider;..\..\inc;..\..\..\..\Fdo\Unmanaged\inc \
;..\..\..\..\Utilities\Common\inc;&quot;$(FDOORACLE)\include&quot;;&quot;$(FDOTHIRDPARTY)\CppUnit\include&quot;"
 +				AdditionalIncludeDirectories="..\..\inc;..\Provider;..\..\..\..\FDO\Unmanaged\in \
c;..\..\..\..\Utilities\Common\inc;&quot;$(FDOORACLE64)\include&quot;;..\..\..\..\Thirdparty\CppUnit\include"
                
 				PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_AFX_SECURE_NO_DEPRECATE"
 				MinimalRebuild="false"
 				RuntimeLibrary="2"
@@ -157,8 +156,7 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="oci.lib cppunit.lib testrunner.lib fdo.lib FdoCommon.lib \
ProvidersCommon.lib FdoGeometry.lib FdoSpatial.lib KingOracleOverrides.lib \
                KingOracleProvider.lib"
-				LinkIncremental="1"
-				AdditionalLibraryDirectories="&quot;..\..\lib\Win64\$(ConfigurationName)&quot;;.. \
\..\..\..\Fdo\Unmanaged\lib\win64\Release;..\..\..\..\Utilities\Common\lib\win64\Relea \
se;&quot;$(FDOORACLE)\lib\msvc&quot;;&quot;$(FDOTHIRDPARTY)\CppUnit\Lib\Win64&quot;" \
+				AdditionalLibraryDirectories="&quot;..\..\lib\Win64\$(ConfigurationName)&quot;;.. \
\..\..\..\Fdo\Unmanaged\lib\win64\Release;..\..\..\..\Utilities\Common\lib\win64\Release;&quot;$(FDOORACLE64)\lib\msvc&quot;;..\..\..\..\Thirdparty\CppUnit\Lib\Win64"
  GenerateDebugInformation="true"
 				SubSystem="2"
 				OptimizeReferences="2"
@@ -242,7 +240,6 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="oci.lib cppunit.lib testrunneru.lib fdo.lib \
                FdoCommon.lib FdoGeometry.lib FdoSpatial.lib KingOracleOverrides.lib"
-				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;$(FDOTHIRDPARTY)\CppUnit\Lib\Win32&quot;;&quo \
t;D:\Development\MapGuide_OS\mapguide-2.0.2.3011\mapguide-2.0.2\OpenSource_FDO\Fdo\Unm \
anaged\lib\win32\release&quot;;D:\oracle\product\10.2.0\client_1\oci\lib\msvc;&quot;..\Overrides\$(ConfigurationName)&quot;"
  GenerateDebugInformation="true"
 				SubSystem="2"
@@ -327,7 +324,6 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="oci.lib cppunit.lib testrunneru.lib fdo.lib \
                FdoCommon.lib FdoGeometry.lib FdoSpatial.lib KingOracleOverrides.lib"
-				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;D:\Development\CppUnit\cppunit-1.12.0\lib\&qu \
ot;;&quot;D:\Development\MapGuide_OS\mapguide-2.0.2.3011\mapguide-2.0.2\OpenSource_FDO \
\Fdo\Unmanaged\lib\win32\release&quot;;D:\oracle\product\10.2.0\client_1\oci\lib\msvc;&quot;..\Overrides\$(ConfigurationName)&quot;"
  GenerateDebugInformation="true"
 				SubSystem="2"
@@ -413,7 +409,6 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="oci.lib cppunitd.lib testrunnerud.lib fdo.lib \
FdoCommon.lib ProvidersCommon.lib FdoGeometry.lib FdoSpatial.lib \
                KingOracleOverrides.lib KingOracleProvider.lib"
-				LinkIncremental="2"
 				AdditionalLibraryDirectories="&quot;D:\Development\CppUnit\cppunit-1.12.0\lib&quo \
t;;..\..\oracle\instantclient_10_2\sdk\lib\msvc;..\..\..\..\..\branches\3.4\Fdo\Unmana \
ged\lib\win32\debug;..\..\..\..\..\branches\3.4\Utilities\Common\lib\win32\debug;&quot;..\..\lib\Win32\$(ConfigurationName)&quot;"
  GenerateDebugInformation="true"
 				SubSystem="2"
@@ -497,7 +492,6 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="oci.lib cppunitd.lib testrunnerud.lib fdo.lib \
FdoCommon.lib ProvidersCommon.lib FdoGeometry.lib FdoSpatial.lib \
                KingOracleOverrides.lib KingOracleProvider.lib"
-				LinkIncremental="2"
 				AdditionalLibraryDirectories="&quot;D:\Development\CppUnit\cppunit-1.12.0\lib&quo \
t;;..\..\..\..\..\branches\3.4\Fdo\Unmanaged\lib\win32\debug;..\..\..\..\..\branches\3 \
.4\Utilities\Common\lib\win32\debug;..\..\oracle\instantclient_10_2\sdk\lib\msvc;&quot;..\..\lib\Win32\$(ConfigurationName)&quot;"
  GenerateDebugInformation="true"
 				SubSystem="2"
@@ -581,7 +575,6 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="oci.lib cppunit.lib testrunnerd.lib fdo.lib \
FdoCommon.lib ProvidersCommon.lib FdoGeometry.lib FdoSpatial.lib \
                KingOracleOverrides.lib KingOracleProvider.lib"
-				LinkIncremental="2"
 				AdditionalLibraryDirectories="&quot;..\..\lib\Win32\$(ConfigurationName)&quot;;.. \
\..\..\..\Fdo\Unmanaged\lib\win32\debug;..\..\..\..\Utilities\Common\lib\win32\debug;&quot;$(FDOORACLE)\lib\msvc&quot;;&quot;$(FDOTHIRDPARTY)\CppUnit\Lib\Win32&quot;"
  GenerateDebugInformation="true"
 				SubSystem="2"
@@ -640,7 +633,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\inc;..\Provider;..\..\..\..\FDO\Unmanaged\inc \
;..\..\..\..\Utilities\Common\inc;&quot;$(FDOORACLE)\include&quot;;&quot;$(FDOTHIRDPARTY)\CppUnit\include&quot;"
 +				AdditionalIncludeDirectories="..\..\inc;..\Provider;..\..\..\..\FDO\Unmanaged\in \
c;..\..\..\..\Utilities\Common\inc;&quot;$(FDOORACLE64)\include&quot;;..\..\..\..\Thirdparty\CppUnit\include"
                
 				PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_AFX_SECURE_NO_DEPRECATE"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
@@ -664,9 +657,8 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="oci.lib cppunit.lib testrunnerd.lib fdo.lib \
FdoCommon.lib ProvidersCommon.lib FdoGeometry.lib FdoSpatial.lib \
                KingOracleOverrides.lib KingOracleProvider.lib"
-				LinkIncremental="2"
-				AdditionalLibraryDirectories="&quot;..\..\lib\Win64\$(ConfigurationName)&quot;;.. \
\..\..\..\Fdo\Unmanaged\lib\win64\debug;..\..\..\..\Utilities\Common\lib\win64\debug;&quot;$(FDOORACLE)\lib\msvc&quot;;&quot;$(FDOTHIRDPARTY)\CppUnit\Lib\Win64&quot;"
 +				AdditionalDependencies="oci.lib cppunitd.lib testrunnerd.lib fdo.lib \
FdoCommon.lib ProvidersCommon.lib FdoGeometry.lib FdoSpatial.lib \
KingOracleOverrides.lib KingOracleProvider.lib" \
+				AdditionalLibraryDirectories="&quot;..\..\lib\Win64\$(ConfigurationName)&quot;;.. \
\..\..\..\Fdo\Unmanaged\lib\win64\debug;..\..\..\..\Utilities\Common\lib\win64\debug;&quot;$(FDOORACLE64)\lib\msvc&quot;;..\..\..\..\Thirdparty\CppUnit\Lib\Win64"
  GenerateDebugInformation="true"
 				SubSystem="2"
 				RandomizedBaseAddress="1"
@@ -693,6 +685,7 @@
 			/>
 			<Tool
 				Name="VCPostBuildEventTool"
+				CommandLine="copy_debug_unittest.bat"
 			/>
 		</Configuration>
 		<Configuration
@@ -748,7 +741,6 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="oci.lib cppunit.lib testrunneru.lib fdo.lib \
FdoCommon.lib ProvidersCommon.lib FdoGeometry.lib FdoSpatial.lib \
                KingOracleOverrides.lib KingOracleProvider.lib"
-				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;$(FDOTHIRDPARTY)\CppUnit\Lib\Win32&quot;;..\. \
.\..\..\..\branches\3.4\Fdo\Unmanaged\lib\win32\Release;..\..\..\..\..\branches\3.4\Ut \
ilities\Common\lib\win32\Release;..\..\oracle\instantclient_10_2\sdk\lib\msvc;&quot;..\..\lib\Win32\$(ConfigurationName)&quot;"
  GenerateDebugInformation="true"
 				SubSystem="2"
@@ -833,7 +825,6 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="oci.lib cppunit.lib testrunneru.lib fdo.lib \
FdoCommon.lib ProvidersCommon.lib FdoGeometry.lib FdoSpatial.lib \
                KingOracleOverrides.lib KingOracleProvider.lib"
-				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;D:\Development\CppUnit\cppunit-1.12.0\lib&quo \
t;;..\..\..\..\..\branches\3.4\Fdo\Unmanaged\lib\win32\Release;..\..\..\..\..\branches \
\3.4\Utilities\Common\lib\win32\Release;..\..\oracle\instantclient_10_2\sdk\lib\msvc;&quot;..\..\lib\Win32\$(ConfigurationName)&quot;"
  GenerateDebugInformation="true"
 				SubSystem="2"
@@ -919,7 +910,6 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="oci.lib cppunitd.lib testrunnerud.lib fdo.lib \
FdoCommon.lib ProvidersCommon.lib FdoGeometry.lib FdoSpatial.lib \
                KingOracleOverrides.lib KingOracleProvider.lib"
-				LinkIncremental="2"
 				AdditionalLibraryDirectories="&quot;D:\Development\CppUnit\cppunit-1.12.0\lib&quo \
t;;..\..\oracle\instantclient_10_2\sdk\lib\msvc;..\..\..\..\..\branches\3.5\Fdo\Unmana \
ged\lib\win32\debug;..\..\..\..\..\branches\3.5\Utilities\Common\lib\win32\debug;&quot;..\..\lib\Win32\$(ConfigurationName)&quot;"
  GenerateDebugInformation="true"
 				SubSystem="2"
@@ -1003,7 +993,6 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="oci.lib cppunitd.lib testrunnerud.lib fdo.lib \
FdoCommon.lib ProvidersCommon.lib FdoGeometry.lib FdoSpatial.lib \
                KingOracleOverrides.lib KingOracleProvider.lib"
-				LinkIncremental="2"
 				AdditionalLibraryDirectories="&quot;D:\Development\CppUnit\cppunit-1.12.0\lib&quo \
t;;..\..\oracle\instantclient_10_2\sdk\lib\msvc;..\..\..\..\..\branches\3.5\Fdo\Unmana \
ged\lib\win32\debug;..\..\..\..\..\branches\3.5\Utilities\Common\lib\win32\debug;&quot;..\..\lib\Win32\$(ConfigurationName)&quot;"
  GenerateDebugInformation="true"
 				SubSystem="2"
@@ -1086,7 +1075,6 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="oci.lib cppunit.lib testrunneru.lib fdo.lib \
FdoCommon.lib ProvidersCommon.lib FdoGeometry.lib FdoSpatial.lib \
                KingOracleOverrides.lib KingOracleProvider.lib"
-				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\oracle\instantclient_10_2\sdk\lib\msvc;&quot; \
D:\Development\CppUnit\cppunit-1.12.0\lib&quot;;..\..\..\..\..\branches\3.5\Fdo\Unmana \
ged\lib\win32\release;..\..\..\..\..\branches\3.5\Utilities\Common\lib\win32\Release;&quot;..\..\lib\Win32\$(ConfigurationName)&quot;"
  GenerateDebugInformation="true"
 				SubSystem="2"
@@ -1171,7 +1159,6 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="oci.lib cppunit.lib testrunneru.lib fdo.lib \
FdoCommon.lib ProvidersCommon.lib FdoGeometry.lib FdoSpatial.lib \
                KingOracleOverrides.lib KingOracleProvider.lib"
-				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\oracle\instantclient_10_2\sdk\lib\msvc;&quot; \
D:\Development\CppUnit\cppunit-1.12.0\lib&quot;;..\..\..\..\..\branches\3.5\Fdo\Unmana \
ged\lib\win32\release;..\..\..\..\..\branches\3.5\Utilities\Common\lib\win32\Release;&quot;..\..\lib\Win32\$(ConfigurationName)&quot;"
  GenerateDebugInformation="true"
 				SubSystem="2"
@@ -1369,10 +1356,6 @@
 				>
 			</File>
 			<File
-				RelativePath=".\ut_ApplySchema.cpp"
-				>
-			</File>
-			<File
 				RelativePath=".\ut_DataTypes.cpp"
 				>
 			</File>

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/c_KgOraUtil.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/c_KgOraUtil.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/c_KgOraUtil.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -13,7 +13,7 @@
 {
 try
 {
-  FdoPtr<IConnectionManager> manager = FdoFeatureAccessManager::GetConnectionManager \
(); +  FdoPtr<IConnectionManager> manager = \
FdoFeatureAccessManager::GetConnectionManager ();  FdoPtr<FdoIConnection> conn = \
manager->CreateConnection (L"King.Oracle");  
   if( !conn.p ) 
@@ -60,6 +60,12 @@
   return c_KgOraUtil::OpentConnection(L"Username=elektro;Password=elektro;Service=//192.168.0.38:1522/epdb;OracleSchema=elektro"); \
  }
 
+FdoIConnection* c_KgOraUtil::OpenUnitTestConnection_DeeoAmazon()
+{
+  //return c_KgOraUtil::OpentConnection(L"Username=unittest;Password=unittest;Service=//temp10gr2/ora10gr2;OracleSchema=UNITTEST"); \
 +  return c_KgOraUtil::OpentConnection(L"Service=//deeo.sl-king.com:1521/DEEO;Username=DEEODB4;Password=DEEODB4;KINGFDOCLASS=MYFDOCLASS;OracleSchema=DEEODB4;"); \
 +}
+
 FdoIConnection* c_KgOraUtil::OpenPerfomanceTestConnection()
 {
   return c_KgOraUtil::OpentConnection(L"Username=unittest;Password=unittest;Service=//temp10gr2/ora10gr2;OracleSchema=UNITTEST"); \
 @@ -69,7 +75,7 @@
 {
 try
 {
-  FdoPtr<IConnectionManager> manager = FdoFeatureAccessManager::GetConnectionManager \
(); +  FdoPtr<IConnectionManager> manager = \
FdoFeatureAccessManager::GetConnectionManager ();  FdoPtr<FdoIConnection> conn = \
manager->CreateConnection (L"King.Oracle.0.1.1");  \
//conn->SetConnectionString(L"UserName=ose;Password=ose;ServiceName=temp");  \
conn->SetConnectionString(L"Username=ose;Password=ose;Service=ora92;OracleSchema=ose;FdoViewsTable=KingFdoClass");


Modified: sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/c_KgOraUtil.h
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/c_KgOraUtil.h	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/c_KgOraUtil.h	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -17,6 +17,8 @@
   static FdoIConnection* OpenNanaimoConnection_10_2();
   static FdoIConnection* OpenUnitTestConn_10_2_SDE();
   static FdoIConnection* OpenUnitTestConnection_Elektro();
+  
+  static FdoIConnection* OpenUnitTestConnection_DeeoAmazon();
 };
 
 #endif
\ No newline at end of file

Added: sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/copy_debug_unittest.bat
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/copy_debug_unittest.bat	       \
                (rev 0)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/copy_debug_unittest.bat	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -0,0 +1,20 @@
+REM SET DESTDIR=%1
+SET DESTDIR=%~dp0\x64\Debug
+
+
+SET KINGORA_SOURCEDIR=%~dp0\..\..\bin\Win64\Debug
+
+ 
+ xcopy "%KINGORA_SOURCEDIR%\*.dll" %DESTDIR%  /D /Y
+ if %errorlevel% neq 0 goto exit_on_copyerror
+ xcopy "%KINGORA_SOURCEDIR%\*.pdb" %DESTDIR%  /D /Y
+ if %errorlevel% neq 0 goto exit_on_copyerror
+ echo King.Oracle files to %DESTDIR%
+
+exit /B %errorlevel%
+
+
+:exit_on_copyerror
+echo Error copy DEEO files to %DESTDIR%
+pause
+exit /B %errorlevel%
\ No newline at end of file

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/stdafx.h
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/stdafx.h	2014-04-09 21:58:56 \
                UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/stdafx.h	2014-04-09 22:00:17 \
UTC (rev 7063) @@ -42,6 +42,7 @@
 
 
 #include <afxdisp.h>        // MFC Automation classes
+#include <iostream>
 
 
 

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/ut_KgOraSchema.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/ut_KgOraSchema.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/ut_KgOraSchema.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -116,8 +116,46 @@
 
 }//end of ut_KgOraSchema::DescribeSchema_Elektro
 
+void ut_KgOraSchema::DescribeSchema_DeeoAmazon()
+{
+  try
+  {
+    FdoPtr<FdoIConnection> conn = c_KgOraUtil::OpenUnitTestConnection_DeeoAmazon();
 
+    c_KgOraConnection* kingora_conn = (c_KgOraConnection*)conn.p;
+    kingora_conn->ClearCachedSchemaDesc();
 
+    FdoPtr<FdoIDescribeSchema> comm = \
(FdoIDescribeSchema*)conn->CreateCommand(FdoCommandType_DescribeSchema); +
+
+    FdoPtr<FdoFeatureSchemaCollection> schemas = comm->Execute();
+
+    CPPUNIT_ASSERT_MESSAGE( "FdoIDescribeSchema:Execute returns NULL schema \
collection" , schemas ); +
+
+    long count_schema =schemas->GetCount();
+
+    FdoPtr<FdoFeatureSchema> schema = schemas->GetItem(0);
+
+    FdoPtr<FdoClassCollection> coll_class = schema->GetClasses();
+    long count_classes = coll_class->GetCount();
+
+    conn->Close();
+
+
+    //CPPUNIT_ASSERT_MESSAGE( "FdoIDescribeSchema:Execute returns 0 spatial contexts \
" , count ); +  }
+  catch(FdoException* ex)
+  {
+    FdoStringP str = ex->GetExceptionMessage();
+    ex->Release();
+    CPPUNIT_FAIL( (const char*)str );
+  }
+
+}//end of ut_KgOraSchema::DescribeSchema_DeeoAmazon
+
+
+
 void ut_KgOraSchema::DifferentOwner_Prepare()
 {
   FdoPtr<FdoIConnection> conn = \
c_KgOraUtil::OpentConnection(L"Username=unittest;Password=unittest;Service=//test10gxe/xe"); \


Modified: sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/ut_KgOraSchema.h
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/ut_KgOraSchema.h	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/ut_KgOraSchema.h	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -5,8 +5,9 @@
 {
   CPPUNIT_TEST_SUITE( ut_KgOraSchema );
     CPPUNIT_TEST( DescribeSchema );    
-    CPPUNIT_TEST( DifferentOwner );    
+    CPPUNIT_TEST( DifferentOwner );        
     CPPUNIT_TEST( TestNamesWith_ ); 
+    CPPUNIT_TEST( DescribeSchema_DeeoAmazon ); 
     CPPUNIT_TEST( DescribeSchema_Elektro ); 
     
   CPPUNIT_TEST_SUITE_END();
@@ -21,6 +22,8 @@
   void TestNamesWith_();
   void DescribeSchema_Elektro();
   
+  void DescribeSchema_DeeoAmazon();
+  
 protected:  
   void DifferentOwner_Prepare();
   

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/ut_KgOraSdeSchema.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/ut_KgOraSdeSchema.cpp	2014-04-09 \
                21:58:56 UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/ut_KgOraSdeSchema.cpp	2014-04-09 \
22:00:17 UTC (rev 7063) @@ -484,7 +484,7 @@
       FdoPtr<FdoGeometryValue> geomval = FdoGeometryValue::Create( fgf );
       strval=geomval->ToString();
       #ifdef DEBUG
-        cout << strval;
+      std::cout << strval;
       #endif
 
       count++;

Modified: sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/ut_OCI.cpp
===================================================================
--- sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/ut_OCI.cpp	2014-04-09 21:58:56 \
                UTC (rev 7062)
+++ sandbox/adsk/3.9/Providers/KingOracle/src/UnitTest/ut_OCI.cpp	2014-04-09 22:00:17 \
UTC (rev 7063) @@ -8,7 +8,7 @@
 //#include "c_FdoOra_API2.h"
 #include "ut_OCI.h"
 
-#include "c_FdoOra_API2.h"
+#include "c_FdoOra_API3.h"
 
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ut_OCI);
@@ -29,7 +29,7 @@
 {
 }
 
-
+
 c_Oci_Connection* ut_OCI::OCI_CreateConnection()
 {
   return c_OCI_API::CreateConnection(D_CONN_USERNAME,D_CONN_PASS,D_CONN_SERVICE);
@@ -66,85 +66,85 @@
 
 
 c_SdoGeomToAGF2 sdotoagf;
-void process_data(c_Oci_Connection* ociconn,SDO_GEOMETRY_TYPE \
                **array_geomobjptr,SDO_GEOMETRY_ind**array_geomindptr,OCINumber*gid,
-                  int  rows_to_process, 
-                  int  *rows_processed)
-{
-  int            row;
-  int         double_gid;
-  
-  SDO_GEOMETRY_TYPE* geomobj = *array_geomobjptr; 
-  SDO_GEOMETRY_ind* geomind = *array_geomindptr;
-
-  for (row = 0; row < rows_to_process; row++, (*rows_processed)++)
-  {
-    /*
-    ** Get ID_COLUMN
-    */
-    if( gid )
-      ociconn->OciCheckError( OCINumberToInt(ociconn->m_OciHpError, gid, 
-        (uword)sizeof(int),OCI_NUMBER_UNSIGNED,(dvoid *)&double_gid));
-
-    
-    if( geomind->_atomic != OCI_IND_NULL )
-    {
-      //SDO_GEOMETRY_TYPE * geom = global_geom_obj[row];
-      
-      
-      int gtype;
-
-      ociconn->OciCheckError( OCINumberToInt(ociconn->m_OciHpError, \
                &(geomobj->sdo_gtype),
-        (uword)sizeof(int), OCI_NUMBER_SIGNED,
-        (dvoid *)&gtype));
-      
-      
-      sdotoagf.SetGeometry(geomobj,geomind);
-      sdotoagf.ToAGF();
-     
-      
-      //char *buff = c_Ora_API2::SdoGeomToString(geomobj,geomind);      
-      //delete []buff;
-      
-      
-      
-      //SDO_GEOMETRY_TYPE*sdo2 = ociconn->NewSdoGeometry();
-      //int size;
-      //size = OCICollSize( c_OCI_API::m_OciHpEnvironment, c_OCI_API::m_OciHpError, \
                sdo2->sdo_ordinates, &size );
-                   
-      
-      // free the spatial object instance
-    
-      
-   
-         
-      //ociconn->OciCheckError(OCIObjectFree(ociconn->m_OciHpEnvironment, \
                ociconn->m_OciHpError, (dvoid *)geomobj,(ub2)OCI_OBJECTFREE_FORCE));
-      //ociconn->OciCheckError(OCIObjectFree(ociconn->m_OciHpEnvironment, \
                ociconn->m_OciHpError, (dvoid *)global_geom_obj[row],(ub2)0));
-      
-      //*array_geomobjptr = NULL;// global_geom_obj[row] = NULL;
-      
-      
-      
-      //OCIObjectFree(ociconn->m_OciHpEnvironment, ociconn->m_OciHpError, (dvoid \
                *)geomind,(ub2)0);
-      
-      
-      //OCIObjectFree(ociconn->m_OciHpEnvironment, ociconn->m_OciHpError, (dvoid \
                *)geomobj,(ub2)0);
-      //*array_geomobjptr = NULL;
-      
-      //delete geomind;
-      
-      array_geomobjptr++;
-      array_geomindptr++;
-      geomobj = *array_geomobjptr;
-      geomind = *array_geomindptr;
-    }
-    
-  } /* end of for-loop: row */
+void process_data(c_Oci_Connection* ociconn,SDO_GEOMETRY_TYPE \
**array_geomobjptr,SDO_GEOMETRY_ind**array_geomindptr,OCINumber*gid, +                \
int  rows_to_process,  +                  int  *rows_processed)
+{
+  int            row;
+  int         double_gid;
+  
+  SDO_GEOMETRY_TYPE* geomobj = *array_geomobjptr; 
+  SDO_GEOMETRY_ind* geomind = *array_geomindptr;
+
+  for (row = 0; row < rows_to_process; row++, (*rows_processed)++)
+  {
+    /*
+    ** Get ID_COLUMN
+    */
+    if( gid )
+      ociconn->OciCheckError( OCINumberToInt(ociconn->m_OciHpError, gid, 
+        (uword)sizeof(int),OCI_NUMBER_UNSIGNED,(dvoid *)&double_gid));
+
+    
+    if( geomind->_atomic != OCI_IND_NULL )
+    {
+      //SDO_GEOMETRY_TYPE * geom = global_geom_obj[row];
+      
+      
+      int gtype;
+
+      ociconn->OciCheckError( OCINumberToInt(ociconn->m_OciHpError, \
&(geomobj->sdo_gtype), +        (uword)sizeof(int), OCI_NUMBER_SIGNED,
+        (dvoid *)&gtype));
+      
+      
+      sdotoagf.SetGeometry(geomobj,geomind);
+      sdotoagf.ToAGF();
+     
+      
+      //char *buff = c_Ora_API2::SdoGeomToString(geomobj,geomind);      
+      //delete []buff;
+      
+      
+      
+      //SDO_GEOMETRY_TYPE*sdo2 = ociconn->NewSdoGeometry();
+      //int size;
+      //size = OCICollSize( c_OCI_API::m_OciHpEnvironment, c_OCI_API::m_OciHpError, \
sdo2->sdo_ordinates, &size ); +                   
+      
+      // free the spatial object instance
+    
+      
+   
+         
+      //ociconn->OciCheckError(OCIObjectFree(ociconn->m_OciHpEnvironment, \
ociconn->m_OciHpError, (dvoid *)geomobj,(ub2)OCI_OBJECTFREE_FORCE)); +      \
//ociconn->OciCheckError(OCIObjectFree(ociconn->m_OciHpEnvironment, \
ociconn->m_OciHpError, (dvoid *)global_geom_obj[row],(ub2)0)); +      
+      //*array_geomobjptr = NULL;// global_geom_obj[row] = NULL;
+      
+      
+      
+      //OCIObjectFree(ociconn->m_OciHpEnvironment, ociconn->m_OciHpError, (dvoid \
*)geomind,(ub2)0); +      
+      
+      //OCIObjectFree(ociconn->m_OciHpEnvironment, ociconn->m_OciHpError, (dvoid \
*)geomobj,(ub2)0); +      //*array_geomobjptr = NULL;
+      
+      //delete geomind;
+      
+      array_geomobjptr++;
+      array_geomindptr++;
+      geomobj = *array_geomobjptr;
+      geomind = *array_geomindptr;
+    }
+    
+  } /* end of for-loop: row */
 }
 
 void ut_OCI::OCI_ReadGeoms()
 {
-  OCINumber         global_gid[D_OCI_ARRAY_SIZE];
-  SDO_GEOMETRY_TYPE *global_geom_obj[D_OCI_ARRAY_SIZE];/* spatial object buffer */
+  OCINumber         global_gid[D_OCI_ARRAY_SIZE];
+  SDO_GEOMETRY_TYPE *global_geom_obj[D_OCI_ARRAY_SIZE];/* spatial object buffer */
   SDO_GEOMETRY_ind  *global_geom_ind[D_OCI_ARRAY_SIZE]; /* Object indicator */
   int rows_fetched=0,rows_processed=0;
   
@@ -164,100 +164,100 @@
 {
     c_Oci_Connection* ociconn = OCI_CreateConnection();
     
-    /* initialize stmthp */
-    OCIStmt 		*stmthp;
+    /* initialize stmthp */
+    OCIStmt 		*stmthp;
     ociconn->OciCheckError( OCIHandleAlloc((dvoid *)ociconn->m_OciHpEnvironment, \
(dvoid **)&stmthp, (ub4)OCI_HTYPE_STMT, (size_t)0, (dvoid **)0));  
-    /* parse query */
-    ociconn->OciCheckError( OCIStmtPrepare(stmthp, ociconn->m_OciHpError, 
-      (text *)sql.c_str(), (ub4)wcslen(sql.c_str())*sizeof(wchar_t), 
-      (ub4)OCI_NTV_SYNTAX, (ub4)OCI_DEFAULT));
-
-    
-
-
-    
-    
-    // define GID and spatial ADT object 
-/*    
-    OCIDefine *defn1p;
-    ociconn->OciCheckError( OCIDefineByPos(stmthp, &defn1p, ociconn->m_OciHpError, \
                (ub4)1, 
-      (dvoid *)&gid, 
-      (sb4)sizeof(OCINumber), SQLT_VNU,
-      (dvoid *)0, (ub2 *)0, (ub2 *)0, 
-      (ub4)OCI_DEFAULT));
-*/
-    OCIDefine *defn2p;
-    ociconn->OciCheckError( OCIDefineByPos(stmthp, &defn2p, ociconn->m_OciHpError, \
                (ub4)1, 
-      (dvoid *)0, (sb4)0, SQLT_NTY, (dvoid *)0,
-      (ub2 *)0, (ub2 *)0, (ub4)OCI_DEFAULT));
-
-    ociconn->OciCheckError( OCIDefineObject(defn2p, ociconn->m_OciHpError, \
                ociconn->m_OciType_SdoGeometry, 
-      (dvoid **)global_geom_obj, (ub4 *)0, 
-      (dvoid **)global_geom_ind, (ub4 *)0));
-
-
-
-    for( int i=0; i < D_OCI_ARRAY_SIZE; i++ )
-    {
-      global_geom_obj[i]=NULL;
-      global_geom_ind[i]=NULL;
-    }
-
-
-
-    /* execute */
-    int status = OCIStmtExecute(ociconn->m_OciHpServiceContext, stmthp, \
                ociconn->m_OciHpError, (ub4)D_OCI_ARRAY_SIZE, (ub4)0, 
-      (OCISnapshot *)NULL, (OCISnapshot *)NULL, 
-      (ub4)OCI_DEFAULT);
-
-    bool has_more_data;
-    if (status == OCI_SUCCESS_WITH_INFO || status == OCI_NO_DATA)
-      has_more_data = FALSE;
-    else
-    {
-      has_more_data = TRUE;
-      ociconn->OciCheckError( status);
-    }
-
-    /* process data */
-    rows_fetched=0;rows_processed=0;
-    ociconn->OciCheckError( OCIAttrGet((dvoid *)stmthp, (ub4)OCI_HTYPE_STMT,
-      (dvoid *)&rows_fetched, (ub4 *)0, 
-      (ub4)OCI_ATTR_ROW_COUNT, ociconn->m_OciHpError));
-    int rows_to_process = rows_fetched - rows_processed;
-
-    process_data(ociconn,global_geom_obj,global_geom_ind,NULL, rows_to_process, \
                &rows_processed);
-
-    while (has_more_data)
-    {
-   
-      status = OCIStmtFetch2(stmthp, ociconn->m_OciHpError, (ub4)D_OCI_ARRAY_SIZE, 
-        (ub2)OCI_FETCH_NEXT, 1,(ub4)OCI_DEFAULT);
-      //status = OCIStmtFetch(stmthp, ociconn->m_OciHpError, (ub4)D_OCI_ARRAY_SIZE, 
-      //  (ub2)OCI_FETCH_NEXT, (ub4)OCI_DEFAULT);
-
-      if (status != OCI_SUCCESS)
-        has_more_data = FALSE;
-
-      /* process data */
-      ociconn->OciCheckError( OCIAttrGet((dvoid *)stmthp, (ub4)OCI_HTYPE_STMT,
-        (dvoid *)&rows_fetched, (ub4 *)0, 
-        (ub4)OCI_ATTR_ROW_COUNT, ociconn->m_OciHpError));
-      rows_to_process = rows_fetched - rows_processed;
-
-      process_data(ociconn, global_geom_obj,global_geom_ind,NULL,rows_to_process, \
                &rows_processed);
-    }
-
-    //ociconn->OciCheckError( \
OCICacheFree(ociconn->m_OciHpEnvironment,ociconn->m_OciHpError,ociconn->m_OciHpServiceContext) \
); +    /* parse query */
+    ociconn->OciCheckError( OCIStmtPrepare(stmthp, ociconn->m_OciHpError, 
+      (text *)sql.c_str(), (ub4)wcslen(sql.c_str())*sizeof(wchar_t), 
+      (ub4)OCI_NTV_SYNTAX, (ub4)OCI_DEFAULT));
+
     
 
 
     
+    
+    // define GID and spatial ADT object 
+/*    
+    OCIDefine *defn1p;
+    ociconn->OciCheckError( OCIDefineByPos(stmthp, &defn1p, ociconn->m_OciHpError, \
(ub4)1,  +      (dvoid *)&gid, 
+      (sb4)sizeof(OCINumber), SQLT_VNU,
+      (dvoid *)0, (ub2 *)0, (ub2 *)0, 
+      (ub4)OCI_DEFAULT));
+*/
+    OCIDefine *defn2p;
+    ociconn->OciCheckError( OCIDefineByPos(stmthp, &defn2p, ociconn->m_OciHpError, \
(ub4)1,  +      (dvoid *)0, (sb4)0, SQLT_NTY, (dvoid *)0,
+      (ub2 *)0, (ub2 *)0, (ub4)OCI_DEFAULT));
 
+    ociconn->OciCheckError( OCIDefineObject(defn2p, ociconn->m_OciHpError, \
ociconn->m_OciType_SdoGeometry,  +      (dvoid **)global_geom_obj, (ub4 *)0, 
+      (dvoid **)global_geom_ind, (ub4 *)0));
 
-    /* initialize stmthp */
-    
+
+
+    for( int i=0; i < D_OCI_ARRAY_SIZE; i++ )
+    {
+      global_geom_obj[i]=NULL;
+      global_geom_ind[i]=NULL;
+    }
+
+
+
+    /* execute */
+    int status = OCIStmtExecute(ociconn->m_OciHpServiceContext, stmthp, \
ociconn->m_OciHpError, (ub4)D_OCI_ARRAY_SIZE, (ub4)0,  +      (OCISnapshot *)NULL, \
(OCISnapshot *)NULL,  +      (ub4)OCI_DEFAULT);
+
+    bool has_more_data;
+    if (status == OCI_SUCCESS_WITH_INFO || status == OCI_NO_DATA)
+      has_more_data = FALSE;
+    else
+    {
+      has_more_data = TRUE;
+      ociconn->OciCheckError( status);
+    }
+
+    /* process data */
+    rows_fetched=0;rows_processed=0;
+    ociconn->OciCheckError( OCIAttrGet((dvoid *)stmthp, (ub4)OCI_HTYPE_STMT,
+      (dvoid *)&rows_fetched, (ub4 *)0, 
+      (ub4)OCI_ATTR_ROW_COUNT, ociconn->m_OciHpError));
+    int rows_to_process = rows_fetched - rows_processed;
+
+    process_data(ociconn,global_geom_obj,global_geom_ind,NULL, rows_to_process, \
&rows_processed); +
+    while (has_more_data)
+    {
+   
+      status = OCIStmtFetch2(stmthp, ociconn->m_OciHpError, (ub4)D_OCI_ARRAY_SIZE, 
+        (ub2)OCI_FETCH_NEXT, 1,(ub4)OCI_DEFAULT);
+      //status = OCIStmtFetch(stmthp, ociconn->m_OciHpError, (ub4)D_OCI_ARRAY_SIZE, 
+      //  (ub2)OCI_FETCH_NEXT, (ub4)OCI_DEFAULT);
+
+      if (status != OCI_SUCCESS)
+        has_more_data = FALSE;
+
+      /* process data */
+      ociconn->OciCheckError( OCIAttrGet((dvoid *)stmthp, (ub4)OCI_HTYPE_STMT,
+        (dvoid *)&rows_fetched, (ub4 *)0, 
+        (ub4)OCI_ATTR_ROW_COUNT, ociconn->m_OciHpError));
+      rows_to_process = rows_fetched - rows_processed;
+
+      process_data(ociconn, global_geom_obj,global_geom_ind,NULL,rows_to_process, \
&rows_processed); +    }
+
+    //ociconn->OciCheckError( \
OCICacheFree(ociconn->m_OciHpEnvironment,ociconn->m_OciHpError,ociconn->m_OciHpServiceContext) \
); +    
+
+
+    
+
+
+    /* initialize stmthp */
+    
     ociconn->OciCheckError( OCIHandleFree((dvoid *)stmthp, (ub4)OCI_HTYPE_STMT));
     
     c_OCI_API::CloseConnection(ociconn);
@@ -267,20 +267,20 @@
 clock_t elog_t2=clock();
 double msecs = (double)((elog_t2-elog_t1)* CLOCKS_PER_SEC / 1000);
     //ociconn->OciCheckError( OCICacheFree ( \
                ociconn->m_OciHpEnvironment,ociconn->m_OciHpError,ociconn->m_OciHpServiceContext \
                )); 
-    // free the spatial object instance
-
-/*
-    for(int row=0;row<D_ARRAY_SIZE;row++) 
-    {
-    
-      if( global_geom_obj[row] )
-      {            
-        ociconn->OciCheckError( OCIObjectFree(ociconn->m_OciHpEnvironment, \
                ociconn->m_OciHpError, (dvoid *)global_geom_obj[row], 
-        (ub2)OCI_OBJECTFREE_FORCE));
-
-        global_geom_obj[row] = NULL;
-      }
-    }
+    // free the spatial object instance
+
+/*
+    for(int row=0;row<D_ARRAY_SIZE;row++) 
+    {
+    
+      if( global_geom_obj[row] )
+      {            
+        ociconn->OciCheckError( OCIObjectFree(ociconn->m_OciHpEnvironment, \
ociconn->m_OciHpError, (dvoid *)global_geom_obj[row],  +        \
(ub2)OCI_OBJECTFREE_FORCE)); +
+        global_geom_obj[row] = NULL;
+      }
+    }
 */   
 
     
@@ -310,8 +310,8 @@
 
 void ut_OCI::OCI_ReadGeoms2()
 {
-  OCINumber         global_gid[D_OCI_ARRAY_SIZE];
-  SDO_GEOMETRY_TYPE *global_geom_obj[D_OCI_ARRAY_SIZE];/* spatial object buffer */
+  OCINumber         global_gid[D_OCI_ARRAY_SIZE];
+  SDO_GEOMETRY_TYPE *global_geom_obj[D_OCI_ARRAY_SIZE];/* spatial object buffer */
   SDO_GEOMETRY_ind  *global_geom_ind[D_OCI_ARRAY_SIZE]; /* Object indicator */
   int rows_processed=0;
   
@@ -339,22 +339,22 @@
         
         stm->Prepare(sql.c_str(),0);
         stm->ExecuteSelectAndDefine(256);
-        
-        c_SdoGeomToAGF2 sdotoagf;
-        while (stm->ReadNext())
-        {
-          c_SDO_GEOMETRY*geom = stm->GetSdoGeom(1);
-          
-          sdotoagf.SetGeometry(geom);      
-          sdotoagf.ToAGF();
-          delete geom;
-          
-          method1_rows_fetched++;
-          rows_processed++;
-          
-        }
-
-        
+        
+        c_SdoGeomToAGF2 sdotoagf;
+        while (stm->ReadNext())
+        {
+          c_SDO_GEOMETRY*geom = stm->GetSdoGeom(1);
+          
+          sdotoagf.SetGeometry(geom);      
+          sdotoagf.ToAGF();
+          delete geom;
+          
+          method1_rows_fetched++;
+          rows_processed++;
+          
+        }
+
+        
         ociconn->TerminateStatement(stm);
         
         
@@ -380,23 +380,23 @@
     for(int loop=0;loop<loop_count;loop++)      
     {
         stm->ExecuteSelect(256);
-        
-        c_SdoGeomToAGF2 sdotoagf;
-        while (stm->ReadNext())
-        {
-          c_SDO_GEOMETRY*geom = stm->GetSdoGeom(1);
-          
-          sdotoagf.SetGeometry(geom);      
-          sdotoagf.ToAGF();
-          delete geom;
-          
-          method2_rows_fetched++;
-          rows_processed++;
-          
-        }
-
-        
         
+        c_SdoGeomToAGF2 sdotoagf;
+        while (stm->ReadNext())
+        {
+          c_SDO_GEOMETRY*geom = stm->GetSdoGeom(1);
+          
+          sdotoagf.SetGeometry(geom);      
+          sdotoagf.ToAGF();
+          delete geom;
+          
+          method2_rows_fetched++;
+          rows_processed++;
+          
+        }
+
+        
+        
     }
 
     clock_t elog_t2=clock();
@@ -437,7 +437,7 @@
     c_OCI_API::OciInit();
     c_Oci_Connection* ociconn = OCI_CreateConnection();
 
-    FdoPtr<c_KgOraSchemaDesc> schema = \
c_FdoOra_API2::DescribeSchema(ociconn,L"UNITTEST",L"UNITTEST",NULL,NULL); +    \
FdoPtr<c_KgOraSchemaDesc> schema = \
c_FdoOra_API3::DescribeSchema(ociconn,L"UNITTEST",L"UNITTEST",NULL,NULL);  
     c_OCI_API::CloseConnection(ociconn);
     
@@ -475,8 +475,8 @@
     }
 
 
-    long val1 = c_Ora_API2::GetSequenceNextVal(ociconn,L"TEST1_FDOSEQ");
-    long val2 = c_Ora_API2::GetSequenceNextVal(ociconn,L"TEST1_FDOSEQ");
+    FdoInt64 val1 = c_Ora_API2::GetSequenceNextVal(ociconn,L"TEST1_FDOSEQ");
+    FdoInt64 val2 = c_Ora_API2::GetSequenceNextVal(ociconn,L"TEST1_FDOSEQ");
     
     if( val2 != (val1+1) )
     {
@@ -894,21 +894,21 @@
     
     std::wstring sqlstr;
     
-    sqlstr = L"INSERT INTO USER_SDO_GEOM_METADATA VALUES ( \
'TEMPX','GEOMX',MDSYS.SDO_DIM_ARRAY(:1,:2),:3)"; +    sqlstr = L"INSERT INTO \
USER_SDO_GEOM_METADATA VALUES ( 'TEMPX','GEOMX',MDSYS.SDO_DIM_ARRAY(:1,:2),:3)";  
     stm->Prepare(sqlstr.c_str());
     
     c_SDO_DIM_ELEMENT* xdim_sdoelem = c_SDO_DIM_ELEMENT::Create(con);
-    xdim_sdoelem->SetDimName(L"X");
-    xdim_sdoelem->SetLB(1);
-    xdim_sdoelem->SetUB(2);
+    xdim_sdoelem->SetDimName(L"X");
+    xdim_sdoelem->SetLB(1);
+    xdim_sdoelem->SetUB(2);
     xdim_sdoelem->SetTolerance(0.1);
     stm->BindSdoDimElement(1,xdim_sdoelem);
     
     c_SDO_DIM_ELEMENT* ydim_sdoelem = c_SDO_DIM_ELEMENT::Create(con);
-    ydim_sdoelem->SetDimName(L"Y");
-    ydim_sdoelem->SetLB(3);
-    ydim_sdoelem->SetUB(4);
+    ydim_sdoelem->SetDimName(L"Y");
+    ydim_sdoelem->SetLB(3);
+    ydim_sdoelem->SetUB(4);
     ydim_sdoelem->SetTolerance(0.2);
     stm->BindSdoDimElement(2,ydim_sdoelem);
     
@@ -1193,7 +1193,7 @@
     
     clock_t elog_t1=clock();
     
-    FdoPtr<c_KgOraSchemaDesc> schema = \
c_FdoOra_API2::DescribeSchema(ociconn,L"UNITTEST",L"UNITTEST",NULL,NULL); +    \
FdoPtr<c_KgOraSchemaDesc> schema = \
c_FdoOra_API3::DescribeSchema(ociconn,L"UNITTEST",L"UNITTEST",NULL,NULL);  
     
     clock_t elog_t2=clock();
@@ -1248,22 +1248,22 @@
         
         stm->Prepare(sql.c_str(),0);
         stm->ExecuteSelectAndDefine(256);
-        
-        c_SdoGeomToAGF2 sdotoagf;
-        while (stm->ReadNext())
-        {
-          c_SDO_GEOMETRY*geom = stm->GetSdoGeom(1);
-          
-          sdotoagf.SetGeometry(geom);      
-          sdotoagf.ToAGF();
-          delete geom;
-          
-          method1_rows_fetched++;
-          rows_processed++;
-          
-        }
-
-        
+        
+        c_SdoGeomToAGF2 sdotoagf;
+        while (stm->ReadNext())
+        {
+          c_SDO_GEOMETRY*geom = stm->GetSdoGeom(1);
+          
+          sdotoagf.SetGeometry(geom);      
+          sdotoagf.ToAGF();
+          delete geom;
+          
+          method1_rows_fetched++;
+          rows_processed++;
+          
+        }
+
+        
         m_OciConn->TerminateStatement(stm);
         
         



_______________________________________________
fdo-commits mailing list
fdo-commits@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/fdo-commits

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic