2002-12-05 Daniel Morgan <danmorg@sc.rr.com>
authorDaniel Morgan <monodanmorg@yahoo.com>
Thu, 5 Dec 2002 13:31:05 +0000 (13:31 -0000)
committerDaniel Morgan <monodanmorg@yahoo.com>
Thu, 5 Dec 2002 13:31:05 +0000 (13:31 -0000)
* System.Data.OracleClient
* System.Data.OracleClient/System.Data.OracleClient
  added directory to mcs/class for the Oracle 8i
  data provider

* System.Data.OracleClient/OciGlue.cs
* System.Data.OracleClient/OracleConnection.cs
* System.Data.OracleClient/OracleCommand.cs: added
files for the System.Data.OracleClient.dll assembly

* System.Data.OracleClient/ociglue.c
* System.Data.OracleClient/ociglue.h: added
files for thte System.Data.OracleClient.gluelib.dll
unmanaged c shared library

* System.Data.OracleClient/TestOracleClient.cs: test
the OracleClient data provider for Oracle 8i database

* ChangeLog: added file

* README.TXT: added file

* System.Data.OracleClient/OciGlueLib_MSVC_win32.make:
added makefile for ociglue shared lib on Win32 platform
and compiler Visual C++ 7.0

* System.Data.OracleClient/OciGlueLib_BCC_win32.make:
added makefile for ociglue shared lib on Win32 platform
and compiler Borland C++ 5.5

* MonoOracleClient.csproj
* MonoOracleClient.csproj.usr
* MonoOracleClient.sln
* MonoOracleClient.suo: added Visual Studio 1.0
project files to build the
assembly System.Data.OracleClient.dll

svn path=/trunk/mcs/; revision=9394

16 files changed:
mcs/class/System.Data.OracleClient/ChangeLog [new file with mode: 0755]
mcs/class/System.Data.OracleClient/README.TXT [new file with mode: 0755]
mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.csproj [new file with mode: 0755]
mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.csproj.user [new file with mode: 0755]
mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.sln [new file with mode: 0755]
mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.suo [new file with mode: 0755]
mcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlue.cs [new file with mode: 0755]
mcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlueLib_BCC_win32.make [new file with mode: 0755]
mcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlueLib_MSVC_win32.make [new file with mode: 0755]
mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleCommand.cs [new file with mode: 0755]
mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleConnection.cs [new file with mode: 0755]
mcs/class/System.Data.OracleClient/System.Data.OracleClient/ociglue.c [new file with mode: 0755]
mcs/class/System.Data.OracleClient/System.Data.OracleClient/ociglue.h [new file with mode: 0755]
mcs/class/System.Data.OracleClient/Test/Test.csproj [new file with mode: 0755]
mcs/class/System.Data.OracleClient/Test/Test.csproj.user [new file with mode: 0755]
mcs/class/System.Data.OracleClient/Test/TestOracleClient.cs [new file with mode: 0755]

diff --git a/mcs/class/System.Data.OracleClient/ChangeLog b/mcs/class/System.Data.OracleClient/ChangeLog
new file mode 100755 (executable)
index 0000000..cd5d35b
--- /dev/null
@@ -0,0 +1,38 @@
+2002-12-05  Daniel Morgan <danmorg@sc.rr.com>
+
+       * System.Data.OracleClient
+       * System.Data.OracleClient/System.Data.OracleClient
+         added directory to mcs/class for the Oracle 8i 
+         data provider
+       
+       * System.Data.OracleClient/OciGlue.cs
+       * System.Data.OracleClient/OracleConnection.cs
+       * System.Data.OracleClient/OracleCommand.cs: added
+       files for the System.Data.OracleClient.dll assembly
+       
+       * System.Data.OracleClient/ociglue.c
+       * System.Data.OracleClient/ociglue.h: added
+       files for thte System.Data.OracleClient.gluelib.dll
+       unmanaged c shared library
+       
+       * System.Data.OracleClient/TestOracleClient.cs: test
+       the OracleClient data provider for Oracle 8i database
+       
+       * ChangeLog: added file
+       
+       * README.TXT: added file
+       
+       * System.Data.OracleClient/OciGlueLib_MSVC_win32.make:
+       added makefile for ociglue shared lib on Win32 platform 
+       and compiler Visual C++ 7.0
+       
+       * System.Data.OracleClient/OciGlueLib_BCC_win32.make:
+       added makefile for ociglue shared lib on Win32 platform
+       and compiler Borland C++ 5.5
+       
+       * MonoOracleClient.csproj
+       * MonoOracleClient.csproj.usr
+       * MonoOracleClient.sln
+       * MonoOracleClient.suo: added Visual Studio 1.0
+       project files to build the
+       assembly System.Data.OracleClient.dll
diff --git a/mcs/class/System.Data.OracleClient/README.TXT b/mcs/class/System.Data.OracleClient/README.TXT
new file mode 100755 (executable)
index 0000000..6b93b50
--- /dev/null
@@ -0,0 +1,87 @@
+\r
+README.TXT for Mono Oracle 8i data provider\r
+\r
+Located at\r
+mcs/class/System.Data.OracleClient\r
+\r
+Requirements:\r
+\r
+1. C#/CLR compiler. (only tried with Visual Studio.NET)\r
+   to build the OracleClient assembly.\r
+\r
+2. C compiler (only tried with the command-line c compilers\r
+   Borland C++ 5.5 and Visual C++ 7.0) that can build\r
+   the OracleClient glue shared library. \r
+   \r
+   A free command-line\r
+   version of the Borland C++ 5.5 compiler\r
+   for Win32 can be downloaded\r
+   from http://www.borland.com/\r
+\r
+3. Oracle 8i client software via either of the following:\r
+   a. Oracle 8i client with access to an Oracle 8i database\r
+   b. Oracle 8i server\r
+   \r
+   Either one, the client software needs to include the\r
+   oci shared library.  This is oci.dll on Win32.\r
+   Oracle 8i can be downloaded from\r
+   http://www.oracle.com/\r
+\r
+4. GLIB 2.0.  You should already have this installed since\r
+   Mono requires it.  It can be downloaded from\r
+   http://www.gtk.org/\r
+   or for Win32, it can be downloaded from\r
+   http://www.gimp.org/win32\r
+\r
+Notes:\r
+\r
+I seriously doubt this will build within the\r
+mcs/class/System.Data.OracleClient directory \r
+structure.  Maybe, moving the project files to\r
+a simpler directory structure may help.\r
+\r
+There are two parts:\r
+\r
+1. assembly System.Data.OracleClient.dll which\r
+   includes files OracleCommand.cs and OracleConnection.cs\r
+\r
+2. unmanaged System.Data.OracleClient.ociglue.dll which\r
+   must be built with a compiler that can link with the\r
+   oci shared library.  On Windows, \r
+   the Oracle shared library oci.dll\r
+   This shared library provides the glue between\r
+   System.Data.OracleClient.dll and oci.dll\r
+   \r
+How to build the various parts:\r
+\r
+1. System.Data.OracleClient.dll is built \r
+   using Visual Studio.NET 1.0 via its projects files\r
+   I have not tried building it \r
+   via only the .NET Framework 1.0 command-line tools.\r
+\r
+2. System.Data.OracleClient.ociglue.dll is built by the\r
+   C compiler that can build a native c shared library\r
+   that can link with the Oracle 8i oci shared libary and\r
+   the GLIB 2.0 shared library.  A Makefile for\r
+   command-line compilers for Borland C++ 5.5 \r
+   and Visual C++ 7.0  I have only tried building this\r
+   on Windows XP.\r
+   \r
+TODO:\r
+\r
+1. get the OracleClient assembly to run on mono\r
+2. get the OracleClient glue lib to build with mcs on mono\r
+3. get the OracleClient to build with gcc\r
+4. get the OracleClient assembly and glub lib to \r
+   build with mcs on mono and run on mono on GNU/Linux\r
+5. Add transactions\r
+6. Add a data reader and retrieve simple data types\r
+7. Add parameters (binding variables)\r
+8. Add a data adapter\r
+9. add connection pooling support\r
+10. add more complex types\r
+11. add support for stored procedures, functions, and packages\r
+12. add support for security permissions\r
+13. add ability to execute queries in SQL# CLI\r
+14. add ability to execute queries in SQL# For GTK#\r
+\r
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.csproj b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.csproj
new file mode 100755 (executable)
index 0000000..5fa9b6e
--- /dev/null
@@ -0,0 +1,98 @@
+<VisualStudioProject>\r
+    <CSHARP\r
+        ProjectType = "Local"\r
+        ProductVersion = "7.0.9466"\r
+        SchemaVersion = "1.0"\r
+        ProjectGuid = "{799D520E-73ED-43A1-91FD-81D64C32A6F0}"\r
+    >\r
+        <Build>\r
+            <Settings\r
+                ApplicationIcon = ""\r
+                AssemblyKeyContainerName = ""\r
+                AssemblyName = "System.Data.OracleClient"\r
+                AssemblyOriginatorKeyFile = ""\r
+                DefaultClientScript = "JScript"\r
+                DefaultHTMLPageLayout = "Grid"\r
+                DefaultTargetSchema = "IE50"\r
+                DelaySign = "false"\r
+                OutputType = "Library"\r
+                RootNamespace = "System.Data.OracleClient"\r
+                StartupObject = "Test.OracleClient.OracleTest"\r
+            >\r
+                <Config\r
+                    Name = "Debug"\r
+                    AllowUnsafeBlocks = "false"\r
+                    BaseAddress = "285212672"\r
+                    CheckForOverflowUnderflow = "false"\r
+                    ConfigurationOverrideFile = ""\r
+                    DefineConstants = "DEBUG;TRACE"\r
+                    DocumentationFile = ""\r
+                    DebugSymbols = "true"\r
+                    FileAlignment = "4096"\r
+                    IncrementalBuild = "true"\r
+                    Optimize = "false"\r
+                    OutputPath = "bin\Debug\"\r
+                    RegisterForComInterop = "false"\r
+                    RemoveIntegerChecks = "false"\r
+                    TreatWarningsAsErrors = "false"\r
+                    WarningLevel = "4"\r
+                />\r
+                <Config\r
+                    Name = "Release"\r
+                    AllowUnsafeBlocks = "false"\r
+                    BaseAddress = "285212672"\r
+                    CheckForOverflowUnderflow = "false"\r
+                    ConfigurationOverrideFile = ""\r
+                    DefineConstants = "TRACE"\r
+                    DocumentationFile = ""\r
+                    DebugSymbols = "false"\r
+                    FileAlignment = "4096"\r
+                    IncrementalBuild = "false"\r
+                    Optimize = "true"\r
+                    OutputPath = "bin\Release\"\r
+                    RegisterForComInterop = "false"\r
+                    RemoveIntegerChecks = "false"\r
+                    TreatWarningsAsErrors = "false"\r
+                    WarningLevel = "4"\r
+                />\r
+            </Settings>\r
+            <References>\r
+                <Reference\r
+                    Name = "System"\r
+                    AssemblyName = "System"\r
+                    HintPath = "E:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"\r
+                />\r
+                <Reference\r
+                    Name = "System.Data"\r
+                    AssemblyName = "System.Data"\r
+                    HintPath = "E:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"\r
+                />\r
+                <Reference\r
+                    Name = "System.XML"\r
+                    AssemblyName = "System.Xml"\r
+                    HintPath = "E:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"\r
+                />\r
+            </References>\r
+        </Build>\r
+        <Files>\r
+            <Include>\r
+                <File\r
+                    RelPath = "OciGlue.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "OracleCommand.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+                <File\r
+                    RelPath = "OracleConnection.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+            </Include>\r
+        </Files>\r
+    </CSHARP>\r
+</VisualStudioProject>\r
+\r
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.csproj.user b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.csproj.user
new file mode 100755 (executable)
index 0000000..4089d2b
--- /dev/null
@@ -0,0 +1,48 @@
+<VisualStudioProject>\r
+    <CSHARP>\r
+        <Build>\r
+            <Settings ReferencePath = "" >\r
+                <Config\r
+                    Name = "Debug"\r
+                    EnableASPDebugging = "false"\r
+                    EnableASPXDebugging = "false"\r
+                    EnableUnmanagedDebugging = "false"\r
+                    EnableSQLServerDebugging = "false"\r
+                    RemoteDebugEnabled = "false"\r
+                    RemoteDebugMachine = ""\r
+                    StartAction = "Project"\r
+                    StartArguments = ""\r
+                    StartPage = ""\r
+                    StartProgram = ""\r
+                    StartURL = ""\r
+                    StartWorkingDirectory = ""\r
+                    StartWithIE = "false"\r
+                />\r
+                <Config\r
+                    Name = "Release"\r
+                    EnableASPDebugging = "false"\r
+                    EnableASPXDebugging = "false"\r
+                    EnableUnmanagedDebugging = "false"\r
+                    EnableSQLServerDebugging = "false"\r
+                    RemoteDebugEnabled = "false"\r
+                    RemoteDebugMachine = ""\r
+                    StartAction = "Project"\r
+                    StartArguments = ""\r
+                    StartPage = ""\r
+                    StartProgram = ""\r
+                    StartURL = ""\r
+                    StartWorkingDirectory = ""\r
+                    StartWithIE = "false"\r
+                />\r
+            </Settings>\r
+        </Build>\r
+        <OtherProjectSettings\r
+            CopyProjectDestinationFolder = ""\r
+            CopyProjectUncPath = ""\r
+            CopyProjectOption = "0"\r
+            ProjectView = "ProjectFiles"\r
+            ProjectTrust = "0"\r
+        />\r
+    </CSHARP>\r
+</VisualStudioProject>\r
+\r
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.sln b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.sln
new file mode 100755 (executable)
index 0000000..1e200c7
--- /dev/null
@@ -0,0 +1,27 @@
+Microsoft Visual Studio Solution File, Format Version 7.00\r
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoOracleClient", "MonoOracleClient.csproj", "{799D520E-73ED-43A1-91FD-81D64C32A6F0}"\r
+EndProject\r
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "..\Test\Test.csproj", "{2A30C592-6B73-48E0-9640-A0DE8CA3C02F}"\r
+EndProject\r
+Global\r
+       GlobalSection(SolutionConfiguration) = preSolution\r
+               ConfigName.0 = Debug\r
+               ConfigName.1 = Release\r
+       EndGlobalSection\r
+       GlobalSection(ProjectDependencies) = postSolution\r
+       EndGlobalSection\r
+       GlobalSection(ProjectConfiguration) = postSolution\r
+               {799D520E-73ED-43A1-91FD-81D64C32A6F0}.Debug.ActiveCfg = Debug|.NET\r
+               {799D520E-73ED-43A1-91FD-81D64C32A6F0}.Debug.Build.0 = Debug|.NET\r
+               {799D520E-73ED-43A1-91FD-81D64C32A6F0}.Release.ActiveCfg = Release|.NET\r
+               {799D520E-73ED-43A1-91FD-81D64C32A6F0}.Release.Build.0 = Release|.NET\r
+               {2A30C592-6B73-48E0-9640-A0DE8CA3C02F}.Debug.ActiveCfg = Debug|.NET\r
+               {2A30C592-6B73-48E0-9640-A0DE8CA3C02F}.Debug.Build.0 = Debug|.NET\r
+               {2A30C592-6B73-48E0-9640-A0DE8CA3C02F}.Release.ActiveCfg = Release|.NET\r
+               {2A30C592-6B73-48E0-9640-A0DE8CA3C02F}.Release.Build.0 = Release|.NET\r
+       EndGlobalSection\r
+       GlobalSection(ExtensibilityGlobals) = postSolution\r
+       EndGlobalSection\r
+       GlobalSection(ExtensibilityAddIns) = postSolution\r
+       EndGlobalSection\r
+EndGlobal\r
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.suo b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.suo
new file mode 100755 (executable)
index 0000000..2ca0d8c
Binary files /dev/null and b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/MonoOracleClient.suo differ
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlue.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlue.cs
new file mode 100755 (executable)
index 0000000..4cdf73c
--- /dev/null
@@ -0,0 +1,715 @@
+// 
+// ociglue.cs - provides glue between 
+//              managed C#/.NET System.Data.OracleClient.dll and 
+//              unmanaged native c library oci.dll
+//              to be used in Mono System.Data.OracleClient as
+//              the Oracle 8i data provider.
+//  
+// Part of managed C#/.NET library System.Data.OracleClient.dll
+//
+// Part of the Mono class libraries at
+// mcs/class/System.Data.OracleClient/System.Data.OracleClient.OCI
+//
+// Assembly: System.Data.OracleClient.dll
+// Namespace: System.Data.OracleClient
+// 
+// Author: 
+//     Daniel Morgan <danmorg@sc.rr.com>
+//         
+// Copyright (C) Daniel Morgan, 2002
+// 
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.Data.OracleClient.OCI {
+       internal sealed class OciGlue {
+
+               // TODO: need to clean up, dispose, close, etc...
+               
+               // connection parameters
+               string database = "";
+               string username = "";
+               string password = "";
+
+               private UInt32 ociGlueConnectionHandle = 0;
+
+               // http://download-west.oracle.com/docs/cd/A87861_01/NT817EE/index.htm
+               // from oracle/ora81/oci/include/oci.h
+
+               // Currently, these are not being used, nor are the
+               // OCI_* constants nor the DllImports for oci.dll
+               IntPtr myenvhp = IntPtr.Zero; // OCIEnv - the environment handle
+               IntPtr mysrvhp = IntPtr.Zero; // OCIServer - the server handle
+               IntPtr myerrhp = IntPtr.Zero; // OCIError - the error handle
+               IntPtr myusrhp = IntPtr.Zero; // OCISession- user session handle
+               IntPtr mysvchp = IntPtr.Zero; // OCISvcCtx- the  service handle
+
+               public const UInt32 OCI_DEFAULT = (UInt32) 0x00;
+
+               public const UInt32 OCI_THREADED  = (UInt32) 0x01;
+               public const UInt32 OCI_OBJECT    = (UInt32) 0x02;
+               public const UInt32 OCI_EVENTS    = (UInt32) 0x04;
+               public const UInt32 OCI_RESERVED1 = (UInt32) 0x08;
+               public const UInt32 OCI_SHARED    = (UInt32) 0x10;
+               public const UInt32 OCI_RESERVED2 = (UInt32) 0x20;
+               
+               public const UInt32 OCI_NO_UCB    = (UInt32) 0x40;
+               public const UInt32  OCI_NO_MUTEX = (UInt32) 0x80;
+               
+               public const UInt32  OCI_SHARED_EXT = (UInt32) 0x100;
+               public const UInt32  OCI_CACHE      = (UInt32) 0x200;
+               public const UInt32  OCI_NO_CACHE   = (UInt32) 0x400;
+
+               public const UInt32 OCI_HTYPE_FIRST         = 1;
+               public const UInt32 OCI_HTYPE_ENV           = 1;
+               public const UInt32 OCI_HTYPE_ERROR         = 2;
+               public const UInt32 OCI_HTYPE_SVCCTX        = 3;
+               public const UInt32 OCI_HTYPE_STMT          = 4;
+               public const UInt32 OCI_HTYPE_BIND          = 5;
+               public const UInt32 OCI_HTYPE_DEFINE        = 6;
+               public const UInt32 OCI_HTYPE_DESCRIBE      = 7;
+               public const UInt32 OCI_HTYPE_SERVER        = 8;
+               public const UInt32 OCI_HTYPE_SESSION       = 9;
+               public const UInt32 OCI_HTYPE_TRANS         =10;
+               public const UInt32 OCI_HTYPE_COMPLEXOBJECT =11;
+               public const UInt32 OCI_HTYPE_SECURITY      =12;
+               public const UInt32 OCI_HTYPE_SUBSCRIPTION  =13;
+               public const UInt32 OCI_HTYPE_DIRPATH_CTX   =14;
+               public const UInt32 OCI_HTYPE_DIRPATH_COLUMN_ARRAY =15;
+               public const UInt32 OCI_HTYPE_DIRPATH_STREAM       =16;
+               public const UInt32 OCI_HTYPE_PROC          =17;
+               public const UInt32 OCI_HTYPE_LAST          =17;
+
+               public const UInt32 OCI_ATTR_FNCODE  =1;
+               public const UInt32 OCI_ATTR_OBJECT   =2;
+               public const UInt32 OCI_ATTR_NONBLOCKING_MODE  =3;
+               public const UInt32 OCI_ATTR_SQLCODE  =4;
+               public const UInt32 OCI_ATTR_ENV  =5;
+               public const UInt32 OCI_ATTR_SERVER =6;
+               public const UInt32 OCI_ATTR_SESSION =7;
+               public const UInt32 OCI_ATTR_TRANS   =8;
+               public const UInt32 OCI_ATTR_ROW_COUNT =  9;
+               public const UInt32 OCI_ATTR_SQLFNCODE =10;
+               public const UInt32 OCI_ATTR_PREFETCH_ROWS = 11;
+               public const UInt32 OCI_ATTR_NESTED_PREFETCH_ROWS =12;
+               public const UInt32 OCI_ATTR_PREFETCH_MEMORY =13;
+               public const UInt32 OCI_ATTR_NESTED_PREFETCH_MEMORY =14;
+               public const UInt32 OCI_ATTR_CHAR_COUNT  =15; 
+               
+               public const UInt32 OCI_ATTR_PDSCL   =16;
+               public const UInt32 OCI_ATTR_FSPRECISION =OCI_ATTR_PDSCL;
+               
+               public const UInt32 OCI_ATTR_PDPRC   =17;
+               public const UInt32 OCI_ATTR_LFPRECISION =OCI_ATTR_PDPRC; 
+               
+               public const UInt32 OCI_ATTR_PARAM_COUNT =18;
+               public const UInt32 OCI_ATTR_ROWID   =19;
+               public const UInt32 OCI_ATTR_CHARSET  =20;
+               public const UInt32 OCI_ATTR_NCHAR   =21;
+               public const UInt32 OCI_ATTR_USERNAME =22;
+               public const UInt32 OCI_ATTR_PASSWORD =23;
+               public const UInt32 OCI_ATTR_STMT_TYPE  = 24;
+               public const UInt32 OCI_ATTR_INTERNAL_NAME =  25;
+               public const UInt32 OCI_ATTR_EXTERNAL_NAME =  26;
+               public const UInt32 OCI_ATTR_XID  =   27;
+               public const UInt32 OCI_ATTR_TRANS_LOCK =28;
+               public const UInt32 OCI_ATTR_TRANS_NAME= 29;
+               public const UInt32 OCI_ATTR_HEAPALLOC =30;
+               public const UInt32 OCI_ATTR_CHARSET_ID =31;
+               public const UInt32 OCI_ATTR_CHARSET_FORM =32;
+               public const UInt32 OCI_ATTR_MAXDATA_SIZE =33;
+               public const UInt32 OCI_ATTR_CACHE_OPT_SIZE =34;
+               public const UInt32 OCI_ATTR_CACHE_MAX_SIZE =35;
+               public const UInt32 OCI_ATTR_PINOPTION =36;
+               public const UInt32 OCI_ATTR_ALLOC_DURATION =37;
+               
+               public const UInt32 OCI_ATTR_PIN_DURATION =38;
+               public const UInt32 OCI_ATTR_FDO          =39;
+               public const UInt32 OCI_ATTR_POSTPROCESSING_CALLBACK =40;
+               
+               public const UInt32 OCI_ATTR_POSTPROCESSING_CONTEXT =41;
+               
+               public const UInt32 OCI_ATTR_ROWS_RETURNED =42;
+               
+               public const UInt32 OCI_ATTR_FOCBK        =43;
+               public const UInt32 OCI_ATTR_IN_V8_MODE   =44;
+               public const UInt32 OCI_ATTR_LOBEMPTY     =45;
+               public const UInt32 OCI_ATTR_SESSLANG     =46;
+
+               public const UInt32 OCI_ATTR_VISIBILITY =       47;
+               public const UInt32 OCI_ATTR_RELATIVE_MSGID     =       48;
+               public const UInt32 OCI_ATTR_SEQUENCE_DEVIATION=        49;
+
+               public const UInt32 OCI_ATTR_CONSUMER_NAME      =       50;
+               public const UInt32 OCI_ATTR_DEQ_MODE           =51;
+               public const UInt32 OCI_ATTR_NAVIGATION =       52;
+               public const UInt32 OCI_ATTR_WAIT               =       53;
+               public const UInt32 OCI_ATTR_DEQ_MSGID          =54;
+
+               public const UInt32 OCI_ATTR_PRIORITY           =55;
+               public const UInt32 OCI_ATTR_DELAY              =       56;
+               public const UInt32 OCI_ATTR_EXPIRATION =       57;     
+               public const UInt32 OCI_ATTR_CORRELATION        =       58;
+               public const UInt32 OCI_ATTR_ATTEMPTS           =59;    
+               public const UInt32 OCI_ATTR_RECIPIENT_LIST     =       60;
+               public const UInt32 OCI_ATTR_EXCEPTION_QUEUE    =61;       
+               public const UInt32 OCI_ATTR_ENQ_TIME           =62; 
+               public const UInt32 OCI_ATTR_MSG_STATE          =63;
+               
+               public const UInt32 OCI_ATTR_AGENT_NAME =       64;
+               public const UInt32 OCI_ATTR_AGENT_ADDRESS      =       65;
+               public const UInt32 OCI_ATTR_AGENT_PROTOCOL     =       66;
+
+               public const UInt32 OCI_ATTR_SENDER_ID          =68;
+               public const UInt32 OCI_ATTR_ORIGINAL_MSGID     =     69;
+
+               public const UInt32 OCI_ATTR_QUEUE_NAME =     70;
+               public const UInt32 OCI_ATTR_NFY_MSGID         =     71;
+               public const UInt32 OCI_ATTR_MSG_PROP          =     72;
+
+               public const UInt32 OCI_ATTR_NUM_DML_ERRORS    =     73;
+               public const UInt32 OCI_ATTR_DML_ROW_OFFSET    =     74;
+
+               public const UInt32 OCI_ATTR_DATEFORMAT        =     75;
+               public const UInt32 OCI_ATTR_BUF_ADDR          =     76;
+               public const UInt32 OCI_ATTR_BUF_SIZE          =     77;
+               public const UInt32 OCI_ATTR_DIRPATH_MODE      =     78;
+               public const UInt32 OCI_ATTR_DIRPATH_NOLOG     =     79;
+               public const UInt32 OCI_ATTR_DIRPATH_PARALLEL  =     80;
+               public const UInt32 OCI_ATTR_NUM_ROWS          =     81;
+
+               public const UInt32 OCI_ATTR_COL_COUNT        =      82;
+               
+               public const UInt32 OCI_ATTR_STREAM_OFFSET    =      83;
+               public const UInt32 OCI_ATTR_SHARED_HEAPALLOC  =     84;
+
+               public const UInt32 OCI_ATTR_SERVER_GROUP      =     85;
+
+               public const UInt32 OCI_ATTR_MIGSESSION       =      86;
+
+               public const UInt32 OCI_ATTR_NOCACHE           =     87;
+
+               public const UInt32 OCI_ATTR_MEMPOOL_SIZE       =    88;
+               public const UInt32 OCI_ATTR_MEMPOOL_INSTNAME    =   89;
+               public const UInt32 OCI_ATTR_MEMPOOL_APPNAME      =  90;
+               public const UInt32 OCI_ATTR_MEMPOOL_HOMENAME   =    91;
+               public const UInt32 OCI_ATTR_MEMPOOL_MODEL      =    92;
+               public const UInt32 OCI_ATTR_MODES              =    93;
+
+               public const UInt32 OCI_ATTR_SUBSCR_NAME        =    94;
+               public const UInt32 OCI_ATTR_SUBSCR_CALLBACK    =    95;
+               public const UInt32 OCI_ATTR_SUBSCR_CTX         =    96;
+               public const UInt32 OCI_ATTR_SUBSCR_PAYLOAD     =    97;
+               public const UInt32 OCI_ATTR_SUBSCR_NAMESPACE   =    98;
+
+               public const UInt32 OCI_ATTR_PROXY_CREDENTIALS   =   99;
+               public const UInt32 OCI_ATTR_INITIAL_CLIENT_ROLES = 100;
+
+               public const UInt32 OCI_ATTR_UNK           =   101;
+               public const UInt32 OCI_ATTR_NUM_COLS      =   102;
+               public const UInt32 OCI_ATTR_LIST_COLUMNS  =   103;
+               public const UInt32 OCI_ATTR_RDBA          =   104;
+               public const UInt32 OCI_ATTR_CLUSTERED     =   105;
+               public const UInt32  OCI_ATTR_PARTITIONED   =   106;
+               public const UInt32 OCI_ATTR_INDEX_ONLY    =   107; 
+               public const UInt32 OCI_ATTR_LIST_ARGUMENTS =  108; 
+               public const UInt32 OCI_ATTR_LIST_SUBPROGRAMS =109; 
+               public const UInt32 OCI_ATTR_REF_TDO        =  110; 
+               public const UInt32 OCI_ATTR_LINK           =  111; 
+               public const UInt32 OCI_ATTR_MIN            =  112; 
+               public const UInt32 OCI_ATTR_MAX            =  113; 
+               public const UInt32 OCI_ATTR_INCR           =  114; 
+               public const UInt32 OCI_ATTR_CACHE          =  115; 
+               public const UInt32 OCI_ATTR_ORDER          =  116; 
+               public const UInt32 OCI_ATTR_HW_MARK        =  117; 
+               public const UInt32 OCI_ATTR_TYPE_SCHEMA    =  118; 
+               public const UInt32 OCI_ATTR_TIMESTAMP      =  119; 
+               public const UInt32 OCI_ATTR_NUM_ATTRS      =  120; 
+               public const UInt32 OCI_ATTR_NUM_PARAMS     =  121; 
+               public const UInt32 OCI_ATTR_OBJID          =  122; 
+               public const UInt32 OCI_ATTR_PTYPE          =  123; 
+               public const UInt32 OCI_ATTR_PARAM          =  124; 
+               public const UInt32 OCI_ATTR_OVERLOAD_ID    =  125; 
+               public const UInt32 OCI_ATTR_TABLESPACE     =  126; 
+               public const UInt32 OCI_ATTR_TDO            =  127; 
+               public const UInt32 OCI_ATTR_LTYPE          =  128;   
+               public const UInt32 OCI_ATTR_PARSE_ERROR_OFFSET =129; 
+               public const UInt32 OCI_ATTR_IS_TEMPORARY   =  130;   
+               public const UInt32 OCI_ATTR_IS_TYPED       =  131;   
+               public const UInt32 OCI_ATTR_DURATION       =  132;   
+               public const UInt32 OCI_ATTR_IS_INVOKER_RIGHTS= 133;  
+               public const UInt32 OCI_ATTR_OBJ_NAME      =   134;
+               public const UInt32 OCI_ATTR_OBJ_SCHEMA    =   135;
+               public const UInt32 OCI_ATTR_OBJ_ID        =   136;
+
+               public const UInt32 OCI_ATTR_DIRPATH_SORTED_INDEX =   137; 
+
+               public const UInt32 OCI_ATTR_DIRPATH_INDEX_MAINT_METHOD= 138;
+
+               public const UInt32 OCI_ATTR_DIRPATH_FILE            =139;
+               public const UInt32 OCI_ATTR_DIRPATH_STORAGE_INITIAL =140;
+               public const UInt32 OCI_ATTR_DIRPATH_STORAGE_NEXT    =141;
+
+               public const UInt32 OCI_ATTR_TRANS_TIMEOUT     =       142; 
+               public const UInt32 OCI_ATTR_SERVER_STATUS      =       143;
+               public const UInt32 OCI_ATTR_STATEMENT         =       144; 
+               
+               public const UInt32 OCI_ATTR_NO_CACHE          =      145;
+               public const UInt32 OCI_ATTR_RESERVED_1        =      146;
+               public const UInt32 OCI_ATTR_SERVER_BUSY       =      147;
+               
+               public const UInt32 OCI_UCS2ID = 1000;
+
+               public const UInt32 OCI_SERVER_NOT_CONNECTED = 0x0; 
+               public const UInt32 OCI_SERVER_NORMAL        = 0x1; 
+
+               public const UInt32 OCI_SUBSCR_NAMESPACE_ANONYMOUS =  0;
+               public const UInt32 OCI_SUBSCR_NAMESPACE_AQ        =  1;
+               public const UInt32 OCI_SUBSCR_NAMESPACE_MAX       =  2;
+
+               public const UInt32 OCI_CRED_RDBMS  =  1;
+               public const UInt32 OCI_CRED_EXT    =  2;
+               public const UInt32 OCI_CRED_PROXY  =  3;
+
+               public const Int32 OCI_SUCCESS = 0;
+               public const Int32 OCI_SUCCESS_WITH_INFO = 1;
+               public const Int32 OCI_RESERVED_FOR_INT_USE = 200;
+               public const Int32 OCI_NO_DATA = 100;
+               public const Int32 OCI_ERROR = -1;
+               public const Int32 OCI_INVALID_HANDLE = -2;
+               public const Int32 OCI_NEED_DATA = 99;
+               public const Int32 OCI_STILL_EXECUTING = -3123;
+               public const Int32 OCI_CONTINUE = -24200;
+               
+               // from oci/include/ociap.h
+
+               //------ Platform Invoke to native c library oci.dll ----------
+/*
+               [DllImport("oci.dll")]
+               public static extern Int32 OCIEnvCreate (
+                       out IntPtr envhpp, UInt32 mode, IntPtr ctxp, 
+                       ref IntPtr malocfp, ref IntPtr ralocfp, ref IntPtr mfreefp,
+                       uint xtramemsz, out IntPtr usrmempp);
+               //sword OCIEnvCreate   ( 
+               //      OCIEnv **envhpp, ub4 mode, CONST dvoid *ctxp,
+               //      CONST dvoid *(*malocfp) (dvoid *ctxp, size_t size),
+               //      CONST dvoid *(*ralocfp) (dvoid *ctxp, dvoid *memptr, size_t newsize),
+               //      CONST void (*mfreefp) (dvoid *ctxp, dvoid *memptr)),
+               //      size_t    xtramemsz, dvoid **usrmempp);
+               // [OUT],[IN],[IN],[IN],[IN],[IN],[IN],[OUT]
+
+               [DllImport("oci.dll")]
+               public static extern Int32 OCIHandleAlloc ( 
+                       IntPtr parenth, ref IntPtr hndlpp, UInt32 type, 
+                       int xtramem_sz, ref IntPtr usrmempp);
+               //sword OCIHandleAlloc(
+               //      CONST dvoid *parenth, dvoid **hndlpp, ub4 type, 
+               //      size_t xtramem_sz, dvoid **usrmempp );
+               // [IN],OUT],[OUT],[IN],[OUT]
+
+               [DllImport("oci.dll")]
+               public static extern Int32 OCIServerAttach ( 
+                       ref IntPtr srvhp, ref IntPtr errhp, string dblink,
+                       Int32 dblink_len, UInt32 mode);
+               //sword OCIServerAttach (
+               //      OCIServer *srvhp, OCIError *errhp, CONST text *dblink,
+               //      sb4 dblink_len, ub4 mode);
+               // [IN/OUT],[IN/OUT],[IN],[IN],[IN]
+
+               [DllImport("oci.dll")]
+               public static extern Int32 OCIAttrSet ( 
+                       ref IntPtr trgthndlp, UInt32 trghndltyp, IntPtr attributep,
+                       UInt32 size, UInt32 attrtype,
+                       ref IntPtr errhp);
+               //sword OCIAttrSet ( 
+               //      dvoid *trgthndlp, ub4 trghndltyp, dvoid *attributep,
+               //      ub4 size, ub4 attrtype, OCIError *errhp );
+               // [IN/OUT], [IN/OUT], [IN], [IN], [IN], [IN/OUT]
+
+               [DllImport("oci.dll")]
+               public static extern Int32 OCISessionBegin ( 
+                       IntPtr svchp, ref IntPtr errhp, ref IntPtr usrhp,
+                       UInt32 credt, UInt32 mode);
+               //sword OCISessionBegin (
+               //      OCISvcCtx *svchp, OCIError *errhp,
+               //      OCISession *usrhp, ub4 credt, ub4 mode );
+               // [IN],[IN],[IN/OUT],[IN],[IN]
+*/
+               [DllImport("oci.dll")]
+               public static extern UInt32 OCIErrorGet ( 
+                       ref IntPtr hndlp, UInt32 recordno, ref IntPtr sqlstate,
+                       out Int32 errcodep, out string bufp, UInt32 bufsiz,
+                       UInt32 type);
+               //sword OCIErrorGet(
+               //      dvoid *hndlp, ub4 recordno, text *sqlstate,
+               //      sb4 *errcodep, text *bufp, ub4 bufsiz,
+               //      ub4 type);
+               // [IN],[IN],[OUT],[OUT],[OUT],[IN],[IN]
+
+               //------ Platform Invoke to native c library System.Data.OracleClient.ociglue.dll ----------
+               // System.Data.OracleClient.ociglue.dll is the glue between C# and oci.dll
+
+               [DllImport("System.Data.OracleClient.ociglue.dll")]
+               public static extern IntPtr OciGlue_OCIEnvCreate(ref Int32 status);
+               // void *OciGlue_OCIEnvCreate(sword *status);
+
+               [DllImport("System.Data.OracleClient.ociglue.dll")]
+               public static extern IntPtr OciGlue_OCIHandleAlloc(ref Int32 status,
+                                               IntPtr parenth, UInt32 type);
+               // dvoid *OciGlue_OCIHandleAlloc(sword *status, 
+               //              CONST dvoid *parenth, ub4 type);
+
+               [DllImport("System.Data.OracleClient.ociglue.dll")]
+               public static extern void OciGlue_OCIServerAttach(ref Int32 status,
+                               IntPtr srvhp,
+                               IntPtr errhp, string dblink, UInt32 mode);
+               // void OciGlue_OCIServerAttach(sword *status, dvoid *srvhp, 
+               //              dvoid *errhp, char *dblink, ub4 mode);
+               
+               [DllImport("System.Data.OracleClient.ociglue.dll")]
+               public static extern void OciGlue_OCIAttrSet(ref Int32 status, 
+                       IntPtr trgthndlp, UInt32 trghndltyp, 
+                       IntPtr attributep, UInt32 size, UInt32 attrtype, 
+                       IntPtr errhp);
+               //void OciGlue_OCIAttrSet(sword *status, 
+               //      dvoid *trgthndlp, ub4 trghndltyp, 
+               //      dvoid *attributep, ub4 size, ub4 attrtype, 
+               //      dvoid *errhp)
+
+               [DllImport("System.Data.OracleClient.ociglue.dll")]
+               public static extern IntPtr OciGlue_OCISessionBegin(ref Int32 status,
+                       IntPtr svchp, IntPtr errhp, IntPtr usrhp,
+                       UInt32 credt, UInt32 mode);
+               // void OciGlue_OCISessionBegin(sword *status, 
+               //      dvoid *svchp, dvoid *errhp, dvoid *usrhp,
+               //      ub4 credt, ub4 mode )   
+
+               [DllImport("System.Data.OracleClient.ociglue.dll")]
+               public static extern Int32 OciGlue_Connect (
+                       out UInt32 ociGlueConnectionHandle, 
+                       string database, 
+                       string username, string password);
+               //sword OciGlue_Connect (
+               //      uint4 oci_glue_handle, 
+               //      char *database, 
+               //      char *username, char *password);
+
+               [DllImport("System.Data.OracleClient.ociglue.dll")]
+               public static extern Int32 OciGlue_Disconnect (UInt32 connection_handle);
+               // sword OciGlue_Disconnect (ub4 connection_handle);
+
+               [DllImport("System.Data.OracleClient.ociglue.dll")]
+               public static extern Int32 OciGlue_PrepareAndExecuteNonQuerySimple (
+                       UInt32 ociGlueConnectionHandle,
+                       string sqlstmt, out int found);
+               //sword OciGlue_PrepareAndExecuteNonQuerySimple (
+               //      guint4 oci_glue_handle, 
+               //      char *sqlstmt, int *found);
+
+               [DllImport("System.Data.OracleClient.ociglue.dll")]
+               public static extern UInt32 OciGlue_ConnectionCount();
+               //guint OciGlue_ConnectionCount();
+
+               [DllImport("System.Data.OracleClient.ociglue.dll")]
+               public static extern IntPtr OciGlue_CheckError (Int32 status, UInt32 connection_handle);
+               // CONST text *OciGlue_CheckError (sword status, ub4 connection_handle);
+
+               [DllImport("System.Data.OracleClient.ociglue.dll")]
+               public static extern void Free (IntPtr obj);
+               // void Free (void *obj);
+
+               // --------- Methods --------------------------------
+
+               public string OciGlueCheckError(Int32 status) {
+                       IntPtr intptrMsg = IntPtr.Zero;
+                       string strMsg = "";
+                       string msg = "";
+                       
+                       intptrMsg = OciGlue_CheckError(status, ociGlueConnectionHandle);
+                       strMsg = Marshal.PtrToStringAnsi(intptrMsg);
+                       if(strMsg != null) {
+                               msg = String.Copy(strMsg);
+                               Free(intptrMsg);
+                       }
+
+                       return msg;
+               }
+
+               // for debug
+               public static void IsObjectNull(string usedfor, string name, object obj) {
+                       string exists = "";
+                       if(obj == null) {
+                               exists = "is null";
+                       }
+                       else {
+                               exists = "is not null";
+                               if(obj is IntPtr) {
+                                       IntPtr intptr = (IntPtr) obj;
+                                       if(intptr == IntPtr.Zero)
+                                               exists = exists + " - IntPtr is IntPtr.Zero";
+                                       else
+                                               exists = exists + " - IntPtr is not IntPtr.Zero";                                    
+                               }
+                       }
+                       string outstring = 
+                               "UsedFor: " + usedfor + 
+                               " Object name: " + name + 
+                               " exists: " + exists; 
+               }
+
+               public Int32 OciGlueConnect(OracleConnectionInfo conInfo) {
+
+                       Int32 status = 0;
+                       
+                       database = conInfo.Database;
+                       username = conInfo.Username;
+                       password = conInfo.Password;
+
+                       Console.WriteLine("OciGlue_Connect");
+                       status = OciGlue.OciGlue_Connect (out ociGlueConnectionHandle,
+                               database, username, password);
+                       Console.WriteLine("  Handle: " + ociGlueConnectionHandle);
+
+                       if(status != 0) {
+                               CheckStatus(status);
+                       }               
+                                               
+                       return status;
+               }
+
+               public Int32 OciGlueDisconnect() {
+
+                       Int32 status = 0;
+                       string msg = "";
+                       
+                       Console.WriteLine("OciGlue_Disconnect");
+                       Console.WriteLine("  Handle: " + ociGlueConnectionHandle);
+                       status = OciGlue.OciGlue_Disconnect (ociGlueConnectionHandle);
+                       ociGlueConnectionHandle = 0;
+                       
+                       if(status != 0) {
+                               msg = CheckStatus(status);
+                               throw new Exception(msg);
+                       }
+                                               
+                       return status;
+               }
+
+
+               // Helper methods
+               public Int32 PrepareAndExecuteNonQuerySimple(string sql) 
+               {
+                       Int32 status = 0;
+                       int found = 0;
+
+                       Console.WriteLine("PrepareAndExecuteNonQuerySimple");
+                       status = OciGlue_PrepareAndExecuteNonQuerySimple (
+                               ociGlueConnectionHandle, sql, out found);
+
+                       Console.WriteLine("  Handle: " + ociGlueConnectionHandle +
+                               " Found: " + found.ToString());
+
+                       CheckStatus(status);
+                       return status;
+               }
+
+               // currently not used
+               public void Connect() 
+               {       
+                       Int32 status = 0;
+                       IntPtr nothing = IntPtr.Zero;
+                       // initialize the mode to be the threaded and object environment
+                       Console.WriteLine();
+                       // OCI_THREADED|OCI_OBJECT
+                       // OCI_DEFAULT
+                       // OCI_THREADED|OCI_OBJECT|OCI_NO_UCB
+                       //status = OCIEnvCreate(out myenvhp, OCI_DEFAULT|OCI_NO_UCB, 
+                       //      IntPtr.Zero, 
+                       //      ref nothing, ref nothing, ref nothing, 0, 
+                       //      out nothing);
+                       myenvhp = OciGlue_OCIEnvCreate(ref status);
+                       IsObjectNull("Result from OCIEnvCreate for initialize the mode for environment","myenvhp",myenvhp);
+                       CheckStatus(status);
+
+                       // allocate a server handle
+                       Console.WriteLine();
+                       //status = OCIHandleAlloc (myenvhp, ref mysrvhp,
+                       //      OCI_HTYPE_SERVER, 0, ref nothing);
+                       mysrvhp = OciGlue_OCIHandleAlloc(ref status,
+                                               myenvhp, OCI_HTYPE_SERVER);
+                       IsObjectNull("Result from OCIHandleAlloc for server handle","mysrvhp",mysrvhp);
+                       CheckStatus(status);
+
+                       // allocate an error handle
+                       Console.WriteLine();
+                       //status = OCIHandleAlloc (myenvhp, ref myerrhp,
+                       //      OCI_HTYPE_ERROR, 0, ref nothing);
+                       myerrhp = OciGlue_OCIHandleAlloc(ref status,
+                                               myenvhp, OCI_HTYPE_ERROR);
+                       IsObjectNull("Result from OCIHandleAlloc for error handle","myerrhp",myerrhp);
+                       CheckError(status);
+
+                       // create a server context
+                       Console.WriteLine();
+                       string dblink = "DANSDB";
+                       //mysrvhp = OciGlueMallocType (OciGlueType_OCIServer);
+                       //status = OCIServerAttach (ref mysrvhp, ref myerrhp, dblink, 
+                       //      dblink.Length, OCI_DEFAULT);
+                       OciGlue_OCIServerAttach(ref status,
+                               mysrvhp, myerrhp, dblink, OCI_DEFAULT);
+                       IsObjectNull("Result from OCIServerAttach for server context","mysrvhp",mysrvhp);
+                       CheckError(status);
+
+                       // allocate a service handle
+                       Console.WriteLine();
+                       //status = OCIHandleAlloc (myenvhp, ref mysvchp,
+                       //      OCI_HTYPE_SVCCTX, 0, ref nothing);
+                       mysvchp = OciGlue_OCIHandleAlloc(ref status,
+                               myenvhp, OCI_HTYPE_SVCCTX);
+                       IsObjectNull("Result from OCIHandleAlloc for service handle","myenvhp",mysvchp);
+                       CheckError(status);
+                       Console.Out.Flush();
+
+                       // set the server attribute in the service context handle
+                       Console.WriteLine();
+                       Console.Out.Flush();
+                       //status = OCIAttrSet (
+                       //      ref mysvchp, OCI_HTYPE_SVCCTX, 
+                       //      mysrvhp, 0, OCI_ATTR_SERVER, ref myerrhp);
+                       OciGlue_OCIAttrSet(ref status,
+                               mysvchp, OCI_HTYPE_SVCCTX, 
+                               mysrvhp, (UInt32) 0, OCI_ATTR_SERVER, myerrhp);
+
+                       IsObjectNull("Result from OCIAttrSet for server attribute","mysvchp",mysvchp);
+                       Console.WriteLine("status is: " + status.ToString());
+                       CheckError(status);
+
+                       // allocate a user session handle
+                       Console.WriteLine(" blah ");
+                       Console.Out.Flush();
+                       //status = OCIHandleAlloc (myenvhp, ref myusrhp,
+                       //      OCI_HTYPE_SESSION, 0, ref nothing);
+                       myusrhp = OciGlue_OCIHandleAlloc(ref status,
+                               myenvhp, OCI_HTYPE_SESSION);
+                       IsObjectNull("Result from OCIHandleAlloc for user session","myusrhp",myusrhp);
+                       CheckError(status);
+
+                       // set username attribute in user session handle
+                       Console.WriteLine();
+                       string username = "scott";
+                       IntPtr intptrUsername = Marshal.StringToHGlobalAnsi( username );
+                       //status = OCIAttrSet (
+                       //      ref myusrhp, OCI_HTYPE_SESSION,
+                       //      intptrUsername, (UInt32) username.Length,
+                       //      OCI_ATTR_USERNAME, ref myerrhp);
+                       OciGlue_OCIAttrSet(ref status,
+                               myusrhp, OCI_HTYPE_SESSION,
+                               intptrUsername, (UInt32) username.Length,
+                               OCI_ATTR_USERNAME, myerrhp);
+                       IsObjectNull("Result from OCIAttrSet for username","myusrhp",myusrhp);
+                       CheckError(status);
+
+                       // set password attribute in user session handle
+                       Console.WriteLine();
+                       string password = "tiger";
+                       IntPtr intptrPassword = Marshal.StringToHGlobalAnsi( password );
+                       //status = OCIAttrSet (ref myusrhp, 
+                       //      OCI_HTYPE_SESSION,
+                       //      intptrPassword, (UInt32) password.Length,
+                       //      OCI_ATTR_PASSWORD, ref myerrhp);
+                       OciGlue_OCIAttrSet(ref status,
+                               myusrhp,
+                               OCI_HTYPE_SESSION,
+                               intptrPassword, (UInt32) password.Length,
+                               OCI_ATTR_PASSWORD, myerrhp);
+                       IsObjectNull("Result from OCIAttrSet for password","myusrhp",myusrhp);
+                       CheckError(status);
+                       
+                       // begin session
+                       Console.WriteLine();
+                       //status = OCISessionBegin (mysvchp, ref myerrhp, ref myusrhp,
+                       //      OCI_CRED_RDBMS, OCI_DEFAULT);
+                       OciGlue_OCISessionBegin(ref status,
+                               mysvchp, myerrhp, myusrhp,
+                               OCI_CRED_RDBMS, OCI_DEFAULT);
+                       IsObjectNull("Result from OCISessionBegin","myusrhp",myusrhp);
+                       CheckError(status);
+
+                       // FIXME: check for errors to make sure
+                       //        authentication was successful
+
+                       // set the user session attribute in the service context handle
+                       Console.WriteLine();
+                       //status = OCIAttrSet (ref mysvchp, 
+                       //      OCI_HTYPE_SVCCTX, 
+                       //      myusrhp, 0, OCI_ATTR_SESSION, ref myerrhp);
+                       OciGlue_OCIAttrSet(ref status,
+                               mysvchp, 
+                               OCI_HTYPE_SVCCTX, 
+                               myusrhp, 0, OCI_ATTR_SESSION, myerrhp);
+                       IsObjectNull("Result from OCIAttrSet for user session attribute in service context handle","myusrhp",myusrhp);
+                       CheckError(status);
+
+                       Console.WriteLine();
+                       // FIXME: check for errors after each call
+
+                       // FIXME: need to properly free resources, such as,
+                       //        intptrUsername, intptrPassword, etc...
+                       
+                       // Wait
+                       Console.WriteLine("Waiting... Press Enter to continue.");
+                       string s = Console.ReadLine();
+                       Console.WriteLine();
+                       Console.WriteLine("Exiting...");
+               }
+
+               public string CheckStatus(Int32 status) {
+                       return CheckError(status);
+               }
+
+               // OCIError errhp, Int32 status
+               public string CheckError(Int32 status) {                
+                       string msg = "";
+                       Int32 errcode = 0;
+
+                       switch (status) {
+                       case OCI_SUCCESS:
+                               msg = "Succsss";
+                               break;
+                       case OCI_SUCCESS_WITH_INFO:
+                               msg = "Error - OCI_SUCCESS_WITH_INFO";
+                               break;
+                       case OCI_NEED_DATA:
+                               msg = "Error - OCI_NEED_DATA";
+                               break;
+                       case OCI_NO_DATA:
+                               msg = "Error - OCI_NODATA";
+                               break;
+                       case OCI_ERROR:
+                               if(ociGlueConnectionHandle != 0) {
+                                       string errmsg = OciGlueCheckError(status);
+                                       //OCIErrorGet(ref errhp, 1, ref nullString, out errcode,
+                                       //      out errbuf, (UInt32) errbuf.Length, OCI_HTYPE_ERROR);
+                                       msg = "OCI Error - errcode: " + errcode.ToString() + " errbuf: " + errmsg;
+                               }
+                               else
+                                       msg = "OCI Error!";
+                               break;
+                       case OCI_INVALID_HANDLE:
+                               msg = "Error - OCI_INVALID_HANDLE";
+                               break;
+                       case OCI_STILL_EXECUTING:
+                               msg = "Error - OCI_STILL_EXECUTE";
+                               break;
+                       case OCI_CONTINUE:
+                               msg = "Error - OCI_CONTINUE";
+                               break;
+                       default:
+                               msg = "Default";
+                               break;
+                       }
+                       return msg;
+               }
+       }
+}
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlueLib_BCC_win32.make b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlueLib_BCC_win32.make
new file mode 100755 (executable)
index 0000000..78e374f
--- /dev/null
@@ -0,0 +1,22 @@
+#\r
+# Makefile for System.Data.OracleClient.gluelib.dll\r
+# using Borland C++\r
+#\r
+# This Makefile untested for Borland C++\r
+# a free Borland C++ 5.5 command-line \r
+# compiler can be downloaded\r
+# from http://www.borland.com/\r
+#\r
+\r
+all: System.Data.OracleClient.ociglue.dll\r
+\r
+System.Data.OracleClient.ociglue.dll: ociglue.c ocglue.h\r
+       set BINC=%BORLAND_HOME%\include \r
+       set BLIB=%BORLAND_HOME%\lib\r
+       %BORLAND_HOME%\bin\bcc32 -w-pro -c -a4 -DOCI_BORLAND -I. -I%BINC% -I..\include ociglue.c -I..\..\cygwin\home\DanielMorgan\mono\install\include\glib-2.0 -I..\..\cygwin\home\DanielMorgan\mono\install\lib\glib-2.0\include\r
+       echo LIBRARY System.Data.OracleClient.ociglue.dll > System.Data.OracleClient.ociglue.def\r
+       echo DESCRIPTION 'System.Data.OracleClient.ociglue.dll' >> System.Data.OracleClient.ociglue.def\r
+       echo EXPORTS >> System.Data.OracleClient.ociglue.def\r
+       echo _qxiqtbi=qxiqtbi >> System.Data.OracleClient.ociglue.def\r
+       %BORLAND_HOME%\bin\bcc32 -tWD -L%BLIB% -L..\lib\bc System.Data.OracleClient.ociglue.obj oci.lib bidsfi.lib glib-2.0.lib intl.lib iconv.lib\r
+       :end\r
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlueLib_MSVC_win32.make b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlueLib_MSVC_win32.make
new file mode 100755 (executable)
index 0000000..6e801ae
--- /dev/null
@@ -0,0 +1,51 @@
+# \r
+# ociglue.c - provides glue between \r
+#             managed C#/.NET System.Data.OracleClient.dll and \r
+#             unmanaged native c library oci.dll\r
+#             to be used in Mono System.Data.OracleClient as\r
+#             the Oracle 8i data provider.\r
+#\r
+# Builds unmanaged C library System.Data.OracleClient.ociglue.dll\r
+#\r
+# Author: \r
+#      Daniel Morgan <danmorg@sc.rr.com>\r
+#       \r
+# Copyright (C) Daniel Morgan, 2002\r
+#\r
+#\r
+# Licensed under the MIT/X11 License.\r
+#\r
+\r
+# builds with command-line Microsoft C 7.0 using cl and nmake\r
+# builds using the MSVC OCI import library oci.lib (lib that exports symbols from oci.dll)\r
+\r
+# GLIB 2.0 for Win32 found at http://www.gimp.org/win32\r
+\r
+PROJECT = System.Data.OracleClient.ociglue.dll\r
+\r
+GLIB_CFLAGS = -IF:\cygwin\home\DanielMorgan\mono\install\include\glib-2.0 -IF:\cygwin\home\DanielMorgan\mono\install\lib\glib-2.0\include\r
+GLIB_LIBS = /LIBPATH:F:\cygwin\home\DanielMorgan\mono\install\lib glib-2.0.lib intl.lib iconv.lib\r
+\r
+# Oracle 8i OCI\r
+ORACLE_CFLAGS = -I%ORACLE_HOME%\oci\include\r
+ORACLE_LIBS = /LIBPATH:%ORACLE_HOME%\oci\lib\msvc oci.lib\r
+\r
+OCIGLUELIB_CFLAGS = -I. -D_DLL -D_MT $(ORACLE_CFLAGS) $(GLIB_CFLAGS)\r
+OCIGLUELIB_LIBS = kernel32.lib msvcrt.lib $(ORACLE_LIBS) $(GLIB_LIBS)\r
+OCIGLUELIB_LINKFLAGS = /link /Dll /out:System.Data.OracleClient.ociglue.dll /nod:libc $(OCIGLUELIB_LIBS) $(OCIGLUELIB_EXPORTS)\r
+\r
+OCIGLUELIB_EXPORTS = /export:OciGlue_Connect /export:OciGlue_PrepareAndExecuteNonQuerySimple /export:OciGlue_Disconnect /export:OciGlue_ConnectionCount /export:OciGlue_CheckError /export:Free\r
+\r
+SOURCE_H_FILES = ociglue.h\r
+SOURCE_C_FILES = ociglue.c\r
+\r
+all: System.Data.OracleClient.ociglue.dll\r
+\r
+$(SOURCE_C_FILES) : $(SOURCE_H_FILES)\r
+\r
+System.Data.OracleClient.ociglue.dll : $(SOURCE_C_FILES)\r
+       cl  $(OCIGLUELIB_CFLAGS) $(SOURCE_C_FILES) $(OCIGLUELIB_LINKFLAGS)\r
+       \r
+clean:\r
+       rm -f ociglue.dll\r
+       rm -f ociglue.o\r
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleCommand.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleCommand.cs
new file mode 100755 (executable)
index 0000000..90d5f82
--- /dev/null
@@ -0,0 +1,77 @@
+// 
+// OracleCommand.cs
+//
+// Part of the Mono class libraries at
+// mcs/class/System.Data.OracleClient/System.Data.OracleClient
+//
+// Assembly: System.Data.OracleClient.dll
+// Namespace: System.Data.OracleClient
+//
+// Author: Daniel Morgan <danmorg@sc.rr.com>
+//
+// Copyright (C) Daniel Morgan, 2002
+//
+// Licensed under the MIT/X11 License.
+//
+
+using System;
+using System.Data;
+using System.Data.OracleClient.OCI;
+
+namespace System.Data.OracleClient
+{
+       public class OracleCommand
+       {
+               string sql = "";
+               OracleConnection conn = null;
+
+               public OracleCommand ()
+               {
+                       
+               }
+
+               public int ExecuteNonQuery () 
+               {
+                       int rowsAffected = -1;
+
+                       if(conn == null)
+                               throw new Exception("Connection is null");
+                       if(conn.State != ConnectionState.Open)
+                               throw new Exception("ConnectionState not Open");
+                       if(sql.Equals(""))
+                               throw new Exception("CommandText is StringEmpty");
+
+                       Int32 status;
+                       status = conn.Oci.PrepareAndExecuteNonQuerySimple (sql);
+                       if(status != 0) {
+                               string statusText;
+                               statusText = conn.Oci.CheckError(status);
+                               string msg = 
+                                       "SQL Error: [" + 
+                                       sql + "] " +
+                                       statusText;
+                               throw new Exception(msg);
+                       }
+
+                       return rowsAffected;
+               }
+
+               public string CommandText {
+                       get {
+                               return sql;
+                       }
+                       set {
+                               sql = value;
+                       }
+               }
+
+               public OracleConnection Connection {
+                       get {
+                               return conn;
+                       }
+                       set {
+                               conn = value;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleConnection.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleConnection.cs
new file mode 100755 (executable)
index 0000000..272377a
--- /dev/null
@@ -0,0 +1,180 @@
+//
+// OracleConnection.cs 
+//
+// Part of the Mono class libraries at
+// mcs/class/System.Data.OracleClient/System.Data.OracleClient
+//
+// Assembly: System.Data.OracleClient.dll
+// Namespace: System.Data.OracleClient
+//
+// Author: Daniel Morgan <danmorg@sc.rr.com>
+//
+// Copyright (C) Daniel Morgan, 2002
+//
+// Original source code for setting ConnectionString 
+// by Tim Coleman <tim@timcoleman.com>
+//
+// Copyright (C) Tim Coleman, 2002
+//
+// Licensed under the MIT/X11 License.
+//
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Data;
+using System.Data.OracleClient.OCI;
+using System.Text;
+
+namespace System.Data.OracleClient {
+       internal struct OracleConnectionInfo {
+               public string Username;
+               public string Password;
+               public string Database;
+       }
+
+       public class OracleConnection {
+               private OciGlue oci;
+               private ConnectionState state;
+               private OracleConnectionInfo conInfo;
+               private string connectionString = "";
+
+               public OracleConnection () {
+                       state = ConnectionState.Closed;
+                       oci = new OciGlue ();
+               }
+
+               public OracleConnection (string connectionString) : this() {
+                       this.connectionString = connectionString;
+               }
+
+               public void Open () {
+                       Int32 status;
+                       
+                       status = oci.OciGlueConnect(conInfo);
+                       if(status != 0)
+                               throw new Exception("Error: Unable to connect: " + status.ToString());
+                       else
+                               state = ConnectionState.Open;
+               }
+
+               public void Close () {
+                       Int32 status = oci.OciGlueDisconnect();
+                       state = ConnectionState.Closed;
+                       if(status != 0)
+                               throw new Exception("Error: Unable to connect: " + status.ToString());
+               }
+
+               // only for DEBUG purposes
+               public static uint ConnectionCount {
+                       get {
+                               uint count = OciGlue.OciGlue_ConnectionCount();
+                               uint cnt = count;
+                               return cnt;
+                       }
+               }
+
+               public ConnectionState State {
+                       get {
+                               return state;
+                       }
+               }
+
+               public string ConnectionString {
+                       get {
+                               return connectionString;
+                       }
+                       set {
+                               SetConnectionString(value);
+                       }
+               }
+
+               internal OciGlue Oci {
+                       get {
+                               return oci;
+                       }
+               }
+
+               void SetConnectionString (string connectionString) {
+                       this.connectionString = connectionString;
+                       conInfo.Username = "";
+                       conInfo.Database = "";
+                       conInfo.Password = "";
+
+                       if (connectionString == String.Empty)
+                               return;
+                       
+                       connectionString += ";";
+                       NameValueCollection parameters = new NameValueCollection ();
+
+                       bool inQuote = false;
+                       bool inDQuote = false;
+
+                       string name = String.Empty;
+                       string value = String.Empty;
+                       StringBuilder sb = new StringBuilder ();
+
+                       foreach (char c in connectionString) {
+                               switch (c) {
+                               case '\'':
+                                       inQuote = !inQuote;
+                                       break;
+                               case '"' :
+                                       inDQuote = !inDQuote;
+                                       break;
+                               case ';' :
+                                       if (!inDQuote && !inQuote) {
+                                               if (name != String.Empty && name != null) {
+                                                       value = sb.ToString ();
+                                                       parameters [name.ToUpper ().Trim ()] = value.Trim ();
+                                               }
+                                               name = String.Empty;
+                                               value = String.Empty;
+                                               sb = new StringBuilder ();
+                                       }
+                                       else
+                                               sb.Append (c);
+                                       break;
+                               case '=' :
+                                       if (!inDQuote && !inQuote) {
+                                               name = sb.ToString ();
+                                               sb = new StringBuilder ();
+                                       }
+                                       else
+                                               sb.Append (c);
+                                       break;
+                               default:
+                                       sb.Append (c);
+                                       break;
+                               }
+                       }
+
+                       SetProperties (parameters);
+               }
+
+               private void SetProperties (NameValueCollection parameters) {   
+                       string value;
+                       foreach (string name in parameters) {
+                               value = parameters[name];
+
+                               switch (name) {
+                               case "DATA SOURCE" :
+                               case "DATABASE" :
+                                       // set Database property
+                                       conInfo.Database = value;
+                                       break;
+                               case "PASSWORD" :
+                               case "PWD" :
+                                       conInfo.Password = value;
+                                       break;
+                               case "UID" :
+                               case "USER ID" :
+                                       conInfo.Username = value;
+                                       break;
+                               default:
+                                       throw new Exception("Connection parameter not supported.");
+                               }
+                       }
+               }
+       }
+}
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/ociglue.c b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/ociglue.c
new file mode 100755 (executable)
index 0000000..f0f76ff
--- /dev/null
@@ -0,0 +1,385 @@
+// 
+// ociglue.c -  provides glue between 
+//              managed C#/.NET System.Data.OracleClient.dll and 
+//              unmanaged native c library oci.dll
+//              to be used in Mono System.Data.OracleClient as
+//              the Oracle 8i data provider.
+//  
+// Part of unmanaged C library System.Data.OracleClient.ociglue.dll
+//
+// Part of the Mono class libraries at
+// mcs/class/System.Data.OracleClient/System.Data.OracleClient.OCI
+//
+// Assembly: System.Data.OracleClient.dll
+// Namespace: System.Data.OracleClient
+// 
+// Author: 
+//     Daniel Morgan <danmorg@sc.rr.com>
+//         
+// Copyright (C) Daniel Morgan, 2002
+// 
+// Licensed under the MIT/X11 License.
+//
+
+#include "ociglue.h"
+
+GSList *conlist = NULL;
+
+oci_glue_connection_t *find_connection (ub4 connection_handle);
+GSList *find_connection_node (ub4 connection_handle);
+
+sword OciGlue_Connect (ub4 *connection_handle, 
+                                          char *database, char *username, char *password)
+{
+       sword status;
+       oci_glue_connection_t *oci_glue_handle;
+
+       *connection_handle = 0;
+
+       oci_glue_handle = g_new(oci_glue_connection_t, 1);
+
+       *connection_handle = (ub4) oci_glue_handle;
+       
+       oci_glue_handle->connection_handle = *connection_handle;
+       oci_glue_handle->envhp  = (OCIEnv *) 0;
+       oci_glue_handle->errhp  = (OCIError *) 0;
+       oci_glue_handle->authp  = (OCISession *) 0;
+       oci_glue_handle->srvhp  = (OCIServer *) 0;
+       oci_glue_handle->svchp  = (OCISvcCtx *) 0;
+       oci_glue_handle->stmthp = (OCIStmt *) 0;
+
+       conlist = g_slist_append (conlist, oci_glue_handle);
+
+       status = OCIEnvCreate(&(oci_glue_handle->envhp), OCI_DEFAULT, (dvoid *)0, 
+                               0, 0, 0, (size_t) 0, (dvoid **)0);
+    
+       if(status != 0) {
+               OciGlue_Disconnect (*connection_handle);
+               return status;
+       }
+
+       status = OCIHandleAlloc( (dvoid *) (oci_glue_handle->envhp), 
+                                       (dvoid **) &(oci_glue_handle->errhp), 
+                                       OCI_HTYPE_ERROR, 
+                   (size_t) 0, (dvoid **) 0);
+
+       if(status != 0) {
+               OciGlue_Disconnect (*connection_handle);
+               return status;
+       }
+
+  /* server contexts */
+  status = OCIHandleAlloc( (dvoid *) (oci_glue_handle->envhp), 
+                                       (dvoid **) &(oci_glue_handle->srvhp), OCI_HTYPE_SERVER,
+                   (size_t) 0, (dvoid **) 0);
+
+       if(status != 0) {
+               OciGlue_Disconnect (*connection_handle);
+               return status;
+       }
+
+  status = OCIHandleAlloc( (dvoid *) (oci_glue_handle->envhp), 
+                                       (dvoid **) &(oci_glue_handle->svchp), OCI_HTYPE_SVCCTX,
+                   (size_t) 0, (dvoid **) 0);
+
+       if(status != 0) {
+               OciGlue_Disconnect (*connection_handle);
+               return status;
+       }
+
+  status = OCIServerAttach(oci_glue_handle->srvhp, 
+                                       oci_glue_handle->errhp, (text *)"", strlen(""), 0);
+
+       if(status != 0) {
+               OciGlue_Disconnect (*connection_handle);
+               return status;
+       }
+
+  status = OCIAttrSet( (dvoid *) (oci_glue_handle->svchp), OCI_HTYPE_SVCCTX, 
+                                       (dvoid *) (oci_glue_handle->srvhp), 
+                    (ub4) 0, OCI_ATTR_SERVER, 
+                                       (OCIError *) (oci_glue_handle->errhp));
+
+       if(status != 0) {
+               OciGlue_Disconnect (*connection_handle);
+               return status;
+       }
+
+  status = OCIHandleAlloc((dvoid *) (oci_glue_handle->envhp), 
+                                               (dvoid **)&(oci_glue_handle->authp), 
+                        (ub4) OCI_HTYPE_SESSION, (size_t) 0, (dvoid **) 0);
+
+       if(status != 0) {
+               OciGlue_Disconnect (*connection_handle);
+               return status;
+       }
+
+  status = OCIAttrSet((dvoid *) oci_glue_handle->authp, (ub4) OCI_HTYPE_SESSION,
+                 (dvoid *) username, (ub4) strlen((char *)username),
+                 (ub4) OCI_ATTR_USERNAME, oci_glue_handle->errhp);
+  
+       if(status != 0) {
+               OciGlue_Disconnect (*connection_handle);
+               return status;
+       }
+
+  status = OCIAttrSet((dvoid *) oci_glue_handle->authp, (ub4) OCI_HTYPE_SESSION,
+                 (dvoid *) password, (ub4) strlen((char *)password),
+                 (ub4) OCI_ATTR_PASSWORD, oci_glue_handle->errhp);
+
+       if(status != 0) {
+               OciGlue_Disconnect (*connection_handle);
+               return status;
+       }
+
+  status = OCISessionBegin ( oci_glue_handle->svchp,  
+                                               oci_glue_handle->errhp, 
+                                               oci_glue_handle->authp, 
+                                               OCI_CRED_RDBMS, 
+                                               (ub4) OCI_DEFAULT);
+
+       if(status != 0) {
+               OciGlue_Disconnect (*connection_handle);
+               return status;
+       }
+
+  status = OCIAttrSet((dvoid *) (oci_glue_handle->svchp), 
+                                       (ub4) OCI_HTYPE_SVCCTX,
+                   (dvoid *) (oci_glue_handle->authp), (ub4) 0,
+                   (ub4) OCI_ATTR_SESSION, 
+                                  oci_glue_handle->errhp); 
+
+       if(status != 0) {
+               OciGlue_Disconnect (*connection_handle);
+               return status;
+       }
+
+       return status;
+}
+
+sword OciGlue_PrepareAndExecuteNonQuerySimple (ub4 connection_handle,
+                                                                       char *sqlstmt, int *found)
+{
+       sword status = 0;
+       oci_glue_connection_t *oci_glue_handle;
+       void *node;
+       GSList *con_node;
+       
+               
+       if(!conlist)
+               return -1;
+
+       if(connection_handle == 0)
+               return -2;
+
+       if(!found)
+               return -1;
+
+       *found = 0;
+
+       oci_glue_handle = find_connection (connection_handle);
+
+       if(!oci_glue_handle)
+               return -1;
+       else
+               *found = oci_glue_handle->connection_handle;
+
+       if(!(oci_glue_handle->stmthp)) {
+               status = OCIHandleAlloc((dvoid *) (oci_glue_handle->envhp), 
+                                               (dvoid **) &(oci_glue_handle->stmthp),
+                                   (ub4)OCI_HTYPE_STMT, (CONST size_t) 0, (dvoid **) 0);
+
+               if(status != 0)
+                       return status;
+       }
+       
+       status = OCIStmtPrepare((oci_glue_handle->stmthp), 
+                                               oci_glue_handle->errhp, 
+                                               (CONST OraText *)sqlstmt, (ub4)strlen(sqlstmt),
+                    (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT);
+
+       if(status != 0)
+               return status;
+
+       status = OCIStmtExecute(oci_glue_handle->svchp, 
+                                               oci_glue_handle->stmthp, 
+                                               oci_glue_handle->errhp, 
+                                               (ub4) 1, (ub4) 0, 
+               (CONST OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT);
+
+       return status;
+}
+
+sword OciGlue_Disconnect (ub4 connection_handle)
+{
+       sword status = -1;
+       
+       GSList *node = NULL;
+       oci_glue_connection_t *oci_glue_handle = NULL;
+
+       if(connection_handle == 0)
+               return -2;
+
+       if(conlist == NULL)
+               return -2;
+
+       oci_glue_handle = find_connection (connection_handle);
+
+       if(oci_glue_handle) {
+               
+               status = OCISessionEnd(oci_glue_handle->svchp, 
+                       oci_glue_handle->errhp, oci_glue_handle->authp, (ub4) 0);
+  
+               status = OCIServerDetach(oci_glue_handle->srvhp, oci_glue_handle->errhp, 
+                       (ub4) OCI_DEFAULT);
+
+               if (oci_glue_handle->srvhp)
+                       status = OCIHandleFree((dvoid *) oci_glue_handle->srvhp, (ub4) OCI_HTYPE_SERVER);
+
+               if (oci_glue_handle->svchp)
+                       status = OCIHandleFree((dvoid *) oci_glue_handle->svchp, (ub4) OCI_HTYPE_SVCCTX);
+
+               if (oci_glue_handle->errhp)
+                       status = OCIHandleFree((dvoid *) oci_glue_handle->errhp, (ub4) OCI_HTYPE_ERROR);
+
+               if (oci_glue_handle->authp)
+                       status = OCIHandleFree((dvoid *) oci_glue_handle->authp, (ub4) OCI_HTYPE_SESSION);
+
+               if (oci_glue_handle->stmthp)
+                       status = OCIHandleFree((dvoid *) oci_glue_handle->stmthp, (ub4) OCI_HTYPE_STMT);
+
+               if (oci_glue_handle->envhp)
+                       status = OCIHandleFree((dvoid *) oci_glue_handle->envhp, (ub4) OCI_HTYPE_ENV);
+       }
+       node = find_connection_node (connection_handle);
+       if(node) {
+                       conlist = g_slist_remove_link (conlist, node);
+                       g_slist_free_1 (node);
+                       node = NULL;
+       }
+       if(oci_glue_handle) {
+               g_free (oci_glue_handle);
+               oci_glue_handle = NULL;
+       }
+
+       status = 0;
+       
+  return status;
+}
+
+guint OciGlue_ConnectionCount ()
+{
+       return g_slist_length (conlist);
+}
+
+CONST text *OciGlue_CheckError (sword status, ub4 connection_handle)
+{
+       oci_glue_connection_t *oci_glue_handle = NULL;
+       text *errbuf;
+       sb4 errcode = 0;
+       size_t errbuf_size;
+       
+       if(!conlist)
+               return NULL;
+
+       if(connection_handle == 0)
+               return NULL;
+
+       oci_glue_handle = find_connection (connection_handle);
+
+       if(!oci_glue_handle)
+               return NULL;
+
+       errbuf_size = sizeof(text) * 512;
+       errbuf = (text *) malloc(errbuf_size);
+
+       OCIErrorGet((dvoid *)(oci_glue_handle->errhp), 
+               (ub4) 1, (text *) NULL, &errcode,
+               errbuf, (ub4) errbuf_size, OCI_HTYPE_ERROR);
+       
+       return errbuf;
+}
+
+void Free (void *obj)
+{
+       free(obj);
+}
+
+GSList *find_connection_node (ub4 connection_handle)
+{
+       GSList *node = NULL;
+       oci_glue_connection_t *oci_glue_handle = NULL;
+
+       for(node = conlist;
+               node;
+               node = node->next) {
+
+               oci_glue_handle = (oci_glue_connection_t *) node->data;
+               if(oci_glue_handle->connection_handle == connection_handle)
+                       return node;
+       }
+       return NULL;
+}
+
+oci_glue_connection_t *find_connection (ub4 connection_handle)
+{      
+       GSList *node = NULL;
+       oci_glue_connection_t *oci_glue_handle = NULL;
+
+       for(node = conlist;
+               node;
+               node = node->next) {
+
+               oci_glue_handle = (oci_glue_connection_t *) node->data; 
+               if(oci_glue_handle->connection_handle == connection_handle)
+                       return oci_glue_handle;         
+       }
+       return NULL;
+}
+
+/* For some reason, I was unable to get these to work. */
+/*
+dvoid *OciGlue_OCIEnvCreate(sword *status)
+{
+       OCIEnv *myenvhp = NULL;
+
+       *status = OCIEnvCreate(&myenvhp, OCI_THREADED|OCI_OBJECT, (dvoid *)0, 
+                               0, 0, 0, (size_t) 0, (dvoid **)0);
+
+       return myenvhp;
+}
+
+dvoid *OciGlue_OCIHandleAlloc(sword *status, CONST dvoid *parenth, ub4 type)
+{
+       dvoid *hndlpp = NULL;
+        
+       *status = OCIHandleAlloc ((dvoid *)parenth, (dvoid **)&hndlpp,
+                                                       type, 0, (dvoid **) 0);
+
+       return hndlpp;
+}
+
+void OciGlue_OCIServerAttach(sword *status, dvoid *srvhp, dvoid *errhp, 
+                                                        char *dblink, ub4 mode)
+{
+       *status = OCIServerAttach(srvhp, errhp, 
+                               dblink, (sb4) strlen(dblink), (ub4) mode);
+}
+
+void OciGlue_OCIAttrSet(sword *status, 
+                                               dvoid *trgthndlp, ub4 trghndltyp, 
+                                               dvoid *attributep, ub4 size, ub4 attrtype, 
+                                               dvoid *errhp)
+{
+       *status = OCIAttrSet (trgthndlp, trghndltyp, 
+                                                 attributep, size, attrtype, 
+                                                 errhp);
+}
+
+void OciGlue_OCISessionBegin(sword *status, dvoid *svchp, dvoid *errhp, dvoid *usrhp,
+                                                       ub4 credt, ub4 mode )
+{
+       *status = OCISessionBegin (svchp, errhp, usrhp, credt, mode);
+}
+*/
+
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/ociglue.h b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/ociglue.h
new file mode 100755 (executable)
index 0000000..ac3da64
--- /dev/null
@@ -0,0 +1,63 @@
+// 
+// ociglue.c -  provides glue between 
+//              managed C#/.NET System.Data.OracleClient.dll and 
+//              unmanaged native c library oci.dll
+//              to be used in Mono System.Data.OracleClient as
+//              the Oracle 8i data provider.
+//  
+// Part of unmanaged C library System.Data.OracleClient.ociglue.dll
+//
+// Part of the Mono class libraries at
+// mcs/class/System.Data.OracleClient/System.Data.OracleClient.OCI
+//
+// Assembly: System.Data.OracleClient.dll
+// Namespace: System.Data.OracleClient
+// 
+// Author: 
+//     Daniel Morgan <danmorg@sc.rr.com>
+//         
+// Copyright (C) Daniel Morgan, 2002
+// 
+// Licensed under the MIT/X11 License.
+//
+
+#ifndef __MONO_OCIGLUE_LIB_H__
+#define __MONO_OCIGLUE_LIB_H__
+
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <oci.h>
+
+struct _oci_glue_connection_t
+{
+       ub4 connection_handle;
+
+       OCIEnv *envhp;
+       OCIError *errhp;
+       OCISession *authp;
+       OCIServer *srvhp;
+       OCISvcCtx *svchp;
+       OCIStmt *stmthp;
+};
+
+typedef struct _oci_glue_connection_t oci_glue_connection_t;
+
+/*
+dvoid *OciGlue_OCIEnvCreate(sword *status);
+dvoid *OciGlue_OCIHandleAlloc(sword *status, CONST dvoid *parenth, ub4 type);
+void OciGlue_OCIServerAttach(sword *status, dvoid *srvhp, dvoid *errhp, char *dblink, ub4 mode);
+void OciGlue_OCIAttrSet(sword *status, dvoid *trgthndlp, ub4 trghndltyp, dvoid *attributep, ub4 size, ub4 attrtype, dvoid *errhp);
+void OciGlue_OCISessionBegin(sword *status, dvoid *svchp, dvoid *errhp, dvoid *usrhp, ub4 credt, ub4 mode );
+*/
+
+sword OciGlue_Connect (ub4 *connection_handle, char *database, char *username, char *password);
+sword OciGlue_PrepareAndExecuteNonQuerySimple (ub4 connection_handle, char *sqlstmt, int *found);
+sword OciGlue_Disconnect (ub4 connection_handle);
+guint OciGlue_ConnectionCount ();
+CONST text *OciGlue_CheckError (sword status, ub4 connection_handle);
+void Free (void *obj);
+
+#endif /* __MONO_OCIGLUE_H__ */
+
diff --git a/mcs/class/System.Data.OracleClient/Test/Test.csproj b/mcs/class/System.Data.OracleClient/Test/Test.csproj
new file mode 100755 (executable)
index 0000000..e70b91c
--- /dev/null
@@ -0,0 +1,93 @@
+<VisualStudioProject>\r
+    <CSHARP\r
+        ProjectType = "Local"\r
+        ProductVersion = "7.0.9466"\r
+        SchemaVersion = "1.0"\r
+        ProjectGuid = "{2A30C592-6B73-48E0-9640-A0DE8CA3C02F}"\r
+    >\r
+        <Build>\r
+            <Settings\r
+                ApplicationIcon = ""\r
+                AssemblyKeyContainerName = ""\r
+                AssemblyName = "Test"\r
+                AssemblyOriginatorKeyFile = ""\r
+                DefaultClientScript = "JScript"\r
+                DefaultHTMLPageLayout = "Grid"\r
+                DefaultTargetSchema = "IE50"\r
+                DelaySign = "false"\r
+                OutputType = "Exe"\r
+                RootNamespace = "Test"\r
+                StartupObject = ""\r
+            >\r
+                <Config\r
+                    Name = "Debug"\r
+                    AllowUnsafeBlocks = "false"\r
+                    BaseAddress = "285212672"\r
+                    CheckForOverflowUnderflow = "false"\r
+                    ConfigurationOverrideFile = ""\r
+                    DefineConstants = "DEBUG;TRACE"\r
+                    DocumentationFile = ""\r
+                    DebugSymbols = "true"\r
+                    FileAlignment = "4096"\r
+                    IncrementalBuild = "true"\r
+                    Optimize = "false"\r
+                    OutputPath = "bin\Debug\"\r
+                    RegisterForComInterop = "false"\r
+                    RemoveIntegerChecks = "false"\r
+                    TreatWarningsAsErrors = "false"\r
+                    WarningLevel = "4"\r
+                />\r
+                <Config\r
+                    Name = "Release"\r
+                    AllowUnsafeBlocks = "false"\r
+                    BaseAddress = "285212672"\r
+                    CheckForOverflowUnderflow = "false"\r
+                    ConfigurationOverrideFile = ""\r
+                    DefineConstants = "TRACE"\r
+                    DocumentationFile = ""\r
+                    DebugSymbols = "false"\r
+                    FileAlignment = "4096"\r
+                    IncrementalBuild = "false"\r
+                    Optimize = "true"\r
+                    OutputPath = "bin\Release\"\r
+                    RegisterForComInterop = "false"\r
+                    RemoveIntegerChecks = "false"\r
+                    TreatWarningsAsErrors = "false"\r
+                    WarningLevel = "4"\r
+                />\r
+            </Settings>\r
+            <References>\r
+                <Reference\r
+                    Name = "System"\r
+                    AssemblyName = "System"\r
+                    HintPath = "E:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"\r
+                />\r
+                <Reference\r
+                    Name = "System.Data"\r
+                    AssemblyName = "System.Data"\r
+                    HintPath = "E:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"\r
+                />\r
+                <Reference\r
+                    Name = "System.XML"\r
+                    AssemblyName = "System.XML"\r
+                    HintPath = "E:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"\r
+                />\r
+                <Reference\r
+                    Name = "MonoOracleClient"\r
+                    Project = "{799D520E-73ED-43A1-91FD-81D64C32A6F0}"\r
+                    Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"\r
+                />\r
+            </References>\r
+        </Build>\r
+        <Files>\r
+            <Include>\r
+                <File\r
+                    RelPath = "TestOracleClient.cs"\r
+                    SubType = "Code"\r
+                    BuildAction = "Compile"\r
+                />\r
+            </Include>\r
+        </Files>\r
+    </CSHARP>\r
+</VisualStudioProject>\r
+\r
diff --git a/mcs/class/System.Data.OracleClient/Test/Test.csproj.user b/mcs/class/System.Data.OracleClient/Test/Test.csproj.user
new file mode 100755 (executable)
index 0000000..e31ed2b
--- /dev/null
@@ -0,0 +1,48 @@
+<VisualStudioProject>\r
+    <CSHARP>\r
+        <Build>\r
+            <Settings ReferencePath = "" >\r
+                <Config\r
+                    Name = "Debug"\r
+                    EnableASPDebugging = "false"\r
+                    EnableASPXDebugging = "false"\r
+                    EnableUnmanagedDebugging = "false"\r
+                    EnableSQLServerDebugging = "false"\r
+                    RemoteDebugEnabled = "false"\r
+                    RemoteDebugMachine = ""\r
+                    StartAction = "Project"\r
+                    StartArguments = ""\r
+                    StartPage = ""\r
+                    StartProgram = ""\r
+                    StartURL = ""\r
+                    StartWorkingDirectory = ""\r
+                    StartWithIE = "true"\r
+                />\r
+                <Config\r
+                    Name = "Release"\r
+                    EnableASPDebugging = "false"\r
+                    EnableASPXDebugging = "false"\r
+                    EnableUnmanagedDebugging = "false"\r
+                    EnableSQLServerDebugging = "false"\r
+                    RemoteDebugEnabled = "false"\r
+                    RemoteDebugMachine = ""\r
+                    StartAction = "Project"\r
+                    StartArguments = ""\r
+                    StartPage = ""\r
+                    StartProgram = ""\r
+                    StartURL = ""\r
+                    StartWorkingDirectory = ""\r
+                    StartWithIE = "true"\r
+                />\r
+            </Settings>\r
+        </Build>\r
+        <OtherProjectSettings\r
+            CopyProjectDestinationFolder = ""\r
+            CopyProjectUncPath = ""\r
+            CopyProjectOption = "0"\r
+            ProjectView = "ProjectFiles"\r
+            ProjectTrust = "0"\r
+        />\r
+    </CSHARP>\r
+</VisualStudioProject>\r
+\r
diff --git a/mcs/class/System.Data.OracleClient/Test/TestOracleClient.cs b/mcs/class/System.Data.OracleClient/Test/TestOracleClient.cs
new file mode 100755 (executable)
index 0000000..e83c4c5
--- /dev/null
@@ -0,0 +1,146 @@
+// 
+// TestOracleClient.cs - Tests Sytem.Data.OracleClient
+//                       data provider in Mono.
+//  
+// Part of managed C#/.NET library System.Data.OracleClient.dll
+//
+// Part of the Mono class libraries at
+// mcs/class/System.Data.OracleClient/System.Data.OracleClient.OCI
+//
+// Tests:
+//     Assembly: System.Data.OracleClient.dll
+//     Namespace: System.Data.OracleClient
+// 
+// Author: 
+//     Daniel Morgan <danmorg@sc.rr.com>
+//         
+// Copyright (C) Daniel Morgan, 2002
+// 
+
+using System;
+using System.Runtime.InteropServices;
+using System.Data.OracleClient;
+
+namespace Test.OracleClient
+{
+       public class OracleTest
+       {
+               public OracleTest() 
+               {
+
+               }
+
+               static void DoTest1(OracleConnection con, int conn) 
+               {
+                       string inst = conn.ToString();
+
+                       string insertSql =
+                               "insert into scott.emp " +
+                               "(empno, ename, job, sal, deptno) " +
+                               "values(123" + inst + "," +
+                               "'conn" + inst + "'," +
+                               "'homy" + inst + "'," +
+                               "321" + inst + ",20)";
+                       
+                       Console.WriteLine("insertSql: " + insertSql);
+                       OracleCommand cmd = new OracleCommand();
+                       cmd.Connection = con;
+
+                       cmd.CommandText = insertSql;
+                       cmd.ExecuteNonQuery();
+
+                       if(conn == 2)
+                               cmd.CommandText = "rollback";
+                       else
+                               cmd.CommandText = "commit";
+                       cmd.ExecuteNonQuery();
+               }
+
+               static void DoTest9(OracleConnection con) {
+                       string inst = "9";
+
+                       string insertSql =
+                               "insert into scott.emp " +
+                               "(empno, ename, job, sal, deptno) " +
+                               "values(123" + inst + "," +
+                               "'conn" + inst + "'," +
+                               "'homy" + inst + "'," +
+                               "321" + inst + ",20)";
+                       
+                       Console.WriteLine("insertSql: " + insertSql);
+                       OracleCommand cmd = new OracleCommand();
+                       cmd.Connection = con;
+
+                       cmd.CommandText = insertSql;
+                       cmd.ExecuteNonQuery();
+
+                       cmd.CommandText = "commit";
+                       cmd.ExecuteNonQuery();
+               }
+
+               static void ConnectionCount() {
+                       uint count = OracleConnection.ConnectionCount;
+                       string msg = "Connection Count: " + count.ToString();
+                       Console.WriteLine(msg);
+               }
+
+               static void Wait(string msg) 
+               {
+                       Console.WriteLine(msg);
+                       Console.WriteLine("Waiting...  Presee Enter to continue...");
+                       string nothing = Console.ReadLine();
+               }
+
+               [STAThread]
+               static void Main(string[] args)
+               {       
+                       string connectionString;
+                       connectionString = 
+                               "Data Source=dansdb;" +
+                               "User ID=scott;" +
+                               "Password=tiger";
+
+                       Wait("Verify database.");
+
+                       ConnectionCount(); // should be 0
+
+                       OracleConnection con1 = new OracleConnection();
+                       con1.ConnectionString = connectionString;
+                       con1.Open();
+                       ConnectionCount(); // should be 1
+
+                       OracleConnection con2 = new OracleConnection();
+                       con2.ConnectionString = connectionString;
+                       con2.Open();
+                       ConnectionCount(); // should be 2
+
+                       OracleConnection con3 = new OracleConnection();
+                       con3.ConnectionString = connectionString;
+                       con3.Open();
+                       ConnectionCount(); // should be 3
+
+                       Wait("Verify Connected.");
+                                       
+                       DoTest1(con1, 1);
+                       DoTest1(con2, 2);
+                       DoTest1(con3, 3);
+                       
+                       DoTest9(con1);
+
+                       Wait("Verify Proper Results.");
+                       
+                       ConnectionCount(); // should be 3
+
+                       con1.Close();
+                       ConnectionCount(); // should be 2
+
+                       con2.Close();
+                       ConnectionCount(); // should be 1
+
+                       con3.Close();
+                       ConnectionCount(); // should be 0
+
+                       Wait("Verify Disconnected");
+               }
+       }
+}