Added files and folders for TARGET_JVM code base
authorBoris Kirzner <borisk@mono-cvs.ximian.com>
Mon, 30 May 2005 06:45:10 +0000 (06:45 -0000)
committerBoris Kirzner <borisk@mono-cvs.ximian.com>
Mon, 30 May 2005 06:45:10 +0000 (06:45 -0000)
svn path=/trunk/mcs/; revision=45180

105 files changed:
mcs/class/System.Data/ChangeLog
mcs/class/System.Data/System.Data.Configuration.jvm/GlobalConfig.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.Configuration.jvm/ObjectNameResolutionSectionHandler.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.Configuration.jvm/ObjectNameResolver.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.Configuration.jvm/ObjectNameResolversCollection.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbCommand.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbCommandBuilder.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbConnection.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbConnectionFactory.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbConvert.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbDataAdapter.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbDataReader.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbError.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbErrorCollection.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbException.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbInfoMessageEventArgs.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbInfoMessageEventHandler.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbLiteral.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbOracleDataReader.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbParameter.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbParameterCollection.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbPermission.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbPermissionAttribute.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbRowUpdatedEventArgs.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbRowUpdatedEventHandler.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbRowUpdatingEventArgs.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbRowUpdatingEventHandler.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbSchemaGuid.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbStringManager.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbTransaction.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/OleDbType.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.OleDb.jvm/libgda.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDBCommand.cs
mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDBConnection.cs
mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDBParameter.cs
mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDataReader.cs
mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDbCommand.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDbError.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDbErrorCollection.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDbException.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDbParameter.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDbParameterCollection.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractTransaction.cs
mcs/class/System.Data/System.Data.ProviderBase.jvm/DbStringManager.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.ProviderBase.jvm/OleDbStrings.resx [new file with mode: 0644]
mcs/class/System.Data/System.Data.ProviderBase.jvm/ParameterMetadataWrapper.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.ProviderBase.jvm/SqlClientStrings.resx [new file with mode: 0644]
mcs/class/System.Data/System.Data.ProviderBase.jvm/regex.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/ISqlNotificationReceiver.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/MetaType.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlClientPermission.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlClientPermissionAttribute.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlCollation.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlCommand.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlCommand.resx [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlCommandBuilder.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlConnection.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlConnection.resx [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlConnectionPool.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlConvert.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlDataAdapter.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlDataReader.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlError.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlErrorCollection.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlException.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlInfoMessageEventArgs.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlInfoMessageEventHandler.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlParameter.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlParameterCollection.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlParameterConverter.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlResultSet.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlRowUpdatedEventArgs.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlRowUpdatedEventHandler.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlRowUpdatingEventArgs.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlRowUpdatingEventHandler.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlStringManager.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlTransaction.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient.jvm/SqlXmlTextReader.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/INullable.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlBinary.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlBoolean.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlByte.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlBytes.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlChars.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlCompareOptions.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlDate.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlDateTime.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlDecimal.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlDouble.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlGuid.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlInt16.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlInt32.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlInt64.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlMoney.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlNullValueException.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlSingle.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlStreamChars.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlString.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlTime.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlTruncateException.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlTypeException.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlUtcDateTime.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlXmlReader.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.sln [new file with mode: 0644]
mcs/class/System.Data/System.Data.vmwcsproj [new file with mode: 0644]

index bfa04727768e49f60f4175197e046fb7a79b290f..7b7bc210aa34d1e48110a1c5e3e3d25278073c05 100644 (file)
@@ -1,3 +1,115 @@
+2005-05-30 BorisKirzner <borisk@mainsoft.com>
+       * System.Data : new folders added :
+               - System.Data.SqlClient.jvm
+               - System.Data.Configuration.jvm
+               - System.Data.SqlTypes.jvm
+               - System.Data.OleDb.jvm 
+       * System.Data.vmwcsproj : TARGET_JVM project file added
+       * System.Data.sln : TARGET_JVM solution file added
+       * System.Data.SqlClient.jvm/SqlDataReader.cs 
+       * System.Data.SqlClient.jvm/SqlParameterCollection.cs
+       * System.Data.SqlClient.jvm/SqlRowUpdatedEventArgs.cs
+       * System.Data.SqlClient.jvm/SqlException.cs
+       * System.Data.SqlClient.jvm/SqlConnection.cs
+       * System.Data.SqlClient.jvm/SqlInfoMessageEventHandler.cs
+       * System.Data.SqlClient.jvm/SqlStringManager.cs
+       * System.Data.SqlClient.jvm/SqlRowUpdatingEventHandler.cs
+       * System.Data.SqlClient.jvm/SqlErrorCollection.cs
+       * System.Data.SqlClient.jvm/SqlParameterConverter.cs
+       * System.Data.SqlClient.jvm/MetaType.cs
+       * System.Data.SqlClient.jvm/SqlDataAdapter.cs
+       * System.Data.SqlClient.jvm/SqlConnection.resx
+       * System.Data.SqlClient.jvm/SqlClientPermissionAttribute.cs
+       * System.Data.SqlClient.jvm/SqlRowUpdatedEventHandler.cs
+       * System.Data.SqlClient.jvm/SqlCommand.cs
+       * System.Data.SqlClient.jvm/SqlInfoMessageEventArgs.cs
+       * System.Data.SqlClient.jvm/SqlConvert.cs
+       * System.Data.SqlClient.jvm/SqlParameter.cs
+       * System.Data.SqlClient.jvm/SqlRowUpdatingEventArgs.cs
+       * System.Data.SqlClient.jvm/SqlCollation.cs
+       * System.Data.SqlClient.jvm/ISqlNotificationReceiver.cs
+       * System.Data.SqlClient.jvm/SqlCommandBuilder.cs
+       * System.Data.SqlClient.jvm/SqlTransaction.cs
+       * System.Data.SqlClient.jvm/SqlClientPermission.cs
+       * System.Data.SqlClient.jvm/SqlXmlTextReader.cs
+       * System.Data.SqlClient.jvm/SqlError.cs
+       * System.Data.SqlClient.jvm/SqlConnectionPool.cs
+       * System.Data.SqlClient.jvm/SqlCommand.resx
+       * System.Data.SqlClient.jvm/SqlResultSet.cs
+       * System.Data.Configuration.jvm/ObjectNameResolutionSectionHandler.cs
+       * System.Data.Configuration.jvm/GlobalConfig.cs
+       * System.Data.Configuration.jvm/ObjectNameResolversCollection.cs
+       * System.Data.Configuration.jvm/ObjectNameResolver.cs
+       * System.Data.SqlTypes.jvm/SqlDateTime.cs
+       * System.Data.SqlTypes.jvm/SqlTime.cs
+       * System.Data.SqlTypes.jvm/SqlDecimal.cs
+       * System.Data.SqlTypes.jvm/SqlInt32.cs
+       * System.Data.SqlTypes.jvm/SqlTypeException.cs
+       * System.Data.SqlTypes.jvm/SqlChars.cs
+       * System.Data.SqlTypes.jvm/SqlInt16.cs
+       * System.Data.SqlTypes.jvm/SqlCompareOptions.cs
+       * System.Data.SqlTypes.jvm/SqlByte.cs
+       * System.Data.SqlTypes.jvm/SqlInt64.cs
+       * System.Data.SqlTypes.jvm/SqlTruncateException.cs
+       * System.Data.SqlTypes.jvm/SqlString.cs
+       * System.Data.SqlTypes.jvm/SqlUtcDateTime.cs
+       * System.Data.SqlTypes.jvm/SqlDouble.cs
+       * System.Data.SqlTypes.jvm/SqlStreamChars.cs
+       * System.Data.SqlTypes.jvm/SqlDate.cs
+       * System.Data.SqlTypes.jvm/SqlBoolean.cs
+       * System.Data.SqlTypes.jvm/SqlSingle.cs
+       * System.Data.SqlTypes.jvm/SqlXmlReader.cs
+       * System.Data.SqlTypes.jvm/SqlBinary.cs
+       * System.Data.SqlTypes.jvm/SqlBytes.cs
+       * System.Data.SqlTypes.jvm/SqlNullValueException.cs
+       * System.Data.SqlTypes.jvm/SqlMoney.cs
+       * System.Data.SqlTypes.jvm/INullable.cs
+       * System.Data.SqlTypes.jvm/SqlGuid.cs
+       * System.Data.ProviderBase.jvm/OleDbStrings.resx
+       * System.Data.ProviderBase.jvm/AbstractDataReader.cs
+       * System.Data.ProviderBase.jvm/ParameterMetadataWrapper.cs
+       * System.Data.ProviderBase.jvm/AbstractDbError.cs
+       * System.Data.ProviderBase.jvm/SqlClientStrings.resx
+       * System.Data.ProviderBase.jvm/AbstractDbParameterCollection.cs
+       * System.Data.ProviderBase.jvm/AbstractDbException.cs
+       * System.Data.ProviderBase.jvm/AbstractDBConnection.cs
+       * System.Data.ProviderBase.jvm/AbstractDbErrorCollection.cs
+       * System.Data.ProviderBase.jvm/DbStringManager.cs
+       * System.Data.ProviderBase.jvm/AbstractDbCommand.cs
+       * System.Data.ProviderBase.jvm/AbstractDBCommand.cs
+       * System.Data.ProviderBase.jvm/AbstractTransaction.cs
+       * System.Data.ProviderBase.jvm/AbstractDBParameter.cs
+       * System.Data.ProviderBase.jvm/AbstractDbParameter.cs
+       * System.Data.ProviderBase.jvm/regex.cs
+       * System.Data.OleDb.jvm/OleDbErrorCollection.cs
+       * System.Data.OleDb.jvm/OleDbSchemaGuid.cs
+       * System.Data.OleDb.jvm/OleDbDataAdapter.cs
+       * System.Data.OleDb.jvm/OleDbPermissionAttribute.cs
+       * System.Data.OleDb.jvm/libgda.cs
+       * System.Data.OleDb.jvm/OleDbRowUpdatedEventHandler.cs
+       * System.Data.OleDb.jvm/OleDbCommand.cs
+       * System.Data.OleDb.jvm/OleDbInfoMessageEventArgs.cs
+       * System.Data.OleDb.jvm/OleDbConvert.cs
+       * System.Data.OleDb.jvm/OleDbParameter.cs
+       * System.Data.OleDb.jvm/OleDbType.cs
+       * System.Data.OleDb.jvm/OleDbOracleDataReader.cs
+       * System.Data.OleDb.jvm/OleDbRowUpdatingEventArgs.cs
+       * System.Data.OleDb.jvm/OleDbCommandBuilder.cs
+       * System.Data.OleDb.jvm/OleDbTransaction.cs
+       * System.Data.OleDb.jvm/OleDbConnectionFactory.cs
+       * System.Data.OleDb.jvm/OleDbPermission.cs
+       * System.Data.OleDb.jvm/OleDbError.cs
+       * System.Data.OleDb.jvm/OleDbLiteral.cs
+       * System.Data.OleDb.jvm/OleDbDataReader.cs
+       * System.Data.OleDb.jvm/OleDbParameterCollection.cs
+       * System.Data.OleDb.jvm/OleDbRowUpdatedEventArgs.cs
+       * System.Data.OleDb.jvm/OleDbException.cs
+       * System.Data.OleDb.jvm/OleDbConnection.cs
+       * System.Data.OleDb.jvm/OleDbInfoMessageEventHandler.cs
+       * System.Data.OleDb.jvm/OleDbStringManager.cs
+       * System.Data.OleDb.jvm/OleDbRowUpdatingEventHandler.cs
+               New classes added (used in TARGET_JVM only)
+               
 2005-05-29 BorisKirzner <borisk@mainsoft.com>
        * System.Data.dll.sources: Added ExceptionHelper.cs
        
diff --git a/mcs/class/System.Data/System.Data.Configuration.jvm/GlobalConfig.cs b/mcs/class/System.Data/System.Data.Configuration.jvm/GlobalConfig.cs
new file mode 100644 (file)
index 0000000..27decd2
--- /dev/null
@@ -0,0 +1,51 @@
+using System.Collections;\r
+using System.Configuration;\r
+using System.Xml;\r
+using System.Collections.Specialized;\r
+\r
+namespace System.Data.Configuration {\r
+\r
+       internal enum BooleanSetting {\r
+               False,\r
+               True,\r
+               NotSet\r
+       }\r
+\r
+       internal sealed class Switches {\r
+\r
+               private Switches() {}\r
+\r
+               const string SwitchesSection = "system.data/switches";\r
+               const string PrefetchSchemaConfigName = "JDBC.PrefetchSchema";\r
+               static readonly string AppDomainPrefetchSchemaConfigName = String.Concat(SwitchesSection, "/", PrefetchSchemaConfigName);\r
+\r
+               internal static BooleanSetting PrefetchSchema {\r
+                       get {\r
+\r
+                               object value = AppDomain.CurrentDomain.GetData(AppDomainPrefetchSchemaConfigName);\r
+                               if (value != null)\r
+                                       return (BooleanSetting)value;\r
+\r
+                               BooleanSetting setting = BooleanSetting.NotSet;\r
+\r
+                               NameValueCollection switches = (NameValueCollection)ConfigurationSettings.GetConfig(SwitchesSection);\r
+                               if (switches != null) {\r
+                                       string strVal = (string)switches[PrefetchSchemaConfigName];\r
+                                       if (strVal != null) {\r
+                                               try {\r
+                                                       setting = Boolean.Parse(strVal) ? BooleanSetting.True : BooleanSetting.False;\r
+                                               }\r
+                                               catch (Exception e) {\r
+                                                       throw new ConfigurationException(e.Message, e);\r
+                                               }\r
+                                       }\r
+                               }\r
+\r
+                               //lock(AppDomainPrefetchSchemaConfigName)\r
+                               AppDomain.CurrentDomain.SetData(AppDomainPrefetchSchemaConfigName, setting);\r
+\r
+                               return setting;\r
+                       }\r
+               }\r
+       }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.Configuration.jvm/ObjectNameResolutionSectionHandler.cs b/mcs/class/System.Data/System.Data.Configuration.jvm/ObjectNameResolutionSectionHandler.cs
new file mode 100644 (file)
index 0000000..5a60337
--- /dev/null
@@ -0,0 +1,79 @@
+using System.Collections;\r
+using System.Configuration;\r
+using System.Xml;\r
+\r
+namespace System.Data.Configuration {\r
+       class ObjectNameResolutionSectionHandler : IConfigurationSectionHandler {\r
+               public virtual object Create (object parent, object configContext, XmlNode section) {\r
+                       if (section.Attributes != null && section.Attributes.Count != 0)\r
+                               HandlersUtil.ThrowException ("Unrecognized attribute", section);\r
+\r
+                       ObjectNameResolversCollection col = new ObjectNameResolversCollection(parent as ObjectNameResolversCollection);\r
+\r
+                       XmlNodeList resolvers = section.ChildNodes;\r
+                       foreach (XmlNode child in resolvers) {\r
+                               XmlNodeType ntype = child.NodeType;\r
+                               if (ntype == XmlNodeType.Whitespace || ntype == XmlNodeType.Comment)\r
+                                       continue;\r
+\r
+                               if (ntype != XmlNodeType.Element)\r
+                                       HandlersUtil.ThrowException ("Only elements allowed", child);\r
+\r
+                               string dbname = HandlersUtil.ExtractAttributeValue ("dbname", child,false,true);\r
+                               string match = HandlersUtil.ExtractAttributeValue ("match", child);\r
+                               string pri = HandlersUtil.ExtractAttributeValue ("priority", child);\r
+\r
+                               ObjectNameResolver resolver = new ObjectNameResolver(dbname, match, int.Parse(pri));\r
+                               col.Add(resolver);\r
+                       }\r
+\r
+                       col.Sort();\r
+                       \r
+                       return col;\r
+               }\r
+       }\r
+\r
+       internal sealed class HandlersUtil {\r
+               private HandlersUtil () {\r
+               }\r
+\r
+               static internal string ExtractAttributeValue (string attKey, XmlNode node) {\r
+                       return ExtractAttributeValue (attKey, node, false);\r
+               }\r
+                       \r
+               static internal string ExtractAttributeValue (string attKey, XmlNode node, bool optional) {\r
+                       return ExtractAttributeValue (attKey, node, optional, false);\r
+               }\r
+               \r
+               static internal string ExtractAttributeValue (string attKey, XmlNode node, bool optional,\r
+                       bool allowEmpty) {\r
+                       if (node.Attributes == null) {\r
+                               if (optional)\r
+                                       return null;\r
+\r
+                               ThrowException ("Required attribute not found: " + attKey, node);\r
+                       }\r
+\r
+                       XmlNode att = node.Attributes.RemoveNamedItem (attKey);\r
+                       if (att == null) {\r
+                               if (optional)\r
+                                       return null;\r
+                               ThrowException ("Required attribute not found: " + attKey, node);\r
+                       }\r
+\r
+                       string value = att.Value;\r
+                       if (!allowEmpty && value == String.Empty) {\r
+                               string opt = optional ? "Optional" : "Required";\r
+                               ThrowException (opt + " attribute is empty: " + attKey, node);\r
+                       }\r
+\r
+                       return value;\r
+               }\r
+\r
+               static internal void ThrowException (string msg, XmlNode node) {\r
+                       if (node != null && node.Name != String.Empty)\r
+                               msg = msg + " (node name: " + node.Name + ") ";\r
+                       throw new ConfigurationException (msg, node);\r
+               }\r
+       }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.Configuration.jvm/ObjectNameResolver.cs b/mcs/class/System.Data/System.Data.Configuration.jvm/ObjectNameResolver.cs
new file mode 100644 (file)
index 0000000..447d79b
--- /dev/null
@@ -0,0 +1,65 @@
+using System.Collections;\r
+using System.Configuration;\r
+using System.Xml;\r
+using System.Text.RegularExpressions;\r
+\r
+namespace System.Data.Configuration {\r
+       sealed class ObjectNameResolver : IComparable {\r
+               string _dbname;\r
+               int _priority;\r
+               Regex _regex;\r
+               \r
+               public ObjectNameResolver(string dbname, string match, int priority) {\r
+                       _dbname = dbname;\r
+                       _regex = new Regex(match, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);\r
+                       \r
+                       _priority = priority;\r
+               }\r
+\r
+               public ObjectNameResolver(Regex regex) {\r
+                       _regex = regex;\r
+                       _dbname = null;\r
+                       _priority = int.MaxValue;\r
+               }\r
+\r
+               public string DbName {\r
+                       get {\r
+                               return _dbname;\r
+                       }\r
+               }\r
+\r
+               public static string GetCatalog(Match match) {\r
+                       return GetCapture(match, "CATALOG");\r
+               }\r
+\r
+               public static string GetSchema(Match match) {\r
+                       return GetCapture(match, "SCHEMA");\r
+               }\r
+\r
+               public static string GetName(Match match) {\r
+                       return GetCapture(match, "NAME");\r
+               }\r
+\r
+               public Match Match(string expression) {\r
+                       return _regex.Match(expression.Trim());\r
+               }\r
+\r
+               static string GetCapture(Match match, string captureName) {\r
+                       Group g = match.Groups[captureName];\r
+                       if (!g.Success)\r
+                               return String.Empty;\r
+\r
+                       return g.Value.Trim();\r
+               }\r
+\r
+               #region IComparable Members\r
+\r
+               public int CompareTo(object obj) {\r
+                       // TODO:  Add ObjectNameResolver.CompareTo implementation\r
+                       return _priority.CompareTo(((ObjectNameResolver)obj)._priority);\r
+               }\r
+\r
+               #endregion\r
+\r
+       }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.Configuration.jvm/ObjectNameResolversCollection.cs b/mcs/class/System.Data/System.Data.Configuration.jvm/ObjectNameResolversCollection.cs
new file mode 100644 (file)
index 0000000..3f4f19c
--- /dev/null
@@ -0,0 +1,84 @@
+using System.Collections;\r
+using System.Configuration;\r
+using System.Xml;\r
+using System.Text.RegularExpressions;\r
+\r
+namespace System.Data.Configuration {\r
+       sealed class ObjectNameResolversCollection : IEnumerable, ICollection {\r
+\r
+               ArrayList _resolvers;\r
+\r
+               #region ctors\r
+\r
+               internal ObjectNameResolversCollection(ObjectNameResolversCollection parent) {\r
+                       _resolvers = new ArrayList();\r
+\r
+                       if (parent != null)\r
+                               _resolvers.AddRange(parent);\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region methods\r
+\r
+               internal void Add(ObjectNameResolver value) {\r
+                       _resolvers.Add(value);\r
+               }\r
+\r
+               internal void Sort() {\r
+                       _resolvers.Sort();\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region props\r
+\r
+               internal ObjectNameResolver this[int index] {\r
+                       get {\r
+                               return (ObjectNameResolver)_resolvers[index];\r
+                       }\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region IEnumerable Members\r
+\r
+               public IEnumerator GetEnumerator() {\r
+                       // TODO:  Add ObjectNameResolversCollection.GetEnumerator implementation\r
+                       return _resolvers.GetEnumerator();\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region ICollection Members\r
+\r
+               public bool IsSynchronized {\r
+                       get {\r
+                               // TODO:  Add ObjectNameResolversCollection.IsSynchronized getter implementation\r
+                               return _resolvers.IsSynchronized;\r
+                       }\r
+               }\r
+\r
+               public int Count {\r
+                       get {\r
+                               // TODO:  Add ObjectNameResolversCollection.Count getter implementation\r
+                               return _resolvers.Count;\r
+                       }\r
+               }\r
+\r
+               public void CopyTo(Array array, int index) {\r
+                       // TODO:  Add ObjectNameResolversCollection.CopyTo implementation\r
+                       _resolvers.CopyTo(array, index);\r
+               }\r
+\r
+               public object SyncRoot {\r
+                       get {\r
+                               // TODO:  Add ObjectNameResolversCollection.SyncRoot getter implementation\r
+                               return _resolvers.SyncRoot;\r
+                       }\r
+               }\r
+\r
+               #endregion\r
+       }\r
+\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbCommand.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbCommand.cs
new file mode 100644 (file)
index 0000000..75c9b7c
--- /dev/null
@@ -0,0 +1,263 @@
+//\r
+// System.Data.OleDb.OleDbCommand\r
+//\r
+// Author:\r
+//   Boris Kirzner (borisk@mainsoft.com)\r
+//\r
+\r
+using System;\r
+using System.Collections;\r
+using System.Text;\r
+using System.Text.RegularExpressions;\r
+using System.Data;\r
+using System.Data.Common;\r
+using System.Data.ProviderBase;\r
+\r
+using java.sql;\r
+// Cannot use this because it makes ArrayList ambiguous reference\r
+//using java.util;\r
+\r
+namespace System.Data.OleDb\r
+{\r
+       public sealed class OleDbCommand : AbstractDbCommand, IDbCommand, ICloneable\r
+       {\r
+\r
+               #region Fields\r
+\r
+               internal static readonly int oracleTypeRefCursor = java.sql.Types.OTHER;\r
+               private static readonly int _oracleRefCursor = -10; // oracle.jdbc.OracleTypes.CURSOR\r
+               private int _currentParameterIndex = 0;\r
+               private ResultSet _currentRefCursor;\r
+\r
+               #endregion // Fields\r
+\r
+               #region Constructors\r
+\r
+               static OleDbCommand()\r
+               {\r
+                       try {\r
+                               java.lang.Class OracleTypesClass = java.lang.Class.forName("oracle.jdbc.OracleTypes");\r
+                               _oracleRefCursor = OracleTypesClass.getField("CURSOR").getInt(null);\r
+                       }\r
+                       catch(java.lang.ClassNotFoundException e) {\r
+                               // oracle driver is not in classpath - just continue\r
+                       }\r
+               }\r
+\r
+               /**\r
+                * Initializes a new instance of the OleDbCommand class.\r
+                * The base constructor initializes all fields to their default values.\r
+                * The following table shows initial property values for an instance of SqlCommand.\r
+                */\r
+               public OleDbCommand() : this(null, null, null)\r
+               {\r
+               }\r
+\r
+               public OleDbCommand(OleDbConnection connection) : this(null, connection, null)\r
+               {\r
+               }\r
+\r
+               /**\r
+                * Initializes a new instance of the OleDbCommand class with the text of the query.\r
+                * @param cmdText The text of the query.\r
+                */\r
+               public OleDbCommand(String cmdText) : this(cmdText, null, null)\r
+               {\r
+               }\r
+\r
+               /**\r
+                * Initializes a new instance of the OleDbCommand class with the text of the query and a SqlConnection.\r
+                * @param cmdText The text of the query.\r
+                * @param connection A SqlConnection that represents the connection to an instance of SQL Server.\r
+                */\r
+               public OleDbCommand(String cmdText, OleDbConnection connection) : this(cmdText, connection, null)\r
+               {\r
+               }\r
+\r
+               /**\r
+                * Initializes a new instance of the OleDbCommand class with the text of the query, a SqlConnection, and the Transaction.\r
+                * @param cmdText The text of the query.\r
+                * @param connection A SqlConnection that represents the connection to an instance of SQL Server.\r
+                * @param transaction The SqlTransaction in which the OleDbCommand executes.\r
+                */\r
+               public OleDbCommand(\r
+                       String cmdText,\r
+                       OleDbConnection connection,\r
+                       OleDbTransaction transaction)\r
+                       : base(cmdText, connection, transaction)\r
+               {\r
+               }\r
+\r
+               #endregion // Constructors\r
+\r
+               #region Properties\r
+\r
+               public new OleDbConnection Connection\r
+               {\r
+                       get { return (OleDbConnection)base.Connection; }\r
+                       set { base.Connection = (AbstractDBConnection)value; }\r
+               }\r
+\r
+               public new OleDbParameterCollection Parameters\r
+               {\r
+                       get { \r
+                               if (_parameters == null) {\r
+                                       _parameters = CreateParameterCollection(this);\r
+                               }\r
+                               return (OleDbParameterCollection)_parameters; \r
+                       }\r
+               }\r
+\r
+               public new OleDbTransaction Transaction\r
+               {\r
+                       get { return (OleDbTransaction)base.Transaction; }\r
+                       set { base.Transaction = (DbTransaction)value; }\r
+               }\r
+\r
+               internal override ResultSet CurrentResultSet\r
+               {\r
+                       get { \r
+                               try {\r
+                                       ResultSet resultSet = base.CurrentResultSet;\r
\r
+                                       if (resultSet != null) {\r
+                                               return resultSet;                                               \r
+                                       }\r
+                                       return CurrentRefCursor;\r
+                               }\r
+                               catch(SQLException e) {\r
+                                       throw new Exception(e.Message, e);\r
+                               }\r
+                       }\r
+               }\r
+\r
+               private ResultSet CurrentRefCursor\r
+               {\r
+                       get {\r
+                               if (_currentParameterIndex < 0) {\r
+                                       NextRefCursor();\r
+                               }\r
+                               if (_currentRefCursor == null && _currentParameterIndex < InternalParameters.Count) {\r
+                                       _currentRefCursor = (ResultSet)((CallableStatement)_statement).getObject(_currentParameterIndex + 1);\r
+                               }\r
+                               return _currentRefCursor;\r
+                       }\r
+               }\r
+\r
+               #endregion // Properties\r
+\r
+               #region Methods\r
+\r
+               public new OleDbDataReader ExecuteReader()\r
+               {\r
+                       return (OleDbDataReader)ExecuteReader(CommandBehavior.Default);\r
+               }\r
+\r
+               public new OleDbDataReader ExecuteReader(CommandBehavior behavior)\r
+               {\r
+                       return (OleDbDataReader)base.ExecuteReader(behavior);\r
+               }\r
+\r
+               public new OleDbParameter CreateParameter()\r
+               {\r
+                       return (OleDbParameter)CreateParameterInternal();\r
+               } \r
+\r
+               protected override void CheckParameters()\r
+               {\r
+                       for(int i = 0; i < Parameters.Count; i++) {\r
+                               OleDbParameter parameter = (OleDbParameter)Parameters[i];\r
+                               if ((parameter.OleDbType == OleDbType.Empty) || (parameter.OleDbType == OleDbType.Error)) {\r
+                                       throw ExceptionHelper.ParametersNotInitialized(i,parameter.ParameterName,parameter.OleDbType.ToString());\r
+                               }\r
+\r
+                               if (((parameter.OleDbType == OleDbType.Char) || (parameter.OleDbType == OleDbType.Binary) ||\r
+                                       (parameter.OleDbType == OleDbType.VarWChar) || (parameter.OleDbType == OleDbType.VarBinary) ||\r
+                                       (parameter.OleDbType == OleDbType.VarNumeric)) && (parameter.Size == 0)) {\r
+                                       throw ExceptionHelper.WrongParameterSize("OleDb");\r
+                               }\r
+                       }\r
+               }\r
+\r
+               protected override DbParameter CreateParameterInternal()\r
+               {\r
+                       return new OleDbParameter();\r
+               }\r
+\r
+               protected override DbParameterCollection CreateParameterCollection(AbstractDbCommand parent)\r
+               {\r
+                       return new OleDbParameterCollection((OleDbCommand)parent);\r
+               }\r
+\r
+               public object Clone()\r
+               {\r
+                       OleDbCommand clone = new OleDbCommand();\r
+                       CopyTo(clone);\r
+                       return clone;\r
+               }\r
+\r
+               protected override void PrepareInternalParameters()\r
+               {\r
+                       InternalParameters.Clear();\r
+                       _currentParameterIndex = -1;\r
+               }\r
+\r
+               protected override void BindOutputParameter(AbstractDbParameter parameter, int parameterIndex)\r
+               {\r
+                       CallableStatement callableStatement = ((CallableStatement)_statement);\r
+                       if (((OleDbParameter)parameter).IsOracleRefCursor) {\r
+                               callableStatement.registerOutParameter(++parameterIndex, _oracleRefCursor);\r
+                       }\r
+                       else {\r
+                               base.BindOutputParameter(parameter, parameterIndex);\r
+                       }\r
+               }\r
+\r
+               protected override bool SkipParameter(DbParameter parameter)\r
+               {\r
+                       return ((OleDbParameter)parameter).IsOracleRefCursor;\r
+               }\r
+\r
+               internal override bool NextResultSet()\r
+               {\r
+                       try { \r
+                               bool hasMoreResults = base.NextResultSet();\r
+\r
+                               if (hasMoreResults) {\r
+                                       return true;\r
+                               }\r
+                               else {\r
+                                       return NextRefCursor();\r
+                               }\r
+                       }\r
+                       catch (SQLException e) {\r
+                               throw CreateException(e);\r
+                       }\r
+               }\r
+\r
+               private bool NextRefCursor()\r
+               {\r
+                       _currentRefCursor = null;\r
+                       // FIXME : should we count all parameters or only out ones?\r
+                       for (_currentParameterIndex++;InternalParameters.Count > _currentParameterIndex;_currentParameterIndex++) {\r
+                               if (((OleDbParameter)InternalParameters[_currentParameterIndex]).IsOracleRefCursor) {\r
+                                       return true;                                            \r
+                               }\r
+                       }\r
+                       return false;\r
+               }\r
+\r
+               protected override DbDataReader CreateReader()\r
+               {\r
+                       return new OleDbDataReader(this);\r
+               }\r
+\r
+               protected override SystemException CreateException(SQLException e)\r
+               {\r
+                       return new OleDbException(e,Connection);                \r
+               }\r
+\r
+               #endregion // Methods\r
+      \r
+       }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbCommandBuilder.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbCommandBuilder.cs
new file mode 100644 (file)
index 0000000..bf79829
--- /dev/null
@@ -0,0 +1,121 @@
+//\r
+// System.Data.OleDb.OleDbCommandBuilder\r
+//\r
+// Author:\r
+//   Rodrigo Moya (rodrigo@ximian.com)\r
+//   Tim Coleman (tim@timcoleman.com)\r
+//\r
+// Copyright (C) Rodrigo Moya, 2002\r
+// Copyright (C) Tim Coleman, 2002\r
+//\r
+\r
+using System.ComponentModel;\r
+using System.Data;\r
+using System.Data.Common;\r
+\r
+namespace System.Data.OleDb\r
+{\r
+       /// <summary>\r
+       /// Provides a means of automatically generating single-table commands used to reconcile changes made to a DataSet with the associated database. This class cannot be inherited.\r
+       /// </summary>\r
+       public sealed class OleDbCommandBuilder : Component\r
+       {\r
+               #region Fields\r
+\r
+               OleDbDataAdapter adapter;\r
+               string quotePrefix;\r
+               string quoteSuffix;\r
+\r
+               #endregion // Fields\r
+\r
+               #region Constructors\r
+               \r
+               public OleDbCommandBuilder ()\r
+               {\r
+                       adapter = null;\r
+                       quotePrefix = String.Empty;\r
+                       quoteSuffix = String.Empty;\r
+               }\r
+\r
+               public OleDbCommandBuilder (OleDbDataAdapter adapter) \r
+                       : this ()\r
+               {\r
+                       this.adapter = adapter;\r
+               }\r
+\r
+               #endregion // Constructors\r
+\r
+               #region Properties\r
+\r
+               public OleDbDataAdapter DataAdapter {\r
+                       get {\r
+                               return adapter;\r
+                       }\r
+                       set {\r
+                               adapter = value;\r
+                       }\r
+               }\r
+\r
+               public string QuotePrefix {\r
+                       get {\r
+                               return quotePrefix;\r
+                       }\r
+                       set {\r
+                               quotePrefix = value;\r
+                       }\r
+               }\r
+\r
+               public string QuoteSuffix {\r
+                       get {\r
+                               return quoteSuffix;\r
+                       }\r
+                       set {\r
+                               quoteSuffix = value;\r
+                       }\r
+               }\r
+\r
+               #endregion // Properties\r
+\r
+               #region Methods\r
+\r
+               public static void DeriveParameters (OleDbCommand command) \r
+               {\r
+                       if (command.Connection.State != ConnectionState.Open) {\r
+                               throw new InvalidOperationException("DeriveParameters requires an open and available Connection. The connection's current state is Closed.");\r
+                       }\r
+                       command.DeriveParameters ();\r
+               }\r
+\r
+               [MonoTODO]\r
+               protected override void Dispose (bool disposing) \r
+               {\r
+                       throw new NotImplementedException ();           \r
+               }\r
+\r
+               [MonoTODO]\r
+               public OleDbCommand GetDeleteCommand ()\r
+               {\r
+                       throw new NotImplementedException ();\r
+               }\r
+\r
+               [MonoTODO]\r
+               public OleDbCommand GetInsertCommand ()\r
+               {\r
+                       throw new NotImplementedException ();\r
+               }\r
+\r
+               [MonoTODO]\r
+               public OleDbCommand GetUpdatetCommand ()\r
+               {\r
+                       throw new NotImplementedException ();\r
+               }\r
+\r
+               [MonoTODO]\r
+               public void RefreshSchema ()\r
+               {\r
+                       throw new NotImplementedException ();\r
+               }\r
+\r
+               #endregion // Methods\r
+       }\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbConnection.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbConnection.cs
new file mode 100644 (file)
index 0000000..c0e3c5b
--- /dev/null
@@ -0,0 +1,349 @@
+//\r
+// System.Data.OleDb.OleDbConnection\r
+//\r
+// Author:\r
+//   Boris Kirzner (borisk@mainsoft.com)\r
+//\r
+\r
+\r
+using System.Data;\r
+using System.Data.Common;\r
+using System.Collections;\r
+\r
+using java.sql;\r
+\r
+namespace System.Data.OleDb\r
+{\r
+       public sealed class OleDbConnection : AbstractDBConnection, System.ICloneable\r
+       {\r
+               #region Fields \r
+\r
+               protected static Hashtable _skippedUserParameters = new Hashtable(new CaseInsensitiveHashCodeProvider(),new CaseInsensitiveComparer());\r
+\r
+               private static DbStringManager _stringManager = new DbStringManager("System.Data.System.Data.ProviderBase.jvm.OleDbStrings");\r
+\r
+               private static readonly string[] _resourceIgnoredKeys = new string[] {"CON_PROVIDER","CON_DATA_SOURCE","CON_DATABASE",\r
+                                                                                                                                                         "CON_PASSWORD","CON_USER_ID","CON_TIMEOUT",\r
+                                                                                                                                                         "CON_SERVER_NAME","CON_PORT","CON_SERVICE_NAME",\r
+                                                                                                                                                         "CON_JNDI_NAME","CON_JNDI_PROVIDER","CON_JNDI_FACTORY",\r
+                                                                                                                                                         "JDBC_DRIVER","JDBC_URL","DB2_CON_LOCATION" };\r
+\r
+               #endregion //Fields\r
+\r
+               #region Events\r
+\r
+               public event OleDbInfoMessageEventHandler InfoMessage;\r
+               public event StateChangeEventHandler StateChange;\r
+\r
+               #endregion // Events\r
+               \r
+               #region Constructors\r
+\r
+               public OleDbConnection() : this(null)\r
+               {\r
+               }\r
+\r
+               public OleDbConnection(String connectionString) : base(connectionString)\r
+               {                       \r
+               }\r
+\r
+               #endregion // Constructors\r
+\r
+               #region Properties\r
+\r
+               protected override string[] ResourceIgnoredKeys\r
+               {\r
+                       get { return _resourceIgnoredKeys; }\r
+               }\r
+\r
+               public String Provider\r
+               {\r
+                       get { return ConnectionStringHelper.FindValue(UserParameters,StringManager.GetStringArray("CON_PROVIDER")); }\r
+               }\r
+\r
+               protected override Hashtable SkippedUserParameters\r
+               {\r
+                       get { return _skippedUserParameters; }\r
+               }\r
+\r
+               protected override string ServerName\r
+               {\r
+                       get { \r
+                               if (ProviderType == PROVIDER_TYPE.IBMDADB2 || ProviderType == PROVIDER_TYPE.MSDAORA) {\r
+                                       string host = ConnectionStringHelper.FindValue(UserParameters,StringManager.GetStringArray("CON_SERVER_NAME"));\r
+\r
+                                       if (!String.Empty.Equals(host)) {\r
+                                               return host;\r
+                                       }\r
+\r
+                                       if (ProviderType == PROVIDER_TYPE.IBMDADB2) {\r
+                                               string location = ConnectionStringHelper.FindValue(UserParameters,StringManager.GetStringArray("DB2_CON_LOCATION"));\r
+\r
+                                               if (!String.Empty.Equals(location)) {\r
+                                                       int semicolumnIndex = location.IndexOf(':');\r
+                                                       if (semicolumnIndex != -1) {\r
+                                                               return location.Substring(0,semicolumnIndex);\r
+                                                       }\r
+                                                       else {\r
+                                                               return location;\r
+                                                       }\r
+                                               }\r
+                                       }\r
+\r
+                               }\r
+                               return base.ServerName; \r
+                       }\r
+               }\r
+\r
+               protected override string CatalogName\r
+               {\r
+                       get { \r
+                               switch (ProviderType) {\r
+                                       case PROVIDER_TYPE.IBMDADB2:\r
+                                       case PROVIDER_TYPE.MSDAORA:\r
+                                               return DataSource;\r
+                               }\r
+                               return base.CatalogName;\r
+                       }\r
+               }\r
+\r
+               protected override string Port\r
+               {\r
+                       get {\r
+                               string port = ConnectionStringHelper.FindValue(UserParameters, StringManager.GetStringArray("CON_PORT"));\r
+                               switch (ProviderType) {\r
+                                       case PROVIDER_TYPE.MSDAORA :\r
+                                               if (String.Empty.Equals(port)) {\r
+                                                       return StringManager.GetString("ORA_CON_PORT");\r
+                                               }\r
+                                               return port;\r
+                                       case PROVIDER_TYPE.IBMDADB2 :\r
+                                               if (String.Empty.Equals(port)) {\r
+                                                       string location = ConnectionStringHelper.FindValue(UserParameters,StringManager.GetStringArray("DB2_CON_LOCATION"));\r
+\r
+                                                       if (!String.Empty.Equals(location)) {\r
+                                                               int semicolumnIndex = location.IndexOf(':');\r
+                                                               if (semicolumnIndex != -1) {\r
+                                                                       return location.Substring(semicolumnIndex + 1);\r
+                                                               }\r
+                                                       }\r
+                                                       return StringManager.GetString("DB2_CON_PORT");\r
+                                               }\r
+                                               return port;\r
+                               }\r
+                               return base.Port;\r
+                       }\r
+               }\r
+\r
+               protected override string JdbcDriverName\r
+               {\r
+                       get {\r
+                               JDBC_MODE jdbcMode = JdbcMode;\r
+                               switch (jdbcMode) {\r
+                                       case JDBC_MODE.DATA_SOURCE_MODE :\r
+                                               return base.JdbcDriverName;\r
+                                       case JDBC_MODE.JDBC_DRIVER_MODE :\r
+                                               return ConnectionStringHelper.FindValue(UserParameters,StringManager.GetStringArray("JDBC_DRIVER"));\r
+                                       case JDBC_MODE.PROVIDER_MODE:\r
+                                               switch (ProviderType) {\r
+                                                       case PROVIDER_TYPE.SQLOLEDB :\r
+                                                               return StringManager.GetString("SQL_JDBC_DRIVER");\r
+                                                       case PROVIDER_TYPE.MSDAORA :\r
+                                                               return StringManager.GetString("ORA_JDBC_DRIVER");\r
+                                                       case PROVIDER_TYPE.IBMDADB2 :\r
+                                                               return StringManager.GetString("DB2_JDBC_DRIVER");\r
+                                               }\r
+                                               break;\r
+                               };\r
+                               return base.JdbcDriverName;\r
+                       }\r
+               }\r
+\r
+               protected override DbStringManager StringManager\r
+               {\r
+                       get { return _stringManager; }\r
+               }\r
+\r
+               #endregion // Properties\r
+\r
+               #region Methods\r
+\r
+               public new OleDbTransaction BeginTransaction(IsolationLevel level)\r
+               {\r
+                       return new OleDbTransaction(level, this);\r
+               }\r
+\r
+               public new OleDbTransaction BeginTransaction()\r
+               {\r
+                       return BeginTransaction(IsolationLevel.ReadCommitted);\r
+               }\r
+\r
+               public new OleDbCommand CreateCommand()\r
+               {\r
+                       return new OleDbCommand(this);\r
+               }\r
+\r
+               protected override DbTransaction BeginDbTransaction(IsolationLevel isolationLevel) {\r
+                       return BeginTransaction();\r
+               }\r
+\r
+               protected override DbCommand CreateDbCommand() {\r
+                       return CreateCommand();\r
+               }\r
+\r
+\r
+               protected internal override void CopyTo(AbstractDBConnection target)\r
+               {\r
+                       base.CopyTo(target);\r
+               }\r
+\r
+               public object Clone()\r
+               {\r
+                       OleDbConnection clone = new OleDbConnection();\r
+                       CopyTo(clone);\r
+                       return clone;\r
+               }\r
+\r
+               protected override SystemException CreateException(SQLException e)\r
+               {\r
+                       return new OleDbException(e,this);              \r
+               }\r
+\r
+               public DataTable GetOleDbSchemaTable (Guid schema, object[] restrictions)\r
+               {\r
+                       DataTable schemaTable = new DataTable("Tables");\r
+                       schemaTable.Columns.Add("TABLE_CATALOG");\r
+                       schemaTable.Columns.Add("TABLE_SCHEMA");\r
+                       schemaTable.Columns.Add("TABLE_NAME");\r
+                       schemaTable.Columns.Add("TABLE_TYPE");\r
+                       schemaTable.Columns.Add("TABLE_GUID");\r
+                       schemaTable.Columns.Add("DESCRIPTION");\r
+                       schemaTable.Columns.Add("TABLE_PROPID");\r
+                       schemaTable.Columns.Add("DATE_CREATED");\r
+                       schemaTable.Columns.Add("DATE_MODIFIED");\r
+            \r
+            \r
+                       Connection con = JdbcConnection;\r
+                       String catalog = con.getCatalog();\r
+            \r
+                       DatabaseMetaData meta = con.getMetaData();\r
+                       ResultSet schemaRes = meta.getSchemas();\r
+                       System.Collections.ArrayList schemas = new System.Collections.ArrayList();\r
+                       while(schemaRes.next()) {\r
+                               schemas.Add(schemaRes.getString(1));\r
+                       }\r
+                       schemaRes.close();\r
+\r
+                       for(int i = 0; i < schemas.Count; i++) {\r
+                               ResultSet tableRes = meta.getTables(catalog, schemas[i].ToString(), null, null);\r
+                               while(tableRes.next()) {\r
+                                       DataRow row = schemaTable.NewRow();\r
+                                       row["TABLE_CATALOG"] = catalog;\r
+                                       row["TABLE_SCHEMA"] = schemas[i];\r
+                                       row["TABLE_NAME"] = tableRes.getString("TABLE_NAME");\r
+                                       row["TABLE_TYPE"] = tableRes.getString("TABLE_TYPE");\r
+                                       row["DESCRIPTION"] = tableRes.getString("REMARKS");\r
+                    \r
+                                       schemaTable.Rows.Add(row);\r
+                               }\r
+                               tableRes.close();\r
+                       }\r
+                       return schemaTable;\r
+               }\r
+\r
+               protected internal override void ValidateConnectionString(string connectionString)\r
+               {\r
+                       base.ValidateConnectionString(connectionString);\r
+\r
+                       JDBC_MODE currentJdbcMode = JdbcMode;\r
+                       \r
+                       if (currentJdbcMode == JDBC_MODE.NONE) {\r
+                               string provider = StringManager.GetString("CON_PROVIDER");\r
+\r
+                               if (String.Empty.Equals(provider)) {\r
+                                       throw ExceptionHelper.OleDbNoProviderSpecified();\r
+                               }\r
+                       }\r
+               }\r
+\r
+               protected override string BuildJdbcUrl()\r
+               {\r
+                       switch (JdbcMode) {\r
+                               case JDBC_MODE.PROVIDER_MODE :\r
+                               switch (ProviderType) {\r
+                                       case PROVIDER_TYPE.IBMDADB2:\r
+                                               return BuildDb2Url();\r
+                                       case PROVIDER_TYPE.MSDAORA:\r
+                                               return BuildOracleUrl();\r
+                                       case PROVIDER_TYPE.SQLOLEDB:\r
+                                               return BuildMsSqlUrl();\r
+                               }\r
+                               break;\r
+                       }\r
+                       return base.BuildJdbcUrl();\r
+               }\r
+\r
+               public static void ReleaseObjectPool()\r
+               {\r
+                       // since we're using connection pool from app servet, this is by design\r
+                       //throw new NotImplementedException();\r
+               }\r
+\r
+               internal override void OnSqlWarning(SQLWarning warning)\r
+               {\r
+                       OleDbErrorCollection col = new OleDbErrorCollection(warning, this);\r
+                       OnOleDbInfoMessage(new OleDbInfoMessageEventArgs(col));\r
+               }\r
+\r
+               internal override Connection GetConnectionFromProvider()\r
+               {\r
+                       if ((ProviderType == PROVIDER_TYPE.MSDAORA) && \r
+                               ("true").Equals(StringManager.GetString("ORA_CONNECTION_POOLING_ENABLED","false"))) {\r
+                               ActivateJdbcDriver(JdbcDriverName);\r
+                               return OleDbConnectionFactory.GetConnection(ProviderType,JdbcUrl,User,Password,ConnectionTimeout);\r
+                       }\r
+                       else {\r
+                               return base.GetConnectionFromProvider();\r
+                       }\r
+               }\r
+\r
+               private String BuildDb2Url()\r
+               {\r
+                       return StringManager.GetString("DB2_JDBC_URL") //jdbc:db2://\r
+                               + ServerName + ":" + Port + "/" + CatalogName;\r
+               }\r
+\r
+               private String BuildOracleUrl()\r
+               {\r
+                       return StringManager.GetString("ORA_JDBC_URL") //"jdbc:oracle:thin:@"\r
+                               + ServerName + ":" + Port + ":" + CatalogName;\r
+               }\r
+        \r
+               internal override void OnStateChanged(ConnectionState orig, ConnectionState current)\r
+               {\r
+                       if(StateChange != null) {\r
+                               StateChange(this, new StateChangeEventArgs(orig, current));\r
+                       }\r
+               }\r
+\r
+               public override void Close()\r
+               {\r
+                       ConnectionState orig = State;\r
+                       base.Close();\r
+                       ConnectionState current = State;\r
+                       if(current != orig) {\r
+                               OnStateChanged(orig, current);\r
+                       }\r
+               }\r
+\r
+               private void OnOleDbInfoMessage (OleDbInfoMessageEventArgs value)
+               {
+                       if (InfoMessage != null) {
+                               InfoMessage (this, value);
+                       }
+               }\r
+\r
+               #endregion // Methods\r
+\r
+       }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbConnectionFactory.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbConnectionFactory.cs
new file mode 100644 (file)
index 0000000..fb2a2c4
--- /dev/null
@@ -0,0 +1,167 @@
+/*\r
+  * Copyright (c) 2002-2004 Mainsoft Corporation.\r
+  *\r
+  * Permission is hereby granted, free of charge, to any person obtaining a\r
+  * copy of this software and associated documentation files (the "Software"),\r
+  * to deal in the Software without restriction, including without limitation\r
+  * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+  * and/or sell copies of the Software, and to permit persons to whom the\r
+  * Software is furnished to do so, subject to the following conditions:\r
+  *\r
+  * The above copyright notice and this permission notice shall be included in\r
+  * all copies or substantial portions of the Software.\r
+  *\r
+  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+  * DEALINGS IN THE SOFTWARE.\r
+  */\r
+\r
+\r
+using System;\r
+using System.Data;\r
+using System.Data.Common;\r
+using System.Reflection;\r
+using System.Collections;\r
+\r
+namespace System.Data.OleDb\r
+{\r
+       internal class OleDbConnectionFactory\r
+       {\r
+               private static Object LockObj = new Object();\r
+               private static Hashtable dataSourceCache = new Hashtable();\r
+               private static Type OracleConnectionCacheImplType = Type.GetType("oracle.jdbc.pool.OracleConnectionCacheImpl");\r
+                                                                                                                                                 \r
+               private static MethodInfo setUrlMethod = OracleConnectionCacheImplType.GetMethod("setURL", BindingFlags.Public | BindingFlags.Instance);\r
+               private static MethodInfo setUserMethod = OracleConnectionCacheImplType.GetMethod("setUser", BindingFlags.Public | BindingFlags.Instance);\r
+               private static MethodInfo setPasswordMethod = OracleConnectionCacheImplType.GetMethod("setPassword", BindingFlags.Public | BindingFlags.Instance);\r
+               private static MethodInfo getActiveSizeMethod = OracleConnectionCacheImplType.GetMethod("getActiveSize", BindingFlags.Public | BindingFlags.Instance);\r
+               private static MethodInfo closeMethod = OracleConnectionCacheImplType.GetMethod("close", BindingFlags.Public | BindingFlags.Instance);\r
+               private static MethodInfo setMaxLimitMethod = OracleConnectionCacheImplType.GetMethod("setMaxLimit", BindingFlags.Public | BindingFlags.Instance);\r
+               private static MethodInfo setMinLimitMethod = OracleConnectionCacheImplType.GetMethod("setMinLimit", BindingFlags.Public | BindingFlags.Instance);\r
+               private static long timestamp = DateTime.Now.Ticks;\r
+               private static int MINUTES_TIMEOUT = 60;\r
+\r
+               private static DbStringManager StringManager = new DbStringManager("System.Data.System.Data.ProviderBase.jvm.OleDbStrings");\r
+\r
+               internal static java.sql.Connection GetConnection(OleDbConnection.PROVIDER_TYPE providerType,String url,String user,String password,int timeout)\r
+               {\r
+                       CacheKey key = new CacheKey(url,user,password);\r
+                       Object dataSourceObj;\r
+                       lock(LockObj) \r
+                       {\r
+                               if (TimeIsOver())\r
+                                       Clear();\r
+\r
+                               dataSourceObj = dataSourceCache[key];\r
+                               if (dataSourceObj == null) \r
+                               {\r
+                                       switch(providerType) \r
+                                       {\r
+                                               case OleDbConnection.PROVIDER_TYPE.MSDAORA :                                    \r
+                                       \r
+                                                       dataSourceObj = Activator.CreateInstance(OracleConnectionCacheImplType);\r
+                                       \r
+                                                       Object[] setUrlArgs = new Object[1] { url };\r
+                                                       Object[] setUserArgs = new Object[1] { user };\r
+                                                       Object[] setPasswordArgs = new Object[1] { password };\r
+\r
+                                                       setUrlMethod.Invoke(dataSourceObj,setUrlArgs);\r
+                                                       setUserMethod.Invoke(dataSourceObj,setUserArgs);\r
+                                                       setPasswordMethod.Invoke(dataSourceObj,setPasswordArgs);\r
+\r
+                                                       int maxLimit = Convert.ToInt32(StringManager.GetString("ORA_CONNECTION_POOLING_MAX_LIMIT","-1"));\r
+                                                       int minLimit = Convert.ToInt32(StringManager.GetString("ORA_CONNECTION_POOLING_MIN_LIMIT","-1"));\r
+\r
+                                                       if(minLimit != -1)\r
+                                                               setMinLimitMethod.Invoke(dataSourceObj,new Object[1] { minLimit } );\r
+\r
+                                                       if(maxLimit != -1)\r
+                                                               setMaxLimitMethod.Invoke(dataSourceObj,new Object[1] { maxLimit } );\r
+\r
+                                                       break;\r
+                                       }\r
+                                       dataSourceCache.Add(key,dataSourceObj);\r
+                               }\r
+                       }\r
+\r
+                       java.sql.Connection conn;\r
+                       lock(dataSourceObj) {\r
+                               if (((javax.sql.DataSource)dataSourceObj).getLoginTimeout() != timeout) {\r
+                                       ((javax.sql.DataSource)dataSourceObj).setLoginTimeout(timeout);\r
+                               }\r
+                               conn = ((javax.sql.DataSource)dataSourceObj).getConnection();\r
+                       }\r
+                       return conn;\r
+               }\r
+\r
+               private static bool TimeIsOver() \r
+               {\r
+                               return (DateTime.Now.Ticks - timestamp > MINUTES_TIMEOUT * TimeSpan.TicksPerMinute);\r
+               }\r
+\r
+               private static void Clear() \r
+               {\r
+                       ArrayList closedDataSources = new ArrayList();\r
+\r
+                       // collect all the datasources with no connections in use\r
+                       foreach(DictionaryEntry e in dataSourceCache)\r
+                       {\r
+                               Object dataSourceObj = e.Value;\r
+                               Object dataSourceObjKey = e.Key;\r
+\r
+                               if (getActiveSizeMethod.Invoke(dataSourceObj,new object[0]).Equals(0)) {\r
+                                       closeMethod.Invoke(dataSourceObj,new object[0]);\r
+                                       closedDataSources.Add(dataSourceObjKey);\r
+                               }\r
+                       }\r
+\r
+                       // close and remove all data sources with no connections in use\r
+                       foreach(Object dataSourceObjKey in closedDataSources) {\r
+                               dataSourceCache.Remove(dataSourceObjKey);\r
+                       }       \r
+               }\r
+       }\r
+\r
+       // Key for data sources cache\r
+       // data sources mapped by jdbc url, user and password\r
+       internal class CacheKey\r
+    {\r
+        private String url;\r
+        private String user;\r
+        private String password;\r
+\r
+        public CacheKey(String url, String user, String password)\r
+        {\r
+            this.url = url;\r
+            this.user = user;\r
+            this.password = password;\r
+        }\r
+\r
+        public bool equals(Object o)\r
+        {\r
+            if (this == o) return true;\r
+            if (!(o is CacheKey)) return false;\r
+\r
+            CacheKey cacheKey = (CacheKey) o;\r
+\r
+            if (!password.Equals(cacheKey.password)) return false;\r
+            if (!url.Equals(cacheKey.url)) return false;\r
+            if (!user.Equals(cacheKey.user)) return false;\r
+\r
+            return true;\r
+        }\r
+\r
+        public int hashCode()\r
+        {\r
+            int result;\r
+            result = url.GetHashCode();\r
+            result = 29 * result + user.GetHashCode();\r
+            result = 29 * result + password.GetHashCode();\r
+            return result;\r
+        }\r
+    }\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbConvert.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbConvert.cs
new file mode 100644 (file)
index 0000000..a59e0c5
--- /dev/null
@@ -0,0 +1,313 @@
+//\r
+// System.Data.OlDb.OleDbConvert\r
+//\r
+// Author:\r
+//   Boris Kirzner (borisk@mainsoft.com)\r
+//\r
+\r
+using System;\r
+using System.Collections;\r
+using System.Data.Common;\r
+\r
+using java.sql;\r
+\r
+namespace System.Data.OleDb\r
+{\r
+       internal sealed class OleDbConvert : DbConvert\r
+       {\r
+               #region Fields\r
+\r
+               private static Hashtable _typeNamesMap;\r
+\r
+               #endregion // Fields\r
+\r
+               #region Constructors\r
+\r
+               static OleDbConvert()\r
+               {\r
+                       _typeNamesMap = new Hashtable(30,new CaseInsensitiveHashCodeProvider(), new CaseInsensitiveComparer());\r
+                       \r
+                       // SqlServer types mapping\r
+//                     _typeNamesMap.Add("numeric(3, 0)1","DBTYPE_I1");\r
+                       _typeNamesMap.Add("smallint","DBTYPE_I2");\r
+                       _typeNamesMap.Add("Int","DBTYPE_I4");\r
+                       _typeNamesMap.Add("bigint","DBTYPE_I8");\r
+                       _typeNamesMap.Add("tinyint","DBTYPE_UI1");\r
+//                     _typeNamesMap.Add("numeric(5,0)","DBTYPE_UI2");\r
+//                     _typeNamesMap.Add("numeric(10,0)","DBTYPE_UI4");\r
+//                     _typeNamesMap.Add("numeric(20,0)","DBTYPE_UI8");\r
+                       _typeNamesMap.Add("Float","DBTYPE_R8");\r
+                       _typeNamesMap.Add("Real","DBTYPE_R4");\r
+                       _typeNamesMap.Add("numeric","DBTYPE_NUMERIC");\r
+                       _typeNamesMap.Add("decimal","DBTYPE_NUMERIC");\r
+                       _typeNamesMap.Add("money","DBTYPE_CY");\r
+                       _typeNamesMap.Add("smallmoney","DBTYPE_CY");\r
+                       _typeNamesMap.Add("ntext","DBTYPE_WLONGVARCHAR");\r
+                       _typeNamesMap.Add("nchar","DBTYPE_WCHAR");\r
+                       _typeNamesMap.Add("nvarchar","DBTYPE_WVARCHAR");\r
+                       _typeNamesMap.Add("Bit","DBTYPE_BOOL");\r
+//                     _typeNamesMap.Add("nvarchar(4000)","DBTYPE_VARIANT");\r
+                       _typeNamesMap.Add("sql_variant","DBTYPE_VARIANT");\r
+                       _typeNamesMap.Add("uniqueidentifier","DBTYPE_GUID");\r
+                       _typeNamesMap.Add("image","DBTYPE_LONGVARBINARY");\r
+                       _typeNamesMap.Add("timestamp","DBTYPE_BINARY");\r
+                       _typeNamesMap.Add("binary","DBTYPE_BINARY");\r
+                       _typeNamesMap.Add("varbinary","DBTYPE_VARBINARY");\r
+                       _typeNamesMap.Add("char","DBTYPE_CHAR");\r
+                       _typeNamesMap.Add("varchar","DBTYPE_VARCHAR");\r
+                       _typeNamesMap.Add("text","DBTYPE_LONGVARCHAR");\r
+//                     _typeNamesMap.Add("nchar","DBTYPE_WSTR");\r
+//                     _typeNamesMap.Add("nvarchar","DBTYPE_WSTR");\r
+//                     _typeNamesMap.Add("ntext","DBTYPE_WSTR");\r
+//                     _typeNamesMap.Add("datetime","DBTYPE_DATE");\r
+                       _typeNamesMap.Add("datetime","DBTYPE_DBTIMESTAMP");\r
+                       _typeNamesMap.Add("smalldatetime","DBTYPE_DBTIMESTAMP");\r
+                       _typeNamesMap.Add("Ignored","DBTYPE_BYREF");\r
+               }\r
+\r
+               #endregion //Constructors\r
+\r
+               #region Methods\r
+\r
+               internal static String JdbcTypeNameToDbTypeName(string jdbcTypeName)\r
+               {\r
+                       jdbcTypeName = jdbcTypeName.Trim();\r
+                       string dbTypeName = (string)_typeNamesMap[jdbcTypeName];\r
+\r
+                       return (dbTypeName != null) ? dbTypeName : jdbcTypeName;\r
+               }\r
+\r
+               internal static OleDbType JdbcTypeToOleDbType(int jdbcType)\r
+               {\r
+                       switch ((DbTypes.JavaSqlTypes)jdbcType) {\r
+                               case DbTypes.JavaSqlTypes.ARRAY: return OleDbType.Binary;\r
+                               case DbTypes.JavaSqlTypes.BIGINT: return OleDbType.BigInt;\r
+                               case DbTypes.JavaSqlTypes.BINARY: return OleDbType.Binary;\r
+                               case DbTypes.JavaSqlTypes.BIT: return OleDbType.Boolean;\r
+                               case DbTypes.JavaSqlTypes.BLOB: return OleDbType.Binary;\r
+                               case DbTypes.JavaSqlTypes.BOOLEAN: return OleDbType.Boolean;\r
+                               case DbTypes.JavaSqlTypes.CHAR: return OleDbType.Char;\r
+                               case DbTypes.JavaSqlTypes.CLOB: return OleDbType.LongVarWChar;\r
+                               case DbTypes.JavaSqlTypes.DATALINK: return OleDbType.IUnknown;\r
+                               case DbTypes.JavaSqlTypes.DATE: return OleDbType.DBDate;\r
+                               case DbTypes.JavaSqlTypes.DECIMAL: return OleDbType.Decimal;\r
+                               case DbTypes.JavaSqlTypes.DISTINCT: return OleDbType.IUnknown; \r
+                               case DbTypes.JavaSqlTypes.DOUBLE: return OleDbType.Double;\r
+                               case DbTypes.JavaSqlTypes.FLOAT: return OleDbType.Double;\r
+                               case DbTypes.JavaSqlTypes.INTEGER: return OleDbType.Integer;\r
+                               case DbTypes.JavaSqlTypes.JAVA_OBJECT: return OleDbType.IUnknown;\r
+                               case DbTypes.JavaSqlTypes.LONGVARBINARY: return OleDbType.LongVarBinary;\r
+                               case DbTypes.JavaSqlTypes.LONGVARCHAR: return OleDbType.LongVarWChar;\r
+                               case DbTypes.JavaSqlTypes.NULL: return OleDbType.Empty;\r
+                               case DbTypes.JavaSqlTypes.NUMERIC: return OleDbType.Numeric;\r
+                               default:\r
+                               case DbTypes.JavaSqlTypes.OTHER: return OleDbType.IUnknown;\r
+                               case DbTypes.JavaSqlTypes.REAL: return OleDbType.Single;\r
+                               case DbTypes.JavaSqlTypes.REF: return OleDbType.IUnknown;\r
+                               case DbTypes.JavaSqlTypes.SMALLINT: return OleDbType.SmallInt;\r
+                               case DbTypes.JavaSqlTypes.STRUCT: return OleDbType.IUnknown;\r
+                               case DbTypes.JavaSqlTypes.TIME: return OleDbType.DBTime;\r
+                               case DbTypes.JavaSqlTypes.TIMESTAMP: return OleDbType.DBTimeStamp;\r
+                               case DbTypes.JavaSqlTypes.TINYINT: return OleDbType.TinyInt;\r
+                               case DbTypes.JavaSqlTypes.VARBINARY: return OleDbType.VarBinary;\r
+                               case DbTypes.JavaSqlTypes.VARCHAR: return OleDbType.VarChar;\r
+                       }\r
+               }\r
+\r
+               internal static OleDbType ValueTypeToOleDbType(Type type)\r
+               {\r
+                       switch (Type.GetTypeCode(type)) {\r
+                               case TypeCode.Boolean: return OleDbType.Boolean;\r
+                               case TypeCode.Byte: return OleDbType.UnsignedTinyInt;\r
+                               case TypeCode.Char: return OleDbType.Char;\r
+                               case TypeCode.DateTime: return OleDbType.Date;\r
+                               case TypeCode.DBNull: return OleDbType.Empty;\r
+                               case TypeCode.Decimal: return OleDbType.Decimal;\r
+                               case TypeCode.Double: return OleDbType.Double;\r
+                               case TypeCode.Empty: return OleDbType.Empty;\r
+                               case TypeCode.Int16: return OleDbType.SmallInt;\r
+                               case TypeCode.Int32: return OleDbType.Integer;\r
+                               case TypeCode.Int64: return OleDbType.BigInt;\r
+                               default:\r
+                               case TypeCode.Object: {\r
+                                       if (type.Equals(DbTypes.TypeOfByteArray)) return  OleDbType.Binary;\r
+                                       if (type.Equals(DbTypes.TypeOfTimespan)) return OleDbType.DBTime;\r
+                                       if (type.Equals(DbTypes.TypeOfGuid)) return OleDbType.Guid;\r
+\r
+                                       return OleDbType.IUnknown;\r
+                               }\r
+                               case TypeCode.SByte: return OleDbType.TinyInt;\r
+                               case TypeCode.Single: return OleDbType.Single;\r
+                               case TypeCode.String: return OleDbType.VarWChar;\r
+                               case TypeCode.UInt16: return OleDbType.UnsignedSmallInt;\r
+                               case TypeCode.UInt32: return OleDbType.UnsignedInt;\r
+                               case TypeCode.UInt64: return OleDbType.UnsignedBigInt;\r
+                       }\r
+               }\r
+\r
+               internal static Type OleDbTypeToValueType(OleDbType oleDbType)\r
+               {\r
+                       switch (oleDbType) {\r
+                               case OleDbType.BigInt : return DbTypes.TypeOfInt64;// typeof(long);\r
+                               case OleDbType.Binary : return DbTypes.TypeOfByteArray;\r
+                               case OleDbType.Boolean : return DbTypes.TypeOfBoolean;\r
+                               case OleDbType.BSTR : return DbTypes.TypeOfString;\r
+                               case OleDbType.Char : return DbTypes.TypeOfString;\r
+                               case OleDbType.Currency : return DbTypes.TypeOfDecimal;\r
+                               case OleDbType.Date : return DbTypes.TypeOfDateTime;\r
+                               case OleDbType.DBDate : return DbTypes.TypeOfDateTime;\r
+                               case OleDbType.DBTime : return DbTypes.TypeOfTimespan;\r
+                               case OleDbType.DBTimeStamp : return DbTypes.TypeOfDateTime;\r
+                               case OleDbType.Decimal : return DbTypes.TypeOfDecimal;\r
+                               case OleDbType.Double : return DbTypes.TypeOfDouble;\r
+                               case OleDbType.Empty : return null; //typeof(DBNull);\r
+                               case OleDbType.Error : return typeof(Exception);\r
+                               case OleDbType.Filetime : return DbTypes.TypeOfDateTime;\r
+                               case OleDbType.Guid : return DbTypes.TypeOfGuid;\r
+                               case OleDbType.IDispatch : return DbTypes.TypeOfObject;\r
+                               case OleDbType.Integer : return DbTypes.TypeOfInt32;\r
+                               case OleDbType.IUnknown : return DbTypes.TypeOfObject;\r
+                               case OleDbType.LongVarBinary : return DbTypes.TypeOfByteArray;\r
+                               case OleDbType.LongVarChar : return DbTypes.TypeOfString;\r
+                               case OleDbType.LongVarWChar : return DbTypes.TypeOfString;\r
+                               case OleDbType.Numeric : return DbTypes.TypeOfDecimal;\r
+                               case OleDbType.PropVariant : return DbTypes.TypeOfObject;\r
+                               case OleDbType.Single : return DbTypes.TypeOfFloat;\r
+                               case OleDbType.SmallInt : return DbTypes.TypeOfInt16;\r
+                               case OleDbType.TinyInt : return DbTypes.TypeOfSByte;\r
+                               case OleDbType.UnsignedBigInt : return DbTypes.TypeOfUInt64;\r
+                               case OleDbType.UnsignedInt : return DbTypes.TypeOfUInt32;\r
+                               case OleDbType.UnsignedSmallInt : return DbTypes.TypeOfUInt16;\r
+                               case OleDbType.UnsignedTinyInt : return DbTypes.TypeOfByte;\r
+                               case OleDbType.VarBinary : return DbTypes.TypeOfByteArray;\r
+                               case OleDbType.VarChar : return DbTypes.TypeOfString;\r
+                               case OleDbType.Variant : return DbTypes.TypeOfObject;\r
+                               case OleDbType.VarNumeric : return DbTypes.TypeOfDecimal;\r
+                               case OleDbType.VarWChar : return DbTypes.TypeOfString;\r
+                               case OleDbType.WChar : return DbTypes.TypeOfString;\r
+                               default : return DbTypes.TypeOfObject;\r
+                       }\r
+               }\r
+\r
+               internal static OleDbType DbTypeToOleDbType(DbType dbType)\r
+               {\r
+                       switch (dbType) {\r
+                               case DbType.AnsiString : return OleDbType.VarChar;\r
+                               case DbType.Binary : return OleDbType.VarBinary;\r
+                               case DbType.Byte : return OleDbType.UnsignedTinyInt;\r
+                               case DbType.Boolean : return OleDbType.Boolean;\r
+                               case DbType.Currency : return OleDbType.Currency;\r
+                               case DbType.Date : return OleDbType.DBDate;\r
+                               case DbType.DateTime : return OleDbType.DBTimeStamp;\r
+                               case DbType.Decimal : return OleDbType.Decimal;\r
+                               case DbType.Double : return OleDbType.Double;\r
+                               case DbType.Guid : return OleDbType.Guid;\r
+                               case DbType.Int16 : return OleDbType.SmallInt;\r
+                               case DbType.Int32 : return OleDbType.Integer;\r
+                               case DbType.Int64 : return OleDbType.BigInt;\r
+                               case DbType.Object : return OleDbType.Variant;\r
+                               case DbType.SByte : return OleDbType.TinyInt;\r
+                               case DbType.Single : return OleDbType.Single;\r
+                               case DbType.String : return OleDbType.VarWChar;\r
+                               case DbType.Time : return OleDbType.DBTime;\r
+                               case DbType.UInt16 : return OleDbType.UnsignedSmallInt;\r
+                               case DbType.UInt32 : return OleDbType.UnsignedInt;\r
+                               case DbType.UInt64 : return OleDbType.UnsignedBigInt;\r
+                               case DbType.VarNumeric : return OleDbType.VarNumeric;\r
+                               case DbType.AnsiStringFixedLength : return OleDbType.Char;\r
+                               case DbType.StringFixedLength : return OleDbType.WChar;\r
+                               default : throw ExceptionHelper.InvalidDbType((int)dbType);\r
+                       }\r
+               }\r
+\r
+               internal static DbType OleDbTypeToDbType(OleDbType oleDbType)\r
+               {\r
+                       switch (oleDbType) {\r
+                               case OleDbType.Empty : return DbType.Object;\r
+                               case OleDbType.SmallInt : return DbType.Int16;\r
+                               case OleDbType.Integer : return DbType.Int32;\r
+                               case OleDbType.Single : return DbType.Single;\r
+                               case OleDbType.Double : return DbType.Double;\r
+                               case OleDbType.Currency : return DbType.Currency;\r
+                               case OleDbType.Date : return DbType.DateTime;\r
+                               case OleDbType.BSTR : return DbType.String;\r
+                               case OleDbType.IDispatch : return DbType.Object;\r
+                               case OleDbType.Error : return DbType.Object;\r
+                               case OleDbType.Boolean : return DbType.Boolean;\r
+                               case OleDbType.Variant : return DbType.Object;\r
+                               case OleDbType.IUnknown : return DbType.Object;\r
+                               case OleDbType.Decimal : return DbType.Decimal;\r
+                               case OleDbType.TinyInt : return DbType.SByte;\r
+                               case OleDbType.UnsignedTinyInt : return DbType.Byte;\r
+                               case OleDbType.UnsignedSmallInt : return DbType.UInt16;\r
+                               case OleDbType.UnsignedInt : return DbType.UInt32;\r
+                               case OleDbType.BigInt : return DbType.Int64;\r
+                               case OleDbType.UnsignedBigInt : return DbType.UInt64;\r
+                               case OleDbType.Filetime : return DbType.DateTime;\r
+                               case OleDbType.Guid : return DbType.Guid;\r
+                               case OleDbType.Binary : return DbType.Binary;\r
+                               case OleDbType.Char : return DbType.AnsiStringFixedLength;\r
+                               case OleDbType.WChar : return DbType.StringFixedLength;\r
+                               case OleDbType.Numeric : return DbType.Decimal;\r
+                               case OleDbType.DBDate : return DbType.Date;\r
+                               case OleDbType.DBTime : return DbType.Time;\r
+                               case OleDbType.DBTimeStamp : return DbType.DateTime;\r
+                               case OleDbType.PropVariant : return DbType.Object;\r
+                               case OleDbType.VarNumeric : return DbType.VarNumeric;\r
+                               case OleDbType.VarChar : return DbType.AnsiString;\r
+                               case OleDbType.LongVarChar : return DbType.AnsiString;\r
+                               case OleDbType.VarWChar : return DbType.String;\r
+                               case OleDbType.LongVarWChar : return DbType.String;\r
+                               case OleDbType.VarBinary : return DbType.Binary;\r
+                               case OleDbType.LongVarBinary : return DbType.Binary;\r
+                               default : throw ExceptionHelper.InvalidOleDbType((int)oleDbType);\r
+                       }\r
+               }\r
+\r
+               internal static int     OleDbTypeToJdbcType(OleDbType oleDbType)\r
+               {\r
+                       switch(oleDbType) {\r
+                               case OleDbType.BigInt : return Types.BIGINT;\r
+                               case OleDbType.Binary : return Types.BINARY;\r
+                               case OleDbType.Boolean : return Types.BIT;\r
+                               case OleDbType.BSTR : return Types.VARCHAR;\r
+                               case OleDbType.Char : return Types.CHAR;\r
+                               case OleDbType.Currency : return Types.DECIMAL;\r
+                               case OleDbType.Date : return Types.TIMESTAMP;\r
+                               case OleDbType.DBDate : return Types.DATE;\r
+                               case OleDbType.DBTime : return Types.TIME;\r
+                               case OleDbType.DBTimeStamp : return Types.TIMESTAMP;\r
+                               case OleDbType.Decimal : return Types.DECIMAL;\r
+                               case OleDbType.Double : return Types.DOUBLE;\r
+                               case OleDbType.Empty : return Types.NULL;\r
+                               case OleDbType.Error : return Types.OTHER;\r
+                               case OleDbType.Filetime : return Types.TIMESTAMP;\r
+                               case OleDbType.Guid : return Types.OTHER;\r
+                               case OleDbType.IDispatch : return Types.OTHER; //throw new ArgumentException("The " + oleDbType + " OleDbType value is not supported.");\r
+                               case OleDbType.Integer : return Types.INTEGER;\r
+                               case OleDbType.IUnknown :  return Types.OTHER; //throw new ArgumentException("The " + oleDbType + " OleDbType value is not supported.");\r
+                               case OleDbType.LongVarBinary : return Types.LONGVARBINARY;\r
+                               case OleDbType.LongVarChar : return Types.LONGVARCHAR;\r
+                               case OleDbType.LongVarWChar : return Types.LONGVARCHAR;\r
+                               case OleDbType.Numeric : return Types.NUMERIC;\r
+                               case OleDbType.PropVariant : return Types.OTHER;\r
+                               case OleDbType.Single : return Types.FLOAT;\r
+                               case OleDbType.SmallInt : return Types.SMALLINT;\r
+                               case OleDbType.TinyInt : return Types.TINYINT;\r
+                               case OleDbType.UnsignedBigInt : return Types.BIGINT;\r
+                               case OleDbType.UnsignedInt : return Types.INTEGER;\r
+                               case OleDbType.UnsignedSmallInt : return Types.SMALLINT;\r
+                               case OleDbType.UnsignedTinyInt : return Types.TINYINT;\r
+                               case OleDbType.VarBinary : return Types.VARBINARY;\r
+                               case OleDbType.VarChar : return Types.VARCHAR;\r
+                               case OleDbType.Variant : return Types.VARCHAR;\r
+                               case OleDbType.VarNumeric : return Types.DECIMAL;\r
+                               case OleDbType.VarWChar : return Types.VARCHAR;\r
+                               case OleDbType.WChar : return Types.VARCHAR;\r
+                               default : throw ExceptionHelper.InvalidOleDbType((int)oleDbType);\r
+                       }\r
+\r
+                       #endregion // Methods\r
+               }\r
+       }\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbDataAdapter.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbDataAdapter.cs
new file mode 100644 (file)
index 0000000..2988716
--- /dev/null
@@ -0,0 +1,189 @@
+//\r
+// System.Data.OleDb.OleDbDataAdapter\r
+//\r
+// Authors:\r
+//   Rodrigo Moya (rodrigo@ximian.com)\r
+//   Tim Coleman (tim@timcoleman.com)\r
+//\r
+// Copyright (C) Rodrigo Moya, 2002\r
+// Copyright (C) Tim Coleman, 2002\r
+//\r
+\r
+using System;\r
+using System.ComponentModel;\r
+using System.Data;\r
+using System.Data.Common;\r
+\r
+namespace System.Data.OleDb\r
+{\r
+       public sealed class OleDbDataAdapter : DbDataAdapter, IDbDataAdapter\r
+       {\r
+               #region Fields\r
+\r
+               OleDbCommand deleteCommand;\r
+               OleDbCommand insertCommand;\r
+               OleDbCommand selectCommand;\r
+               OleDbCommand updateCommand;\r
+\r
+               #endregion\r
+\r
+               #region Constructors\r
+\r
+               public OleDbDataAdapter ()\r
+                       : this (new OleDbCommand ())\r
+               {\r
+               }\r
+\r
+               public OleDbDataAdapter (OleDbCommand selectCommand)\r
+               {\r
+                       DeleteCommand = new OleDbCommand ();\r
+                       InsertCommand = new OleDbCommand ();\r
+                       SelectCommand = selectCommand;\r
+                       UpdateCommand = new OleDbCommand ();\r
+               }\r
+\r
+               public OleDbDataAdapter (string selectCommandText, OleDbConnection selectConnection)\r
+                       : this (new OleDbCommand (selectCommandText, selectConnection))\r
+               {\r
+               }\r
+\r
+               public OleDbDataAdapter (string selectCommandText, string selectConnectionString)\r
+                       : this (selectCommandText, new OleDbConnection (selectConnectionString))\r
+               {\r
+               }\r
+\r
+               #endregion // Fields\r
+\r
+               #region Properties\r
+\r
+               public OleDbCommand DeleteCommand {\r
+                       get {\r
+                               return deleteCommand;\r
+                       }\r
+                       set {\r
+                               deleteCommand = value;\r
+                       }\r
+               }\r
+\r
+               public OleDbCommand InsertCommand {\r
+                       get {\r
+                               return insertCommand;\r
+                       }\r
+                       set {\r
+                               insertCommand = value;\r
+                       }\r
+               }\r
+\r
+               public OleDbCommand SelectCommand {\r
+                       get {\r
+                               return selectCommand;\r
+                       }\r
+                       set {\r
+                               selectCommand = value;\r
+                       }\r
+               }\r
+\r
+               public OleDbCommand UpdateCommand {\r
+                       get {\r
+                               return updateCommand;\r
+                       }\r
+                       set {\r
+                               updateCommand = value;\r
+                       }\r
+               }\r
+\r
+               IDbCommand IDbDataAdapter.DeleteCommand {\r
+                       get {\r
+                               return DeleteCommand;\r
+                       }\r
+                       set { \r
+                               if (value != null && !(value is OleDbCommand))\r
+                                       throw new ArgumentException ("DeleteCommand is not of Type OleDbCommand");\r
+                               DeleteCommand = (OleDbCommand)value;\r
+                       }\r
+               }\r
+\r
+               IDbCommand IDbDataAdapter.InsertCommand {\r
+                       get {\r
+                               return InsertCommand;\r
+                       }\r
+                       set { \r
+                               if (value != null && !(value is OleDbCommand))\r
+                                       throw new ArgumentException ("InsertCommand is not of Type OleDbCommand");\r
+                               InsertCommand = (OleDbCommand)value;\r
+                       }\r
+               }\r
+\r
+               IDbCommand IDbDataAdapter.SelectCommand {\r
+                       get {\r
+                               return SelectCommand;\r
+                       }\r
+                       set { \r
+                               if (value != null && !(value is OleDbCommand))\r
+                                       throw new ArgumentException ("SelectCommand is not of Type OleDbCommand");\r
+                               SelectCommand = (OleDbCommand)value;\r
+                       }\r
+               }\r
+\r
+               \r
+               IDbCommand IDbDataAdapter.UpdateCommand {\r
+                       get {\r
+                               return UpdateCommand;\r
+                       }\r
+                       set { \r
+                               if (value != null && !(value is OleDbCommand))\r
+                                       throw new ArgumentException ("UpdateCommand is not of Type OleDbCommand");\r
+                               UpdateCommand = (OleDbCommand)value;\r
+                       }\r
+               }\r
+\r
+               ITableMappingCollection IDataAdapter.TableMappings {\r
+                       get {\r
+                               return TableMappings;\r
+                       }\r
+               }\r
+\r
+               #endregion // Properties\r
+\r
+               #region Methods\r
+\r
+               protected override RowUpdatedEventArgs CreateRowUpdatedEvent (DataRow dataRow,\r
+                                                                             IDbCommand command,\r
+                                                                             StatementType statementType,\r
+                                                                             DataTableMapping tableMapping) \r
+               {\r
+                       return new OleDbRowUpdatedEventArgs (dataRow, command, statementType, tableMapping);\r
+               }\r
+\r
+\r
+               protected override RowUpdatingEventArgs CreateRowUpdatingEvent (DataRow dataRow,\r
+                                                                               IDbCommand command,\r
+                                                                               StatementType statementType,\r
+                                                                               DataTableMapping tableMapping) \r
+               {\r
+                       return new OleDbRowUpdatingEventArgs (dataRow, command, statementType, tableMapping);\r
+               }\r
+\r
+               protected override void OnRowUpdated (RowUpdatedEventArgs value) \r
+               {\r
+                       if (RowUpdated != null)\r
+                               RowUpdated (this, (OleDbRowUpdatedEventArgs) value);\r
+               }\r
+\r
+               protected override void OnRowUpdating (RowUpdatingEventArgs value) \r
+               {\r
+                       if (RowUpdating != null)\r
+                               RowUpdating (this, (OleDbRowUpdatingEventArgs) value);\r
+               }\r
+               \r
+               #endregion // Methods\r
+\r
+               #region Events and Delegates\r
+\r
+               public event OleDbRowUpdatedEventHandler RowUpdated;\r
+               public event OleDbRowUpdatingEventHandler RowUpdating;\r
+\r
+               #endregion // Events and Delegates\r
+\r
+       }\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbDataReader.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbDataReader.cs
new file mode 100644 (file)
index 0000000..638a85f
--- /dev/null
@@ -0,0 +1,60 @@
+//\r
+// System.Data.OleDb.OleDbDataReader\r
+//\r
+// Author:\r
+//   Boris Kirzner (borisk@mainsoft.com)\r
+//\r
+\r
+using System.Data.Common;\r
+using System.Data.ProviderBase;\r
+\r
+using java.sql;\r
+\r
+namespace System.Data.OleDb\r
+{\r
+       public sealed class OleDbDataReader : AbstractDataReader\r
+       {\r
+               #region Fields\r
+\r
+               #endregion // Fields\r
+\r
+               #region Constructors\r
+\r
+               internal OleDbDataReader(OleDbCommand command) : base(command)\r
+               {\r
+               }\r
+\r
+               #endregion // Constructors\r
+\r
+               #region Methods\r
+\r
+               protected override SystemException CreateException(string message, SQLException e)\r
+               {\r
+                       return new OleDbException(message,e, (OleDbConnection)_command.Connection);             \r
+               }\r
+\r
+               protected override SystemException CreateException(java.io.IOException e)\r
+               {\r
+                       return new OleDbException(e, (OleDbConnection)_command.Connection);             \r
+               }\r
+\r
+               public override String GetDataTypeName(int columnIndex)\r
+               {\r
+                       try {\r
+                               string jdbcTypeName = Results.getMetaData().getColumnTypeName(columnIndex + 1);\r
+                               \r
+                               return OleDbConvert.JdbcTypeNameToDbTypeName(jdbcTypeName);\r
+                       }\r
+                       catch (SQLException e) {\r
+                               throw CreateException(e);\r
+                       }\r
+               }\r
+\r
+               protected override int GetProviderType(int jdbcType)
+               {
+                       return (int)OleDbConvert.JdbcTypeToOleDbType(jdbcType);   
+               }\r
+\r
+               #endregion // Methods\r
+       }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbError.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbError.cs
new file mode 100644 (file)
index 0000000..d993881
--- /dev/null
@@ -0,0 +1,68 @@
+/*\r
+  * Copyright (c) 2002-2004 Mainsoft Corporation.\r
+  *\r
+  * Permission is hereby granted, free of charge, to any person obtaining a\r
+  * copy of this software and associated documentation files (the "Software"),\r
+  * to deal in the Software without restriction, including without limitation\r
+  * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+  * and/or sell copies of the Software, and to permit persons to whom the\r
+  * Software is furnished to do so, subject to the following conditions:\r
+  *\r
+  * The above copyright notice and this permission notice shall be included in\r
+  * all copies or substantial portions of the Software.\r
+  *\r
+  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+  * DEALINGS IN THE SOFTWARE.\r
+  */\r
+\r
+namespace System.Data.OleDb\r
+{\r
+       using java.sql;\r
+       using System.Data.Common;\r
+       using System.Data.ProviderBase;\r
+\r
+       [Serializable]\r
+    public sealed class OleDbError : AbstractDbError\r
+    {\r
+\r
+               internal OleDbError(SQLException e, AbstractDBConnection connection) : base(e, connection) {\r
+               }\r
+    \r
+        public String Message\r
+        {\r
+            get\r
+            {\r
+                return DbMessage;\r
+            }\r
+        }\r
+    \r
+        public int NativeError\r
+        {\r
+            get\r
+            {\r
+                return DbErrorCode;\r
+            }\r
+        }\r
+    \r
+        public String Source\r
+        {\r
+            get\r
+            {\r
+                return DbSource;\r
+            }\r
+        }\r
+    \r
+        public String SQLState\r
+        {\r
+            get\r
+            {\r
+                return DbSQLState;\r
+            }\r
+        }\r
+    }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbErrorCollection.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbErrorCollection.cs
new file mode 100644 (file)
index 0000000..801a9ca
--- /dev/null
@@ -0,0 +1,59 @@
+/*\r
+  * Copyright (c) 2002-2004 Mainsoft Corporation.\r
+  *\r
+  * Permission is hereby granted, free of charge, to any person obtaining a\r
+  * copy of this software and associated documentation files (the "Software"),\r
+  * to deal in the Software without restriction, including without limitation\r
+  * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+  * and/or sell copies of the Software, and to permit persons to whom the\r
+  * Software is furnished to do so, subject to the following conditions:\r
+  *\r
+  * The above copyright notice and this permission notice shall be included in\r
+  * all copies or substantial portions of the Software.\r
+  *\r
+  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+  * DEALINGS IN THE SOFTWARE.\r
+  */\r
+\r
+namespace System.Data.OleDb\r
+{\r
+\r
+\r
+    using System.Collections;\r
+       using java.sql;\r
+       using System.Data.Common;\r
+       using System.Data.ProviderBase;\r
+\r
+    /**\r
+     * @author erand\r
+     */\r
+       [Serializable]\r
+    public sealed class OleDbErrorCollection : AbstractDbErrorCollection\r
+    {\r
+               internal OleDbErrorCollection(SQLException e, AbstractDBConnection connection) : base(e, connection) {\r
+               }\r
+        /**\r
+         * Gets the error at the specified index.\r
+         *\r
+         * @param index of the error\r
+         * @return Error on specified index\r
+         */\r
+        public OleDbError this[int index]\r
+        {\r
+            get\r
+            {\r
+                return (OleDbError)GetDbItem(index);\r
+            }\r
+        }\r
+\r
+               protected override AbstractDbError CreateDbError(SQLException e, AbstractDBConnection connection) {\r
+                       return new OleDbError(e, connection);\r
+               }\r
+\r
+    }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbException.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbException.cs
new file mode 100644 (file)
index 0000000..947756b
--- /dev/null
@@ -0,0 +1,125 @@
+/*\r
+  * Copyright (c) 2002-2004 Mainsoft Corporation.\r
+  *\r
+  * Permission is hereby granted, free of charge, to any person obtaining a\r
+  * copy of this software and associated documentation files (the "Software"),\r
+  * to deal in the Software without restriction, including without limitation\r
+  * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+  * and/or sell copies of the Software, and to permit persons to whom the\r
+  * Software is furnished to do so, subject to the following conditions:\r
+  *\r
+  * The above copyright notice and this permission notice shall be included in\r
+  * all copies or substantial portions of the Software.\r
+  *\r
+  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+  * DEALINGS IN THE SOFTWARE.\r
+  */\r
+\r
+\r
+namespace System.Data.OleDb\r
+{\r
+\r
+    using java.sql;\r
+       using System.Text;\r
+       using System.Data.Common;\r
+       using System.Data.ProviderBase;\r
+\r
+    /*\r
+    * CURRENT LIMITATIONS\r
+    * 1. Constructor for serialization SqlException(SerializationInfo info, StreamingContext sc) \r
+    *    is not supported.\r
+    * 2. Method "void GetObjectData(...,...)" is not supported (serialization)\r
+    */\r
+\r
+    public sealed class OleDbException :  System.Runtime.InteropServices.ExternalException\r
+    {\r
+               private class OleDbExceptionImpl : AbstractDbException {\r
+                       internal OleDbExceptionImpl(Exception cause, OleDbConnection connection) : base(cause, connection) {}\r
+\r
+                       internal OleDbExceptionImpl(SQLException cause, OleDbConnection connection) : base(cause, connection) {}\r
+\r
+                       internal OleDbExceptionImpl(string message, SQLException cause, OleDbConnection connection) : base(message, cause, connection) {}\r
+\r
+                       protected override AbstractDbErrorCollection DbErrors {\r
+                               get {\r
+                                       return Errors;\r
+                               }\r
+                       }\r
+\r
+                       public OleDbErrorCollection Errors {\r
+                               get {\r
+                                       return new OleDbErrorCollection(_cause, _connection);\r
+                               }\r
+                       }\r
+\r
+                       public int ErrorCode {\r
+                               get {\r
+                                       return DbErrorCode;\r
+                               }\r
+                       }\r
+               }\r
+               \r
+               OleDbExceptionImpl _impl;\r
+\r
+               internal OleDbException(Exception cause, OleDbConnection connection) : base(null, cause) {\r
+                       _impl = new OleDbExceptionImpl(cause, connection);\r
+               }\r
+\r
+               internal OleDbException(SQLException cause, OleDbConnection connection) : base(null, cause) {\r
+                       _impl = new OleDbExceptionImpl(cause, connection);\r
+               }\r
+\r
+               internal OleDbException(string message, SQLException cause, OleDbConnection connection) : base(null, cause) {\r
+                       _impl = new OleDbExceptionImpl(message, cause, connection);\r
+               }\r
+        /**\r
+         * Gets a collection of one or more SqlError objects that give detailed \r
+         * information about exceptions generated by the SQL Server .NET Data Provider.\r
+         * @return collection of SqlError objects\r
+         */\r
+        public OleDbErrorCollection Errors\r
+        {\r
+            get\r
+            {\r
+                               return (OleDbErrorCollection)_impl.Errors;\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Gets the error code of the error.\r
+         * @return The error code of the error.\r
+         */\r
+        public override int ErrorCode\r
+        {\r
+            get\r
+            {\r
+                return base.HResult;\r
+            }\r
+        }\r
+\r
\r
+        /**\r
+         * Gets the name of the OLE DB provider that generated the error.\r
+         * @return the name of the OLE DB provider that generated the error. \r
+         */\r
+        public override String Source\r
+        {\r
+            get\r
+            {\r
+                return _impl.Source;\r
+            }\r
+        }\r
+\r
+               public override string Message {\r
+                       get {\r
+                               return _impl.Message;\r
+                       }\r
+               }\r
+\r
+    }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbInfoMessageEventArgs.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbInfoMessageEventArgs.cs
new file mode 100644 (file)
index 0000000..fef71d5
--- /dev/null
@@ -0,0 +1,58 @@
+//\r
+// System.Data.OleDb.OleDbInfoMessageEventArgs\r
+//\r
+// Authors:\r
+//   Rodrigo Moya (rodrigo@ximian.com)\r
+//   Tim Coleman (tim@timcoleman.com)\r
+//\r
+// Copyright (C) Rodrigo Moya, 2002\r
+// Copyright (C) Tim Coleman, 2002\r
+//\r
+\r
+using System.Data;\r
+using System.Data.Common;\r
+\r
+namespace System.Data.OleDb\r
+{\r
+       public sealed class OleDbInfoMessageEventArgs : EventArgs\r
+       {\r
+               private OleDbErrorCollection errors;\r
+               internal OleDbInfoMessageEventArgs(OleDbErrorCollection errors)\r
+               {\r
+                       this.errors = errors;\r
+               }\r
+               #region Properties\r
+\r
+               public int ErrorCode {\r
+                       [MonoTODO]\r
+                       get { return errors[0].NativeError; }\r
+               }\r
+\r
+               public OleDbErrorCollection Errors {\r
+                       [MonoTODO]\r
+                       get { return errors; }\r
+               }\r
+\r
+               public string Message {\r
+                       [MonoTODO]\r
+                       get { return errors[0].Message; }\r
+               }\r
+\r
+               public string Source {\r
+                       [MonoTODO]\r
+                       get { return errors[0].Source;}\r
+               }\r
+\r
+               #endregion // Properties\r
+\r
+               #region Methods\r
+\r
+               [MonoTODO]\r
+               public override string ToString ()\r
+               {\r
+                       return errors[0].Message;\r
+               }\r
+\r
+               #endregion // Methods\r
+       }\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbInfoMessageEventHandler.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbInfoMessageEventHandler.cs
new file mode 100644 (file)
index 0000000..6e2b5dd
--- /dev/null
@@ -0,0 +1,17 @@
+//\r
+// System.Data.OleDb.OleDbInfoMessageEventHandler\r
+//\r
+// Author:\r
+//   Rodrigo Moya (rodrigo@ximian.com)\r
+//\r
+// Copyright (C) Rodrigo Moya, 2002\r
+//\r
+\r
+using System.Data;\r
+using System.Data.Common;\r
+\r
+namespace System.Data.OleDb\r
+{\r
+       [Serializable]\r
+       public delegate void OleDbInfoMessageEventHandler (object sender, OleDbInfoMessageEventArgs e);\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbLiteral.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbLiteral.cs
new file mode 100644 (file)
index 0000000..058b47d
--- /dev/null
@@ -0,0 +1,95 @@
+ /*\r
+  * Copyright (c) 2002-2004 Mainsoft Corporation.\r
+  *\r
+  * Permission is hereby granted, free of charge, to any person obtaining a\r
+  * copy of this software and associated documentation files (the "Software"),\r
+  * to deal in the Software without restriction, including without limitation\r
+  * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+  * and/or sell copies of the Software, and to permit persons to whom the\r
+  * Software is furnished to do so, subject to the following conditions:\r
+  *\r
+  * The above copyright notice and this permission notice shall be included in\r
+  * all copies or substantial portions of the Software.\r
+  *\r
+  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+  * DEALINGS IN THE SOFTWARE.\r
+  */\r
+namespace System.Data.OleDb\r
+{\r
+\r
+    using System;\r
+    /**\r
+     *\r
+     */\r
+    public enum OleDbLiteral\r
+                                     {\r
+\r
+        Invalid = 0,\r
+        Binary_Literal = 1,\r
+\r
+        Catalog_Name = 2,\r
+\r
+        Catalog_Separator = 3,\r
+\r
+        Char_Literal = 4,\r
+\r
+        Column_Alias = 5,\r
+\r
+        Column_Name = 6,\r
+\r
+        Correlation_Name = 7,\r
+\r
+        Cursor_Name = 8,\r
+\r
+        Escape_Percent_Prefix = 9,\r
+\r
+        Escape_Underscore_Prefix = 10,\r
+\r
+        Index_Name = 11,\r
+\r
+        Like_Percent = 12,\r
+\r
+        Like_Underscore = 13,\r
+\r
+        Procedure_Name = 14,\r
+\r
+        Quote_Prefix = 15,\r
+\r
+        Schema_Name = 16,\r
+\r
+        Table_Name = 17,\r
+\r
+        Text_Command = 18,\r
+\r
+        User_Name = 19,\r
+\r
+        View_Name = 20,\r
+\r
+        Cube_Name = 21,\r
+\r
+        Dimension_Name = 22,\r
+\r
+        Hierarchy_Name = 23,\r
+\r
+        Level_Name = 24,\r
+\r
+        Member_Name = 25,\r
+\r
+        Property_Name = 26,\r
+\r
+        Schema_Separator = 27,\r
+\r
+        Quote_Suffix = 28,\r
+\r
+        Escape_Percent_Suffix = 29,\r
+\r
+        Escape_Underscore_Suffix = 30,\r
+\r
+\r
+    }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbOracleDataReader.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbOracleDataReader.cs
new file mode 100644 (file)
index 0000000..609acd2
--- /dev/null
@@ -0,0 +1,94 @@
+//using System;\r
+//\r
+//using java.sql;\r
+//\r
+//namespace System.Data.OleDb\r
+//{\r
+//     public class OleDbOracleDataReader : OleDbDataReader\r
+//     {\r
+//             private int _nextParameterIndex = 0;\r
+//             internal OleDbOracleDataReader(OleDbCommand command)\r
+//             {\r
+//                     _command = command;\r
+//                     _statement = command.getStatement();\r
+//                     _schemaTable = null;\r
+//        \r
+//                     try {\r
+//                             _results = null;\r
+//                             _lastColumnAccessed = -1;\r
+//                             _hasRows = Read();\r
+//                             _rowRead = _hasRows;\r
+//                     }\r
+//                     catch (SQLException e) {\r
+//                             throw new Exception(e.Message, e);\r
+//                     }\r
+//             }\r
+//\r
+//             private ResultSet GetNextResultSet()\r
+//             {\r
+//                     for (;_command.Parameters.Count > _nextParameterIndex;_nextParameterIndex++)\r
+//                     {\r
+//                             if (((OleDbParameter)_command.Parameters[_nextParameterIndex]).IsOracleRefCursor)\r
+//                                     return (ResultSet)((CallableStatement)_statement).getObject(++_nextParameterIndex);\r
+//                     }\r
+//\r
+//                     return null;\r
+//             }\r
+//\r
+//             public override bool Read()\r
+//             {\r
+//                     try {\r
+//                             if (_results == null) {\r
+//                                     _results = GetNextResultSet();\r
+//                                     _lastColumnAccessed = -1;\r
+//                                     _rowRead = false;\r
+//                                     _lastRowReached = false;\r
+//                             }\r
+//             \r
+//                             if (_results == null) {\r
+//                                     return false;\r
+//                             }\r
+//                             \r
+//                             // in the ctor we read one row so we have to check\r
+//                             // if a row has been read. if yes turn the flag of\r
+//                             // so next time we actualy read. and return the _hasRows param \r
+//                             // we initialize in the ctor.\r
+//                             if (_rowRead) {\r
+//                                     _rowRead = false;\r
+//                                     return _hasRows;\r
+//                             }\r
+//                             else {\r
+//                                     if (!_lastRowReached) {\r
+//                                             _lastRowReached = !(_results.next());\r
+//                                             return !(_lastRowReached);\r
+//                                     }\r
+//                                     else {\r
+//                                             return false;\r
+//                                     }\r
+//                             }\r
+//                     }\r
+//                     catch (SQLException exp) {\r
+//                             throw new Exception(exp.Message, exp);\r
+//                     }\r
+//             }\r
+//\r
+//             public override bool NextResult()\r
+//             {\r
+//                     try {\r
+//                             if (_results != null) {\r
+//                                     _results.close();       \r
+//                             }\r
+//                             _results = GetNextResultSet();\r
+//                             _lastColumnAccessed = -1;\r
+//                             _rowRead = false;\r
+//                             _lastRowReached = false;\r
+//                             _schemaTable = ConstructSchemaTable();\r
+//
+//                             return (_results != null);\r
+//                     }\r
+//                     catch (SQLException exp) {\r
+//                             throw new Exception(exp.Message, exp);\r
+//                     }\r
+//             }\r
+//     }\r
+//}\r
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbParameter.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbParameter.cs
new file mode 100644 (file)
index 0000000..3f5ac91
--- /dev/null
@@ -0,0 +1,220 @@
+//\r
+// System.Data.OleDb.OleDbParameter\r
+//\r
+// Author:\r
+//   Boris Kirzner (borisk@mainsoft.com)\r
+//\r
+\r
+using System;\r
+using System.Text;\r
+using System.Data;\r
+using System.Data.Common;\r
+using System.Data.ProviderBase;\r
+\r
+using java.sql;\r
+using java.lang;\r
+\r
+namespace System.Data.OleDb\r
+{\r
+    public sealed class OleDbParameter : AbstractDbParameter, IDbDataParameter, ICloneable\r
+    {\r
+\r
+               #region Fields\r
+\r
+        internal OleDbType _oleDbType = OleDbType.VarWChar;\r
+               private bool _isOracleRefCursor = false;\r
+\r
+               #endregion // Fields\r
+    \r
+               #region Constructors\r
+\r
+        public OleDbParameter()\r
+        {\r
+        }\r
+    \r
+        public OleDbParameter(String parameterName, Object value)\r
+                       : this (parameterName, OleDbType.VarWChar, 0, ParameterDirection.Input,\r
+                                       false, 0, 0, String.Empty, DataRowVersion.Current, value)\r
+        {\r
+                       _isDbTypeSet = false;\r
+        }\r
+    \r
+        public OleDbParameter(String parameterName, OleDbType dbType)\r
+                       : this (parameterName, dbType, 0, ParameterDirection.Input,\r
+                                       false, 0, 0, String.Empty, DataRowVersion.Current, null)\r
+        {\r
+        }\r
+    \r
+        public OleDbParameter(String parameterName, OleDbType dbType, int size)\r
+                       : this (parameterName, dbType, size, ParameterDirection.Input,\r
+                                       false, 0, 0, String.Empty, DataRowVersion.Current, null)\r
+        {\r
+        }\r
+    \r
+        public OleDbParameter(String parameterName, OleDbType dbType, int size,\r
+            String sourceColumn)\r
+                       : this (parameterName, dbType, size, ParameterDirection.Input,\r
+                                       false, 0, 0, sourceColumn, DataRowVersion.Current, null)\r
+        {\r
+        }\r
+    \r
+        \r
+        public OleDbParameter(String parameterName, \r
+                                                       OleDbType dbType, \r
+                                                       int size,\r
+                                                       ParameterDirection direction, \r
+                                                       bool isNullable,\r
+                                                       byte precision, \r
+                                                       byte scale, \r
+                                                       String sourceColumn,\r
+                                                       DataRowVersion sourceVersion, \r
+                                                       Object value)\r
+        {\r
+            ParameterName = parameterName;\r
+            OleDbType = dbType;\r
+            Size = size;\r
+            Direction = direction;\r
+            IsNullable = isNullable;\r
+            Precision = precision;\r
+            Scale = scale;\r
+            SourceColumn = sourceColumn;\r
+            SourceVersion = sourceVersion;\r
+            Value = value;\r
+        }\r
+\r
+               #endregion // Constructors\r
+\r
+               #region Properties\r
+\r
+               public override DbType DbType\r
+        {\r
+            get { return OleDbConvert.OleDbTypeToDbType(_oleDbType); }           \r
+                       set { _oleDbType = OleDbConvert.DbTypeToOleDbType(value); }\r
+        }                \r
+        \r
+        public OleDbType OleDbType\r
+        {\r
+            get { return _oleDbType; }            \r
+                       set {\r
+                _oleDbType = value;\r
+                               _isDbTypeSet = true;\r
+            }\r
+        }    \r
+    \r
+        public new Object Value\r
+        {\r
+            get { return base.Value; }\r
+            set {\r
+                if (!_isDbTypeSet && (value != null)) {\r
+                    _oleDbType = OleDbConvert.ValueTypeToOleDbType(value.GetType());\r
+                               }\r
+                base.Value = value;\r
+            }\r
+        }\r
+\r
+               internal override bool IsSpecial {\r
+                       get {\r
+                               return (Direction == ParameterDirection.Output) && IsOracleRefCursor;\r
+                       }\r
+               }\r
+\r
+\r
+               internal bool IsOracleRefCursor\r
+               {\r
+                       get { return _isOracleRefCursor; }\r
+                       set { _isOracleRefCursor = value; }\r
+               }\r
+\r
+               #endregion // Properties\r
+\r
+               #region Methods\r
+\r
+               public override String ToString()\r
+        {\r
+            return ParameterName;\r
+        }\r
+    \r
+        public override object Clone()\r
+        {\r
+            OleDbParameter clone = new OleDbParameter();\r
+                       CopyTo(clone);\r
+\r
+            clone._oleDbType = _oleDbType;\r
+                       clone._isDbTypeSet = _isDbTypeSet;\r
+                       clone._isOracleRefCursor = _isOracleRefCursor;\r
+            return clone;\r
+        }\r
+\r
+               internal override object ConvertValue(object value)\r
+               {\r
+                       // can not convert null or DbNull to other types\r
+                       if (value == null || value == DBNull.Value) {\r
+                               return value;\r
+                       }\r
+\r
+                       // FIXME : some other way to do this?\r
+                       if (OleDbType == OleDbType.Binary) {\r
+                               return value;\r
+                       }\r
+                       // .NET throws an exception to the user.\r
+                       object convertedValue  = value;\r
+\r
+                       // note : if we set user parameter jdbc type inside prepare interbal, the db type is not set\r
+                       if (value is IConvertible && (_isDbTypeSet || IsJdbcTypeSet)) {\r
+                               OleDbType oleDbType = (_isDbTypeSet) ? OleDbType : OleDbConvert.JdbcTypeToOleDbType((int)JdbcType);\r
+                               Type to = OleDbConvert.OleDbTypeToValueType(oleDbType);\r
+                               if (!(value is DateTime && to == DbTypes.TypeOfTimespan)) //anyway will go by jdbc type\r
+                                       convertedValue = Convert.ChangeType(value,to);\r
+                       }\r
+                       return convertedValue;\r
+               }\r
+\r
+               internal override void SetParameterName(ResultSet res)\r
+               {\r
+                       ParameterName = res.getString("COLUMN_NAME");\r
+\r
+                       if (ParameterName.StartsWith("@")) {\r
+                               ParameterName = ParameterName.Remove(0,1);\r
+                       }\r
+               }\r
+\r
+               internal override void SetParameterDbType(ResultSet res)\r
+               {\r
+                       int jdbcType = res.getInt("DATA_TYPE");                 \r
+                       // FIXME : is that correct?\r
+                       if (jdbcType == Types.OTHER) {\r
+                               string typeName = res.getString("TYPE_NAME");\r
+                               if (String.Compare("BLOB",typeName,true) == 0) {\r
+                                       jdbcType = Types.BLOB;\r
+                               }\r
+                               else if (String.Compare("CLOB",typeName,true) == 0) {\r
+                                       jdbcType = Types.CLOB;\r
+                               }\r
+                               else if(String.Compare("FLOAT",typeName,true) == 0) {\r
+                                       jdbcType = Types.FLOAT;\r
+                               }\r
+                               else if(String.Compare("NVARCHAR2",typeName,true) == 0) {\r
+                                       jdbcType = Types.VARCHAR;\r
+                               }\r
+                               else if(String.Compare("NCHAR",typeName,true) == 0) {\r
+                                       jdbcType = Types.CHAR;\r
+                               }\r
+                       }\r
+                       OleDbType = OleDbConvert.JdbcTypeToOleDbType(jdbcType);\r
+                       JdbcType = (DbTypes.JavaSqlTypes)jdbcType;\r
+               }\r
+\r
+               internal override void SetSpecialFeatures(ResultSet res)\r
+               {\r
+                       IsOracleRefCursor = (res.getString("TYPE_NAME") == "REF CURSOR");\r
+               }\r
+\r
+               internal override DbTypes.JavaSqlTypes JdbcTypeFromProviderType()\r
+               {\r
+                       return (DbTypes.JavaSqlTypes)OleDbConvert.OleDbTypeToJdbcType(OleDbType);\r
+               }\r
+\r
+               #endregion // Methods\r
+    \r
+    }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbParameterCollection.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbParameterCollection.cs
new file mode 100644 (file)
index 0000000..67a830c
--- /dev/null
@@ -0,0 +1,105 @@
+//\r
+// System.Data.Common.OleDbParameterCollection\r
+//\r
+// Author:\r
+//   Boris Kirzner (borisk@mainsoft.com)\r
+//\r
+\r
+/*\r
+  * Copyright (c) 2002-2004 Mainsoft Corporation.\r
+  *\r
+  * Permission is hereby granted, free of charge, to any person obtaining a\r
+  * copy of this software and associated documentation files (the "Software"),\r
+  * to deal in the Software without restriction, including without limitation\r
+  * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+  * and/or sell copies of the Software, and to permit persons to whom the\r
+  * Software is furnished to do so, subject to the following conditions:\r
+  *\r
+  * The above copyright notice and this permission notice shall be included in\r
+  * all copies or substantial portions of the Software.\r
+  *\r
+  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+  * DEALINGS IN THE SOFTWARE.\r
+  */\r
+\r
+using System.Data.ProviderBase;\r
+\r
+namespace System.Data.OleDb\r
+{\r
+    public sealed class OleDbParameterCollection :  AbstractDbParameterCollection\r
+    {\r
+               #region Constructors\r
+\r
+        public OleDbParameterCollection(OleDbCommand parent): base(parent)\r
+        {\r
+        }\r
+\r
+               #endregion // Constructors\r
+\r
+               #region Properties\r
+        \r
+        public OleDbParameter this[int index]\r
+        {\r
+            get { return (OleDbParameter)base[index]; }\r
+            set { \r
+                               OnSchemaChanging();\r
+                               base[index] = value; \r
+                       }\r
+        }\r
+\r
+        public OleDbParameter this[string parameterName]\r
+        {\r
+            get { return (OleDbParameter)base[parameterName]; }\r
+            set { \r
+                               OnSchemaChanging();\r
+                               base[parameterName] = value; \r
+                       }\r
+        }\r
+\r
+               protected override Type ItemType { \r
+                       get { return typeof(OleDbParameter); }\r
+               }\r
+\r
+               #endregion // Properties\r
+\r
+               #region Methods\r
+\r
+        public OleDbParameter Add(OleDbParameter value)\r
+        {\r
+            base.Add(value);\r
+            return value;\r
+        }\r
+\r
+        public OleDbParameter Add(string parameterName, object value)\r
+        {\r
+            OleDbParameter param = new OleDbParameter(parameterName, value);\r
+            return Add(param);\r
+        }\r
+\r
+        public OleDbParameter Add(string parameterName, OleDbType sqlDbType)\r
+        {\r
+            OleDbParameter param = new OleDbParameter(parameterName, sqlDbType);\r
+            return Add(param);\r
+        }\r
+\r
+        public OleDbParameter Add(string parameterName, OleDbType sqlDbType, int size)\r
+        {\r
+            OleDbParameter param = new OleDbParameter(parameterName, sqlDbType, size);\r
+            return Add(param);\r
+        }\r
+\r
+        public OleDbParameter Add(string parameterName, OleDbType sqlDbType, int size, string sourceColumn)\r
+        {\r
+            OleDbParameter param = new OleDbParameter(parameterName, sqlDbType, size, sourceColumn);\r
+            return Add(param);\r
+        }\r
+\r
+               #endregion // Methods        \r
+        \r
+    }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbPermission.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbPermission.cs
new file mode 100644 (file)
index 0000000..034b9dc
--- /dev/null
@@ -0,0 +1,95 @@
+//\r
+// System.Data.OleDb.OleDbPermission\r
+//\r
+// Author:\r
+//   Rodrigo Moya (rodrigo@ximian.com)\r
+//   Tim Coleman (tim@timcoleman.com)\r
+//\r
+// Copyright (C) Rodrigo Moya, 2002\r
+// Copyright (C) Tim Coleman, 2002\r
+//\r
+\r
+using System.Data;\r
+using System.Data.Common;\r
+using System.Security;\r
+using System.Security.Permissions;\r
+\r
+namespace System.Data.OleDb\r
+{\r
+       [Serializable]\r
+       public sealed class OleDbPermission : DBDataPermission\r
+       {\r
+               #region Constructors\r
+\r
+               [MonoTODO]\r
+               public OleDbPermission ()\r
+               {\r
+                       throw new NotImplementedException ();\r
+               }\r
+\r
+               [MonoTODO]\r
+               public OleDbPermission (PermissionState state)\r
+               {\r
+                       throw new NotImplementedException ();\r
+               }\r
+\r
+               [MonoTODO]\r
+               public OleDbPermission (PermissionState state, bool allowBlankPassword)\r
+               {\r
+                       throw new NotImplementedException ();\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region Properties\r
+\r
+               public string Provider {\r
+                       [MonoTODO]\r
+                       get { throw new NotImplementedException (); }\r
+                       [MonoTODO]\r
+                       set { throw new NotImplementedException (); }\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region Methods\r
+\r
+               [MonoTODO]\r
+               public override IPermission Copy ()\r
+               {\r
+                       throw new NotImplementedException ();\r
+               }\r
+\r
+               [MonoTODO]\r
+               public override void FromXml (SecurityElement securityElement)\r
+               {\r
+                       throw new NotImplementedException ();\r
+               }\r
+\r
+               [MonoTODO]\r
+               public override IPermission Intersect (IPermission target)\r
+               {\r
+                       throw new NotImplementedException ();\r
+               }\r
+\r
+               [MonoTODO]\r
+               public override bool IsSubsetOf (IPermission target)\r
+               {\r
+                       throw new NotImplementedException ();\r
+               }\r
+\r
+               [MonoTODO]\r
+               public override SecurityElement ToXml ()\r
+               {\r
+                       throw new NotImplementedException ();\r
+               }\r
+\r
+               [MonoTODO]\r
+               public override IPermission Union (IPermission target)\r
+               {\r
+                       throw new NotImplementedException ();\r
+               }\r
+\r
+               #endregion\r
+       }\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbPermissionAttribute.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbPermissionAttribute.cs
new file mode 100644 (file)
index 0000000..9bdaab1
--- /dev/null
@@ -0,0 +1,62 @@
+//\r
+// System.Data.OleDb.OleDbPermissionAttribute\r
+//\r
+// Authors:\r
+//   Rodrigo Moya (rodrigo@ximian.com)\r
+//   Tim Coleman (tim@timcoleman.com)\r
+//\r
+// Copyright (C) Rodrigo Moya, 2002\r
+// Copyright (C) Tim Coleman, 2002\r
+//\r
+\r
+using System.Data;\r
+using System.Data.Common;\r
+using System.Security;\r
+using System.Security.Permissions;\r
+\r
+namespace System.Data.OleDb\r
+{\r
+       [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class\r
+                       | AttributeTargets.Struct | AttributeTargets.Constructor |\r
+                       AttributeTargets.Method)]\r
+       [Serializable]\r
+       public sealed class OleDbPermissionAttribute : DBDataPermissionAttribute\r
+       {\r
+\r
+               #region Constructors \r
+\r
+               [MonoTODO]\r
+               OleDbPermissionAttribute (SecurityAction action) \r
+                       : base (action)\r
+               {\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region Properties\r
+\r
+               [MonoTODO]\r
+               public string Provider {\r
+                       [MonoTODO]\r
+                       get {\r
+                               throw new NotImplementedException (); \r
+                       }\r
+                       [MonoTODO]\r
+                       set {\r
+                               throw new NotImplementedException (); \r
+                       }\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region Methods\r
+\r
+               [MonoTODO]\r
+               public override IPermission CreatePermission () \r
+               {\r
+                       throw new NotImplementedException ();\r
+               }\r
+\r
+               #endregion\r
+       }\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbRowUpdatedEventArgs.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbRowUpdatedEventArgs.cs
new file mode 100644 (file)
index 0000000..a5a52ea
--- /dev/null
@@ -0,0 +1,45 @@
+//\r
+// System.Data.OleDb.OleDbRowUpdatedEventArgs\r
+//\r
+// Authors:\r
+//   Rodrigo Moya (rodrigo@ximian.com)\r
+//   Tim Coleman (tim@timcoleman.com)\r
+//\r
+// Copyright (C) Rodrigo Moya, 2002\r
+// Copyright (C) Tim Coleman, 2002\r
+//\r
+\r
+using System.Data;\r
+using System.Data.Common;\r
+\r
+namespace System.Data.OleDb\r
+{\r
+       public sealed class OleDbRowUpdatedEventArgs : RowUpdatedEventArgs\r
+       {\r
+               #region Fields\r
+               \r
+               OleDbCommand command;\r
+\r
+               #endregion // Fields\r
+\r
+               #region Constructors\r
+\r
+               [MonoTODO]\r
+               public OleDbRowUpdatedEventArgs (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)\r
+                       : base (dataRow, command, statementType, tableMapping)\r
+\r
+               {\r
+                       this.command = (OleDbCommand) command;\r
+               }\r
+\r
+               #endregion // Constructors\r
+\r
+               #region Properties\r
+\r
+               public new OleDbCommand Command {\r
+                       get { return command; }\r
+               }\r
+\r
+               #endregion // Properties\r
+       }\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbRowUpdatedEventHandler.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbRowUpdatedEventHandler.cs
new file mode 100644 (file)
index 0000000..2ef1375
--- /dev/null
@@ -0,0 +1,19 @@
+//\r
+// System.Data.OleDb.OleDbRowUpdatedEventHandler\r
+//\r
+// Author:\r
+//   Rodrigo Moya (rodrigo@ximian.com)\r
+//\r
+// Copyright (C) Rodrigo Moya, 2002\r
+//\r
+\r
+using System.Data;\r
+using System.Data.Common;\r
+\r
+namespace System.Data.OleDb\r
+{\r
+       [Serializable]\r
+       public delegate void OleDbRowUpdatedEventHandler (\r
+               object sender,\r
+               OleDbRowUpdatedEventArgs e);\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbRowUpdatingEventArgs.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbRowUpdatingEventArgs.cs
new file mode 100644 (file)
index 0000000..13a5255
--- /dev/null
@@ -0,0 +1,47 @@
+//\r
+// System.Data.OleDb.OleDbRowUpdatingEventArgs\r
+//\r
+// Authors:\r
+//   Rodrigo Moya (rodrigo@ximian.com)\r
+//   Tim Coleman (tim@timcoleman.com)\r
+//\r
+// Copyright (C) Rodrigo Moya, 2002\r
+// Copyright (C) Tim Coleman, 2002\r
+//\r
+\r
+using System.Data;\r
+using System.Data.Common;\r
+\r
+namespace System.Data.OleDb\r
+{\r
+       public sealed class OleDbRowUpdatingEventArgs : RowUpdatingEventArgs\r
+       {\r
+\r
+               #region Fields\r
+\r
+               OleDbCommand command = null;\r
+\r
+               #endregion\r
+\r
+               #region Constructors\r
+\r
+               [MonoTODO]\r
+               public OleDbRowUpdatingEventArgs (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)\r
+                       : base (dataRow, command, statementType, tableMapping)\r
+\r
+               {\r
+                       this.command = (OleDbCommand) command;\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region Properties\r
+               \r
+               public new OleDbCommand Command {\r
+                       get { return command; }\r
+                       set { command = value; }\r
+               }\r
+\r
+               #endregion\r
+       }\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbRowUpdatingEventHandler.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbRowUpdatingEventHandler.cs
new file mode 100644 (file)
index 0000000..c2ec2bd
--- /dev/null
@@ -0,0 +1,19 @@
+//\r
+// System.Data.OleDb.OleDbRowUpdatingEventHandler\r
+//\r
+// Author:\r
+//   Rodrigo Moya (rodrigo@ximian.com)\r
+//\r
+// Copyright (C) Rodrigo Moya, 2002\r
+//\r
+\r
+using System.Data;\r
+using System.Data.Common;\r
+\r
+namespace System.Data.OleDb\r
+{\r
+       [Serializable]\r
+       public delegate void OleDbRowUpdatingEventHandler (\r
+               object sender,\r
+               OleDbRowUpdatingEventArgs e);\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbSchemaGuid.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbSchemaGuid.cs
new file mode 100644 (file)
index 0000000..26fdf8c
--- /dev/null
@@ -0,0 +1,67 @@
+//\r
+// System.Data.OleDb.OleDbSchemaGuid\r
+//\r
+// Authors:\r
+//   Rodrigo Moya (rodrigo@ximian.com)\r
+//   Tim Coleman (tim@timcoleman.com)\r
+//\r
+// Copyright (C) Rodrigo Moya, 2002\r
+// Copyright (C) Tim Coleman, 2002\r
+//\r
+\r
+using System.Data;\r
+using System.Data.Common;\r
+\r
+namespace System.Data.OleDb\r
+{\r
+       public sealed class OleDbSchemaGuid\r
+       {\r
+               #region Fields\r
+\r
+               public static readonly Guid Assertions = new Guid ("df855bea-fb95-4abc-8932-e57e45c7ddae");\r
+               public static readonly Guid Catalogs = new Guid ("e4a67334-f03c-45af-8b1d-531f99268045");\r
+               public static readonly Guid Character_Sets = new Guid ("e4533bdb-0b55-48ee-986d-17d07143657d");\r
+               public static readonly Guid Check_Constraints = new Guid ("fedf7f5d-cfb4-4635-af02-45eb4bb4e8f3");\r
+               public static readonly Guid Check_Constraints_By_Table = new Guid ("d76547ef-837d-413c-8d76-bab1d7bb014a");\r
+               public static readonly Guid Collations = new Guid ("5145b85c-c448-4b9e-8929-4c2de31ffa30");\r
+               public static readonly Guid Columns = new Guid ("86dcd6e2-9a8c-4c6d-bc1c-e0e334c727c9");\r
+               public static readonly Guid Column_Domain_Usage = new Guid ("058acb5e-eb1d-4b6e-8e98-a7d59a959ff1");\r
+               public static readonly Guid Column_Privileges = new Guid ("43152796-f3b4-4342-9647-008f1060e352");\r
+               public static readonly Guid Constraint_Column_Usage = new Guid ("3a39f999-f481-4293-8b9f-af7e91b4ee7d");\r
+               public static readonly Guid Constraint_Table_Usage = new Guid ("d689719b-24b0-4963-a635-097c480edcd2");\r
+               public static readonly Guid DbInfoLiterals = new Guid ("7a564da6-f3bc-474b-9e66-71cb47bde5b0");\r
+               public static readonly Guid Foreign_Keys = new Guid ("d9e547ce-e62d-4200-b849-566bc3dc29de");\r
+               public static readonly Guid Indexes = new Guid ("69d8523c-96ad-40cb-a89a-ee98d2d6fcec");\r
+               public static readonly Guid Key_Column_Usage = new Guid ("65423211-805e-4822-8eb4-f4f6d540056e");\r
+               public static readonly Guid Primary_Keys = new Guid ("c6e5b174-fbd8-4055-b757-8585040e463f");\r
+               public static readonly Guid Procedures = new Guid ("61f276ad-4f25-4c26-b4ae-8238e06d56db");\r
+               public static readonly Guid Procedure_Columns = new Guid ("7148080d-e053-4ada-b79a-9a2ff614a3d4");\r
+               public static readonly Guid Procedure_Parameters = new Guid ("984af700-8fe7-476f-81c2-4b814df67907");\r
+               public static readonly Guid Provider_Types = new Guid ("0bc2da44-d834-4136-9ff0-3cef477784b9");\r
+               public static readonly Guid Referential_Constraints = new Guid ("d2eab85e-49a7-462d-aa22-1d97c74178ae");\r
+               public static readonly Guid Schemata = new Guid ("2fbd7503-0af3-43d2-92c6-51e78b84dd37");\r
+               public static readonly Guid Sql_Languages = new Guid ("d60a511d-a07f-4e59-aac2-71c25fab5b02");\r
+               public static readonly Guid Statistics = new Guid ("03ed9f7d-35bc-45fe-993f-ee7a5f29fb74");\r
+               public static readonly Guid Tables = new Guid ("ceac88ba-240c-4bb4-821e-4a49fc013371");\r
+               public static readonly Guid Tables_Info = new Guid ("9ff81c59-2b1e-4371-a08b-3a2d373189fa");\r
+               public static readonly Guid Table_Constraints = new Guid ("62883c55-082d-42cb-bb00-747985ca6047");\r
+               public static readonly Guid Table_Privileges = new Guid ("1a73f478-8c8e-4ede-b3ec-22ba13ab55a0");\r
+               public static readonly Guid Table_Statistics = new Guid ("9c944744-cd51-448a-8be4-7095f039d0ef");\r
+               public static readonly Guid Translations = new Guid ("5578b57e-a682-4f1b-bdb4-f8a14ad6f61e");\r
+               public static readonly Guid Trustee = new Guid ("521207e2-3a23-42b6-ac78-810a3fce3271");\r
+               public static readonly Guid Usage_Privileges = new Guid ("f8113a2b-2934-4c67-ab7b-adbe3ab74973");\r
+               public static readonly Guid Views = new Guid ("9a6345b6-61a0-40fd-9b45-402f3c9c9c3e");\r
+               public static readonly Guid View_Column_Usage = new Guid ("2c91ef91-02d8-4d38-ae5a-1e826873d6ea");\r
+               public static readonly Guid View_Table_Usage = new Guid ("7dcb7f53-1045-4fdf-86a1-d3caaf27c7f5");\r
+\r
+               #endregion\r
+\r
+               #region Constructors\r
+\r
+               public OleDbSchemaGuid ()\r
+               {\r
+               }\r
+\r
+               #endregion\r
+       }\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbStringManager.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbStringManager.cs
new file mode 100644 (file)
index 0000000..755beda
--- /dev/null
@@ -0,0 +1,66 @@
+//namespace System.Data.OleDb\r
+//{\r
+//\r
+//    using java.util;\r
+//\r
+//    public class OleDbStringManager : IDbStringManager\r
+//    {\r
+//\r
+//        private static readonly String BUNDLE_NAME = "OleDBStrings"; //$NON-NLS-1$\r
+//\r
+//        private static readonly ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);\r
+//\r
+//        private OleDbStringManager()\r
+//        {\r
+//        }\r
+//\r
+//        public String getString(String key)\r
+//        {\r
+//            try\r
+//            {\r
+//                return RESOURCE_BUNDLE.getString(key);\r
+//            }\r
+//            catch (MissingResourceException)\r
+//            {\r
+//                return null;\r
+//            }\r
+//        }\r
+//     \r
+//        public String getString(String key, String defaultValue)\r
+//        {\r
+//            try\r
+//            {\r
+//                return RESOURCE_BUNDLE.getString(key);\r
+//            }\r
+//            catch (MissingResourceException)\r
+//            {\r
+//                return defaultValue;\r
+//            }\r
+//        }\r
+//     \r
+//     \r
+//        public String[] getStringArray(String key)\r
+//        {\r
+//            try\r
+//            {\r
+//                String tmp = RESOURCE_BUNDLE.getString(key);\r
+//                java.util.StringTokenizer st = new java.util.StringTokenizer(tmp, ",");\r
+//                     \r
+//                String[] strArr = new String[st.countTokens()];\r
+//                     \r
+//                for (int i = 0; i < strArr.Length; i++)\r
+//                {\r
+//                    strArr[i] = st.nextToken();\r
+//                             \r
+//                }\r
+//                             \r
+//                return strArr;\r
+//                     \r
+//            }\r
+//            catch (MissingResourceException)\r
+//            {\r
+//                return null;\r
+//            }\r
+//        }\r
+//    }\r
+//}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbTransaction.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbTransaction.cs
new file mode 100644 (file)
index 0000000..0a894a1
--- /dev/null
@@ -0,0 +1,66 @@
+/*\r
+  * Copyright (c) 2002-2004 Mainsoft Corporation.\r
+  *\r
+  * Permission is hereby granted, free of charge, to any person obtaining a\r
+  * copy of this software and associated documentation files (the "Software"),\r
+  * to deal in the Software without restriction, including without limitation\r
+  * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+  * and/or sell copies of the Software, and to permit persons to whom the\r
+  * Software is furnished to do so, subject to the following conditions:\r
+  *\r
+  * The above copyright notice and this permission notice shall be included in\r
+  * all copies or substantial portions of the Software.\r
+  *\r
+  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+  * DEALINGS IN THE SOFTWARE.\r
+  */\r
+\r
+namespace System.Data.OleDb\r
+{\r
+\r
+    using System.Data.Common;\r
+    using System.Data;\r
+\r
+    /**\r
+     * @author erand\r
+     */\r
+    public class OleDbTransaction : AbstractTransaction\r
+    {\r
+    \r
+        internal OleDbTransaction(OleDbConnection connection) : base(IsolationLevel.ReadCommitted, connection, null)\r
+        {\r
+        }\r
+\r
+        internal OleDbTransaction(OleDbConnection connection, String transactionName) : base(IsolationLevel.ReadCommitted, connection, transactionName)\r
+        {\r
+        }\r
+\r
+        internal OleDbTransaction(IsolationLevel isolationLevel, OleDbConnection connection) : base(isolationLevel, connection, null)\r
+        {\r
+        }\r
+\r
+           public new OleDbConnection Connection\r
+           {\r
+                   get\r
+                   {\r
+                           return (OleDbConnection)base.Connection;\r
+                   }\r
+           }\r
+\r
+           public OleDbTransaction Begin()\r
+           {\r
+                   return Begin(IsolationLevel.ReadCommitted);\r
+           }\r
+\r
+           public OleDbTransaction Begin(IsolationLevel isolationLevetl)\r
+           {\r
+                       throw new InvalidOperationException("Only one transaction can be active on this session.");\r
+           }\r
+    \r
+    }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbType.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/OleDbType.cs
new file mode 100644 (file)
index 0000000..2de635d
--- /dev/null
@@ -0,0 +1,108 @@
+ /*\r
+  * Copyright (c) 2002-2004 Mainsoft Corporation.\r
+  *\r
+  * Permission is hereby granted, free of charge, to any person obtaining a\r
+  * copy of this software and associated documentation files (the "Software"),\r
+  * to deal in the Software without restriction, including without limitation\r
+  * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+  * and/or sell copies of the Software, and to permit persons to whom the\r
+  * Software is furnished to do so, subject to the following conditions:\r
+  *\r
+  * The above copyright notice and this permission notice shall be included in\r
+  * all copies or substantial portions of the Software.\r
+  *\r
+  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+  * DEALINGS IN THE SOFTWARE.\r
+  */\r
+namespace System.Data.OleDb\r
+{\r
+\r
+    \r
+    /**\r
+     *\r
+     */\r
+    public enum OleDbType\r
+    {\r
+\r
+        Empty = 0,\r
+\r
+        SmallInt = 2,\r
+\r
+        Integer = 3,\r
+\r
+        Single = 4,\r
+\r
+        Double = 5,\r
+\r
+        Currency = 6,\r
+\r
+        Date = 7,\r
+\r
+        BSTR = 8,\r
+\r
+        IDispatch = 9,\r
+\r
+        Error = 10,\r
+\r
+        Boolean = 11,\r
+\r
+        Variant = 12,\r
+\r
+        IUnknown = 13,\r
+\r
+        Decimal = 14,\r
+\r
+        TinyInt = 16,\r
+\r
+        UnsignedTinyInt = 17,\r
+\r
+        UnsignedSmallInt = 18,\r
+\r
+        UnsignedInt = 19,\r
+\r
+        BigInt = 20,\r
+\r
+        UnsignedBigInt = 21,\r
+\r
+        Filetime = 64,\r
+\r
+        Guid = 72,\r
+\r
+        Binary = 128,\r
+\r
+        Char = 129,\r
+\r
+        WChar = 130,\r
+\r
+        Numeric = 131,\r
+\r
+        DBDate = 133,\r
+\r
+        DBTime = 134,\r
+\r
+        DBTimeStamp = 135,\r
+\r
+        PropVariant = 138,\r
+\r
+        VarNumeric = 139,\r
+\r
+        VarChar = 200,\r
+\r
+        LongVarChar = 201,\r
+\r
+        VarWChar = 202,\r
+\r
+        LongVarWChar = 203,\r
+\r
+        VarBinary = 204,\r
+\r
+        LongVarBinary = 205,\r
+\r
+        \r
+    }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.OleDb.jvm/libgda.cs b/mcs/class/System.Data/System.Data.OleDb.jvm/libgda.cs
new file mode 100644 (file)
index 0000000..e69de29
index 5174651218340d1b8e5198ea9db0b81fd1780daa..18289ea09d44a987710e36d0e7afe8822077af56 100644 (file)
-//namespace System.Data.Common\r
-//{\r
 //\r
-//     using java.sql;\r
-//     using java.util;\r
-//\r
-//     using System;\r
-//     using System.Collections;\r
-//     using System.Data;\r
-//     using System.Data.ProviderBase;\r
-//\r
-//     /**\r
-//      * @author erand\r
-//      */\r
-//     public abstract class AbstractDBCommand : DbCommandBase\r
-//     {\r
-//             protected String _cmdText, _javaCmdText;\r
-//             protected AbstractDBConnection _connection;\r
-//             protected IDbTransaction _transaction;\r
-//             protected int _cmdTimeout = 30;\r
-//             protected CommandType _cmdType = CommandType.Text;\r
-//             protected UpdateRowSource _updateRowSource = UpdateRowSource.Both;\r
-//             protected Statement _statement;\r
-//             protected IDataParameterCollection _paramCollection;\r
-//             protected IDataReader _reader;\r
-//             private bool _isCommandTextChanged;\r
-//             private CommandBehavior _behvior = CommandBehavior.Default;\r
-//\r
-//             private static readonly int _oracleRefCursor;\r
-//             protected const int oracleTypeRefCursor = 1111; // Types.OTHER\r
-//        \r
-//        \r
-//             static AbstractDBCommand()\r
-//             {\r
+// System.Data.ProviderBase.AbstractDbCommand\r
+//\r
+// Author:\r
+//   Boris Kirzner (borisk@mainsoft.com)\r
+//   Konstantin Triger (kostat@mainsoft.com)\r
+//\r
+\r
+using System;\r
+using System.Text;\r
+using System.Text.RegularExpressions;\r
+using System.Collections;\r
+using System.Data;\r
+using System.Data.Common;\r
+\r
+using java.sql;\r
+using java.io;\r
+\r
+#if !USE_DOTNET_REGEXP\r
+using java.util.regex;\r
+#endif\r
+\r
+namespace System.Data.ProviderBase\r
+{\r
+       public abstract class AbstractDbCommand : DbCommandBase\r
+       {\r
+               #region ProcedureColumnCache
+
+               internal sealed class ProcedureColumnCache : AbstractDbMetaDataCache\r
+               {\r
+                       internal ArrayList GetProcedureColumns(AbstractDBConnection connection, String commandText,AbstractDbCommand command) \r
+                       {\r
+                               string connectionCatalog = connection.JdbcConnection.getCatalog();\r
+                               string key = String.Concat(connection.ConnectionString, connectionCatalog, commandText);\r
+                               System.Collections.Hashtable cache = Cache;\r
+\r
+                               ArrayList col = cache[key] as ArrayList;\r
+\r
+                               if (null != col) {\r
+                                       return col;\r
+                               }\r
+       \r
+                               col = connection.GetProcedureColumns(commandText,command);\r
+                               if (col != null)\r
+                                       cache[key] = col;\r
+                               return col;                             \r
+                       }\r
+               }
+
+               #endregion
+
+               #region SqlStatementsHelper
+
+               internal sealed class SqlStatementsHelper
+               {
+                       #region Fields
+#if USE_DOTNET_REGEXP                  \r
+                       internal static readonly Regex NamedParameterStoredProcedureRegExp = new Regex(@"^\s*{?\s*((?<RETVAL>@\w+)\s*=\s*)?call\s+(?<PROCNAME>(((\[[^\]]*\])|([^\.\(])*)\s*\.\s*){0,2}(\[[^\]]*\]|((\s*[^\.\(\)\{\}\s])+)))\s*(\(\s*(?<USERPARAM>((""([^""]|(""""))*"")|('([^']|(''))*')|[^,])*)?\s*(,\s*(?<USERPARAM>((""([^""]|(""""))*"")|('([^']|(''))*')|[^,])*)\s*)*\))?\s*}?\s*$", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);\r
+                       internal static readonly Regex SimpleParameterStoredProcedureRegExp = new Regex(@"^\s*{?\s*((?<RETVAL>\?)\s*=\s*)?call\s+(?<PROCNAME>(((\[[^\]]*\])|([^\.\(])*)\s*\.\s*){0,2}(\[[^\]]*\]|((\s*[^\.\(\)\{\}\s])+)))\s*(\(\s*(?<USERPARAM>((""([^""]|(""""))*"")|('([^']|(''))*')|[^,])*)?\s*(,\s*(?<USERPARAM>((""([^""]|(""""))*"")|('([^']|(''))*')|[^,])*)\s*)*\))?\s*}?\s*$", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);\r
+#else\r
+                       internal static readonly Pattern NamedParameterStoredProcedureRegExp = Pattern.compile(@"^\s*\{?\s*(?:(@\w+)\s*=\s*)?call\s+((?:(?:(?:\[[^\]]*\])|(?:[^\.\(\)\{\}\[\]])*)\s*\.\s*){0,2}(?:\[[^\]]*\]|(?:(?:\s*[^\.\(\)\{\}\[\]])+)))\s*(?:\((.*)\))?\s*\}?\s*$", Pattern.CASE_INSENSITIVE);\r
+                       internal static readonly Pattern SimpleParameterStoredProcedureRegExp = Pattern.compile(@"^\s*\{?\s*(?:(\?)\s*=\s*)?call\s+((?:(?:(?:\[[^\]]*\])|(?:[^\.\(\)\{\}\[\]])*)\s*\.\s*){0,2}(?:\[[^\]]*\]|(?:(?:\s*[^\.\(\)\{\}\[\]])+)))\s*(?:\((.*)\))?\s*\}?\s*$", Pattern.CASE_INSENSITIVE);\r
+#endif\r
+\r
+//                     internal static readonly Regex NamedParameterRegExp = new Regex(@"((?<USERPARAM>@\w+)|(\[[^\[\]]*\])|(""([^""]|(""""))*"")|('([^']|(''))*'))*", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);\r
+//                     internal static readonly Regex SimpleParameterRegExp = new Regex(@"((?<USERPARAM>\?)|(\[[^\[\]]*\])|(""([^""]|(""""))*"")|('([^']|(''))*'))*", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);\r
+                       internal static readonly SimpleRegex NamedParameterRegExp = new SqlParamsRegex();\r
+                       internal static readonly SimpleRegex SimpleParameterRegExp = new OleDbParamsRegex();\r
+\r
+                       internal static readonly Regex SelectFromStatementReqExp = new Regex(@"^\s*SELECT\s+(((\[[^\[\]]*\])|(""([^""]|(""""))*"")|('([^']|(''))*')|[^'""\[])*\s+)*FROM\s+", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);\r
+                       internal static readonly Regex ForBrowseStatementReqExp = new Regex(@"\s+FOR\s+BROWSE\s*$", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);\r
+\r
+                       internal static readonly SimpleRegex CompoundStatementSplitterReqExp = new CharacterSplitterRegex(';');\r
+                       internal static readonly SimpleRegex ProcedureParameterSplitterReqExp = new CharacterSplitterRegex(',');\r
+\r
+                       #endregion // Fields
+               }
+
+               #endregion // SqlStatementsHelper
+\r
+               #region Fields\r
+\r
+               protected DbParameterCollection _parameters;\r
+               protected java.sql.Statement _statement;\r
+               protected AbstractDBConnection _connection;\r
+               protected AbstractTransaction _transaction;\r
+               private bool _isCommandPrepared;\r
+               protected CommandBehavior _behavior;\r
+               private ArrayList _internalParameters;\r
+               string _javaCommandText;\r
+               private int _recordsAffected;\r
+               private ResultSet _currentResultSet;\r
+               private DbDataReader _currentReader;\r
+               private bool _nullParametersInPrepare;\r
+               private bool _hasResultSet;\r
+\r
+               internal static ProcedureColumnCache _procedureColumnCache = new ProcedureColumnCache();\r
+\r
+               #endregion // Fields\r
+\r
+               #region Constructors\r
+\r
+               public AbstractDbCommand(\r
+                       String cmdText,\r
+                       AbstractDBConnection connection,\r
+                       AbstractTransaction transaction)\r
+               {\r
+                       _connection = connection;\r
+                       base.CommandText = cmdText;\r
+                       _transaction = transaction;\r
+                       _isCommandPrepared = false;\r
+                       _recordsAffected = -1;\r
+                       if (connection != null) {\r
+                               connection.AddReference(this);\r
+                       }\r
+               }\r
+\r
+               #endregion // Constructors\r
+\r
+               #region Properties\r
+\r
+               protected override DbParameterCollection DbParameterCollection\r
+               {\r
+                       get {\r
+                               if (_parameters == null) {\r
+                                       _parameters = CreateParameterCollection(this);\r
+                               }\r
+                               return _parameters; \r
+                       }\r
+               }\r
+\r
+               protected override DbConnection DbConnection\r
+               {\r
+                       get { return (DbConnection)_connection; }\r
+                       set {\r
+                               if (value == _connection) {\r
+                                       return;\r
+                               }\r
+\r
+                               if (_currentReader != null && !_currentReader.IsClosed) {\r
+                                       throw ExceptionHelper.ConnectionIsBusy(this.GetType().Name,((AbstractDBConnection)_connection).InternalState);\r
+                               }\r
+                               if (_connection != null) {\r
+                                       _connection.RemoveReference(this);\r
+                               }\r
+                               _connection = (AbstractDBConnection) value;\r
+                               if (_connection != null) {\r
+                                       _connection.AddReference(this);\r
+                               }\r
+                       }\r
+               }\r
+\r
+               protected override DbTransaction DbTransaction\r
+               {\r
+                       get { return _transaction != null ? _transaction.ActiveTransaction : null; }\r
+                       set { _transaction = (AbstractTransaction)value; }\r
+               }\r
+\r
+               public override string CommandText\r
+               {\r
+                       get { return base.CommandText; }\r
+                       set { \r
+                               if (CommandText == null || String.Compare(CommandText, value,  true) != 0) {\r
+                                       base.CommandText = value;\r
+                                       _isCommandPrepared = false;\r
+                               }\r
+                       }\r
+               }\r
+\r
+               internal CommandBehavior Behavior\r
+               {\r
+                       get { return _behavior; }\r
+                       set { _behavior = value; }\r
+               }\r
+\r
+               protected bool IsCommandPrepared\r
+               {\r
+                       get { return _isCommandPrepared; }\r
+                       set { _isCommandPrepared = value; }\r
+               }\r
+\r
+               protected bool NullParametersInPrepare\r
+               {\r
+                       get { return _nullParametersInPrepare; }\r
+                       set { _nullParametersInPrepare = value; }\r
+               }\r
+\r
+               protected ArrayList InternalParameters\r
+               {\r
+                       get {\r
+                               if (_internalParameters == null) {\r
+                                       _internalParameters = new ArrayList();\r
+                               }\r
+                               return _internalParameters;\r
+                       }\r
+               }\r
+\r
+               // Number of records affected by execution of batch statement\r
+               // -1 for SELECT statements.\r
+               internal int RecordsAffected\r
+               {\r
+                       get {\r
+                               return _recordsAffected;\r
+                       }\r
+               }\r
+\r
+               // AbstractDbCommand acts as IEnumerator over JDBC statement\r
+               // AbstractDbCommand.CurrentResultSet corresponds to IEnumerator.Current\r
+               internal virtual ResultSet CurrentResultSet\r
+               {\r
+                       get { \r
+                               try {\r
+                                       if (_currentResultSet == null && _hasResultSet) {\r
+                                               _currentResultSet = _statement.getResultSet(); \r
+                                       }\r
+                                       return _currentResultSet;\r
+                               }\r
+                               catch(SQLException e) {\r
+                                       throw new Exception(e.Message, e);\r
+                               }\r
+                       }\r
+               }\r
+\r
+               internal java.sql.Statement JdbcStatement\r
+               {\r
+                       get { return _statement; }\r
+               }\r
+#if USE_DOTNET_REGEX\r
+               protected virtual Regex StoredProcedureRegExp\r
+#else\r
+               protected virtual Pattern StoredProcedureRegExp\r
+#endif\r
+               {\r
+                       get { return SqlStatementsHelper.SimpleParameterStoredProcedureRegExp; }\r
+               }\r
+\r
+               protected virtual SimpleRegex ParameterRegExp\r
+               {\r
+                       get { return SqlStatementsHelper.SimpleParameterRegExp; }\r
+               }\r
+\r
+               #endregion // Properties\r
+\r
+               #region Methods\r
+\r
+               protected abstract DbParameter CreateParameterInternal();\r
+\r
+               protected abstract void CheckParameters();\r
+\r
+               protected abstract DbDataReader CreateReader();\r
+\r
+               protected abstract DbParameterCollection CreateParameterCollection(AbstractDbCommand parent);\r
+\r
+               protected abstract SystemException CreateException(SQLException e);\r
+\r
+               protected internal void CopyTo(AbstractDbCommand target)\r
+               {\r
+                       target._behavior = _behavior;\r
+                       target.CommandText = CommandText;\r
+                       target.CommandTimeout = CommandTimeout;\r
+                       target.CommandType = CommandType;\r
+                       target._connection = _connection;\r
+                       target._transaction = _transaction;\r
+                       target.UpdatedRowSource = UpdatedRowSource;\r
+\r
+                       if (Parameters != null && Parameters.Count > 0) {\r
+                               target._parameters = CreateParameterCollection(target);\r
+                               for(int i=0 ; i < Parameters.Count; i++) {\r
+                                       target.Parameters.Add(((AbstractDbParameter)Parameters[i]).Clone());\r
+                               }\r
+                       }\r
+               }\r
+\r
+               public override void Cancel()\r
+               {\r
+                       try {\r
+                               if (_statement != null)\r
+                                       _statement.cancel();\r
+                       }\r
+                       catch {\r
+                               // MSDN says : "If there is nothing to cancel, nothing happens. \r
+                               // However, if there is a command in process, and the attempt to cancel fails, \r
+                               // no exception is generated."\r
+                       }\r
+               }\r
+               \r
+               protected virtual bool SkipParameter(DbParameter parameter)\r
+               {\r
+                       return false;\r
+               }\r
+\r
+               protected override DbParameter CreateDbParameter()\r
+               {\r
+                       return CreateParameterInternal();\r
+               }\r
+\r
+               internal void DeriveParameters ()\r
+               {\r
+                       if(CommandType != CommandType.StoredProcedure) {\r
+                               throw ExceptionHelper.DeriveParametersNotSupported(this.GetType(),CommandType);\r
+                       }\r
+\r
+                       ArrayList parameters = DeriveParameters(CommandText, true);\r
+                       Parameters.Clear();\r
+                       foreach (AbstractDbParameter param in parameters) {\r
+                               Parameters.Add(param.Clone());\r
+                       }\r
+               }\r
+\r
+               protected ArrayList DeriveParameters(string procedureName, bool throwIfNotExist)\r
+               {\r
+                       try {\r
+                               ArrayList col = _procedureColumnCache.GetProcedureColumns((AbstractDBConnection)Connection, procedureName, this);\r
+                               if (col == null) {\r
+                                       if (throwIfNotExist)\r
+                                               throw ExceptionHelper.NoStoredProcedureExists(procedureName);\r
+                                       col = new ArrayList();\r
+                               }\r
+\r
+                               return col;\r
+                       }\r
+                       catch(SQLException e) {\r
+                               throw CreateException(e);\r
+                       }\r
+               }\r
+\r
+               string CreateTableDirectCommandText(string tableNames) {\r
+                       string forBrowse = String.Empty;\r
+                       if ((Behavior & CommandBehavior.KeyInfo) != 0) {\r
+                               AbstractDBConnection connection = (AbstractDBConnection)Connection;\r
+                               if (connection != null) {\r
+                                       string dbname = connection.JdbcConnection.getMetaData().getDatabaseProductName();\r
+                                       if (dbname == "Microsoft SQL Server")   //must add "FOR BROWSE" for selects\r
+                                               forBrowse = " FOR BROWSE";\r
+                               }\r
+                       }\r
+\r
+                       string[] names = tableNames.Split(',');\r
+                       StringBuilder sb = new StringBuilder();\r
+\r
+                       for(int i = 0; i < names.Length; i++) {\r
+                               sb.Append("SELECT * FROM ");\r
+                               sb.Append(names[i]);\r
+                               sb.Append(forBrowse);\r
+                               sb.Append(';');\r
+                       }\r
+                               \r
+                       if(names.Length <= 1) {\r
+                               sb.Remove(sb.Length - 1,1);\r
+                       }\r
+                       return sb.ToString();\r
+               }\r
+\r
+               private string PrepareCommandTextAndParameters()\r
+               {\r
+                       NullParametersInPrepare = false;\r
+                       switch (CommandType) {\r
+                               case CommandType.TableDirect :\r
+                                       return CreateTableDirectCommandText(CommandText);\r
+                               case CommandType.StoredProcedure :\r
+                                       return CreateStoredProcedureCommandTextSimple(CommandText, Parameters, DeriveParameters(CommandText, false));\r
+                               case CommandType.Text :\r
+\r
+                                       int userParametersPosition = 0;\r
+                                       int charsConsumed = 0;\r
+                                       StringBuilder sb = new StringBuilder(CommandText.Length);\r
+\r
+                                       for (SimpleMatch match = SqlStatementsHelper.CompoundStatementSplitterReqExp.Match(CommandText);\r
+                                               match.Success;\r
+                                               match = match.NextMatch()) {\r
+\r
+                                               int length = match.Length;\r
+\r
+                                               if (length == 0)\r
+                                                       continue;\r
+\r
+                                               int start = match.Index;\r
+                                               string value = match.Value;\r
+\r
+                                               sb.Append(CommandText, charsConsumed, start-charsConsumed);\r
+                                               charsConsumed = start + length;\r
+\r
+#if USE_DOTNET_REGEX\r
+                                               Match storedProcMatch = StoredProcedureRegExp.Match(value);\r
+                                               // count parameters for all kinds of simple statements \r
+                                               userParametersPosition +=\r
+                                                       (storedProcMatch.Success) ?\r
+                                                       // statement is stored procedure call\r
+                                                       CreateStoredProcedureCommandText(sb, value, storedProcMatch, Parameters, userParametersPosition) :\r
+                                                       // statement is a simple SQL query                              \r
+                                                       PrepareSimpleQuery(sb, value, Parameters, userParametersPosition);      \r
+#else\r
+                                               Matcher storedProcMatch = StoredProcedureRegExp.matcher((java.lang.CharSequence)(object)value);\r
+                                               userParametersPosition +=\r
+                                                       (storedProcMatch.find()) ?\r
+                                                       // statement is stored procedure call\r
+                                                       CreateStoredProcedureCommandText(sb, value, storedProcMatch, Parameters, userParametersPosition) :\r
+                                                       // statement is a simple SQL query                              \r
+                                                       PrepareSimpleQuery(sb, value, Parameters, userParametersPosition);\r
+#endif\r
+                                       }\r
+\r
+                                       sb.Append(CommandText, charsConsumed, CommandText.Length-charsConsumed);\r
+\r
+                                       return sb.ToString();\r
+                       }\r
+                       return null;\r
+               }\r
+\r
+               string CreateStoredProcedureCommandTextSimple(string procedureName, IDataParameterCollection userParams, IList derivedParams) {\r
+                       StringBuilder sb = new StringBuilder();\r
+\r
+                       int curUserPos = 0;\r
+                       int curDerivedPos = 0;\r
+                       bool addParas = true;\r
+                       string trimedProcedureName = (procedureName != null) ? procedureName.TrimEnd() : String.Empty;\r
+                       if (trimedProcedureName.Length > 0 && trimedProcedureName[trimedProcedureName.Length-1] == ')')\r
+                               addParas = false;\r
+                       \r
+                       if (derivedParams.Count > 0 && ((AbstractDbParameter)derivedParams[curDerivedPos]).Direction == ParameterDirection.ReturnValue) {\r
+                               AbstractDbParameter derivedParam = (AbstractDbParameter)derivedParams[curDerivedPos++];\r
+\r
+                               AbstractDbParameter userParameter = GetUserParameter(derivedParam.Placeholder, userParams, curUserPos);\r
+                               if (userParameter != null && userParameter.Direction == ParameterDirection.ReturnValue) {\r
+                                       curUserPos++;\r
+                                       InternalParameters.Add(userParameter);\r
+                                       sb.Append("{? = call ");\r
+\r
+                                       if (derivedParam != null && !userParameter.IsDbTypeSet) {\r
+                                               userParameter.JdbcType = derivedParam.JdbcType;\r
+                                       }\r
+                               }\r
+                               else {\r
+                                       sb.Append("{call ");\r
+                               }\r
+                       }\r
+                       else {\r
+                               if (userParams.Count > 0 && \r
+                                       ((AbstractDbParameter)userParams[0]).Direction == ParameterDirection.ReturnValue) {\r
+                                       curUserPos++;\r
+                                       InternalParameters.Add(userParams[0]);\r
+                                       sb.Append("{? = call ");\r
+                               }\r
+                               else\r
+                                       sb.Append("{call ");\r
+                       }\r
+\r
+                       sb.Append(procedureName);\r
+                       if (addParas)\r
+                               sb.Append('(');\r
+\r
+                       bool needComma = false;\r
+                       for (int i = curDerivedPos; i < derivedParams.Count; i++) {\r
+                               AbstractDbParameter derivedParameter = (AbstractDbParameter)derivedParams[curDerivedPos++];\r
+                               \r
+                               bool addParam = false;\r
+\r
+                               if (derivedParameter.IsSpecial) {\r
+                                       // derived parameter is special - never appears in user parameters or user values\r
+                                       InternalParameters.Add((AbstractDbParameter)derivedParameter.Clone());\r
+                                       addParam = true;\r
+                               }\r
+                               else {\r
+                                       AbstractDbParameter userParameter = GetUserParameter(derivedParameter.Placeholder, userParams, curUserPos);\r
+                                       if (userParameter != null) {\r
+                                               curUserPos++;\r
+                                               InternalParameters.Add(userParameter);\r
+                                               addParam = true;\r
+\r
+                                               if (derivedParameter != null && !userParameter.IsDbTypeSet) {\r
+                                                       userParameter.JdbcType = derivedParameter.JdbcType;\r
+                                               }\r
+                                       }\r
+                               }\r
+\r
+                               if (addParam) {\r
+                                       if (needComma)\r
+                                               sb.Append(',');\r
+                                       else\r
+                                               needComma = true;\r
+\r
+                                       sb.Append('?');\r
+                               }\r
+                       }\r
+\r
+                       for (int i = curUserPos; i < userParams.Count; i++) {\r
+                               if (needComma)\r
+                                       sb.Append(',');\r
+                               else\r
+                                       needComma = true;\r
+\r
+                               AbstractDbParameter userParameter = (AbstractDbParameter)userParams[curUserPos++];\r
+                               InternalParameters.Add(userParameter);\r
+\r
+                               sb.Append('?');\r
+                       }\r
+\r
+                       if (addParas)\r
+                               sb.Append(')');\r
+                       sb.Append('}');\r
+                       return sb.ToString();\r
+               }\r
+\r
+               /// <summary>\r
+               /// We suppose that user parameters are in the same order as devived parameters except the special cases\r
+               /// (return value, oracle ref cursors etc.)\r
+               /// </summary>\r
+               //protected virtual string CreateStoredProcedureCommandText(string procedureName, IList userParametersList, int userParametersListStart/*, int userParametersListCount*/, string[] userValuesList, ArrayList derivedParametersList)\r
+#if USE_DOTNET_REGEX\r
+               int CreateStoredProcedureCommandText(StringBuilder sb, string sql, Match match, IDataParameterCollection userParams, int userParamsStartPosition)\r
+#else\r
+               int CreateStoredProcedureCommandText(StringBuilder sb, string sql, Matcher match, IDataParameterCollection userParams, int userParamsStartPosition)\r
+#endif\r
+               {\r
+                       int curUserPos = userParamsStartPosition;\r
+#if USE_DOTNET_REGEX\r
+                       Group procNameGroup = null;\r
+\r
+                       for (Match procNameMatch = match; procNameMatch.Success; procNameMatch = procNameMatch.NextMatch()){\r
+                               procNameGroup = match.Groups["PROCNAME"];\r
+                               if (!procNameGroup.Success) {\r
+                                       continue;\r
+                               }\r
+                       }\r
+\r
+                       if (procNameGroup == null || !procNameGroup.Success)\r
+                               throw new ArgumentException("Not a stored procedure call: '{0}'", sql);\r
+\r
+                       ArrayList derivedParameters = DeriveParameters(procNameGroup.Value, false);\r
+#else\r
+                       ArrayList derivedParameters = DeriveParameters(match.group(2).Trim(), false);\r
+#endif\r
+                       int curDerivedPos = 0;\r
+\r
+                       AbstractDbParameter retValderivedParameter = curDerivedPos < derivedParameters.Count ?\r
+                               (AbstractDbParameter)derivedParameters[curDerivedPos] : null;\r
+                       if (retValderivedParameter != null && retValderivedParameter.Direction == ParameterDirection.ReturnValue)\r
+                               curDerivedPos++;\r
+\r
+                       int queryCurrentPosition = 0;\r
+                       \r
+#if USE_DOTNET_REGEX\r
+                       for (Match retValMatch = match; retValMatch.Success; retValMatch = retValMatch.NextMatch()){\r
+                               Group retval = retValMatch.Groups["RETVAL"];\r
+                               if (!retval.Success) {\r
+                                       continue;\r
+                               }\r
+\r
+                               int retvalIndex = retval.Index;\r
+                               string retvalValue = retval.Value;\r
+                               int retvalLength = retval.Length;\r
+#else\r
+                       int retvalIndex = match.start(1);\r
+                       for (;retvalIndex >= 0;) {\r
+                               string retvalValue = match.group(1);\r
+                               int retvalLength = retvalValue.Length;\r
+#endif\r
+\r
+                               sb.Append(sql, queryCurrentPosition, retvalIndex);\r
+                               AbstractDbParameter userParameter = GetUserParameter(retvalValue, userParams, curUserPos);\r
+                               if (userParameter != null) {\r
+                                       sb.Append('?');\r
+                                       InternalParameters.Add(userParameter);\r
+\r
+                                       if (retValderivedParameter != null && !userParameter.IsDbTypeSet) {\r
+                                               userParameter.JdbcType = retValderivedParameter.JdbcType;\r
+                                       }\r
+\r
+                                       curUserPos++;\r
+                               }\r
+                               else {\r
+                                       sb.Append(retvalValue);\r
+                               }\r
+\r
+                               queryCurrentPosition = (retvalIndex + retvalLength);\r
+\r
+                               break;\r
+                       }\r
+\r
+#if USE_DOTNET_REGEX\r
+                       sb.Append(sql, queryCurrentPosition, procNameGroup.Index + procNameGroup.Length - queryCurrentPosition);\r
+                       queryCurrentPosition = procNameGroup.Index + procNameGroup.Length;\r
+#else\r
+                       sb.Append(sql, queryCurrentPosition, match.end(2) - queryCurrentPosition);\r
+                       queryCurrentPosition = match.end(2);\r
+#endif\r
+\r
+                       bool hasUserParams = false;\r
+\r
+#if USE_DOTNET_REGEX\r
+                       must rewrite the regex to not parse params to have single code with java regex\r
+#else\r
+                       int paramsStart = match.start(3);\r
+                       if (paramsStart >= 0) {\r
+#endif\r
+\r
+                               hasUserParams = true;\r
+                               sb.Append(sql,queryCurrentPosition,paramsStart - queryCurrentPosition);\r
+                               queryCurrentPosition = paramsStart;\r
+\r
+                               for (SimpleMatch m = SqlStatementsHelper.ProcedureParameterSplitterReqExp.Match(match.group(3));\r
+                                       m.Success;m = m.NextMatch()) {\r
+\r
+                                       SimpleCapture parameterCapture = m;\r
+                                       sb.Append(sql,queryCurrentPosition,paramsStart + parameterCapture.Index - queryCurrentPosition);\r
+\r
+                                       // advance in query\r
+                                       queryCurrentPosition = paramsStart + parameterCapture.Index + parameterCapture.Length;\r
+\r
+                                       AbstractDbParameter derivedParameter = curDerivedPos < derivedParameters.Count ?\r
+                                               (AbstractDbParameter)derivedParameters[curDerivedPos++] : null;\r
+                                       \r
+                                       //check for special params\r
+                                       while (derivedParameter != null && derivedParameter.IsSpecial) {\r
+                                               // derived parameter is special - never appears in user parameters or user values\r
+                                               InternalParameters.Add((AbstractDbParameter)derivedParameter.Clone());\r
+                                               sb.Append('?');\r
+                                               sb.Append(',');\r
+\r
+                                               derivedParameter = curDerivedPos < derivedParameters.Count ?\r
+                                                       (AbstractDbParameter)derivedParameters[curDerivedPos++] : null;\r
+                                       }\r
+\r
+                                       AbstractDbParameter userParameter = GetUserParameter(parameterCapture.Value.Trim(), userParams, curUserPos);\r
+\r
+                                       if (userParameter != null) {\r
+                                               sb.Append('?');\r
+                                               InternalParameters.Add(userParameter);\r
+                                               if (derivedParameter != null && !userParameter.IsDbTypeSet) {\r
+                                                       userParameter.JdbcType = derivedParameter.JdbcType;\r
+                                               }\r
+                                               // advance in user parameters\r
+                                               curUserPos++;                           \r
+                                       }\r
+                                       else {\r
+                                               sb.Append(parameterCapture.Value);\r
+                                       }                                                                       \r
+                               }                                       \r
+                       }\r
+\r
+                       bool addedSpecialParams = false;\r
+\r
+                       for (int i = curDerivedPos; i < derivedParameters.Count;) {\r
+                               AbstractDbParameter derivedParameter = (AbstractDbParameter)derivedParameters[i++];\r
+                               if (derivedParameter.IsSpecial) {\r
+                                       // derived parameter is special - never appears in user parameters or user values\r
+                                       if (!hasUserParams && !addedSpecialParams) {\r
+                                               addedSpecialParams = true;\r
+                                               curDerivedPos++;\r
+                                               sb.Append('(');\r
+                                       }\r
+\r
+                                       for (;curDerivedPos < i;curDerivedPos++)\r
+                                               sb.Append(',');\r
+\r
+                                       InternalParameters.Add((AbstractDbParameter)derivedParameter.Clone());\r
+                                       sb.Append('?');\r
+                               }\r
+                       }\r
+\r
+                       if (!hasUserParams && addedSpecialParams)\r
+                               sb.Append(')');\r
+\r
+                       sb.Append(sql,queryCurrentPosition,sql.Length - queryCurrentPosition);\r
+                       return curUserPos - userParamsStartPosition;\r
+               }\r
+\r
+               protected virtual AbstractDbParameter GetUserParameter(string parameterName, IList userParametersList, int userParametersListPosition)\r
+               {\r
+                       if (userParametersListPosition < userParametersList.Count) {\r
+                               AbstractDbParameter param = (AbstractDbParameter)userParametersList[userParametersListPosition];\r
+                               if (param.Placeholder == parameterName)\r
+                                       return param;\r
+                       }\r
+                       return null;\r
+               }\r
+\r
+               int PrepareSimpleQuery(StringBuilder sb, string query, IList userParametersList, int userParametersListStart)\r
+               {\r
+                       int queryCurrentPosition = 0;\r
+                       int userParametersListPosition = userParametersListStart;\r
+\r
+                       if (userParametersList.Count > 0) {\r
+                               for (SimpleMatch m = ParameterRegExp.Match(query);\r
+                                       m.Success;m = m.NextMatch()) {\r
+\r
+                                       SimpleCapture parameterCapture = m;\r
+                                       sb.Append(query,queryCurrentPosition,parameterCapture.Index - queryCurrentPosition);\r
+\r
+                                       // advance in query\r
+                                       queryCurrentPosition = parameterCapture.Index + parameterCapture.Length;        \r
+\r
+                                       AbstractDbParameter userParameter = GetUserParameter(parameterCapture.Value, userParametersList, userParametersListPosition);\r
+\r
+                                       if (userParameter != null) {\r
+                                               if (IsNullParameter(userParameter)) {\r
+                                                       sb.Append("null");\r
+                                                       NullParametersInPrepare = true;\r
+                                               }\r
+                                               else {\r
+                                                       sb.Append('?');\r
+                                                       InternalParameters.Add(userParameter);  \r
+                                               }       \r
+                                               // advance in user parameters\r
+                                               userParametersListPosition++;                           \r
+                                       }\r
+                                       else {\r
+                                               sb.Append(parameterCapture.Value);\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       sb.Append(query,queryCurrentPosition,query.Length - queryCurrentPosition);\r
+                       int userParamsConsumed = userParametersListPosition - userParametersListStart;\r
+\r
+                       if ((Behavior & CommandBehavior.KeyInfo) == 0)\r
+                               return userParamsConsumed;\r
+\r
+                       AbstractDBConnection connection = (AbstractDBConnection)Connection;\r
+                       if (connection == null)\r
+                               return userParamsConsumed;\r
+\r
+                       string dbname = connection.JdbcConnection.getMetaData().getDatabaseProductName();\r
+                       if (dbname == "Microsoft SQL Server") { //must add "FOR BROWSE" for selects\r
+                               if (SqlStatementsHelper.SelectFromStatementReqExp.IsMatch(query))\r
+                                       if (!SqlStatementsHelper.ForBrowseStatementReqExp.IsMatch(query))\r
+                                               sb.Append(" FOR BROWSE");\r
+                       }\r
+\r
+                       return userParamsConsumed;\r
+               }\r
+\r
+               protected virtual bool IsNullParameter(AbstractDbParameter parameter)\r
+               {\r
+                       return ((parameter.Value == null || parameter.Value == DBNull.Value) && !parameter.IsDbTypeSet);\r
+               }\r
+\r
+               protected virtual void PrepareInternalParameters()\r
+               {\r
+                       InternalParameters.Clear();\r
+               }\r
+        \r
+               protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)\r
+               {\r
+                       AbstractDBConnection connection = (AbstractDBConnection)Connection;\r
+                       if (connection == null) {\r
+                               throw ExceptionHelper.ConnectionNotInitialized("ExecuteReader");\r
+                       }\r
+\r
+                       IDbTransaction transaction = Transaction;\r
+                       if ((transaction != null && transaction.Connection != connection) ||\r
+                               (transaction == null && !connection.JdbcConnection.getAutoCommit())) {\r
+                               throw ExceptionHelper.TransactionNotInitialized();\r
+                       }\r
+\r
+                       connection.IsExecuting = true;\r
+\r
+                       try {\r
+                               Behavior = behavior;\r
+\r
+                               PrepareInternalParameters();                    \r
+                               PrepareInternal(false);\r
+\r
+                               // For SchemaOnly there is no need for statement execution\r
+                               if (Behavior != CommandBehavior.SchemaOnly) {\r
+                                       _recordsAffected = -1;\r
+\r
+                                       if ((Behavior & CommandBehavior.SingleRow) != 0) {\r
+                                               _statement.setMaxRows(1);\r
+                                       }\r
+                               \r
+                                       if(_statement is PreparedStatement) {\r
+                                               BindParameters(InternalParameters);\r
+                                               _hasResultSet = ((PreparedStatement)_statement).execute();\r
+                                       }\r
+                                       else {\r
+                                               _hasResultSet =_statement.execute(_javaCommandText);                                    \r
+                                       }\r
+               \r
+                                       if (!_hasResultSet) {\r
+                                               int updateCount = _statement.getUpdateCount();\r
+                                               if (updateCount >= 0) {\r
+                                                       AccumulateRecordsAffected(updateCount);\r
+                                                       _hasResultSet = true; //play as if we have resultset\r
+                                                       NextResultSet();\r
+                                               }\r
+                                       }                                       \r
+                               }\r
+                               connection.IsFetching = true;\r
+                               try {\r
+                                       _currentReader = CreateReader();\r
+                               }\r
+                               catch(Exception e) {\r
+                                       connection.IsFetching = false;\r
+                                       throw e;\r
+                               }\r
+                               return _currentReader;\r
+                       }\r
+                       catch(SQLException e) {                         \r
+                               throw CreateException(e);\r
+                       }\r
+                       finally {\r
+                               connection.IsExecuting = false;\r
+                               NullParametersInPrepare = false;\r
+                       }\r
+               }\r
+\r
+               public override void Prepare()\r
+               {\r
+                       ((AbstractDBConnection)Connection).IsExecuting = true;\r
+                       try {\r
+                               CheckParameters();\r
+                               PrepareInternal(true);  \r
+                       }\r
+                       finally {\r
+                               ((AbstractDBConnection)Connection).IsExecuting = false;\r
+                       }\r
+               }\r
+\r
+               private void PrepareInternal(bool isExplicit)\r
+               {\r
+                       if ((Connection == null) || (Connection.State != ConnectionState.Open)) {\r
+                               throw ExceptionHelper.ConnectionNotOpened("Prepare",(Connection != null) ? Connection.State.ToString() : "");\r
+                       }\r
+\r
+                       if (IsCommandPrepared) {\r
+                               // maybe we have to prepare the command again\r
+                               bool hasNullParameters = false;\r
+                               for(int i = 0; (i < Parameters.Count) && !hasNullParameters; i++) {\r
+                                       AbstractDbParameter parameter = (AbstractDbParameter)Parameters[i];\r
+                                       if (IsNullParameter(parameter)) {\r
+                                               // if we still have null parameters - have to prepare agail\r
+                                               IsCommandPrepared = false;\r
+                                               hasNullParameters = true;\r
+                                       }\r
+                               }\r
+\r
+                               if (!NullParametersInPrepare && hasNullParameters) {\r
+                                       // if we prepeared using null parameters and now there is no null parameters - need to prepare again\r
+                                       IsCommandPrepared = false;\r
+                               }\r
+                       }\r
+\r
+                       if (!IsCommandPrepared) {\r
+\r
+                               _javaCommandText = PrepareCommandTextAndParameters();\r
+\r
+                               java.sql.Connection jdbcCon = _connection.JdbcConnection;\r
+\r
+                               // For SchemaOnly we just prepare statement (for future use in GetSchemaTable)\r
+                               if (Behavior == CommandBehavior.SchemaOnly) {\r
+                                       if (CommandType == CommandType.StoredProcedure)\r
+                                               _statement = jdbcCon.prepareCall(_javaCommandText);\r
+                                       else\r
+                                               _statement = jdbcCon.prepareStatement(_javaCommandText);        \r
+                                       return;\r
+                               }\r
+\r
+                               if (CommandType == CommandType.StoredProcedure)\r
+                                       _statement = jdbcCon.prepareCall(_javaCommandText);\r
+                               else {\r
+                                       int internalParametersCount = InternalParameters.Count;\r
+                                       if ( internalParametersCount > 0) {\r
+                                               bool hasOnlyInputParameters = true;\r
+                                               for(int i=0; i < internalParametersCount; i++) {\r
+                                                       AbstractDbParameter internalParameter = (AbstractDbParameter)InternalParameters[i];\r
+                                                       if (IsNullParameter(internalParameter)) {\r
+                                                               NullParametersInPrepare = true;\r
+                                                       }\r
+\r
+                                                       if ((internalParameter.Direction & ParameterDirection.Output) != 0){\r
+                                                               hasOnlyInputParameters = false;\r
+                                                       }\r
+                                               }\r
+\r
+                                               if (hasOnlyInputParameters) {\r
+                                                       _statement = jdbcCon.prepareStatement(_javaCommandText);        \r
+                                               }\r
+                                               else {                                          \r
+                                                       _statement = jdbcCon.prepareCall(_javaCommandText);\r
+                                               }\r
+                                       }\r
+                                       else {\r
+                                               if (isExplicit) {\r
+                                                       _statement = jdbcCon.prepareStatement(_javaCommandText);                                \r
+                                               }\r
+                                               else {\r
+                                                       _statement = jdbcCon.createStatement();                                 \r
+                                               }\r
+                                       }\r
+                               }\r
+                               IsCommandPrepared = true;\r
+                       }\r
+               }\r
+\r
+               protected void BindParameters(ArrayList parameters)\r
+               {\r
+                       for(int parameterIndex = 0; parameterIndex < parameters.Count; parameterIndex++) {\r
+                               AbstractDbParameter parameter = (AbstractDbParameter)parameters[parameterIndex];\r
+                               switch (parameter.Direction) {\r
+                                       case ParameterDirection.Input :\r
+                                               BindInputParameter(parameter,parameterIndex);\r
+                                               break;\r
+                                       case ParameterDirection.InputOutput:\r
+                                               BindInputParameter(parameter,parameterIndex);\r
+                                               BindOutputParameter(parameter,parameterIndex);\r
+                                               break;\r
+                                       case ParameterDirection.Output :\r
+                                               BindOutputParameter(parameter,parameterIndex);\r
+                                               break;\r
+                                       case ParameterDirection.ReturnValue :\r
+                                               BindOutputParameter(parameter,parameterIndex);\r
+                                               break;\r
+                               }\r
+                       }\r
+               }\r
+               \r
+               protected virtual void BindInputParameter(AbstractDbParameter parameter, int parameterIndex)\r
+               {\r
+                       object value = parameter.ConvertedValue;                        \r
+                       // java parameters are 1 based, while .net are 0 based\r
+                       parameterIndex++; \r
+                       PreparedStatement preparedStatement = ((PreparedStatement)_statement);\r
+\r
+                       switch (parameter.JdbcType) {\r
+                               case DbTypes.JavaSqlTypes.DATALINK:\r
+                               case DbTypes.JavaSqlTypes.DISTINCT:\r
+                               case DbTypes.JavaSqlTypes.JAVA_OBJECT:\r
+                               case DbTypes.JavaSqlTypes.OTHER:\r
+                               case DbTypes.JavaSqlTypes.REF:\r
+                               case DbTypes.JavaSqlTypes.STRUCT: {\r
+                                       preparedStatement.setObject(parameterIndex, value, (int)parameter.JdbcType);\r
+                                       return;\r
+                               }\r
+                       }\r
+\r
+                       if ((value is DBNull) || (value == null)) {\r
+                               preparedStatement.setNull(parameterIndex, (int)((AbstractDbParameter)parameter).JdbcType);\r
+                       }\r
+                       else if (value is long) {\r
+                               preparedStatement.setLong(parameterIndex, (long)value);\r
+                       }\r
+                       else if (value is byte[]) {\r
+                               if (((byte[])value).Length <= 4000) {\r
+                                       preparedStatement.setBytes(parameterIndex, vmw.common.TypeUtils.ToSByteArray((byte[]) value));\r
+                               }\r
+                               else {\r
+                                       InputStream iStream=new ByteArrayInputStream(vmw.common.TypeUtils.ToSByteArray((byte[]) value));\r
+                                       preparedStatement.setBinaryStream(parameterIndex,iStream,((byte[])value).Length);\r
+                               }\r
+                       }\r
+                       else if (value is byte) {\r
+                               preparedStatement.setByte(parameterIndex, (sbyte)(byte)value);\r
+                       }\r
+                       else if (value is char[]) {\r
+                               Reader reader = new CharArrayReader((char[])value);\r
+                               preparedStatement.setCharacterStream(parameterIndex,reader,((char[])value).Length);\r
+                       }\r
+                       else if (value is bool) {\r
+                               preparedStatement.setBoolean(parameterIndex, (bool) value);\r
+                       }\r
+                       else if (value is char) {\r
+                               preparedStatement.setString(parameterIndex, ((char)value).ToString());\r
+                       }\r
+                       else if (value is DateTime) {\r
+                               switch (parameter.JdbcType) {\r
+                                       default:\r
+                                       case DbTypes.JavaSqlTypes.TIMESTAMP:\r
+                                               preparedStatement.setTimestamp(parameterIndex,DbConvert.ClrTicksToJavaTimestamp(((DateTime)value).Ticks));\r
+                                               break;\r
+                                       case DbTypes.JavaSqlTypes.TIME:\r
+                                               preparedStatement.setTime(parameterIndex,DbConvert.ClrTicksToJavaTime(((DateTime)value).Ticks));\r
+                                               break;\r
+                                       case DbTypes.JavaSqlTypes.DATE:\r
+                                               preparedStatement.setDate(parameterIndex,DbConvert.ClrTicksToJavaDate(((DateTime)value).Ticks));\r
+                                               break;\r
+                               }\r
+                       }\r
+                       else if (value is TimeSpan) {\r
+                               if (parameter.JdbcType == DbTypes.JavaSqlTypes.TIMESTAMP)\r
+                                       preparedStatement.setTimestamp(parameterIndex,DbConvert.ClrTicksToJavaTimestamp(((TimeSpan)value).Ticks));\r
+                               else\r
+                                       preparedStatement.setTime(parameterIndex,DbConvert.ClrTicksToJavaTime(((TimeSpan)value).Ticks));\r
+                       }\r
+                       else if (value is Decimal) {\r
+                               preparedStatement.setBigDecimal(parameterIndex, vmw.common.PrimitiveTypeUtils.DecimalToBigDecimal((Decimal) value));\r
+                       }\r
+                       else if (value is double) {\r
+                               preparedStatement.setDouble(parameterIndex, (double)value);\r
+                       }\r
+                       else if (value is float) {\r
+                               preparedStatement.setFloat(parameterIndex, (float)value);\r
+                       }\r
+                       else if (value is int) {\r
+                               preparedStatement.setInt(parameterIndex, (int)value);\r
+                       }\r
+                       else if (value is string) {\r
+                               preparedStatement.setString(parameterIndex, (string)value);\r
+                       }\r
+                       else if (value is Guid) {\r
+                               preparedStatement.setString(parameterIndex, value.ToString());\r
+                       }\r
+                       else if (value is short) {\r
+                               preparedStatement.setShort(parameterIndex, (short)value);\r
+                       }\r
+                       else if (value is sbyte) {\r
+                               preparedStatement.setByte(parameterIndex, (sbyte)value);\r
+                       }\r
+                       else {\r
+                               preparedStatement.setObject(parameterIndex, value);\r
+                       }\r
+               }\r
+\r
+               protected virtual void BindOutputParameter(AbstractDbParameter parameter, int parameterIndex)
+               {
+                       parameter.Validate();
+                       int jdbcType = (int)parameter.JdbcType;         \r
+                       // java parameters are 1 based, while .net are 0 based\r
+                       parameterIndex++;\r
+\r
+                       CallableStatement callableStatement = ((CallableStatement)_statement);\r
+\r
+                       // the scale has a meening only in DECIMAL and NUMERIC parameters\r
+                       if (jdbcType == Types.DECIMAL || jdbcType == Types.NUMERIC) {\r
+                               if(parameter.DbType == DbType.Currency) {\r
+                                       callableStatement.registerOutParameter(parameterIndex, jdbcType, 4);\r
+                               }\r
+                               else {\r
+                                       callableStatement.registerOutParameter(parameterIndex, jdbcType, parameter.Scale);\r
+                               }\r
+                       }\r
+                       else {\r
+                               callableStatement.registerOutParameter(parameterIndex, jdbcType);\r
+                       }
+               }\r
+\r
+               private void FillOutputParameters()
+               {       
+                       if  (!(_statement is CallableStatement)) {
+                               return;
+                       }
+                       for(int i = 0; i < InternalParameters.Count; i++) {
+                               AbstractDbParameter parameter = (AbstractDbParameter)InternalParameters[i];
+                               ParameterDirection direction = parameter.Direction;
+                               if (((direction & ParameterDirection.Output) != 0) && !SkipParameter(parameter)) {                                      
+                                       FillOutputParameter(parameter, i);
+                               }
+                               // drop jdbc type of out parameter, since it possibly was updated in ExecuteReader
+                               parameter.IsJdbcTypeSet = false;
+                       }
+               }\r
+\r
+               protected virtual void FillOutputParameter(DbParameter parameter, int index)\r
+               {                       \r
+                       CallableStatement callableStatement = (CallableStatement)_statement;\r
+                       ParameterMetadataWrapper parameterMetadataWrapper = null; \r
+                       // FIXME wait for other drivers to implement\r
 //                     try {\r
-//                             java.lang.Class OracleTypesClass = java.lang.Class.forName("oracle.jdbc.OracleTypes");\r
-//                             _oracleRefCursor = OracleTypesClass.getField("CURSOR").getInt(null);\r
-//                     }\r
-//                     catch(java.lang.ClassNotFoundException e) {\r
-//                             // oracle driver is not in classpath - just continue\r
-//                     }\r
-//             }\r
-//\r
-//             public AbstractDBCommand(\r
-//                     String cmdText,\r
-//                     AbstractDBConnection connection,\r
-//                     IDbTransaction transaction)\r
-//             {\r
-//                     _connection = connection;\r
-//                     _cmdText = cmdText;\r
-//                     _transaction = transaction;\r
-//                     _isCommandTextChanged = true;\r
-//             }\r
-//    \r
-//             public java.sql.Statement Statement\r
-//             {\r
-//                     get\r
-//                     {\r
-//                             return _statement;\r
-//                     }\r
-//                     set\r
-//                     {\r
-//                             _statement = value;\r
-//                     }\r
-//             }\r
-//\r
-//             public virtual String JavaCommandText\r
-//             {\r
-//                     get\r
-//                     {\r
-//                             return _javaCmdText;\r
-//                     }\r
-//                     set\r
-//                     {\r
-//                             _javaCmdText = value;\r
-//                     }\r
-//             }\r
-//\r
-//             protected bool getCommandTextChanged()\r
-//             {\r
-//                     return _isCommandTextChanged;\r
-//             }\r
-//    \r
-//             internal void setCommandTextChanged(bool value)\r
-//             {\r
-//                     _isCommandTextChanged = value;\r
-//             }\r
-//    \r
-//             public Statement getStatement()\r
-//             {\r
-//                     return _statement;\r
-//             }\r
-//             /**\r
-//              * @see System.Data.IDbCommand#Cancel()\r
-//              */\r
-//             public override void Cancel()\r
-//             {\r
-//                     try\r
-//                     {\r
-//                             if (_statement != null)\r
-//                                     _statement.cancel();\r
-//                     }\r
-//                     catch (SQLException exp)\r
-//                     {\r
-//                             Console.WriteLine(exp);\r
-//                     }\r
-//             }\r
-//\r
-////           /**\r
-////            * @see System.Data.IDbCommand#ExecuteScalar()\r
-////            */\r
-////           public virtual Object ExecuteScalar()\r
-////           {\r
-////                   Object result = null;\r
-////                   IDataReader reader = ((IDbCommand)this).ExecuteReader();\r
-////\r
-////                   if (reader != null && reader.Read())\r
-////                   {\r
-////                           result = ((IDataRecord) reader).GetValue(0);\r
-////                   }\r
-////                   reader.Close();\r
-////\r
-////                   return result;\r
-////           }\r
-//\r
-////           /**\r
-////            * @see System.Data.IDbCommand#CommandTimeout\r
-////            */\r
-////           public virtual int CommandTimeout\r
-////           {\r
-////                   get\r
-////                   {\r
-////                           return _cmdTimeout;\r
-////                   }\r
-////                   set\r
-////                   {\r
-////                           _cmdTimeout = value;\r
-////                   }\r
-////           }\r
-//\r
-////           /**\r
-////            * @see System.Data.IDbCommand#CommandType\r
-////            */\r
-////           public virtual CommandType CommandType\r
-////           {\r
-////                   get\r
-////                   {\r
-////                           return _cmdType;\r
-////                   }\r
-////                   set\r
-////                   {\r
-////                           _cmdType = value;\r
-////                   }\r
-////           }\r
-//\r
-////           /**\r
-////            * @see System.Data.IDbCommand#Connection\r
-////            */\r
-////           public virtual IDbConnection Connection\r
-////           {\r
-////                   get\r
-////                   {\r
-////                           return (IDbConnection)_connection;\r
-////                   }\r
-////                   set\r
-////                   {\r
-////                           _connection = (AbstractDBConnection) value;\r
-////                   }\r
-////           }\r
-//\r
-////           /**\r
-////            * @see System.Data.IDbCommand#Transaction\r
-////            */\r
-////           public virtual IDbTransaction Transaction\r
-////           {\r
-////                   get\r
-////                   {\r
-////                           return _transaction;\r
-////                   }\r
-////                   set\r
-////                   {\r
-////                           _transaction = value;\r
-////                   }\r
-////           }\r
-//\r
-////           /**\r
-////            * @see System.Data.IDbCommand#UpdatedRowSource\r
-////            */\r
-////           public virtual UpdateRowSource UpdatedRowSource\r
-////           {\r
-////                   get\r
-////                   {\r
-////                           return _updateRowSource;\r
-////                   }\r
-////                   set\r
-////                   {\r
-////                           _updateRowSource = value;\r
-////                   }\r
-////           }\r
-//\r
-////           /**\r
-////            * @see System.Data.IDbCommand#CommandText\r
-////            */\r
-////           public virtual String CommandText\r
-////           {\r
-////                   get\r
-////                   {\r
-////                           return _cmdText;\r
-////                   }\r
-////                   set\r
-////                   {\r
-////                           if (_cmdText == null || String.Compare(_cmdText, value,  true) != 0)\r
-////                           {\r
-////                                   _cmdText = value;\r
-////                                   _isCommandTextChanged = true;\r
-////                           }\r
-////                   }\r
-////           }\r
-//\r
-//             protected virtual void setInputForStatement(\r
-//                     PreparedStatement stm,\r
-//                     int javaType,\r
-//                     int place,\r
-//                     Object value)\r
-//                     //throws SQLException\r
-//             {\r
-//                     // by the type of the the parameter we know wich method of\r
-//                     // the statement to use\r
-//\r
-//                     if (value is DBNull)\r
-//                             stm.setNull(place, javaType);\r
-//\r
-//                     else if (javaType == Types.BINARY)\r
-//                             stm.setBytes(place, vmw.common.TypeUtils.ToSByteArray((byte[]) value));\r
-//\r
-//                     else if (javaType == Types.BLOB)\r
-//                             stm.setObject(place, value);\r
-//\r
-//                     else if (javaType == Types.CLOB)\r
-//                             stm.setObject(place, value);\r
-//\r
-//                     else if (javaType == Types.DISTINCT)\r
-//                             stm.setObject(place, value);\r
-//\r
-//                     else if (javaType == Types.ARRAY)\r
-//                             stm.setObject(place, value);\r
-//\r
-//                     else if (javaType == Types.JAVA_OBJECT)\r
-//                             stm.setObject(place, value);\r
-//\r
-//                     else if (javaType == Types.REF)\r
-//                             stm.setObject(place, value);\r
-//\r
-//                     else if (javaType == Types.STRUCT)\r
-//                             stm.setObject(place, value);\r
-//\r
-//                     else if (javaType == Types.VARBINARY)\r
-//                             stm.setBytes(place, vmw.common.TypeUtils.ToSByteArray((byte[]) value));\r
-//\r
-//                     else if (javaType == Types.BIGINT)\r
-//                             stm.setLong(place, ((java.lang.Long) value).longValue());\r
-//\r
-//                     else if (javaType == Types.BIT)\r
-//                             stm.setBoolean(place, ((java.lang.Boolean) value).booleanValue());\r
-//\r
-//                     else if (javaType == Types.CHAR)\r
-//                             stm.setString(place, ((java.lang.Character) value).toString());\r
-//\r
-//                     else if (javaType == Types.DATE)\r
-//                     {\r
-//                             DateTime tmp = (DateTime) value;\r
-//                             Calendar c = vmw.common.DateTimeUtils.DateTimeToCalendar(tmp);\r
-//                             stm.setDate(\r
-//                                     place, new java.sql.Date(c.getTime().getTime()));\r
-//                     }\r
-//                     else if (javaType == Types.DECIMAL || javaType == Types.NUMERIC)\r
-//                             stm.setBigDecimal(place, vmw.common.PrimitiveTypeUtils.DecimalToBigDecimal((Decimal) value));\r
-//\r
-//                     else if (javaType == Types.DOUBLE)\r
-//                             stm.setDouble(place, ((java.lang.Double) value).doubleValue());\r
-//\r
-//                     else if (javaType == Types.FLOAT)\r
-//                             stm.setFloat(place, ((java.lang.Float) value).floatValue());\r
-//\r
-//                     else if (javaType == Types.INTEGER)\r
-//                             stm.setInt(place, ((java.lang.Integer) value).intValue());\r
-//\r
-//                     else if (javaType == Types.LONGVARCHAR)\r
-//                             stm.setString(place, (String) value);\r
-//\r
-//                     else if (javaType == Types.LONGVARBINARY)\r
-//                             stm.setBytes(place, vmw.common.TypeUtils.ToSByteArray((byte[]) value));\r
-//\r
-//                     else if (javaType == Types.REAL)\r
-//                             stm.setFloat(place, ((java.lang.Float) value).floatValue());\r
-//\r
-//                     else if (javaType == Types.SMALLINT)\r
-//                             stm.setShort(place, ((java.lang.Short) value).shortValue());\r
-//\r
-//                     else if (javaType == Types.TIME)\r
-//                     {\r
-//                             Calendar c = vmw.common.DateTimeUtils.DateTimeToCalendar(value);\r
-//                             stm.setTime(\r
-//                                     place,\r
-//                                     new java.sql.Time(c.getTime().getTime()));\r
+//                             parameterMetadataWrapper = new ParameterMetadataWrapper(callableStatement.getParameterMetaData());\r
 //                     }\r
-//                     else if (javaType == Types.TIMESTAMP)\r
-//                     {\r
-//                             DateTime tmp = (DateTime) value;\r
-//                             Calendar c = vmw.common.DateTimeUtils.DateTimeToCalendar(value);\r
-//                             stm.setTimestamp(\r
-//                                     place,\r
-//                                     new java.sql.Timestamp(c.getTime().getTime()));\r
+//                     catch {\r
+//                             // suppress error : ms driver for sql server does not implement getParameterMetaData\r
+//                             // suppress exception : ms driver for sql server does not implement getParameterMetaData\r
 //                     }\r
-//\r
-//                     else if (javaType == Types.TINYINT)\r
-//                             stm.setByte(place, ((java.lang.Byte) value).byteValue());\r
-//\r
-//                     else if (javaType == Types.VARCHAR)\r
-//                             stm.setString(place, (String) value);\r
-//\r
-//                     else\r
-//                             stm.setObject(place, value, javaType);\r
-//\r
-//             }\r
-//\r
-//             // create the _javaCmdText from the _cmdText (the .NET text)\r
-//             protected String createCommandForStoreProcedure(String text)\r
-//             {\r
-//                     IDbDataParameter param;\r
-//                     bool isFirst = true;\r
-//                     IList paramCollection = (IList) ((IDbCommand)this).Parameters;\r
-//        \r
-//                     //in .Net the name of sore procedure can be wraped by '[' and ']'\r
-//                     // so we remove them.\r
-//                     int indx1 = text.IndexOf('[');\r
-//                     if (indx1 != -1)\r
-//                     {\r
-//                             int indx2 = text.IndexOf(']', indx1);\r
-//                             if (indx2 != -1)\r
-//                                     text = text.Substring(indx1 + 1, indx2 - (indx1 + 1));\r
-//                     }\r
-//\r
-//                     java.lang.StringBuffer sb = new java.lang.StringBuffer(text);\r
-//                     sb.insert(0, "{call ");\r
-//\r
-//                     for (int i = 0; i < paramCollection.Count; i++)\r
-//                     {\r
-//                             param = (IDbDataParameter) paramCollection[i];\r
-//\r
-//                             if (param.Direction == ParameterDirection.ReturnValue)\r
-//                                     sb = sb.insert(1, "? =");\r
-//                             else if (isFirst)\r
-//                             {\r
-//                                     sb = sb.append("(?");\r
-//                                     isFirst = false;\r
-//                             }\r
-//                             else\r
-//                                     sb = sb.append(",?");\r
-//                     }\r
-//\r
-//                     String retVal = sb.toString();\r
-//\r
-//                     if (retVal.IndexOf("(") != -1)\r
-//                             retVal = retVal + ")";\r
-//\r
-//                     retVal += "}";\r
-//\r
-//                     _javaCmdText = retVal;\r
-//\r
-//                     return retVal;\r
-//\r
-//             }\r
-//\r
-//             // prepare the input and output parameters for the jdbc prepared statement\r
-//             // from the SqlParameters of this instance\r
-//             internal virtual void prepareStatementForStoreProcedure()// throws SQLException\r
-//             {\r
-//                     CallableStatement stm = (CallableStatement) _statement;\r
-//                     AbstractDBParameter param;\r
-//                     IList paramCollection = (IList) ((IDbCommand)this).Parameters;\r
-//                     ParameterDirection direction;\r
-//                     //int place;\r
-//\r
-//                     // NOTE - we add 1 to the index because in .NET it is zero base\r
-//                     // and in jdbc it is one base\r
-//                     for (int i = 0; i < paramCollection.Count; i++)\r
-//                     {\r
-//                             param = (AbstractDBParameter) paramCollection[i];\r
-//                             direction = param.Direction;\r
-//\r
-//                             if (direction == ParameterDirection.Input)\r
-//                                     setInput(stm, i + 1, param);\r
-//                             else if (direction == ParameterDirection.Output)\r
-//                             {\r
-//                                     setOutput(stm, i + 1, param);\r
-//                                     param.setParameterPlace(i + 1);\r
-//                             }\r
-//                             else if (direction == ParameterDirection.InputOutput)\r
-//                             {\r
-//                                     setInput(stm, i + 1, param);\r
-//                                     setOutput(stm, i + 1, param);\r
-//                                     param.setParameterPlace(i + 1);\r
-//                             }\r
-//                             else if (direction == ParameterDirection.ReturnValue)\r
-//                             {\r
-//                                     setOutput(stm, 1, param);\r
-//                                     param.setParameterPlace(1);\r
-//                             }\r
-//                     }\r
-//\r
-//             }\r
-//\r
-//             // set input parameter for the statement\r
-//             protected void setInput(\r
-//                     PreparedStatement stm,\r
-//                     int place,\r
-//                     AbstractDbParameter param)\r
-//                     //throws SQLException\r
-//             {\r
-//                     int javaType = param.JdbcType;\r
-//                     Object value = param.Value;\r
-//\r
-//                     value = getJavaWrapperFromCSharp(value);\r
-//\r
-//                     setInputForStatement(stm, javaType, place, value);\r
-//             }\r
-//        \r
-//             public static Object getJavaWrapperFromCSharp(Object obj)\r
-//             {\r
-//                     if (obj is bool)\r
-//                             return new java.lang.Boolean((bool)obj);\r
-//                     else if (obj is byte)\r
-//                             return new java.lang.Byte((sbyte)obj);\r
-//                     else if (obj is char)\r
-//                             return new java.lang.Character((char) obj);\r
-//                     else if (obj is short)\r
-//                             return new java.lang.Short((short)obj);\r
-//                     else if (obj is int)\r
-//                             return new java.lang.Integer((int)obj);\r
-//                     else if (obj is long)\r
-//                             return new java.lang.Long((long)obj);\r
-//                     else if (obj is float)\r
-//                             return new java.lang.Float((float)obj);\r
-//                     else if (obj is double)\r
-//                             return new java.lang.Double((double)obj);\r
-//\r
-//                     return obj;\r
-//\r
-//             }\r
-//\r
-//             // set an output parameter to the statement.\r
-//             protected void setOutput(\r
-//                     CallableStatement stm,\r
-//                     int place,\r
-//                     AbstractDbParameter param)\r
-//                     //throws SQLException\r
-//             {\r
-//                     int javaType = param.JdbcType;\r
-//\r
-//                     // the scale has a meening only in DECIMAL parameters\r
-//                     if (javaType == Types.DECIMAL || javaType == Types.NUMERIC)\r
-//                     {\r
-//                             if(param.DbType == DbType.Currency)\r
-//                                     stm.registerOutParameter(place, javaType, 4);\r
-//                             else\r
-//                                     stm.registerOutParameter(place, javaType, param.Scale);\r
-//                     }\r
-//                     else if (javaType == oracleTypeRefCursor) {\r
-//                             stm.registerOutParameter(place, _oracleRefCursor);\r
-//                     }\r
-//                     else {\r
-//                             stm.registerOutParameter(place, javaType);\r
-//                     }\r
-//\r
-//             }\r
-//\r
-//             // get the the output parameter for a specific statement at a specific place\r
-//             // returns the value of the output parameter\r
-//             protected Object getOutputValue(\r
-//                     AbstractDbParameter param,\r
-//                     CallableStatement stm)\r
-//                     //throws SQLException\r
-//             {\r
-//                     Object retVal = null;\r
-//\r
-//                     int place = param.getParameterPlace();\r
-//\r
-//                     // by the type of the parameter we know wich method to use\r
-//                     // on the statement\r
-//                     int type = param.JdbcType;\r
-//\r
-//                     if (type == Types.ARRAY)\r
-//                             retVal = stm.getObject(place);\r
-//                     else if (type == Types.BIGINT)\r
-//                             retVal = stm.getLong(place);\r
-//                     else if (type == Types.BINARY)\r
-//                             retVal = stm.getBytes(place);\r
-//                     else if (type == Types.BIT)\r
-//                             retVal = stm.getBoolean(place);\r
-//                     else if (type == Types.BLOB)\r
-//                             retVal = stm.getObject(place);\r
-//                     else if (type == Types.CHAR)\r
-//                             retVal = stm.getString(place);\r
-//                     else if (type == Types.CLOB)\r
-//                             retVal = stm.getObject(place);\r
-//                     else if (type == Types.DATE)\r
-//                     {\r
-//                             java.sql.Date date = stm.getDate(place);\r
-//                             if(date != null)\r
-//                             {\r
-//                                     // convertirn sql.Date to DateTime\r
-//                                     Calendar c = Calendar.getInstance();\r
-//                                     c.setTime(date);\r
-//\r
-//                                     retVal = vmw.common.DateTimeUtils.CalendarToDateTime(c);\r
-//                             }\r
-//                             \r
-//                     }\r
-//                     else if (type == Types.DECIMAL)\r
-//                     {\r
-//                             java.math.BigDecimal bd = stm.getBigDecimal(place);\r
-//                             if(bd != null)\r
-//                                     retVal = vmw.common.PrimitiveTypeUtils.BigDecimalToDecimal(bd);\r
-//                     }\r
-//                     else if (type == Types.DISTINCT)\r
-//                             retVal = stm.getObject(place);\r
-//                     else if (type == Types.DOUBLE)\r
-//                             retVal = stm.getDouble(place);\r
-//                     else if (type == Types.FLOAT)\r
-//                             retVal = stm.getFloat(place);\r
-//                     else if (type == Types.INTEGER)\r
-//                             retVal = stm.getInt(place);\r
-//                     else if (type == Types.JAVA_OBJECT)\r
-//                             retVal = stm.getObject(place);\r
-//                     else if (type == Types.LONGVARBINARY)\r
-//                             retVal = stm.getBytes(place);\r
-//                     else if (type == Types.LONGVARCHAR)\r
-//                             retVal = stm.getString(place);\r
-//                     else if (type == Types.NULL)\r
-//                             retVal = DBNull.Value;\r
-//                     else if (type == Types.NUMERIC)\r
-//                             retVal = stm.getBigDecimal(place);\r
-//                     else if (type == Types.OTHER)\r
-//                             retVal = stm.getObject(place);\r
-//                     else if (type == Types.REAL)\r
-//                             retVal = stm.getFloat(place);\r
-//                     else if (type == Types.REF)\r
-//                             retVal = stm.getObject(place);\r
-//                     else if (type == Types.SMALLINT)\r
-//                             retVal = stm.getShort(place);\r
-//                     else if (type == Types.STRUCT)\r
-//                             retVal = stm.getObject(place);\r
-//                     else if (type == Types.TIME)\r
-//                     {\r
-//                             Time t = stm.getTime(place);\r
-//                             if(t != null)\r
-//                             {\r
-//                                     java.util.Date d = new java.util.Date(t.getTime());\r
-//                                     // convertirn sql.Date to DateTime\r
-//                                     Calendar c = Calendar.getInstance();\r
-//                                     c.setTime(d);\r
-//\r
-//                                     retVal = vmw.common.DateTimeUtils.CalendarToDateTime(c);\r
-//                             }\r
-//                             \r
-//                     }\r
-//                     else if (type == Types.TIMESTAMP)\r
-//                     {\r
-//                             Timestamp ts = stm.getTimestamp(place);\r
-//                             if(ts != null)\r
-//                             {\r
-//                                     java.util.Calendar cal = java.util.Calendar.getInstance();\r
-//                                     cal.setTime(new java.util.Date(ts.getTime() + ts.getNanos()/1000000));\r
-//                                     retVal = (DateTime)vmw.common.DateTimeUtils.CalendarToDateTime(cal);\r
-//                             }\r
-//                     }\r
-//                     else if (type == Types.TINYINT)\r
-//                             retVal = stm.getByte(place);\r
-//                     else if (type == Types.VARBINARY)\r
-//                             retVal = stm.getBytes(place);\r
-//                     else if (type == Types.VARCHAR)\r
-//                             retVal = stm.getString(place);\r
-//        \r
-//                     if(stm.wasNull())\r
-//                             retVal = DBNull.Value;\r
-//            \r
-//                     return retVal;\r
-//             }\r
-//\r
-//    \r
-////           IDbDataParameter IDbCommand.CreateParameter()\r
-////           {\r
-////                   return null;\r
-////           }\r
-//    \r
-////           IDataReader IDbCommand.ExecuteReader(CommandBehavior behavior)\r
-////           {\r
-////                   return null;\r
-////           }\r
-////\r
-////           IDataReader IDbCommand.ExecuteReader()\r
-////           {\r
-////                   return null;\r
-////           }\r
-////\r
-////           int IDbCommand.ExecuteNonQuery()\r
-////           {\r
-////                   return -1;\r
-////           }\r
-////\r
-////           void IDbCommand.Prepare()\r
-////           {\r
-////           }\r
-//\r
-//        \r
-////           public IDataParameterCollection Parameters\r
-////           {\r
-////                   get\r
-////                   {\r
-////                           return _paramCollection;\r
-////                   }\r
-////           }\r
-//\r
-//             ~AbstractDBCommand()\r
-//             {\r
-//                     Dispose();\r
-//             }\r
-//\r
-//             public new void Dispose()
-//             {
-//                     if (_paramCollection != null)
-//                             _paramCollection.Clear();
-//
-//                     _connection = null;
-//                     _transaction = null;
-//
-//                     if (_statement != null)
-//                     {
-//                             _statement.close();
-//                             _statement = null;
-//                     }
-//                     base.Dispose();
-//             }\r
-//\r
-//             protected void CheckTrasactionContext()\r
-//             {\r
-//                     if (_connection.Transaction != null && \r
-//                             (Transaction == null || Transaction != _connection.Transaction)) {\r
-//                             throw new InvalidOperationException("Execute requires the command to have a transaction object" + \r
-//                                                     " when the connection assigned to the command is in a pending local transaction." +\r
-//                                                     " The Transaction property of the command has not been initialized.");\r
-//                     }\r
-//             }\r
-//\r
-//             protected String buildJavaCommand(String command)\r
-//             {\r
-//                     IDataParameterCollection parameters = Parameters;\r
-//                     \r
-//                     if (parameters != null && parameters.Count > 0) {\r
-//                             string tokens = command;\r
-//                             System.Text.StringBuilder sb = new System.Text.StringBuilder(tokens.Length);\r
-//\r
-//                             int currParameter = 0;\r
-//                             int currStart = 0;\r
-//                             int curr = 0;\r
-//                             char curSeparator = (char)0;\r
-//                             bool foundSeparator = false;\r
-//\r
-//                             for(;curr<tokens.Length;curr++) {\r
-//                                     switch(tokens[curr]) {\r
-//                                             case '"':\r
-//                                             case '\'':\r
-//                                                     if (foundSeparator) {\r
-//                                                             if (curSeparator == tokens[curr]) {\r
-//                                                                     foundSeparator = false;\r
-//                                                             }\r
-//                                                     }\r
-//                                                     else {\r
-//                                                             // start inner string\r
-//                                                             foundSeparator = true;\r
-//                                                             curSeparator = tokens[curr];\r
-//                                                     }\r
-//                                                     break;\r
-//                                             case '?':\r
-//                                                     if (!foundSeparator) {\r
-//                                                             if (curr > currStart) { \r
-//                                                                     // copy collected \r
-//                                                                     sb.Append(tokens,currStart,curr - currStart);\r
-//                                                             }\r
-//                                                             // append parameter value\r
-//                                                             AbstractDBParameter param = (AbstractDBParameter)parameters[currParameter++];\r
-//                                                             sb.Append(param.formatParameter());\r
-//                                                             currStart = curr+1;\r
-//                                                     }\r
-//                                                     break;\r
-//                                     }\r
-//                             }\r
-//\r
-//                             if (curr > currStart) { // end of the stirng\r
-//                                     sb.Append(tokens,currStart,curr - currStart);\r
-//                             }\r
-//\r
-//                             command = sb.ToString();\r
-//                     }\r
-//                     return command;\r
-//             }\r
-//\r
-//             internal void fillParameters()
-//             {
-//                     if(CommandType == CommandType.StoredProcedure)
-//                     {
-//                             AbstractDBParameter param;
-//                             CallableStatement stm = (CallableStatement)_statement;
-//                             // get the output parameters from the statement
-//                             // and put their values into the SqlParameter
-//                             for (int i = 0; i < _paramCollection.Count; i++)
-//                             {
-//                                     param = (AbstractDBParameter)_paramCollection[i];
-//
-//                                     if (param.IsOracleRefCursor)
-//                                             continue;
-//
-//                                     ParameterDirection direction = param.Direction;
-//                                     if (direction == ParameterDirection.InputOutput
-//                                             || direction == ParameterDirection.Output
-//                                             || direction == ParameterDirection.ReturnValue)
-//                                             param.Value = getOutputValue(param, stm);
-//                             }
-//                     }
-//             }\r
-//\r
-//             protected void setCommandBehabior(CommandBehavior cmdBehavior)\r
-//             {\r
-//                     _behvior = cmdBehavior;\r
-//             }\r
-//\r
-//             internal CommandBehavior getCommandBehavior()\r
-//             {\r
-//                     return _behvior;\r
-//             }\r
-//\r
-//             protected static String GetProcedureName(string cmdText)\r
-//             {\r
-//                     if(cmdText[0] == '[' && cmdText[cmdText.Length - 1] == ']')\r
-//                             return cmdText.Substring(1, cmdText.Length - 2);\r
-//                     return cmdText;\r
-//             }\r
-//        \r
-//     }\r
-//}
\ No newline at end of file
+                       DbTypes.JavaSqlTypes javaSqlType = (DbTypes.JavaSqlTypes)((AbstractDbParameter)parameter).JdbcType;\r
+                       try {\r
+                               parameter.Value = DbConvert.JavaResultSetToClrWrapper(callableStatement,index,javaSqlType,parameter.Size,parameterMetadataWrapper);\r
+                       }\r
+                       catch(java.sql.SQLException e) {\r
+                               throw CreateException(e);\r
+                       }\r
+               }\r
+\r
+               // AbstractDbCommand acts as IEnumerator over JDBC statement\r
+               // AbstractDbCommand.NextResultSet corresponds to IEnumerator.MoveNext\r
+               internal virtual bool NextResultSet()\r
+               {\r
+                       if (!_hasResultSet)\r
+                               return false;\r
+\r
+                       try {\r
+                               for(;;) {\r
+                                       _hasResultSet = _statement.getMoreResults();\r
+                                       if (_hasResultSet)\r
+                                               return true;\r
+                                       int updateCount = _statement.getUpdateCount();\r
+                                       if (updateCount < 0)\r
+                                               return false;\r
+\r
+                                       AccumulateRecordsAffected(updateCount); \r
+                               }\r
+                       }\r
+                       catch (SQLException e) {\r
+                               throw CreateException(e);\r
+                       }\r
+                       finally {\r
+                               _currentResultSet = null;\r
+                       }\r
+               }\r
+\r
+               private void AccumulateRecordsAffected(int updateCount)\r
+               { \r
+                       if (_recordsAffected < 0) {\r
+                               _recordsAffected = updateCount;\r
+                       }\r
+                       else {\r
+                               _recordsAffected += updateCount;\r
+                       }\r
+               }\r
+\r
+               internal void OnReaderClosed(object reader)\r
+               {\r
+                       CloseInternal();\r
+                       if (Connection != null) {\r
+                               ((AbstractDBConnection)Connection).RemoveReference(reader);\r
+                               ((AbstractDBConnection)Connection).IsFetching = false;\r
+                               if ((Behavior & CommandBehavior.CloseConnection) != 0) {\r
+                                       Connection.Close();\r
+                               }\r
+                       }                       \r
+               }\r
+\r
+               internal void CloseInternal()\r
+               {\r
+                       if (Behavior != CommandBehavior.SchemaOnly) {\r
+                               if (_statement != null) {\r
+                                       while (NextResultSet()) {\r
+                                       }                                                       \r
+                                       FillOutputParameters();                         \r
+                               }\r
+                       }\r
+                       _currentReader = null;\r
+                       CleanUp();\r
+               }\r
+\r
+               protected override void Dispose(bool disposing)\r
+               {\r
+                       if (disposing) {\r
+                               CleanUp();\r
+                       }\r
+                       base.Dispose(disposing);\r
+               }\r
+\r
+               private void CleanUp()\r
+               {\r
+                       if (_currentReader != null) {\r
+                               // we must preserve statement object until we have an associated reader object that might access it.\r
+                               return;\r
+                       }\r
+                       if (Connection != null) {\r
+                               ((AbstractDBConnection)Connection).RemoveReference(this);\r
+                       }\r
+                       if (_statement != null) {\r
+                               _statement.close();\r
+                               _statement = null;\r
+                       }                               \r
+                       IsCommandPrepared = false;\r
+                       _internalParameters = null;\r
+                       _currentResultSet = null;\r
+               }\r
+\r
+               internal void OnSchemaChanging()\r
+               {\r
+               }\r
+\r
+               #endregion // Methods\r
+       }\r
+}\r
index 4c70f56f582eb01ba66aa5b312f8091e1db015f8..3b10ce44af4bd56615892bbf7b03710984254a98 100644 (file)
@@ -949,7 +949,7 @@ namespace System.Data.Common
                internal void ValidateBeginTransaction()\r
                {\r
                        if (State != ConnectionState.Open) {\r
-                               throw new InvalidOperationException(Res.GetString("ADP_OpenConnectionRequired_BeginTransaction", new object[] {"BeginTransaction", State}));\r
+                               throw new InvalidOperationException(String.Format("{0} requires an open and available Connection. The connection's current state is {1}.", new object[] {"BeginTransaction", State}));\r
                        }\r
 \r
                        if (!JdbcConnection.getAutoCommit()) {\r
index 493c6a573a5b1fadb7d6667f58494f5609a6ebfc..64323f18c911468f3fcfcb195dd9b6b095ef94db 100644 (file)
-//namespace System.Data.Common\r
-//{\r
 //\r
-//    //using clr.System;\r
-//    //using clr.compiler.BitConstants;\r
-//\r
-//    using System.Data;\r
-//     using System.Data.ProviderBase;\r
-//     using System.Text;\r
-//\r
-//    /**\r
-//     * @author erand\r
-//     */\r
-//    public abstract class AbstractDBParameter : DbParameterBase, System.ICloneable\r
-//    {\r
-//        /* Properties from IDataParameter */\r
-////        protected ParameterDirection _direction = ParameterDirection.Input;\r
-////        protected bool _isNullable = false;\r
-////        protected String _name = null;\r
-////        protected String _sourceColumn = null;\r
-//        protected DataRowVersion _version = DataRowVersion.Current;\r
-////        protected Object _value = null;\r
-//\r
-//        /* Properties from IDbDataParameter */\r
-////        protected byte _precision;\r
-////        protected byte _scale;\r
-////        protected int _size = -1;\r
-//\r
-//        private int _place;\r
-//             private int _jdbcType;\r
-//    \r
-////        /**\r
-////         * @see System.Data.IDbDataParameter#Precision\r
-////         */\r
-////        public virtual byte Precision\r
-////        {\r
-////            get\r
-////            {\r
-////                return _precision;\r
-////            }\r
-////            set\r
-////            {\r
-////                _precision = value;\r
-////            }\r
-////        }\r
-//\r
-//        \r
-////        /**\r
-////         * @see System.Data.IDbDataParameter#Scale\r
-////         */\r
-////        public virtual byte Scale\r
-////        {\r
-////            get\r
-////            {\r
-////                return _scale;\r
-////            }\r
-////            set\r
-////            {\r
-////                _scale = value;\r
-////            }\r
-////        }\r
-//\r
-//        \r
-//\r
-////        /**\r
-////         * @see System.Data.IDbDataParameter#Size\r
-////         */\r
-////        public virtual int Size\r
-////        {\r
-////            get\r
-////            {\r
-////                return _size;\r
-////            }\r
-////            set\r
-////            {\r
-////                _size = value;\r
-////            }\r
-////        }\r
-//\r
-//        \r
-////        /**\r
-////         * @see System.Data.IDataParameter#Direction\r
-////         */\r
-////        public virtual ParameterDirection Direction\r
-////        {\r
-////            get\r
-////            {\r
-////                return _direction;\r
-////            }\r
-////            set\r
-////            {\r
-////                _direction = value;\r
-////            }\r
-////        }\r
-//\r
-//        \r
-////        /**\r
-////         * @see System.Data.IDataParameter#IsNullable\r
-////         */\r
-////        public virtual bool IsNullable\r
-////        {\r
-////            get\r
-////            {\r
-////                return _isNullable;\r
-////            }\r
-////            set\r
-////            {\r
-////                _isNullable = value;\r
-////            }\r
-////        }\r
-//\r
-//        \r
-////        /**\r
-////         * @see System.Data.IDataParameter#ParameterName\r
-////         */\r
-////        public virtual String ParameterName\r
-////        {\r
-////            get\r
-////            {\r
-////                /**@todo What's the value of the Empty string ?*/\r
-////                /*Where to define our Empty String ?*/\r
-////                if (_name == null)\r
-////                    return String.Empty;\r
-////                else\r
-////                    return _name;\r
-////            }\r
-////            set\r
-////            {\r
-////                if ((value != null) && value.Equals(_name))\r
-////                    return;\r
-////                //if ((value != null) && (value.length() > Constants.MAXIMAL_PARAMETER_LENGTH))\r
-////                /**@todo Implement Exception::-->*/\r
-////                //    throw InvalidParameterLength(value);\r
-////\r
-////                _name = value;\r
-////            }\r
-////        }\r
-//\r
-//        \r
-////        /**\r
-////         * @see System.Data.IDataParameter#SourceColumn\r
-////         */\r
-////        public virtual String SourceColumn\r
-////        {\r
-////            get\r
-////            {\r
-////                if (_sourceColumn != null)\r
-////                    return _sourceColumn;\r
-////                else\r
-////                    return String.Empty;\r
-////            }\r
-////            set\r
-////            {\r
-////                _sourceColumn = value;\r
-////            }\r
-////        }\r
-//\r
-//        \r
-//\r
-////        /**\r
-////         * @see System.Data.IDataParameter#SourceVersion\r
-////         */\r
-////        public virtual DataRowVersion SourceVersion\r
-////        {\r
-////            get\r
-////            {\r
-////                return _version;\r
-////            }\r
-////            set\r
-////            {\r
-////                _version = value;\r
-////            }\r
-////        }\r
-//\r
-//        \r
-////        /**\r
-////         * @see System.Data.IDataParameter#Value\r
-////         */\r
-////        public virtual Object Value\r
-////        {\r
-////            get\r
-////            {\r
-////                return _value;\r
-////            }\r
-////            set\r
-////            {\r
-////                _value = value;\r
-////            }\r
-////        }\r
-//\r
-//        \r
-//\r
-//        public virtual void setParameterPlace(int place)\r
-//        {\r
-//            _place = place;\r
-//        }\r
-//\r
-//        public virtual int getParameterPlace()\r
-//        {\r
-//            return _place;\r
-//        }\r
-//\r
-//        abstract internal int getJDBCType(DbType dbType);\r
-//\r
-//             internal int JdbcType\r
-//             {\r
-//                     get {\r
-//                             return _jdbcType;\r
-//                     }\r
-//\r
-//                     set {\r
-//                             _jdbcType = value;\r
-//                     }\r
-//             }\r
-//\r
-//        public abstract DbType DbType\r
-//        {\r
-//            get;\r
-//            set;\r
-//        }\r
-//\r
-//        public abstract Object Clone();\r
-//\r
-//             internal virtual bool IsOracleRefCursor\r
-//             {\r
-//                     get\r
-//                     {\r
-//                             return false;\r
-//                     }\r
-//             }\r
-//        \r
-//        internal virtual String formatParameter()\r
-//        {\r
-//                     if (Value == null || Value == DBNull.Value)\r
-//                             return "NULL";\r
-//                 \r
-//                     switch(DbType) {\r
-//                             case DbType.Byte:\r
-//                             case DbType.Currency:\r
-//                             case DbType.Decimal:\r
-//                             case DbType.Double:\r
-//                             case DbType.Int16:\r
-//                             case DbType.Int32:\r
-//                             case DbType.Int64:\r
-//                             case DbType.SByte:\r
-//                             case DbType.Single:\r
-//                             case DbType.UInt16:\r
-//                             case DbType.UInt32:\r
-//                             case DbType.UInt64:\r
-//                                     return Value.ToString();\r
-//                             case DbType.Boolean:\r
-//                                     return (bool)Value ? "0x1" : "0x0";\r
-//                             case DbType.Binary:\r
-//                             default:\r
-//                                     return String.Concat("\'", Value.ToString().Replace("\'", "\'\'"),"\'");\r
-//                     }\r
-//        }\r
-//    }\r
-//}
\ No newline at end of file
+// System.Data.ProviderBase.AbstractDbParameter\r
+//\r
+// Author:\r
+//   Boris Kirzner (borisk@mainsoft.com)\r
+//\r
+\r
+using System;\r
+using System.Data;\r
+using System.Data.Common;\r
+\r
+using java.sql;\r
+\r
+namespace System.Data.ProviderBase\r
+{\r
+    public abstract class AbstractDbParameter : DbParameterBase\r
+    {\r
+               #region Fields\r
+\r
+               protected byte _precision;\r
+               protected byte _scale;\r
+               protected DataRowVersion _sourceVersion;\r
+               private DbTypes.JavaSqlTypes _jdbcType;\r
+               protected bool _isDbTypeSet = false;\r
+               protected bool _isJdbcTypeSet = false;\r
+               object _convertedValue;\r
+\r
+               #endregion // Fields\r
+\r
+               #region Constructors
+
+               [MonoTODO]
+               protected AbstractDbParameter ()
+               {
+               }
+
+               #endregion // Constructors\r
+\r
+               #region Properties
+               
+               public override byte Precision 
+               { 
+                       get { return _precision; }\r
+                       set { _precision = value; } 
+               }
+
+               public override byte Scale 
+               { 
+                       get { return _scale; }\r
+                       set { _scale = value; } 
+               }
+\r
+               public override DataRowVersion SourceVersion\r
+               {\r
+                       get { return _sourceVersion; }\r
+                       set { _sourceVersion = value; }\r
+               }
+
+               internal DbTypes.JavaSqlTypes JdbcType
+               {
+                       get { 
+                               if (!_isJdbcTypeSet) {
+                                       return JdbcTypeFromProviderType();
+                               }
+                               return _jdbcType; 
+                       }
+                       set { 
+                               _jdbcType = value; 
+                               _isJdbcTypeSet = true;
+                       }
+               }
+               
+               internal bool IsJdbcTypeSet
+               {
+                       get { 
+                               return _isJdbcTypeSet; 
+                       }
+
+                       set {
+                               _isJdbcTypeSet = value;
+                       }
+               }
+
+               internal bool IsDbTypeSet
+               {
+                       get { return _isDbTypeSet; }
+               }
+
+               internal virtual bool IsSpecial {
+                       get {
+                               return false;
+                       }
+               }
+
+               private bool IsFixedLength
+               {
+                       get {
+                               return ((DbType != DbType.AnsiString) && (DbType != DbType.Binary) && 
+                                               (DbType != DbType.String) && (DbType != DbType.VarNumeric));
+                       }
+               }
+
+               protected internal virtual string Placeholder {
+                       get {
+                               return "?";
+                       }
+               }
+
+               internal object ConvertedValue\r
+               {\r
+                       get { \r
+                               if (_convertedValue == null) {\r
+                                       object value = Value;\r
+                                       _convertedValue = ((value != null) && (value != DBNull.Value)) ? ConvertValue(value) : value;\r
+                               }\r
+                               return _convertedValue;\r
+                       }\r
+               }
+
+               public override object Value {
+                       get { return base.Value; }
+                       set { 
+                               _convertedValue = null;
+                               base.Value = value;
+                       }
+               }
+
+               #endregion // Properties
+
+               #region Methods
+
+               internal abstract void SetParameterName(ResultSet res);\r
+\r
+               internal abstract void SetParameterDbType(ResultSet res);\r
+\r
+               internal abstract void SetSpecialFeatures(ResultSet res);
+               
+               public abstract object Clone();
+
+               internal abstract DbTypes.JavaSqlTypes JdbcTypeFromProviderType();
+
+               internal abstract object ConvertValue(object value);
+
+               internal void SetParameterPrecisionAndScale(ResultSet res)
+               {
+                       int jdbcType = res.getInt("DATA_TYPE");\r
+                       if(jdbcType == java.sql.Types.DECIMAL || jdbcType == java.sql.Types.NUMERIC) {\r
+                               Precision = (byte)res.getInt("PRECISION");\r
+                               Scale = (byte)res.getInt("SCALE");\r
+                       }
+               }
+
+               internal void SetParameterSize(ResultSet res)
+               {
+                       Size = res.getInt("LENGTH");
+               }
+
+               internal void SetParameterIsNullable(ResultSet res)
+               {
+                       IsNullable = (res.getInt("NULLABLE") == 1);
+               }
+
+               internal void Validate()
+               {
+                       if (!IsFixedLength && ((Direction & ParameterDirection.Output) != 0) && (Size == 0)) {
+                               throw ExceptionHelper.ParameterSizeNotInitialized(Offset,ParameterName,DbType.ToString(),Size); 
+                       }
+               }
+
+               public override void CopyTo (DbParameter target)\r
+               {\r
+                       base.CopyTo(target);\r
+                       AbstractDbParameter t = (AbstractDbParameter) target;\r
+                       t._precision = _precision;\r
+                       t._scale = _scale;\r
+                       t._sourceVersion = _sourceVersion;\r
+                       t._jdbcType = _jdbcType;\r
+               }
+
+               #endregion // Methods\r
+    }\r
+}\r
+\r
index b6bdbc5ef5f1cbdd8411e8d6dcf9e679a8b910c3..73fc194a3d0d84727aaea9bec81e5c5745d505cd 100644 (file)
@@ -17,6 +17,7 @@ using java.sql;
 namespace System.Data.Common\r
 {\r
        public abstract class AbstractDataReader : DbDataReaderBase, ISafeDataRecord {\r
+\r
                #region Fields\r
 \r
                private ResultSetMetaData _resultsMetaData;\r
@@ -27,6 +28,7 @@ namespace System.Data.Common
                private IReaderCacheContainer[] _readerCache;\r
                private int _currentCacheFilledPosition; \r
                private Stack _resultSetStack = new Stack();\r
+               private bool _isClosed = false;\r
 \r
                [Flags]\r
                private enum ReaderState { Uninitialized = 0, Empty = 1, HasRows = 2, FirstRed = 4, Eof = 8, Fetching = 16 };\r
@@ -238,6 +240,10 @@ namespace System.Data.Common
                                return _readerCache;\r
                        }\r
                }\r
+
+               public override bool IsClosed {\r
+                       get { return _isClosed; }\r
+               }\r
 \r
                #endregion // Properties\r
 \r
@@ -474,6 +480,16 @@ namespace System.Data.Common
                        return ((DateTimeReaderCacheContainer)ReaderCache[columnIndex]).GetDateTime();\r
                }\r
 \r
+               public DateTime GetDateTimeSafe(int columnIndex)\r
+               {\r
+                       if (ReaderCache[columnIndex] is DateTimeReaderCacheContainer) {\r
+                               return GetDateTime(columnIndex);\r
+                       }\r
+                       else {\r
+                               return Convert.ToDateTime(GetValue(columnIndex));\r
+                       }\r
+               }\r
+\r
                public virtual TimeSpan GetTimeSpan(int columnIndex)\r
                {\r
                        FillReaderCache(columnIndex);\r
@@ -1101,17 +1117,6 @@ namespace System.Data.Common
                        if(table == null || column == null || dbMetaData == null)\r
                                return;\r
 \r
-                       ResultSet indexInfoRes = dbMetaData.getIndexInfo(catalog,schema,table,true,false);\r
-                       try {\r
-                               while(indexInfoRes.next()) {\r
-                                       if(indexInfoRes.getString("COLUMN_NAME") == column)\r
-                                               row [(int)SCHEMA_TABLE.IsUnique] = true;\r
-                               }\r
-                       }\r
-                       finally {\r
-                               indexInfoRes.close();\r
-                       }\r
-\r
                        ResultSet versionCol = dbMetaData.getVersionColumns(catalog, schema, table);\r
                        try {\r
                                while(versionCol.next()) {\r
@@ -1127,15 +1132,90 @@ namespace System.Data.Common
                                versionCol.close();\r
                        }\r
 \r
-                       ResultSet bestRowId = dbMetaData.getBestRowIdentifier(catalog, schema, table, DatabaseMetaData__Finals.bestRowTemporary, false);\r
+                       ResultSet primaryKeys = dbMetaData.getPrimaryKeys(catalog,schema,table);\r
+                       bool primaryKeyExists = false;\r
+                       int columnCount = 0;\r
                        try {\r
-                               while(bestRowId.next()) {\r
-                                       if(bestRowId.getString("COLUMN_NAME") == column)\r
+                               while(primaryKeys.next()) {\r
+                                       columnCount++;\r
+                                       if(primaryKeys.getString("COLUMN_NAME") == column) {\r
                                                row [(int)SCHEMA_TABLE.IsKey] = true;\r
+                                               primaryKeyExists = true;\r
+                                       }\r
+                               }\r
+                               // column constitutes a key by itself, so it should be marked as unique \r
+                               if ((columnCount == 1) && (((bool)row [(int)SCHEMA_TABLE.IsKey]) == true)) {\r
+                                       row [(int)SCHEMA_TABLE.IsUnique] = true;\r
                                }\r
                        }\r
                        finally {\r
-                               bestRowId.close();\r
+                               primaryKeys.close();\r
+                       }\r
+\r
+                       ResultSet indexInfoRes = dbMetaData.getIndexInfo(catalog,schema,table,true,false);\r
+                       string currentIndexName = null;\r
+                       columnCount = 0;\r
+                       bool belongsToCurrentIndex = false;\r
+                       bool atFirstIndex = true;\r
+                       bool uniqueKeyExists = false;\r
+                       try {\r
+                               while(indexInfoRes.next()) {\r
+                                       if (indexInfoRes.getShort("TYPE") ==  DatabaseMetaData__Finals.tableIndexStatistic) {\r
+                                               // index of type tableIndexStatistic identifies table statistics - ignore it\r
+                                               continue;\r
+                                       }\r
+                                       \r
+                                       uniqueKeyExists = true;\r
+                                       string iname = indexInfoRes.getString("INDEX_NAME");\r
+                                       if (currentIndexName == iname) {\r
+                                               // we're within the rows of the same index \r
+                                               columnCount++;\r
+                                       }\r
+                                       else {\r
+                                               // we jump to row of new index \r
+                                               if (belongsToCurrentIndex && columnCount == 1) {\r
+                                                       // there is a constraint of type UNIQUE that applies only to this column\r
+                                                       row [(int)SCHEMA_TABLE.IsUnique] = true;\r
+                                               }\r
+\r
+                                               if (currentIndexName != null) {\r
+                                                       atFirstIndex = false;\r
+                                               }\r
+                                               currentIndexName = iname;\r
+                                               columnCount = 1;\r
+                                               belongsToCurrentIndex = false;\r
+                                       }\r
+\r
+                                       if(indexInfoRes.getString("COLUMN_NAME") == column) {\r
+                                               // FIXME : this will cause "spare" columns marked as IsKey. Needs future investigation.\r
+                                               // only the first index we met should be marked as a key\r
+                                               //if (atFirstIndex) {\r
+                                                       row [(int)SCHEMA_TABLE.IsKey] = true;\r
+                                               //}\r
+                                               belongsToCurrentIndex = true;                                           \r
+                                       }\r
+                               }\r
+                               // the column appears in the last index, which is single-column\r
+                               if (belongsToCurrentIndex && columnCount == 1) {\r
+                                       // there is a constraint of type UNIQUE that applies only to this column\r
+                                       row [(int)SCHEMA_TABLE.IsUnique] = true;\r
+                               }\r
+                       }\r
+                       finally {\r
+                               indexInfoRes.close();\r
+                       }                       \r
+\r
+                       if(!primaryKeyExists && !uniqueKeyExists) {\r
+                               ResultSet bestRowId = dbMetaData.getBestRowIdentifier(catalog, schema, table, DatabaseMetaData__Finals.bestRowTemporary, false);\r
+                               try {\r
+                                       while(bestRowId.next()) {\r
+                                               if(bestRowId.getString("COLUMN_NAME") == column)\r
+                                                       row [(int)SCHEMA_TABLE.IsKey] = true;\r
+                                       }\r
+                               }\r
+                               finally {\r
+                                       bestRowId.close();\r
+                               }\r
                        }\r
                }\r
 \r
diff --git a/mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDbCommand.cs b/mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDbCommand.cs
new file mode 100644 (file)
index 0000000..18289ea
--- /dev/null
@@ -0,0 +1,1168 @@
+//\r
+// System.Data.ProviderBase.AbstractDbCommand\r
+//\r
+// Author:\r
+//   Boris Kirzner (borisk@mainsoft.com)\r
+//   Konstantin Triger (kostat@mainsoft.com)\r
+//\r
+\r
+using System;\r
+using System.Text;\r
+using System.Text.RegularExpressions;\r
+using System.Collections;\r
+using System.Data;\r
+using System.Data.Common;\r
+\r
+using java.sql;\r
+using java.io;\r
+\r
+#if !USE_DOTNET_REGEXP\r
+using java.util.regex;\r
+#endif\r
+\r
+namespace System.Data.ProviderBase\r
+{\r
+       public abstract class AbstractDbCommand : DbCommandBase\r
+       {\r
+               #region ProcedureColumnCache
+
+               internal sealed class ProcedureColumnCache : AbstractDbMetaDataCache\r
+               {\r
+                       internal ArrayList GetProcedureColumns(AbstractDBConnection connection, String commandText,AbstractDbCommand command) \r
+                       {\r
+                               string connectionCatalog = connection.JdbcConnection.getCatalog();\r
+                               string key = String.Concat(connection.ConnectionString, connectionCatalog, commandText);\r
+                               System.Collections.Hashtable cache = Cache;\r
+\r
+                               ArrayList col = cache[key] as ArrayList;\r
+\r
+                               if (null != col) {\r
+                                       return col;\r
+                               }\r
+       \r
+                               col = connection.GetProcedureColumns(commandText,command);\r
+                               if (col != null)\r
+                                       cache[key] = col;\r
+                               return col;                             \r
+                       }\r
+               }
+
+               #endregion
+
+               #region SqlStatementsHelper
+
+               internal sealed class SqlStatementsHelper
+               {
+                       #region Fields
+#if USE_DOTNET_REGEXP                  \r
+                       internal static readonly Regex NamedParameterStoredProcedureRegExp = new Regex(@"^\s*{?\s*((?<RETVAL>@\w+)\s*=\s*)?call\s+(?<PROCNAME>(((\[[^\]]*\])|([^\.\(])*)\s*\.\s*){0,2}(\[[^\]]*\]|((\s*[^\.\(\)\{\}\s])+)))\s*(\(\s*(?<USERPARAM>((""([^""]|(""""))*"")|('([^']|(''))*')|[^,])*)?\s*(,\s*(?<USERPARAM>((""([^""]|(""""))*"")|('([^']|(''))*')|[^,])*)\s*)*\))?\s*}?\s*$", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);\r
+                       internal static readonly Regex SimpleParameterStoredProcedureRegExp = new Regex(@"^\s*{?\s*((?<RETVAL>\?)\s*=\s*)?call\s+(?<PROCNAME>(((\[[^\]]*\])|([^\.\(])*)\s*\.\s*){0,2}(\[[^\]]*\]|((\s*[^\.\(\)\{\}\s])+)))\s*(\(\s*(?<USERPARAM>((""([^""]|(""""))*"")|('([^']|(''))*')|[^,])*)?\s*(,\s*(?<USERPARAM>((""([^""]|(""""))*"")|('([^']|(''))*')|[^,])*)\s*)*\))?\s*}?\s*$", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);\r
+#else\r
+                       internal static readonly Pattern NamedParameterStoredProcedureRegExp = Pattern.compile(@"^\s*\{?\s*(?:(@\w+)\s*=\s*)?call\s+((?:(?:(?:\[[^\]]*\])|(?:[^\.\(\)\{\}\[\]])*)\s*\.\s*){0,2}(?:\[[^\]]*\]|(?:(?:\s*[^\.\(\)\{\}\[\]])+)))\s*(?:\((.*)\))?\s*\}?\s*$", Pattern.CASE_INSENSITIVE);\r
+                       internal static readonly Pattern SimpleParameterStoredProcedureRegExp = Pattern.compile(@"^\s*\{?\s*(?:(\?)\s*=\s*)?call\s+((?:(?:(?:\[[^\]]*\])|(?:[^\.\(\)\{\}\[\]])*)\s*\.\s*){0,2}(?:\[[^\]]*\]|(?:(?:\s*[^\.\(\)\{\}\[\]])+)))\s*(?:\((.*)\))?\s*\}?\s*$", Pattern.CASE_INSENSITIVE);\r
+#endif\r
+\r
+//                     internal static readonly Regex NamedParameterRegExp = new Regex(@"((?<USERPARAM>@\w+)|(\[[^\[\]]*\])|(""([^""]|(""""))*"")|('([^']|(''))*'))*", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);\r
+//                     internal static readonly Regex SimpleParameterRegExp = new Regex(@"((?<USERPARAM>\?)|(\[[^\[\]]*\])|(""([^""]|(""""))*"")|('([^']|(''))*'))*", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);\r
+                       internal static readonly SimpleRegex NamedParameterRegExp = new SqlParamsRegex();\r
+                       internal static readonly SimpleRegex SimpleParameterRegExp = new OleDbParamsRegex();\r
+\r
+                       internal static readonly Regex SelectFromStatementReqExp = new Regex(@"^\s*SELECT\s+(((\[[^\[\]]*\])|(""([^""]|(""""))*"")|('([^']|(''))*')|[^'""\[])*\s+)*FROM\s+", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);\r
+                       internal static readonly Regex ForBrowseStatementReqExp = new Regex(@"\s+FOR\s+BROWSE\s*$", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);\r
+\r
+                       internal static readonly SimpleRegex CompoundStatementSplitterReqExp = new CharacterSplitterRegex(';');\r
+                       internal static readonly SimpleRegex ProcedureParameterSplitterReqExp = new CharacterSplitterRegex(',');\r
+\r
+                       #endregion // Fields
+               }
+
+               #endregion // SqlStatementsHelper
+\r
+               #region Fields\r
+\r
+               protected DbParameterCollection _parameters;\r
+               protected java.sql.Statement _statement;\r
+               protected AbstractDBConnection _connection;\r
+               protected AbstractTransaction _transaction;\r
+               private bool _isCommandPrepared;\r
+               protected CommandBehavior _behavior;\r
+               private ArrayList _internalParameters;\r
+               string _javaCommandText;\r
+               private int _recordsAffected;\r
+               private ResultSet _currentResultSet;\r
+               private DbDataReader _currentReader;\r
+               private bool _nullParametersInPrepare;\r
+               private bool _hasResultSet;\r
+\r
+               internal static ProcedureColumnCache _procedureColumnCache = new ProcedureColumnCache();\r
+\r
+               #endregion // Fields\r
+\r
+               #region Constructors\r
+\r
+               public AbstractDbCommand(\r
+                       String cmdText,\r
+                       AbstractDBConnection connection,\r
+                       AbstractTransaction transaction)\r
+               {\r
+                       _connection = connection;\r
+                       base.CommandText = cmdText;\r
+                       _transaction = transaction;\r
+                       _isCommandPrepared = false;\r
+                       _recordsAffected = -1;\r
+                       if (connection != null) {\r
+                               connection.AddReference(this);\r
+                       }\r
+               }\r
+\r
+               #endregion // Constructors\r
+\r
+               #region Properties\r
+\r
+               protected override DbParameterCollection DbParameterCollection\r
+               {\r
+                       get {\r
+                               if (_parameters == null) {\r
+                                       _parameters = CreateParameterCollection(this);\r
+                               }\r
+                               return _parameters; \r
+                       }\r
+               }\r
+\r
+               protected override DbConnection DbConnection\r
+               {\r
+                       get { return (DbConnection)_connection; }\r
+                       set {\r
+                               if (value == _connection) {\r
+                                       return;\r
+                               }\r
+\r
+                               if (_currentReader != null && !_currentReader.IsClosed) {\r
+                                       throw ExceptionHelper.ConnectionIsBusy(this.GetType().Name,((AbstractDBConnection)_connection).InternalState);\r
+                               }\r
+                               if (_connection != null) {\r
+                                       _connection.RemoveReference(this);\r
+                               }\r
+                               _connection = (AbstractDBConnection) value;\r
+                               if (_connection != null) {\r
+                                       _connection.AddReference(this);\r
+                               }\r
+                       }\r
+               }\r
+\r
+               protected override DbTransaction DbTransaction\r
+               {\r
+                       get { return _transaction != null ? _transaction.ActiveTransaction : null; }\r
+                       set { _transaction = (AbstractTransaction)value; }\r
+               }\r
+\r
+               public override string CommandText\r
+               {\r
+                       get { return base.CommandText; }\r
+                       set { \r
+                               if (CommandText == null || String.Compare(CommandText, value,  true) != 0) {\r
+                                       base.CommandText = value;\r
+                                       _isCommandPrepared = false;\r
+                               }\r
+                       }\r
+               }\r
+\r
+               internal CommandBehavior Behavior\r
+               {\r
+                       get { return _behavior; }\r
+                       set { _behavior = value; }\r
+               }\r
+\r
+               protected bool IsCommandPrepared\r
+               {\r
+                       get { return _isCommandPrepared; }\r
+                       set { _isCommandPrepared = value; }\r
+               }\r
+\r
+               protected bool NullParametersInPrepare\r
+               {\r
+                       get { return _nullParametersInPrepare; }\r
+                       set { _nullParametersInPrepare = value; }\r
+               }\r
+\r
+               protected ArrayList InternalParameters\r
+               {\r
+                       get {\r
+                               if (_internalParameters == null) {\r
+                                       _internalParameters = new ArrayList();\r
+                               }\r
+                               return _internalParameters;\r
+                       }\r
+               }\r
+\r
+               // Number of records affected by execution of batch statement\r
+               // -1 for SELECT statements.\r
+               internal int RecordsAffected\r
+               {\r
+                       get {\r
+                               return _recordsAffected;\r
+                       }\r
+               }\r
+\r
+               // AbstractDbCommand acts as IEnumerator over JDBC statement\r
+               // AbstractDbCommand.CurrentResultSet corresponds to IEnumerator.Current\r
+               internal virtual ResultSet CurrentResultSet\r
+               {\r
+                       get { \r
+                               try {\r
+                                       if (_currentResultSet == null && _hasResultSet) {\r
+                                               _currentResultSet = _statement.getResultSet(); \r
+                                       }\r
+                                       return _currentResultSet;\r
+                               }\r
+                               catch(SQLException e) {\r
+                                       throw new Exception(e.Message, e);\r
+                               }\r
+                       }\r
+               }\r
+\r
+               internal java.sql.Statement JdbcStatement\r
+               {\r
+                       get { return _statement; }\r
+               }\r
+#if USE_DOTNET_REGEX\r
+               protected virtual Regex StoredProcedureRegExp\r
+#else\r
+               protected virtual Pattern StoredProcedureRegExp\r
+#endif\r
+               {\r
+                       get { return SqlStatementsHelper.SimpleParameterStoredProcedureRegExp; }\r
+               }\r
+\r
+               protected virtual SimpleRegex ParameterRegExp\r
+               {\r
+                       get { return SqlStatementsHelper.SimpleParameterRegExp; }\r
+               }\r
+\r
+               #endregion // Properties\r
+\r
+               #region Methods\r
+\r
+               protected abstract DbParameter CreateParameterInternal();\r
+\r
+               protected abstract void CheckParameters();\r
+\r
+               protected abstract DbDataReader CreateReader();\r
+\r
+               protected abstract DbParameterCollection CreateParameterCollection(AbstractDbCommand parent);\r
+\r
+               protected abstract SystemException CreateException(SQLException e);\r
+\r
+               protected internal void CopyTo(AbstractDbCommand target)\r
+               {\r
+                       target._behavior = _behavior;\r
+                       target.CommandText = CommandText;\r
+                       target.CommandTimeout = CommandTimeout;\r
+                       target.CommandType = CommandType;\r
+                       target._connection = _connection;\r
+                       target._transaction = _transaction;\r
+                       target.UpdatedRowSource = UpdatedRowSource;\r
+\r
+                       if (Parameters != null && Parameters.Count > 0) {\r
+                               target._parameters = CreateParameterCollection(target);\r
+                               for(int i=0 ; i < Parameters.Count; i++) {\r
+                                       target.Parameters.Add(((AbstractDbParameter)Parameters[i]).Clone());\r
+                               }\r
+                       }\r
+               }\r
+\r
+               public override void Cancel()\r
+               {\r
+                       try {\r
+                               if (_statement != null)\r
+                                       _statement.cancel();\r
+                       }\r
+                       catch {\r
+                               // MSDN says : "If there is nothing to cancel, nothing happens. \r
+                               // However, if there is a command in process, and the attempt to cancel fails, \r
+                               // no exception is generated."\r
+                       }\r
+               }\r
+               \r
+               protected virtual bool SkipParameter(DbParameter parameter)\r
+               {\r
+                       return false;\r
+               }\r
+\r
+               protected override DbParameter CreateDbParameter()\r
+               {\r
+                       return CreateParameterInternal();\r
+               }\r
+\r
+               internal void DeriveParameters ()\r
+               {\r
+                       if(CommandType != CommandType.StoredProcedure) {\r
+                               throw ExceptionHelper.DeriveParametersNotSupported(this.GetType(),CommandType);\r
+                       }\r
+\r
+                       ArrayList parameters = DeriveParameters(CommandText, true);\r
+                       Parameters.Clear();\r
+                       foreach (AbstractDbParameter param in parameters) {\r
+                               Parameters.Add(param.Clone());\r
+                       }\r
+               }\r
+\r
+               protected ArrayList DeriveParameters(string procedureName, bool throwIfNotExist)\r
+               {\r
+                       try {\r
+                               ArrayList col = _procedureColumnCache.GetProcedureColumns((AbstractDBConnection)Connection, procedureName, this);\r
+                               if (col == null) {\r
+                                       if (throwIfNotExist)\r
+                                               throw ExceptionHelper.NoStoredProcedureExists(procedureName);\r
+                                       col = new ArrayList();\r
+                               }\r
+\r
+                               return col;\r
+                       }\r
+                       catch(SQLException e) {\r
+                               throw CreateException(e);\r
+                       }\r
+               }\r
+\r
+               string CreateTableDirectCommandText(string tableNames) {\r
+                       string forBrowse = String.Empty;\r
+                       if ((Behavior & CommandBehavior.KeyInfo) != 0) {\r
+                               AbstractDBConnection connection = (AbstractDBConnection)Connection;\r
+                               if (connection != null) {\r
+                                       string dbname = connection.JdbcConnection.getMetaData().getDatabaseProductName();\r
+                                       if (dbname == "Microsoft SQL Server")   //must add "FOR BROWSE" for selects\r
+                                               forBrowse = " FOR BROWSE";\r
+                               }\r
+                       }\r
+\r
+                       string[] names = tableNames.Split(',');\r
+                       StringBuilder sb = new StringBuilder();\r
+\r
+                       for(int i = 0; i < names.Length; i++) {\r
+                               sb.Append("SELECT * FROM ");\r
+                               sb.Append(names[i]);\r
+                               sb.Append(forBrowse);\r
+                               sb.Append(';');\r
+                       }\r
+                               \r
+                       if(names.Length <= 1) {\r
+                               sb.Remove(sb.Length - 1,1);\r
+                       }\r
+                       return sb.ToString();\r
+               }\r
+\r
+               private string PrepareCommandTextAndParameters()\r
+               {\r
+                       NullParametersInPrepare = false;\r
+                       switch (CommandType) {\r
+                               case CommandType.TableDirect :\r
+                                       return CreateTableDirectCommandText(CommandText);\r
+                               case CommandType.StoredProcedure :\r
+                                       return CreateStoredProcedureCommandTextSimple(CommandText, Parameters, DeriveParameters(CommandText, false));\r
+                               case CommandType.Text :\r
+\r
+                                       int userParametersPosition = 0;\r
+                                       int charsConsumed = 0;\r
+                                       StringBuilder sb = new StringBuilder(CommandText.Length);\r
+\r
+                                       for (SimpleMatch match = SqlStatementsHelper.CompoundStatementSplitterReqExp.Match(CommandText);\r
+                                               match.Success;\r
+                                               match = match.NextMatch()) {\r
+\r
+                                               int length = match.Length;\r
+\r
+                                               if (length == 0)\r
+                                                       continue;\r
+\r
+                                               int start = match.Index;\r
+                                               string value = match.Value;\r
+\r
+                                               sb.Append(CommandText, charsConsumed, start-charsConsumed);\r
+                                               charsConsumed = start + length;\r
+\r
+#if USE_DOTNET_REGEX\r
+                                               Match storedProcMatch = StoredProcedureRegExp.Match(value);\r
+                                               // count parameters for all kinds of simple statements \r
+                                               userParametersPosition +=\r
+                                                       (storedProcMatch.Success) ?\r
+                                                       // statement is stored procedure call\r
+                                                       CreateStoredProcedureCommandText(sb, value, storedProcMatch, Parameters, userParametersPosition) :\r
+                                                       // statement is a simple SQL query                              \r
+                                                       PrepareSimpleQuery(sb, value, Parameters, userParametersPosition);      \r
+#else\r
+                                               Matcher storedProcMatch = StoredProcedureRegExp.matcher((java.lang.CharSequence)(object)value);\r
+                                               userParametersPosition +=\r
+                                                       (storedProcMatch.find()) ?\r
+                                                       // statement is stored procedure call\r
+                                                       CreateStoredProcedureCommandText(sb, value, storedProcMatch, Parameters, userParametersPosition) :\r
+                                                       // statement is a simple SQL query                              \r
+                                                       PrepareSimpleQuery(sb, value, Parameters, userParametersPosition);\r
+#endif\r
+                                       }\r
+\r
+                                       sb.Append(CommandText, charsConsumed, CommandText.Length-charsConsumed);\r
+\r
+                                       return sb.ToString();\r
+                       }\r
+                       return null;\r
+               }\r
+\r
+               string CreateStoredProcedureCommandTextSimple(string procedureName, IDataParameterCollection userParams, IList derivedParams) {\r
+                       StringBuilder sb = new StringBuilder();\r
+\r
+                       int curUserPos = 0;\r
+                       int curDerivedPos = 0;\r
+                       bool addParas = true;\r
+                       string trimedProcedureName = (procedureName != null) ? procedureName.TrimEnd() : String.Empty;\r
+                       if (trimedProcedureName.Length > 0 && trimedProcedureName[trimedProcedureName.Length-1] == ')')\r
+                               addParas = false;\r
+                       \r
+                       if (derivedParams.Count > 0 && ((AbstractDbParameter)derivedParams[curDerivedPos]).Direction == ParameterDirection.ReturnValue) {\r
+                               AbstractDbParameter derivedParam = (AbstractDbParameter)derivedParams[curDerivedPos++];\r
+\r
+                               AbstractDbParameter userParameter = GetUserParameter(derivedParam.Placeholder, userParams, curUserPos);\r
+                               if (userParameter != null && userParameter.Direction == ParameterDirection.ReturnValue) {\r
+                                       curUserPos++;\r
+                                       InternalParameters.Add(userParameter);\r
+                                       sb.Append("{? = call ");\r
+\r
+                                       if (derivedParam != null && !userParameter.IsDbTypeSet) {\r
+                                               userParameter.JdbcType = derivedParam.JdbcType;\r
+                                       }\r
+                               }\r
+                               else {\r
+                                       sb.Append("{call ");\r
+                               }\r
+                       }\r
+                       else {\r
+                               if (userParams.Count > 0 && \r
+                                       ((AbstractDbParameter)userParams[0]).Direction == ParameterDirection.ReturnValue) {\r
+                                       curUserPos++;\r
+                                       InternalParameters.Add(userParams[0]);\r
+                                       sb.Append("{? = call ");\r
+                               }\r
+                               else\r
+                                       sb.Append("{call ");\r
+                       }\r
+\r
+                       sb.Append(procedureName);\r
+                       if (addParas)\r
+                               sb.Append('(');\r
+\r
+                       bool needComma = false;\r
+                       for (int i = curDerivedPos; i < derivedParams.Count; i++) {\r
+                               AbstractDbParameter derivedParameter = (AbstractDbParameter)derivedParams[curDerivedPos++];\r
+                               \r
+                               bool addParam = false;\r
+\r
+                               if (derivedParameter.IsSpecial) {\r
+                                       // derived parameter is special - never appears in user parameters or user values\r
+                                       InternalParameters.Add((AbstractDbParameter)derivedParameter.Clone());\r
+                                       addParam = true;\r
+                               }\r
+                               else {\r
+                                       AbstractDbParameter userParameter = GetUserParameter(derivedParameter.Placeholder, userParams, curUserPos);\r
+                                       if (userParameter != null) {\r
+                                               curUserPos++;\r
+                                               InternalParameters.Add(userParameter);\r
+                                               addParam = true;\r
+\r
+                                               if (derivedParameter != null && !userParameter.IsDbTypeSet) {\r
+                                                       userParameter.JdbcType = derivedParameter.JdbcType;\r
+                                               }\r
+                                       }\r
+                               }\r
+\r
+                               if (addParam) {\r
+                                       if (needComma)\r
+                                               sb.Append(',');\r
+                                       else\r
+                                               needComma = true;\r
+\r
+                                       sb.Append('?');\r
+                               }\r
+                       }\r
+\r
+                       for (int i = curUserPos; i < userParams.Count; i++) {\r
+                               if (needComma)\r
+                                       sb.Append(',');\r
+                               else\r
+                                       needComma = true;\r
+\r
+                               AbstractDbParameter userParameter = (AbstractDbParameter)userParams[curUserPos++];\r
+                               InternalParameters.Add(userParameter);\r
+\r
+                               sb.Append('?');\r
+                       }\r
+\r
+                       if (addParas)\r
+                               sb.Append(')');\r
+                       sb.Append('}');\r
+                       return sb.ToString();\r
+               }\r
+\r
+               /// <summary>\r
+               /// We suppose that user parameters are in the same order as devived parameters except the special cases\r
+               /// (return value, oracle ref cursors etc.)\r
+               /// </summary>\r
+               //protected virtual string CreateStoredProcedureCommandText(string procedureName, IList userParametersList, int userParametersListStart/*, int userParametersListCount*/, string[] userValuesList, ArrayList derivedParametersList)\r
+#if USE_DOTNET_REGEX\r
+               int CreateStoredProcedureCommandText(StringBuilder sb, string sql, Match match, IDataParameterCollection userParams, int userParamsStartPosition)\r
+#else\r
+               int CreateStoredProcedureCommandText(StringBuilder sb, string sql, Matcher match, IDataParameterCollection userParams, int userParamsStartPosition)\r
+#endif\r
+               {\r
+                       int curUserPos = userParamsStartPosition;\r
+#if USE_DOTNET_REGEX\r
+                       Group procNameGroup = null;\r
+\r
+                       for (Match procNameMatch = match; procNameMatch.Success; procNameMatch = procNameMatch.NextMatch()){\r
+                               procNameGroup = match.Groups["PROCNAME"];\r
+                               if (!procNameGroup.Success) {\r
+                                       continue;\r
+                               }\r
+                       }\r
+\r
+                       if (procNameGroup == null || !procNameGroup.Success)\r
+                               throw new ArgumentException("Not a stored procedure call: '{0}'", sql);\r
+\r
+                       ArrayList derivedParameters = DeriveParameters(procNameGroup.Value, false);\r
+#else\r
+                       ArrayList derivedParameters = DeriveParameters(match.group(2).Trim(), false);\r
+#endif\r
+                       int curDerivedPos = 0;\r
+\r
+                       AbstractDbParameter retValderivedParameter = curDerivedPos < derivedParameters.Count ?\r
+                               (AbstractDbParameter)derivedParameters[curDerivedPos] : null;\r
+                       if (retValderivedParameter != null && retValderivedParameter.Direction == ParameterDirection.ReturnValue)\r
+                               curDerivedPos++;\r
+\r
+                       int queryCurrentPosition = 0;\r
+                       \r
+#if USE_DOTNET_REGEX\r
+                       for (Match retValMatch = match; retValMatch.Success; retValMatch = retValMatch.NextMatch()){\r
+                               Group retval = retValMatch.Groups["RETVAL"];\r
+                               if (!retval.Success) {\r
+                                       continue;\r
+                               }\r
+\r
+                               int retvalIndex = retval.Index;\r
+                               string retvalValue = retval.Value;\r
+                               int retvalLength = retval.Length;\r
+#else\r
+                       int retvalIndex = match.start(1);\r
+                       for (;retvalIndex >= 0;) {\r
+                               string retvalValue = match.group(1);\r
+                               int retvalLength = retvalValue.Length;\r
+#endif\r
+\r
+                               sb.Append(sql, queryCurrentPosition, retvalIndex);\r
+                               AbstractDbParameter userParameter = GetUserParameter(retvalValue, userParams, curUserPos);\r
+                               if (userParameter != null) {\r
+                                       sb.Append('?');\r
+                                       InternalParameters.Add(userParameter);\r
+\r
+                                       if (retValderivedParameter != null && !userParameter.IsDbTypeSet) {\r
+                                               userParameter.JdbcType = retValderivedParameter.JdbcType;\r
+                                       }\r
+\r
+                                       curUserPos++;\r
+                               }\r
+                               else {\r
+                                       sb.Append(retvalValue);\r
+                               }\r
+\r
+                               queryCurrentPosition = (retvalIndex + retvalLength);\r
+\r
+                               break;\r
+                       }\r
+\r
+#if USE_DOTNET_REGEX\r
+                       sb.Append(sql, queryCurrentPosition, procNameGroup.Index + procNameGroup.Length - queryCurrentPosition);\r
+                       queryCurrentPosition = procNameGroup.Index + procNameGroup.Length;\r
+#else\r
+                       sb.Append(sql, queryCurrentPosition, match.end(2) - queryCurrentPosition);\r
+                       queryCurrentPosition = match.end(2);\r
+#endif\r
+\r
+                       bool hasUserParams = false;\r
+\r
+#if USE_DOTNET_REGEX\r
+                       must rewrite the regex to not parse params to have single code with java regex\r
+#else\r
+                       int paramsStart = match.start(3);\r
+                       if (paramsStart >= 0) {\r
+#endif\r
+\r
+                               hasUserParams = true;\r
+                               sb.Append(sql,queryCurrentPosition,paramsStart - queryCurrentPosition);\r
+                               queryCurrentPosition = paramsStart;\r
+\r
+                               for (SimpleMatch m = SqlStatementsHelper.ProcedureParameterSplitterReqExp.Match(match.group(3));\r
+                                       m.Success;m = m.NextMatch()) {\r
+\r
+                                       SimpleCapture parameterCapture = m;\r
+                                       sb.Append(sql,queryCurrentPosition,paramsStart + parameterCapture.Index - queryCurrentPosition);\r
+\r
+                                       // advance in query\r
+                                       queryCurrentPosition = paramsStart + parameterCapture.Index + parameterCapture.Length;\r
+\r
+                                       AbstractDbParameter derivedParameter = curDerivedPos < derivedParameters.Count ?\r
+                                               (AbstractDbParameter)derivedParameters[curDerivedPos++] : null;\r
+                                       \r
+                                       //check for special params\r
+                                       while (derivedParameter != null && derivedParameter.IsSpecial) {\r
+                                               // derived parameter is special - never appears in user parameters or user values\r
+                                               InternalParameters.Add((AbstractDbParameter)derivedParameter.Clone());\r
+                                               sb.Append('?');\r
+                                               sb.Append(',');\r
+\r
+                                               derivedParameter = curDerivedPos < derivedParameters.Count ?\r
+                                                       (AbstractDbParameter)derivedParameters[curDerivedPos++] : null;\r
+                                       }\r
+\r
+                                       AbstractDbParameter userParameter = GetUserParameter(parameterCapture.Value.Trim(), userParams, curUserPos);\r
+\r
+                                       if (userParameter != null) {\r
+                                               sb.Append('?');\r
+                                               InternalParameters.Add(userParameter);\r
+                                               if (derivedParameter != null && !userParameter.IsDbTypeSet) {\r
+                                                       userParameter.JdbcType = derivedParameter.JdbcType;\r
+                                               }\r
+                                               // advance in user parameters\r
+                                               curUserPos++;                           \r
+                                       }\r
+                                       else {\r
+                                               sb.Append(parameterCapture.Value);\r
+                                       }                                                                       \r
+                               }                                       \r
+                       }\r
+\r
+                       bool addedSpecialParams = false;\r
+\r
+                       for (int i = curDerivedPos; i < derivedParameters.Count;) {\r
+                               AbstractDbParameter derivedParameter = (AbstractDbParameter)derivedParameters[i++];\r
+                               if (derivedParameter.IsSpecial) {\r
+                                       // derived parameter is special - never appears in user parameters or user values\r
+                                       if (!hasUserParams && !addedSpecialParams) {\r
+                                               addedSpecialParams = true;\r
+                                               curDerivedPos++;\r
+                                               sb.Append('(');\r
+                                       }\r
+\r
+                                       for (;curDerivedPos < i;curDerivedPos++)\r
+                                               sb.Append(',');\r
+\r
+                                       InternalParameters.Add((AbstractDbParameter)derivedParameter.Clone());\r
+                                       sb.Append('?');\r
+                               }\r
+                       }\r
+\r
+                       if (!hasUserParams && addedSpecialParams)\r
+                               sb.Append(')');\r
+\r
+                       sb.Append(sql,queryCurrentPosition,sql.Length - queryCurrentPosition);\r
+                       return curUserPos - userParamsStartPosition;\r
+               }\r
+\r
+               protected virtual AbstractDbParameter GetUserParameter(string parameterName, IList userParametersList, int userParametersListPosition)\r
+               {\r
+                       if (userParametersListPosition < userParametersList.Count) {\r
+                               AbstractDbParameter param = (AbstractDbParameter)userParametersList[userParametersListPosition];\r
+                               if (param.Placeholder == parameterName)\r
+                                       return param;\r
+                       }\r
+                       return null;\r
+               }\r
+\r
+               int PrepareSimpleQuery(StringBuilder sb, string query, IList userParametersList, int userParametersListStart)\r
+               {\r
+                       int queryCurrentPosition = 0;\r
+                       int userParametersListPosition = userParametersListStart;\r
+\r
+                       if (userParametersList.Count > 0) {\r
+                               for (SimpleMatch m = ParameterRegExp.Match(query);\r
+                                       m.Success;m = m.NextMatch()) {\r
+\r
+                                       SimpleCapture parameterCapture = m;\r
+                                       sb.Append(query,queryCurrentPosition,parameterCapture.Index - queryCurrentPosition);\r
+\r
+                                       // advance in query\r
+                                       queryCurrentPosition = parameterCapture.Index + parameterCapture.Length;        \r
+\r
+                                       AbstractDbParameter userParameter = GetUserParameter(parameterCapture.Value, userParametersList, userParametersListPosition);\r
+\r
+                                       if (userParameter != null) {\r
+                                               if (IsNullParameter(userParameter)) {\r
+                                                       sb.Append("null");\r
+                                                       NullParametersInPrepare = true;\r
+                                               }\r
+                                               else {\r
+                                                       sb.Append('?');\r
+                                                       InternalParameters.Add(userParameter);  \r
+                                               }       \r
+                                               // advance in user parameters\r
+                                               userParametersListPosition++;                           \r
+                                       }\r
+                                       else {\r
+                                               sb.Append(parameterCapture.Value);\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       sb.Append(query,queryCurrentPosition,query.Length - queryCurrentPosition);\r
+                       int userParamsConsumed = userParametersListPosition - userParametersListStart;\r
+\r
+                       if ((Behavior & CommandBehavior.KeyInfo) == 0)\r
+                               return userParamsConsumed;\r
+\r
+                       AbstractDBConnection connection = (AbstractDBConnection)Connection;\r
+                       if (connection == null)\r
+                               return userParamsConsumed;\r
+\r
+                       string dbname = connection.JdbcConnection.getMetaData().getDatabaseProductName();\r
+                       if (dbname == "Microsoft SQL Server") { //must add "FOR BROWSE" for selects\r
+                               if (SqlStatementsHelper.SelectFromStatementReqExp.IsMatch(query))\r
+                                       if (!SqlStatementsHelper.ForBrowseStatementReqExp.IsMatch(query))\r
+                                               sb.Append(" FOR BROWSE");\r
+                       }\r
+\r
+                       return userParamsConsumed;\r
+               }\r
+\r
+               protected virtual bool IsNullParameter(AbstractDbParameter parameter)\r
+               {\r
+                       return ((parameter.Value == null || parameter.Value == DBNull.Value) && !parameter.IsDbTypeSet);\r
+               }\r
+\r
+               protected virtual void PrepareInternalParameters()\r
+               {\r
+                       InternalParameters.Clear();\r
+               }\r
+        \r
+               protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)\r
+               {\r
+                       AbstractDBConnection connection = (AbstractDBConnection)Connection;\r
+                       if (connection == null) {\r
+                               throw ExceptionHelper.ConnectionNotInitialized("ExecuteReader");\r
+                       }\r
+\r
+                       IDbTransaction transaction = Transaction;\r
+                       if ((transaction != null && transaction.Connection != connection) ||\r
+                               (transaction == null && !connection.JdbcConnection.getAutoCommit())) {\r
+                               throw ExceptionHelper.TransactionNotInitialized();\r
+                       }\r
+\r
+                       connection.IsExecuting = true;\r
+\r
+                       try {\r
+                               Behavior = behavior;\r
+\r
+                               PrepareInternalParameters();                    \r
+                               PrepareInternal(false);\r
+\r
+                               // For SchemaOnly there is no need for statement execution\r
+                               if (Behavior != CommandBehavior.SchemaOnly) {\r
+                                       _recordsAffected = -1;\r
+\r
+                                       if ((Behavior & CommandBehavior.SingleRow) != 0) {\r
+                                               _statement.setMaxRows(1);\r
+                                       }\r
+                               \r
+                                       if(_statement is PreparedStatement) {\r
+                                               BindParameters(InternalParameters);\r
+                                               _hasResultSet = ((PreparedStatement)_statement).execute();\r
+                                       }\r
+                                       else {\r
+                                               _hasResultSet =_statement.execute(_javaCommandText);                                    \r
+                                       }\r
+               \r
+                                       if (!_hasResultSet) {\r
+                                               int updateCount = _statement.getUpdateCount();\r
+                                               if (updateCount >= 0) {\r
+                                                       AccumulateRecordsAffected(updateCount);\r
+                                                       _hasResultSet = true; //play as if we have resultset\r
+                                                       NextResultSet();\r
+                                               }\r
+                                       }                                       \r
+                               }\r
+                               connection.IsFetching = true;\r
+                               try {\r
+                                       _currentReader = CreateReader();\r
+                               }\r
+                               catch(Exception e) {\r
+                                       connection.IsFetching = false;\r
+                                       throw e;\r
+                               }\r
+                               return _currentReader;\r
+                       }\r
+                       catch(SQLException e) {                         \r
+                               throw CreateException(e);\r
+                       }\r
+                       finally {\r
+                               connection.IsExecuting = false;\r
+                               NullParametersInPrepare = false;\r
+                       }\r
+               }\r
+\r
+               public override void Prepare()\r
+               {\r
+                       ((AbstractDBConnection)Connection).IsExecuting = true;\r
+                       try {\r
+                               CheckParameters();\r
+                               PrepareInternal(true);  \r
+                       }\r
+                       finally {\r
+                               ((AbstractDBConnection)Connection).IsExecuting = false;\r
+                       }\r
+               }\r
+\r
+               private void PrepareInternal(bool isExplicit)\r
+               {\r
+                       if ((Connection == null) || (Connection.State != ConnectionState.Open)) {\r
+                               throw ExceptionHelper.ConnectionNotOpened("Prepare",(Connection != null) ? Connection.State.ToString() : "");\r
+                       }\r
+\r
+                       if (IsCommandPrepared) {\r
+                               // maybe we have to prepare the command again\r
+                               bool hasNullParameters = false;\r
+                               for(int i = 0; (i < Parameters.Count) && !hasNullParameters; i++) {\r
+                                       AbstractDbParameter parameter = (AbstractDbParameter)Parameters[i];\r
+                                       if (IsNullParameter(parameter)) {\r
+                                               // if we still have null parameters - have to prepare agail\r
+                                               IsCommandPrepared = false;\r
+                                               hasNullParameters = true;\r
+                                       }\r
+                               }\r
+\r
+                               if (!NullParametersInPrepare && hasNullParameters) {\r
+                                       // if we prepeared using null parameters and now there is no null parameters - need to prepare again\r
+                                       IsCommandPrepared = false;\r
+                               }\r
+                       }\r
+\r
+                       if (!IsCommandPrepared) {\r
+\r
+                               _javaCommandText = PrepareCommandTextAndParameters();\r
+\r
+                               java.sql.Connection jdbcCon = _connection.JdbcConnection;\r
+\r
+                               // For SchemaOnly we just prepare statement (for future use in GetSchemaTable)\r
+                               if (Behavior == CommandBehavior.SchemaOnly) {\r
+                                       if (CommandType == CommandType.StoredProcedure)\r
+                                               _statement = jdbcCon.prepareCall(_javaCommandText);\r
+                                       else\r
+                                               _statement = jdbcCon.prepareStatement(_javaCommandText);        \r
+                                       return;\r
+                               }\r
+\r
+                               if (CommandType == CommandType.StoredProcedure)\r
+                                       _statement = jdbcCon.prepareCall(_javaCommandText);\r
+                               else {\r
+                                       int internalParametersCount = InternalParameters.Count;\r
+                                       if ( internalParametersCount > 0) {\r
+                                               bool hasOnlyInputParameters = true;\r
+                                               for(int i=0; i < internalParametersCount; i++) {\r
+                                                       AbstractDbParameter internalParameter = (AbstractDbParameter)InternalParameters[i];\r
+                                                       if (IsNullParameter(internalParameter)) {\r
+                                                               NullParametersInPrepare = true;\r
+                                                       }\r
+\r
+                                                       if ((internalParameter.Direction & ParameterDirection.Output) != 0){\r
+                                                               hasOnlyInputParameters = false;\r
+                                                       }\r
+                                               }\r
+\r
+                                               if (hasOnlyInputParameters) {\r
+                                                       _statement = jdbcCon.prepareStatement(_javaCommandText);        \r
+                                               }\r
+                                               else {                                          \r
+                                                       _statement = jdbcCon.prepareCall(_javaCommandText);\r
+                                               }\r
+                                       }\r
+                                       else {\r
+                                               if (isExplicit) {\r
+                                                       _statement = jdbcCon.prepareStatement(_javaCommandText);                                \r
+                                               }\r
+                                               else {\r
+                                                       _statement = jdbcCon.createStatement();                                 \r
+                                               }\r
+                                       }\r
+                               }\r
+                               IsCommandPrepared = true;\r
+                       }\r
+               }\r
+\r
+               protected void BindParameters(ArrayList parameters)\r
+               {\r
+                       for(int parameterIndex = 0; parameterIndex < parameters.Count; parameterIndex++) {\r
+                               AbstractDbParameter parameter = (AbstractDbParameter)parameters[parameterIndex];\r
+                               switch (parameter.Direction) {\r
+                                       case ParameterDirection.Input :\r
+                                               BindInputParameter(parameter,parameterIndex);\r
+                                               break;\r
+                                       case ParameterDirection.InputOutput:\r
+                                               BindInputParameter(parameter,parameterIndex);\r
+                                               BindOutputParameter(parameter,parameterIndex);\r
+                                               break;\r
+                                       case ParameterDirection.Output :\r
+                                               BindOutputParameter(parameter,parameterIndex);\r
+                                               break;\r
+                                       case ParameterDirection.ReturnValue :\r
+                                               BindOutputParameter(parameter,parameterIndex);\r
+                                               break;\r
+                               }\r
+                       }\r
+               }\r
+               \r
+               protected virtual void BindInputParameter(AbstractDbParameter parameter, int parameterIndex)\r
+               {\r
+                       object value = parameter.ConvertedValue;                        \r
+                       // java parameters are 1 based, while .net are 0 based\r
+                       parameterIndex++; \r
+                       PreparedStatement preparedStatement = ((PreparedStatement)_statement);\r
+\r
+                       switch (parameter.JdbcType) {\r
+                               case DbTypes.JavaSqlTypes.DATALINK:\r
+                               case DbTypes.JavaSqlTypes.DISTINCT:\r
+                               case DbTypes.JavaSqlTypes.JAVA_OBJECT:\r
+                               case DbTypes.JavaSqlTypes.OTHER:\r
+                               case DbTypes.JavaSqlTypes.REF:\r
+                               case DbTypes.JavaSqlTypes.STRUCT: {\r
+                                       preparedStatement.setObject(parameterIndex, value, (int)parameter.JdbcType);\r
+                                       return;\r
+                               }\r
+                       }\r
+\r
+                       if ((value is DBNull) || (value == null)) {\r
+                               preparedStatement.setNull(parameterIndex, (int)((AbstractDbParameter)parameter).JdbcType);\r
+                       }\r
+                       else if (value is long) {\r
+                               preparedStatement.setLong(parameterIndex, (long)value);\r
+                       }\r
+                       else if (value is byte[]) {\r
+                               if (((byte[])value).Length <= 4000) {\r
+                                       preparedStatement.setBytes(parameterIndex, vmw.common.TypeUtils.ToSByteArray((byte[]) value));\r
+                               }\r
+                               else {\r
+                                       InputStream iStream=new ByteArrayInputStream(vmw.common.TypeUtils.ToSByteArray((byte[]) value));\r
+                                       preparedStatement.setBinaryStream(parameterIndex,iStream,((byte[])value).Length);\r
+                               }\r
+                       }\r
+                       else if (value is byte) {\r
+                               preparedStatement.setByte(parameterIndex, (sbyte)(byte)value);\r
+                       }\r
+                       else if (value is char[]) {\r
+                               Reader reader = new CharArrayReader((char[])value);\r
+                               preparedStatement.setCharacterStream(parameterIndex,reader,((char[])value).Length);\r
+                       }\r
+                       else if (value is bool) {\r
+                               preparedStatement.setBoolean(parameterIndex, (bool) value);\r
+                       }\r
+                       else if (value is char) {\r
+                               preparedStatement.setString(parameterIndex, ((char)value).ToString());\r
+                       }\r
+                       else if (value is DateTime) {\r
+                               switch (parameter.JdbcType) {\r
+                                       default:\r
+                                       case DbTypes.JavaSqlTypes.TIMESTAMP:\r
+                                               preparedStatement.setTimestamp(parameterIndex,DbConvert.ClrTicksToJavaTimestamp(((DateTime)value).Ticks));\r
+                                               break;\r
+                                       case DbTypes.JavaSqlTypes.TIME:\r
+                                               preparedStatement.setTime(parameterIndex,DbConvert.ClrTicksToJavaTime(((DateTime)value).Ticks));\r
+                                               break;\r
+                                       case DbTypes.JavaSqlTypes.DATE:\r
+                                               preparedStatement.setDate(parameterIndex,DbConvert.ClrTicksToJavaDate(((DateTime)value).Ticks));\r
+                                               break;\r
+                               }\r
+                       }\r
+                       else if (value is TimeSpan) {\r
+                               if (parameter.JdbcType == DbTypes.JavaSqlTypes.TIMESTAMP)\r
+                                       preparedStatement.setTimestamp(parameterIndex,DbConvert.ClrTicksToJavaTimestamp(((TimeSpan)value).Ticks));\r
+                               else\r
+                                       preparedStatement.setTime(parameterIndex,DbConvert.ClrTicksToJavaTime(((TimeSpan)value).Ticks));\r
+                       }\r
+                       else if (value is Decimal) {\r
+                               preparedStatement.setBigDecimal(parameterIndex, vmw.common.PrimitiveTypeUtils.DecimalToBigDecimal((Decimal) value));\r
+                       }\r
+                       else if (value is double) {\r
+                               preparedStatement.setDouble(parameterIndex, (double)value);\r
+                       }\r
+                       else if (value is float) {\r
+                               preparedStatement.setFloat(parameterIndex, (float)value);\r
+                       }\r
+                       else if (value is int) {\r
+                               preparedStatement.setInt(parameterIndex, (int)value);\r
+                       }\r
+                       else if (value is string) {\r
+                               preparedStatement.setString(parameterIndex, (string)value);\r
+                       }\r
+                       else if (value is Guid) {\r
+                               preparedStatement.setString(parameterIndex, value.ToString());\r
+                       }\r
+                       else if (value is short) {\r
+                               preparedStatement.setShort(parameterIndex, (short)value);\r
+                       }\r
+                       else if (value is sbyte) {\r
+                               preparedStatement.setByte(parameterIndex, (sbyte)value);\r
+                       }\r
+                       else {\r
+                               preparedStatement.setObject(parameterIndex, value);\r
+                       }\r
+               }\r
+\r
+               protected virtual void BindOutputParameter(AbstractDbParameter parameter, int parameterIndex)
+               {
+                       parameter.Validate();
+                       int jdbcType = (int)parameter.JdbcType;         \r
+                       // java parameters are 1 based, while .net are 0 based\r
+                       parameterIndex++;\r
+\r
+                       CallableStatement callableStatement = ((CallableStatement)_statement);\r
+\r
+                       // the scale has a meening only in DECIMAL and NUMERIC parameters\r
+                       if (jdbcType == Types.DECIMAL || jdbcType == Types.NUMERIC) {\r
+                               if(parameter.DbType == DbType.Currency) {\r
+                                       callableStatement.registerOutParameter(parameterIndex, jdbcType, 4);\r
+                               }\r
+                               else {\r
+                                       callableStatement.registerOutParameter(parameterIndex, jdbcType, parameter.Scale);\r
+                               }\r
+                       }\r
+                       else {\r
+                               callableStatement.registerOutParameter(parameterIndex, jdbcType);\r
+                       }
+               }\r
+\r
+               private void FillOutputParameters()
+               {       
+                       if  (!(_statement is CallableStatement)) {
+                               return;
+                       }
+                       for(int i = 0; i < InternalParameters.Count; i++) {
+                               AbstractDbParameter parameter = (AbstractDbParameter)InternalParameters[i];
+                               ParameterDirection direction = parameter.Direction;
+                               if (((direction & ParameterDirection.Output) != 0) && !SkipParameter(parameter)) {                                      
+                                       FillOutputParameter(parameter, i);
+                               }
+                               // drop jdbc type of out parameter, since it possibly was updated in ExecuteReader
+                               parameter.IsJdbcTypeSet = false;
+                       }
+               }\r
+\r
+               protected virtual void FillOutputParameter(DbParameter parameter, int index)\r
+               {                       \r
+                       CallableStatement callableStatement = (CallableStatement)_statement;\r
+                       ParameterMetadataWrapper parameterMetadataWrapper = null; \r
+                       // FIXME wait for other drivers to implement\r
+//                     try {\r
+//                             parameterMetadataWrapper = new ParameterMetadataWrapper(callableStatement.getParameterMetaData());\r
+//                     }\r
+//                     catch {\r
+//                             // suppress error : ms driver for sql server does not implement getParameterMetaData\r
+//                             // suppress exception : ms driver for sql server does not implement getParameterMetaData\r
+//                     }\r
+                       DbTypes.JavaSqlTypes javaSqlType = (DbTypes.JavaSqlTypes)((AbstractDbParameter)parameter).JdbcType;\r
+                       try {\r
+                               parameter.Value = DbConvert.JavaResultSetToClrWrapper(callableStatement,index,javaSqlType,parameter.Size,parameterMetadataWrapper);\r
+                       }\r
+                       catch(java.sql.SQLException e) {\r
+                               throw CreateException(e);\r
+                       }\r
+               }\r
+\r
+               // AbstractDbCommand acts as IEnumerator over JDBC statement\r
+               // AbstractDbCommand.NextResultSet corresponds to IEnumerator.MoveNext\r
+               internal virtual bool NextResultSet()\r
+               {\r
+                       if (!_hasResultSet)\r
+                               return false;\r
+\r
+                       try {\r
+                               for(;;) {\r
+                                       _hasResultSet = _statement.getMoreResults();\r
+                                       if (_hasResultSet)\r
+                                               return true;\r
+                                       int updateCount = _statement.getUpdateCount();\r
+                                       if (updateCount < 0)\r
+                                               return false;\r
+\r
+                                       AccumulateRecordsAffected(updateCount); \r
+                               }\r
+                       }\r
+                       catch (SQLException e) {\r
+                               throw CreateException(e);\r
+                       }\r
+                       finally {\r
+                               _currentResultSet = null;\r
+                       }\r
+               }\r
+\r
+               private void AccumulateRecordsAffected(int updateCount)\r
+               { \r
+                       if (_recordsAffected < 0) {\r
+                               _recordsAffected = updateCount;\r
+                       }\r
+                       else {\r
+                               _recordsAffected += updateCount;\r
+                       }\r
+               }\r
+\r
+               internal void OnReaderClosed(object reader)\r
+               {\r
+                       CloseInternal();\r
+                       if (Connection != null) {\r
+                               ((AbstractDBConnection)Connection).RemoveReference(reader);\r
+                               ((AbstractDBConnection)Connection).IsFetching = false;\r
+                               if ((Behavior & CommandBehavior.CloseConnection) != 0) {\r
+                                       Connection.Close();\r
+                               }\r
+                       }                       \r
+               }\r
+\r
+               internal void CloseInternal()\r
+               {\r
+                       if (Behavior != CommandBehavior.SchemaOnly) {\r
+                               if (_statement != null) {\r
+                                       while (NextResultSet()) {\r
+                                       }                                                       \r
+                                       FillOutputParameters();                         \r
+                               }\r
+                       }\r
+                       _currentReader = null;\r
+                       CleanUp();\r
+               }\r
+\r
+               protected override void Dispose(bool disposing)\r
+               {\r
+                       if (disposing) {\r
+                               CleanUp();\r
+                       }\r
+                       base.Dispose(disposing);\r
+               }\r
+\r
+               private void CleanUp()\r
+               {\r
+                       if (_currentReader != null) {\r
+                               // we must preserve statement object until we have an associated reader object that might access it.\r
+                               return;\r
+                       }\r
+                       if (Connection != null) {\r
+                               ((AbstractDBConnection)Connection).RemoveReference(this);\r
+                       }\r
+                       if (_statement != null) {\r
+                               _statement.close();\r
+                               _statement = null;\r
+                       }                               \r
+                       IsCommandPrepared = false;\r
+                       _internalParameters = null;\r
+                       _currentResultSet = null;\r
+               }\r
+\r
+               internal void OnSchemaChanging()\r
+               {\r
+               }\r
+\r
+               #endregion // Methods\r
+       }\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDbError.cs b/mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDbError.cs
new file mode 100644 (file)
index 0000000..d8f2981
--- /dev/null
@@ -0,0 +1,62 @@
+/*\r
+  * Copyright (c) 2002-2004 Mainsoft Corporation.\r
+  *\r
+  * Permission is hereby granted, free of charge, to any person obtaining a\r
+  * copy of this software and associated documentation files (the "Software"),\r
+  * to deal in the Software without restriction, including without limitation\r
+  * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+  * and/or sell copies of the Software, and to permit persons to whom the\r
+  * Software is furnished to do so, subject to the following conditions:\r
+  *\r
+  * The above copyright notice and this permission notice shall be included in\r
+  * all copies or substantial portions of the Software.\r
+  *\r
+  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+  * DEALINGS IN THE SOFTWARE.\r
+  */\r
+\r
+namespace System.Data.ProviderBase {\r
+       using java.sql;\r
+       using System.Data.Common;\r
+\r
+       [Serializable]\r
+       public abstract class AbstractDbError {\r
+               protected SQLException _e;\r
+               string _jdbcProvider;\r
+\r
+               protected AbstractDbError(SQLException e, AbstractDBConnection connection) {\r
+                       _e = e;\r
+                       if (connection != null)\r
+                               _jdbcProvider = connection.JdbcProvider;\r
+               }\r
+    \r
+               protected internal String DbMessage {\r
+                       get {\r
+                               return _e.Message;\r
+                       }\r
+               }\r
+    \r
+               protected int DbErrorCode {\r
+                       get {\r
+                               return _e.getErrorCode();\r
+                       }\r
+               }\r
+    \r
+               protected String DbSource {\r
+                       get {\r
+                               return _jdbcProvider;\r
+                       }\r
+               }\r
+    \r
+               protected String DbSQLState {\r
+                       get {\r
+                               return _e.getSQLState();\r
+                       }\r
+               }\r
+       }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDbErrorCollection.cs b/mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDbErrorCollection.cs
new file mode 100644 (file)
index 0000000..850a116
--- /dev/null
@@ -0,0 +1,93 @@
+/*\r
+  * Copyright (c) 2002-2004 Mainsoft Corporation.\r
+  *\r
+  * Permission is hereby granted, free of charge, to any person obtaining a\r
+  * copy of this software and associated documentation files (the "Software"),\r
+  * to deal in the Software without restriction, including without limitation\r
+  * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+  * and/or sell copies of the Software, and to permit persons to whom the\r
+  * Software is furnished to do so, subject to the following conditions:\r
+  *\r
+  * The above copyright notice and this permission notice shall be included in\r
+  * all copies or substantial portions of the Software.\r
+  *\r
+  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+  * DEALINGS IN THE SOFTWARE.\r
+  */\r
+\r
+namespace System.Data.ProviderBase {\r
+\r
+\r
+       using System.Collections;\r
+       using java.sql;\r
+       using System.Data.Common;\r
+\r
+       /**\r
+        * @author erand\r
+        */\r
+       [Serializable]\r
+       public abstract class AbstractDbErrorCollection : ICollection, IEnumerable {\r
+               private ArrayList _list;\r
+\r
+               internal AbstractDbErrorCollection(SQLException e, AbstractDBConnection connection) {\r
+                       _list = new ArrayList();\r
+\r
+                       while(e != null) {\r
+                               _list.Add(CreateDbError(e, connection));\r
+                               e = e.getNextException();\r
+                       }\r
+               }\r
+\r
+               protected abstract AbstractDbError CreateDbError(SQLException e, AbstractDBConnection connection);\r
+               /**\r
+                * Gets the error at the specified index.\r
+                *\r
+                * @param index of the error\r
+                * @return Error on specified index\r
+                */\r
+               protected AbstractDbError GetDbItem(int index) {\r
+                       return (AbstractDbError)_list[index];\r
+               }\r
+\r
+               /**\r
+                * Adds new Error to the collection\r
+                *\r
+                * @param value new OleDbError\r
+                */\r
+               public void Add(object value) {\r
+                       _list.Add(value);\r
+               }\r
+        \r
+               public int Count {\r
+                       get {\r
+                               return _list.Count;\r
+                       }\r
+               }\r
+\r
+               public IEnumerator GetEnumerator() {\r
+                       return _list.GetEnumerator();\r
+               }\r
+        \r
+               public void CopyTo(System.Array arr, int index) {\r
+                       _list.CopyTo(arr, index);\r
+               }\r
+\r
+               bool ICollection.IsSynchronized {\r
+                       get {\r
+                               return _list.IsSynchronized;\r
+                       }\r
+               }\r
+\r
+               Object ICollection.SyncRoot {\r
+                       get {\r
+                               return _list.SyncRoot;\r
+                       }\r
+               }\r
+        \r
+       }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDbException.cs b/mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDbException.cs
new file mode 100644 (file)
index 0000000..61da36d
--- /dev/null
@@ -0,0 +1,97 @@
+/*\r
+  * Copyright (c) 2002-2004 Mainsoft Corporation.\r
+  *\r
+  * Permission is hereby granted, free of charge, to any person obtaining a\r
+  * copy of this software and associated documentation files (the "Software"),\r
+  * to deal in the Software without restriction, including without limitation\r
+  * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+  * and/or sell copies of the Software, and to permit persons to whom the\r
+  * Software is furnished to do so, subject to the following conditions:\r
+  *\r
+  * The above copyright notice and this permission notice shall be included in\r
+  * all copies or substantial portions of the Software.\r
+  *\r
+  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+  * DEALINGS IN THE SOFTWARE.\r
+  */\r
+\r
+\r
+namespace System.Data.ProviderBase {\r
+\r
+       using java.sql;\r
+       using System.Text;\r
+       using System.Data.Common;\r
+\r
+       /*\r
+       * CURRENT LIMITATIONS\r
+       * 1. Constructor for serialization SqlException(SerializationInfo info, StreamingContext sc) \r
+       *    is not supported.\r
+       * 2. Method "void GetObjectData(...,...)" is not supported (serialization)\r
+       */\r
+\r
+       public abstract class AbstractDbException :  System.SystemException {\r
+               protected SQLException _cause;\r
+               protected AbstractDBConnection _connection;\r
+\r
+               protected AbstractDbException(Exception cause, AbstractDBConnection connection) : base(cause.Message, cause) {\r
+                       _connection = connection;\r
+               }\r
+\r
+               protected AbstractDbException(SQLException cause, AbstractDBConnection connection) : this(String.Empty, cause, connection) {}\r
+\r
+               protected AbstractDbException(string message, SQLException cause, AbstractDBConnection connection) : base(message, cause) {\r
+                       _connection = connection;\r
+                       _cause = cause;\r
+               }\r
+\r
+               abstract protected AbstractDbErrorCollection DbErrors { get; }\r
+\r
+               /**\r
+                * Gets the error code of the error.\r
+                * @return The error code of the error.\r
+                */\r
+               protected int DbErrorCode {\r
+                       get {\r
+                               return _cause != null ? _cause.getErrorCode() : 0;\r
+                       }\r
+               }\r
+\r
\r
+               /**\r
+                * Gets the name of the OLE DB provider that generated the error.\r
+                * @return the name of the OLE DB provider that generated the error. \r
+                */\r
+               public override String Source {\r
+                       get {\r
+                               return _connection != null ? _connection.JdbcProvider : null;\r
+                       }\r
+               }\r
+\r
+               public override string Message {\r
+                       get {\r
+                               StringBuilder sb = new StringBuilder();\r
+                               string message = base.Message;\r
+                               bool addNewLine = false;\r
+                               if (message != null && message.Length > 0) {\r
+                                       sb.Append(message);\r
+                                       addNewLine = true;\r
+                               }\r
+\r
+                               foreach (AbstractDbError err in DbErrors) {\r
+                                       if (addNewLine)\r
+                                               sb.Append(Environment.NewLine);\r
+\r
+                                       addNewLine = true;\r
+                                       sb.Append(err.DbMessage);\r
+                               }\r
+                               return sb.ToString();\r
+                       }\r
+               }\r
+\r
+       }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDbParameter.cs b/mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDbParameter.cs
new file mode 100644 (file)
index 0000000..64323f1
--- /dev/null
@@ -0,0 +1,183 @@
+//\r
+// System.Data.ProviderBase.AbstractDbParameter\r
+//\r
+// Author:\r
+//   Boris Kirzner (borisk@mainsoft.com)\r
+//\r
+\r
+using System;\r
+using System.Data;\r
+using System.Data.Common;\r
+\r
+using java.sql;\r
+\r
+namespace System.Data.ProviderBase\r
+{\r
+    public abstract class AbstractDbParameter : DbParameterBase\r
+    {\r
+               #region Fields\r
+\r
+               protected byte _precision;\r
+               protected byte _scale;\r
+               protected DataRowVersion _sourceVersion;\r
+               private DbTypes.JavaSqlTypes _jdbcType;\r
+               protected bool _isDbTypeSet = false;\r
+               protected bool _isJdbcTypeSet = false;\r
+               object _convertedValue;\r
+\r
+               #endregion // Fields\r
+\r
+               #region Constructors
+
+               [MonoTODO]
+               protected AbstractDbParameter ()
+               {
+               }
+
+               #endregion // Constructors\r
+\r
+               #region Properties
+               
+               public override byte Precision 
+               { 
+                       get { return _precision; }\r
+                       set { _precision = value; } 
+               }
+
+               public override byte Scale 
+               { 
+                       get { return _scale; }\r
+                       set { _scale = value; } 
+               }
+\r
+               public override DataRowVersion SourceVersion\r
+               {\r
+                       get { return _sourceVersion; }\r
+                       set { _sourceVersion = value; }\r
+               }
+
+               internal DbTypes.JavaSqlTypes JdbcType
+               {
+                       get { 
+                               if (!_isJdbcTypeSet) {
+                                       return JdbcTypeFromProviderType();
+                               }
+                               return _jdbcType; 
+                       }
+                       set { 
+                               _jdbcType = value; 
+                               _isJdbcTypeSet = true;
+                       }
+               }
+               
+               internal bool IsJdbcTypeSet
+               {
+                       get { 
+                               return _isJdbcTypeSet; 
+                       }
+
+                       set {
+                               _isJdbcTypeSet = value;
+                       }
+               }
+
+               internal bool IsDbTypeSet
+               {
+                       get { return _isDbTypeSet; }
+               }
+
+               internal virtual bool IsSpecial {
+                       get {
+                               return false;
+                       }
+               }
+
+               private bool IsFixedLength
+               {
+                       get {
+                               return ((DbType != DbType.AnsiString) && (DbType != DbType.Binary) && 
+                                               (DbType != DbType.String) && (DbType != DbType.VarNumeric));
+                       }
+               }
+
+               protected internal virtual string Placeholder {
+                       get {
+                               return "?";
+                       }
+               }
+
+               internal object ConvertedValue\r
+               {\r
+                       get { \r
+                               if (_convertedValue == null) {\r
+                                       object value = Value;\r
+                                       _convertedValue = ((value != null) && (value != DBNull.Value)) ? ConvertValue(value) : value;\r
+                               }\r
+                               return _convertedValue;\r
+                       }\r
+               }
+
+               public override object Value {
+                       get { return base.Value; }
+                       set { 
+                               _convertedValue = null;
+                               base.Value = value;
+                       }
+               }
+
+               #endregion // Properties
+
+               #region Methods
+
+               internal abstract void SetParameterName(ResultSet res);\r
+\r
+               internal abstract void SetParameterDbType(ResultSet res);\r
+\r
+               internal abstract void SetSpecialFeatures(ResultSet res);
+               
+               public abstract object Clone();
+
+               internal abstract DbTypes.JavaSqlTypes JdbcTypeFromProviderType();
+
+               internal abstract object ConvertValue(object value);
+
+               internal void SetParameterPrecisionAndScale(ResultSet res)
+               {
+                       int jdbcType = res.getInt("DATA_TYPE");\r
+                       if(jdbcType == java.sql.Types.DECIMAL || jdbcType == java.sql.Types.NUMERIC) {\r
+                               Precision = (byte)res.getInt("PRECISION");\r
+                               Scale = (byte)res.getInt("SCALE");\r
+                       }
+               }
+
+               internal void SetParameterSize(ResultSet res)
+               {
+                       Size = res.getInt("LENGTH");
+               }
+
+               internal void SetParameterIsNullable(ResultSet res)
+               {
+                       IsNullable = (res.getInt("NULLABLE") == 1);
+               }
+
+               internal void Validate()
+               {
+                       if (!IsFixedLength && ((Direction & ParameterDirection.Output) != 0) && (Size == 0)) {
+                               throw ExceptionHelper.ParameterSizeNotInitialized(Offset,ParameterName,DbType.ToString(),Size); 
+                       }
+               }
+
+               public override void CopyTo (DbParameter target)\r
+               {\r
+                       base.CopyTo(target);\r
+                       AbstractDbParameter t = (AbstractDbParameter) target;\r
+                       t._precision = _precision;\r
+                       t._scale = _scale;\r
+                       t._sourceVersion = _sourceVersion;\r
+                       t._jdbcType = _jdbcType;\r
+               }
+
+               #endregion // Methods\r
+    }\r
+}\r
+\r
diff --git a/mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDbParameterCollection.cs b/mcs/class/System.Data/System.Data.ProviderBase.jvm/AbstractDbParameterCollection.cs
new file mode 100644 (file)
index 0000000..4c35cd5
--- /dev/null
@@ -0,0 +1,82 @@
+//\r
+// System.Data.Common.AbstractDbParameterCollection\r
+//\r
+// Author:\r
+//   Boris Kirzner (borisk@mainsoft.com)\r
+//\r
+\r
+using System;\r
+using System.Data.Common;\r
+using System.Collections;\r
+\r
+namespace System.Data.ProviderBase\r
+{\r
+       public abstract class AbstractDbParameterCollection : DbParameterBaseCollection\r
+       {\r
+               #region Fields\r
+\r
+               private AbstractDbCommand _parent;\r
+\r
+               #endregion // Fields\r
+\r
+               #region Constructors\r
+\r
+               public AbstractDbParameterCollection(DbCommand parent)\r
+        {\r
+                       _parent = (AbstractDbCommand)parent;\r
+        }\r
+\r
+               #endregion // Constructors\r
+\r
+               #region Properties\r
+\r
+               #endregion // Properties\r
+\r
+               #region Methods\r
+\r
+               public override int Add (object value)\r
+        {\r
+            OnSchemaChanging();\r
+                       return base.Add(value);\r
+        }
+
+               public override void Clear()\r
+        {\r
+            OnSchemaChanging();\r
+                       base.Clear();\r
+        }
+
+               public override void Insert(int index, object value)\r
+        {\r
+            OnSchemaChanging();\r
+                       base.Insert(index,value);\r
+        }
+
+               public override void Remove(object value)\r
+        {\r
+            OnSchemaChanging();\r
+                       base.Remove(value);\r
+        }
+
+               public override void RemoveAt(int index)\r
+        {\r
+            OnSchemaChanging();\r
+                       base.RemoveAt(index);\r
+        }
+
+               public override void RemoveAt(string parameterName)\r
+        {\r
+            OnSchemaChanging();\r
+                       base.RemoveAt(parameterName);\r
+        }\r
+\r
+               internal void OnSchemaChanging()\r
+        {\r
+            if (_parent != null) {\r
+                _parent.OnSchemaChanging();\r
+            }\r
+        }\r
+\r
+               #endregion // Methods\r
+       }\r
+}\r
index 586976b19b07d75988e59e17b2665c1cea13f9bc..4e179f06087f66777c173761c805e36a54ead621 100644 (file)
@@ -112,6 +112,7 @@ namespace System.Data.Common
             try\r
             {\r
                 _connection.JdbcConnection.rollback();\r
+                               _connection.JdbcConnection.setAutoCommit(true);\r
                                _connection = null;\r
             }\r
             catch (SQLException exp)\r
diff --git a/mcs/class/System.Data/System.Data.ProviderBase.jvm/DbStringManager.cs b/mcs/class/System.Data/System.Data.ProviderBase.jvm/DbStringManager.cs
new file mode 100644 (file)
index 0000000..c6c7bd7
--- /dev/null
@@ -0,0 +1,57 @@
+using System.Resources;\r
+using System.Reflection;\r
+\r
+namespace System.Data.Common\r
+{\r
+       public class DbStringManager\r
+       {\r
+               #region Fields\r
+\r
+               private readonly string _resourceName;\r
+        private readonly ResourceManager _resourceManager;\r
+               private readonly char[] _delimiters;\r
+\r
+               #endregion // Fields\r
+\r
+               #region Constructors\r
+\r
+               public DbStringManager(string resourceName)\r
+               {\r
+                       _resourceName = resourceName;\r
+                       _resourceManager = new ResourceManager(resourceName,Assembly.GetExecutingAssembly());\r
+                       _delimiters = new char[] {','};\r
+               }        \r
+\r
+               #endregion // Constructors\r
+\r
+               #region Methods\r
+\r
+        public string GetString(string key)\r
+        {\r
+                       return _resourceManager.GetString(key);\r
+        }\r
+       \r
+        public string GetString(string key, string defaultValue)\r
+        {\r
+            try {\r
+                return GetString(key);\r
+            }\r
+            catch (Exception) {\r
+                return defaultValue;\r
+            }\r
+        }\r
+       \r
+        public string[] GetStringArray(String key)\r
+        {\r
+            string tmp  = _resourceManager.GetString(key);\r
+            string[] values = tmp.Split(_delimiters);\r
+                       \r
+                       for(int i=0; i < values.Length; i++) {\r
+                               values[i] = values[i].Trim();\r
+                       }\r
+            return values;                     \r
+        }\r
+\r
+               #endregion // Methods\r
+    }\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.ProviderBase.jvm/OleDbStrings.resx b/mcs/class/System.Data/System.Data.ProviderBase.jvm/OleDbStrings.resx
new file mode 100644 (file)
index 0000000..4da37e7
--- /dev/null
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="utf-8" ?>\r
+<root>\r
+       <!-- \r
+    Microsoft ResX Schema \r
+    \r
+    Version 1.3\r
+    \r
+    The primary goals of this format is to allow a simple XML format \r
+    that is mostly human readable. The generation and parsing of the \r
+    various data types are done through the TypeConverter classes \r
+    associated with the data types.\r
+    \r
+    Example:\r
+    \r
+    ... ado.net/XML headers & schema ...\r
+    <resheader name="resmimetype">text/microsoft-resx</resheader>\r
+    <resheader name="version">1.3</resheader>\r
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\r
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\r
+    <data name="Name1">this is my long string</data>\r
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>\r
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">\r
+        [base64 mime encoded serialized .NET Framework object]\r
+    </data>\r
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
+        [base64 mime encoded string representing a byte array form of the .NET Framework object]\r
+    </data>\r
+                \r
+    There are any number of "resheader" rows that contain simple \r
+    name/value pairs.\r
+    \r
+    Each data row contains a name, and value. The row also contains a \r
+    type or mimetype. Type corresponds to a .NET class that support \r
+    text/value conversion through the TypeConverter architecture. \r
+    Classes that don't support this are serialized and stored with the \r
+    mimetype set.\r
+    \r
+    The mimetype is used forserialized objects, and tells the \r
+    ResXResourceReader how to depersist the object. This is currently not \r
+    extensible. For a given mimetype the value must be set accordingly:\r
+    \r
+    Note - application/x-microsoft.net.object.binary.base64 is the format \r
+    that the ResXResourceWriter will generate, however the reader can \r
+    read any of the formats listed below.\r
+    \r
+    mimetype: application/x-microsoft.net.object.binary.base64\r
+    value   : The object must be serialized with \r
+            : System.Serialization.Formatters.Binary.BinaryFormatter\r
+            : and then encoded with base64 encoding.\r
+    \r
+    mimetype: application/x-microsoft.net.object.soap.base64\r
+    value   : The object must be serialized with \r
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\r
+            : and then encoded with base64 encoding.\r
+\r
+    mimetype: application/x-microsoft.net.object.bytearray.base64\r
+    value   : The object must be serialized into a byte array \r
+            : using a System.ComponentModel.TypeConverter\r
+            : and then encoded with base64 encoding.\r
+    -->\r
+       <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">\r
+               <xsd:element name="root" msdata:IsDataSet="true">\r
+                       <xsd:complexType>\r
+                               <xsd:choice maxOccurs="unbounded">\r
+                                       <xsd:element name="data">\r
+                                               <xsd:complexType>\r
+                                                       <xsd:sequence>\r
+                                                               <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
+                                                               <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />\r
+                                                       </xsd:sequence>\r
+                                                       <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />\r
+                                                       <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />\r
+                                                       <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />\r
+                                               </xsd:complexType>\r
+                                       </xsd:element>\r
+                                       <xsd:element name="resheader">\r
+                                               <xsd:complexType>\r
+                                                       <xsd:sequence>\r
+                                                               <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
+                                                       </xsd:sequence>\r
+                                                       <xsd:attribute name="name" type="xsd:string" use="required" />\r
+                                               </xsd:complexType>\r
+                                       </xsd:element>\r
+                               </xsd:choice>\r
+                       </xsd:complexType>\r
+               </xsd:element>\r
+       </xsd:schema>\r
+       <resheader name="resmimetype">\r
+               <value>text/microsoft-resx</value>\r
+       </resheader>\r
+       <resheader name="version">\r
+               <value>1.3</value>\r
+       </resheader>\r
+       <resheader name="reader">\r
+               <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+       </resheader>\r
+       <resheader name="writer">\r
+               <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+       </resheader>\r
+       <data name="CON_PROVIDER">\r
+               <value>provider</value>\r
+       </data>\r
+       <data name="CON_DATA_SOURCE">\r
+               <value>data source,server,address,addr,network address,host</value>\r
+       </data>\r
+       <data name="CON_DATABASE">\r
+               <value>database,initial catalog</value>\r
+       </data>\r
+       <data name="CON_PASSWORD">\r
+               <value>password,pwd</value>\r
+       </data>\r
+       <data name="CON_USER_ID">\r
+               <value>user id,user,uid</value>\r
+       </data>\r
+       <data name="CON_TIMEOUT">\r
+               <value>connect timeout,connection timeout</value>\r
+       </data>\r
+       <data name="CON_SERVER_NAME">\r
+               <value>hostname</value>\r
+       </data>\r
+       <data name="CON_PORT">\r
+               <value>port</value>\r
+       </data>\r
+       <data name="CON_SERVICE_NAME">\r
+               <value>servicename</value>\r
+       </data>\r
+       <data name="CON_JNDI_NAME">\r
+               <value>jndi-datasource-name</value>\r
+       </data>\r
+       <data name="CON_JNDI_PROVIDER">\r
+               <value>naming-provider-url</value>\r
+       </data>\r
+       <data name="CON_JNDI_FACTORY">\r
+               <value>naming-factory-initial</value>\r
+       </data>\r
+       <data name="JDBC_DRIVER">\r
+               <value>JdbcDriverClassName</value>\r
+       </data>\r
+       <data name="JDBC_URL">\r
+               <value>JdbcURL</value>\r
+       </data>\r
+       <data name="DATA_SOURCE">\r
+               <value>zork</value>\r
+       </data>\r
+       <data name="SERVICE_NAME">\r
+               <value>ora817 </value>\r
+       </data>\r
+       <data name="SQL_JDBC_DRIVER">\r
+               <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>\r
+       </data>\r
+       <data name="SQL_JDBC_URL">\r
+               <value>jdbc:microsoft:sqlserver://</value>\r
+       </data>\r
+       <data name="SQL_CON_PORT">\r
+               <value>1433</value>\r
+       </data>\r
+       <data name="SQL_DEFAULT_INSTANCE_NAME">\r
+               <value>MSSQLSERVER</value>\r
+       </data>\r
+       <data name="ORA_JDBC_DRIVER">\r
+               <value>oracle.jdbc.OracleDriver</value>\r
+       </data>\r
+       <data name="ORA_JDBC_URL">\r
+               <value>jdbc:oracle:thin:@</value>\r
+       </data>\r
+       <data name="ORA_CON_PORT">\r
+               <value>1521</value>\r
+       </data>\r
+       <data name="ORA_CONNECTION_POOLING_ENABLED">\r
+               <value>true</value>\r
+       </data>\r
+       <data name="ORA_CONNECTION_POOLING_MIN_LIMIT">\r
+               <value>0</value>\r
+       </data>\r
+       <data name="ORA_CONNECTION_POOLING_MAX_LIMIT">\r
+               <value>50</value>\r
+       </data>\r
+       <data name="DB2_JDBC_DRIVER">\r
+               <value>com.ibm.db2.jcc.DB2Driver</value>\r
+       </data>\r
+       <data name="DB2_JDBC_URL">\r
+               <value>jdbc:db2://</value>\r
+       </data>\r
+       <data name="DB2_CON_PORT">\r
+               <value>50000</value>\r
+       </data>\r
+       <data name="DB2_CON_LOCATION">\r
+               <value>Location</value>\r
+       </data>\r
+</root>
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.ProviderBase.jvm/ParameterMetadataWrapper.cs b/mcs/class/System.Data/System.Data.ProviderBase.jvm/ParameterMetadataWrapper.cs
new file mode 100644 (file)
index 0000000..3fcbf4c
--- /dev/null
@@ -0,0 +1,70 @@
+using System;\r
+\r
+using java.sql;\r
+\r
+namespace System.Data.Common\r
+{\r
+       public class ParameterMetadataWrapper : java.sql.ResultSetMetaData\r
+       {\r
+               #region Fields \r
+\r
+               ParameterMetaData _parameterMetaData;\r
+\r
+               #endregion // Fields\r
+\r
+               #region Constructors\r
+\r
+               public ParameterMetadataWrapper(ParameterMetaData parameterMetaData)\r
+               {\r
+                       _parameterMetaData = parameterMetaData;\r
+               }\r
+\r
+               #endregion // Constructors\r
+\r
+               #region Methods\r
+\r
+               public int getColumnCount() { throw new NotImplementedException(); }\r
+\r
+               public int getColumnDisplaySize(int i) { throw new NotImplementedException(); }\r
+\r
+               public int getColumnType(int i) { throw new NotImplementedException(); }\r
+\r
+               public int getPrecision(int i) { throw new NotImplementedException(); }\r
+\r
+               public int getScale(int i) { throw new NotImplementedException(); }\r
+\r
+               public int isNullable(int i) { throw new NotImplementedException(); }\r
+\r
+               public bool isAutoIncrement(int i) { throw new NotImplementedException(); }\r
+\r
+               public bool isCaseSensitive(int i) { throw new NotImplementedException(); }\r
+\r
+               public bool isCurrency(int i) { throw new NotImplementedException(); }\r
+\r
+               public bool isDefinitelyWritable(int i) { throw new NotImplementedException(); }\r
+\r
+               public bool isReadOnly(int i) { throw new NotImplementedException(); }\r
+\r
+               public bool isSearchable(int i) { throw new NotImplementedException(); }\r
+\r
+               public bool isSigned(int i) { throw new NotImplementedException(); }\r
+\r
+               public bool isWritable(int i) { throw new NotImplementedException(); }\r
+\r
+               public String getCatalogName(int i) { throw new NotImplementedException(); }\r
+\r
+               public String getColumnClassName(int i) { throw new NotImplementedException(); }\r
+\r
+               public String getColumnLabel(int i) { throw new NotImplementedException(); }\r
+\r
+               public String getColumnName(int i) { throw new NotImplementedException(); }\r
+\r
+               public String getColumnTypeName(int i) { return _parameterMetaData.getParameterTypeName(i); }\r
+\r
+               public String getSchemaName(int i) { throw new NotImplementedException(); }\r
+\r
+               public String getTableName(int i) { throw new NotImplementedException(); }\r
+\r
+               #endregion // Methods\r
+       }\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.ProviderBase.jvm/SqlClientStrings.resx b/mcs/class/System.Data/System.Data.ProviderBase.jvm/SqlClientStrings.resx
new file mode 100644 (file)
index 0000000..15238c1
--- /dev/null
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="utf-8" ?>\r
+<root>\r
+       <!-- \r
+    Microsoft ResX Schema \r
+    \r
+    Version 1.3\r
+    \r
+    The primary goals of this format is to allow a simple XML format \r
+    that is mostly human readable. The generation and parsing of the \r
+    various data types are done through the TypeConverter classes \r
+    associated with the data types.\r
+    \r
+    Example:\r
+    \r
+    ... ado.net/XML headers & schema ...\r
+    <resheader name="resmimetype">text/microsoft-resx</resheader>\r
+    <resheader name="version">1.3</resheader>\r
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\r
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\r
+    <data name="Name1">this is my long string</data>\r
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>\r
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">\r
+        [base64 mime encoded serialized .NET Framework object]\r
+    </data>\r
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
+        [base64 mime encoded string representing a byte array form of the .NET Framework object]\r
+    </data>\r
+                \r
+    There are any number of "resheader" rows that contain simple \r
+    name/value pairs.\r
+    \r
+    Each data row contains a name, and value. The row also contains a \r
+    type or mimetype. Type corresponds to a .NET class that support \r
+    text/value conversion through the TypeConverter architecture. \r
+    Classes that don't support this are serialized and stored with the \r
+    mimetype set.\r
+    \r
+    The mimetype is used forserialized objects, and tells the \r
+    ResXResourceReader how to depersist the object. This is currently not \r
+    extensible. For a given mimetype the value must be set accordingly:\r
+    \r
+    Note - application/x-microsoft.net.object.binary.base64 is the format \r
+    that the ResXResourceWriter will generate, however the reader can \r
+    read any of the formats listed below.\r
+    \r
+    mimetype: application/x-microsoft.net.object.binary.base64\r
+    value   : The object must be serialized with \r
+            : System.Serialization.Formatters.Binary.BinaryFormatter\r
+            : and then encoded with base64 encoding.\r
+    \r
+    mimetype: application/x-microsoft.net.object.soap.base64\r
+    value   : The object must be serialized with \r
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\r
+            : and then encoded with base64 encoding.\r
+\r
+    mimetype: application/x-microsoft.net.object.bytearray.base64\r
+    value   : The object must be serialized into a byte array \r
+            : using a System.ComponentModel.TypeConverter\r
+            : and then encoded with base64 encoding.\r
+    -->\r
+       <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">\r
+               <xsd:element name="root" msdata:IsDataSet="true">\r
+                       <xsd:complexType>\r
+                               <xsd:choice maxOccurs="unbounded">\r
+                                       <xsd:element name="data">\r
+                                               <xsd:complexType>\r
+                                                       <xsd:sequence>\r
+                                                               <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
+                                                               <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />\r
+                                                       </xsd:sequence>\r
+                                                       <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />\r
+                                                       <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />\r
+                                                       <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />\r
+                                               </xsd:complexType>\r
+                                       </xsd:element>\r
+                                       <xsd:element name="resheader">\r
+                                               <xsd:complexType>\r
+                                                       <xsd:sequence>\r
+                                                               <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
+                                                       </xsd:sequence>\r
+                                                       <xsd:attribute name="name" type="xsd:string" use="required" />\r
+                                               </xsd:complexType>\r
+                                       </xsd:element>\r
+                               </xsd:choice>\r
+                       </xsd:complexType>\r
+               </xsd:element>\r
+       </xsd:schema>\r
+       <resheader name="resmimetype">\r
+               <value>text/microsoft-resx</value>\r
+       </resheader>\r
+       <resheader name="version">\r
+               <value>1.3</value>\r
+       </resheader>\r
+       <resheader name="reader">\r
+               <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+       </resheader>\r
+       <resheader name="writer">\r
+               <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+       </resheader>\r
+       <data name="CON_DATA_SOURCE">\r
+               <value>data source,server,address,addr,network address</value>\r
+       </data>\r
+       <data name="CON_DATABASE">\r
+               <value>database,initial catalog</value>\r
+       </data>\r
+       <data name="CON_WORKSTATION_ID">\r
+               <value>workstation id</value>\r
+       </data>\r
+       <data name="CON_PACKET_SIZE">\r
+               <value>packet size</value>\r
+       </data>\r
+       <data name="CON_PASSWORD">\r
+               <value>password,pwd</value>\r
+       </data>\r
+       <data name="CON_USER_ID">\r
+               <value>user id,user,uid</value>\r
+       </data>\r
+       <data name="CON_PORT">\r
+               <value>1433</value>\r
+       </data>\r
+       <data name="SQL_CON_PORT">\r
+               <value>1433</value>\r
+       </data>\r
+       <data name="CON_TIMEOUT">\r
+               <value>connect timeout,connection timeout</value>\r
+       </data>\r
+       <data name="JDBC_DRIVER">\r
+               <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>\r
+       </data>\r
+       <data name="SQL_JDBC_URL">\r
+               <value>jdbc:microsoft:sqlserver://</value>\r
+       </data>\r
+       <data name="DEFAULT_INSTANCE_NAME">\r
+               <value>MSSQLSERVER</value>\r
+       </data>\r
+       <data name="CON_JNDI_NAME">\r
+               <value>jndi-datasource-name</value>\r
+       </data>\r
+       <data name="CON_JNDI_PROVIDER">\r
+               <value>naming-provider-url</value>\r
+       </data>\r
+       <data name="CON_JNDI_FACTORY">\r
+               <value>naming-factory-initial</value>\r
+       </data>\r
+</root>
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.ProviderBase.jvm/regex.cs b/mcs/class/System.Data/System.Data.ProviderBase.jvm/regex.cs
new file mode 100644 (file)
index 0000000..92a2e23
--- /dev/null
@@ -0,0 +1,228 @@
+using System.Data;\r
+using System.Data.Common;\r
+using System.Data.OleDb;\r
+\r
+namespace System.Data.ProviderBase {\r
+       public abstract class SimpleRegex {\r
+               abstract protected internal SimpleMatch Match(string input, int beginning, int length);\r
+               protected internal SimpleMatch Match(string input) {\r
+                       return Match(input, 0, input.Length);\r
+               }\r
+\r
+               protected bool IsWordChar(char c) { //regexp w ([a-zA-Z_0-9]) + #@$\r
+                       if (c < '@') {\r
+                               return (c >= '0' && c <= '9') ||\r
+                                               (c == '#' || c == '$');\r
+                       }\r
+                       else {\r
+                               return (c <= 'Z') ||\r
+                                       (c <= 'z' && c >= '_' && c != '`');\r
+                       }\r
+               }\r
+       }\r
+       public class SimpleCapture {\r
+               int _index;\r
+               int _length;\r
+               string _input;\r
+\r
+               protected SimpleCapture(int index, int length, string input) {\r
+                       _index = index;\r
+                       _length = length;\r
+                       _input = input;\r
+               }\r
+\r
+               protected internal int Index {\r
+                       get {\r
+                               return _index;\r
+                       }\r
+               }\r
+\r
+               protected internal int Length {\r
+                       get {\r
+                               return _length;\r
+                       }\r
+               }\r
+\r
+               protected internal string Value {\r
+                       get {\r
+                               return Input.Substring(Index, Length);\r
+                       }\r
+               }\r
+\r
+               protected string Input {\r
+                       get {\r
+                               return _input;\r
+                       }\r
+               }\r
+       }\r
+\r
+       public class SimpleMatch : SimpleCapture {\r
+               bool _success;\r
+               SimpleRegex _regex;\r
+               int _total;\r
+               int _skip;\r
+\r
+               protected internal SimpleMatch(SimpleRegex regex, int total, bool success, int index, int length, string input)\r
+                       : this(regex, total, success, index, length, 0, input) {}\r
+\r
+               protected internal SimpleMatch(SimpleRegex regex, int total, bool success, int index, int length, int skip, string input)\r
+                       : base(index, length, input) {\r
+                       _success = success;\r
+                       _regex = regex;\r
+                       _total = total;\r
+                       _skip = skip;\r
+               }\r
+\r
+               protected internal SimpleMatch NextMatch() {\r
+                       return _regex.Match(Input, Index+Length+_skip, _total);\r
+               }\r
+\r
+               protected internal bool Success {\r
+                       get {\r
+                               return _success;\r
+                       }\r
+               }\r
+       }\r
+\r
+       internal class OleDbParamsRegex : SimpleRegex {\r
+               protected internal override SimpleMatch Match(string input, int beginning, int length) {\r
+\r
+                       for (int i = beginning; i < length; i++) {\r
+                               char ch = input[i];\r
+                               switch(ch) {\r
+                                       case '\'': {\r
+                                               int end = input.IndexOf('\'', i+1);\r
+                                               if (end < 0)\r
+                                                       break;\r
+\r
+                                               i = end;\r
+                                               break;\r
+                                       }\r
+                                       case '"': {\r
+                                               int end = input.IndexOf('"', i+1);\r
+                                               if (end < 0)\r
+                                                       break;\r
+\r
+                                               i = end;\r
+                                               break;\r
+                                       }\r
+                                       case '[': {\r
+                                               int end = input.IndexOf(']', i+1);\r
+                                               if (end < 0)\r
+                                                       break;\r
+\r
+                                               i = end;\r
+                                               break;\r
+                                       }\r
+                                       case '?': {\r
+                                               return new SimpleMatch(this, length, true, i, 1, input);\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       return new SimpleMatch(this, length, false, length, 0, input);\r
+               }\r
+       }\r
+\r
+       internal class SqlParamsRegex : SimpleRegex {\r
+               //static readonly char[] charsEnd = new char[] {' ', '\f', '\t', '\v', '\r', '\n',  ',', ';', '(', ')', '[', ']','='};\r
+               protected internal override SimpleMatch Match(string input, int beginning, int length) {\r
+\r
+                       int actualLen = length-1; //there must be something after @\r
+                       for (int i = beginning; i < actualLen; i++) {\r
+                               char ch = input[i];\r
+                               switch(ch) {\r
+                                       case '\'': {\r
+                                               int end = input.IndexOf('\'', i+1);\r
+                                               if (end < 0)\r
+                                                       break;\r
+\r
+                                               i = end;\r
+                                               break;\r
+                                       }\r
+                                       case '"': {\r
+                                               int end = input.IndexOf('"', i+1);\r
+                                               if (end < 0)\r
+                                                       break;\r
+\r
+                                               i = end;\r
+                                               break;\r
+                                       }\r
+                                       case '[': {\r
+                                               int end = input.IndexOf(']', i+1);\r
+                                               if (end < 0)\r
+                                                       break;\r
+\r
+                                               i = end;\r
+                                               break;\r
+                                       }\r
+                                       case '@': {\r
+                                               int start = i;\r
+\r
+                                               do {\r
+                                                       i++;\r
+                                               }while (i < length && input[i] == '@');\r
+\r
+                                               if (i - start > 1)\r
+                                                       break;\r
+\r
+                                               while (i < length && IsWordChar(input[i]))\r
+                                                       i++;\r
+       \r
+                                               return new SimpleMatch(this, length, true, start, i-start, input);\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       return new SimpleMatch(this, length, false, length, 0, input);\r
+               }\r
+       }\r
+\r
+       internal class CharacterSplitterRegex : SimpleRegex {\r
+               char _delimiter;\r
+               internal CharacterSplitterRegex(char delimiter) {\r
+                       _delimiter = delimiter;\r
+               }\r
+               protected internal override SimpleMatch Match(string input, int beginning, int length) {\r
+\r
+                       for (int i = beginning; i < length; i++) {\r
+                               char ch = input[i];\r
+                               switch(ch) {\r
+                                       case '\'': {\r
+                                               int end = input.IndexOf('\'', i+1);\r
+                                               if (end < 0)\r
+                                                       break;\r
+\r
+                                               i = end;\r
+                                               break;\r
+                                       }\r
+                                       case '"': {\r
+                                               int end = input.IndexOf('"', i+1);\r
+                                               if (end < 0)\r
+                                                       break;\r
+\r
+                                               i = end;\r
+                                               break;\r
+                                       }\r
+                                       case '[': {\r
+                                               int end = input.IndexOf(']', i+1);\r
+                                               if (end < 0)\r
+                                                       break;\r
+\r
+                                               i = end;\r
+                                               break;\r
+                                       }\r
+                                       default: {\r
+                                               if (ch != _delimiter)\r
+                                                       break;\r
+\r
+                                               return new SimpleMatch(this, length, true, beginning, i-beginning, 1, input);\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       int matchLength = length-beginning;\r
+                       return new SimpleMatch(this, length, matchLength > 0, beginning, matchLength, input);\r
+               }\r
+       }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/ISqlNotificationReceiver.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/ISqlNotificationReceiver.cs
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/MetaType.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/MetaType.cs
new file mode 100644 (file)
index 0000000..6c63759
--- /dev/null
@@ -0,0 +1,52 @@
+namespace System.Data.SqlClient
+{
+
+using System.Data;
+
+public class MetaType
+{
+    /**@todo Implement this CLASS!!!*/
+    public MetaType()
+    {
+    }
+
+
+    public static MetaType GetDefaultMetaType()
+    {
+        return null;
+    }
+
+    public static MetaType GetMetaType(DbType value)
+    {
+        return null;
+    }
+
+    public static MetaType GetMetaType(SqlDbType value)
+    {
+        return null;
+    }
+
+    public DbType DbType
+    {
+        get
+        {
+            return DbType.String;
+        }
+    }
+
+    public SqlDbType SqlDbType
+    {
+        get
+        {
+            return SqlDbType.VarChar;
+        }
+    }
+
+    public int TDSType
+    {
+        get
+        {
+            return 0;
+        }
+    }
+}}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlClientPermission.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlClientPermission.cs
new file mode 100644 (file)
index 0000000..250b799
--- /dev/null
@@ -0,0 +1,57 @@
+//\r
+// System.Data.SqlClient.SqlClientPermission.cs\r
+//\r
+// Author:\r
+//   Rodrigo Moya (rodrigo@ximian.com)\r
+//   Daniel Morgan (danmorg@sc.rr.com)\r
+//   Tim Coleman (tim@timcoleman.com)\r
+//\r
+// (C) Ximian, Inc 2002\r
+// Copyright (C) Tim Coleman, 2002\r
+//\r
+\r
+using System;\r
+using System.Data;\r
+using System.Data.Common;\r
+using System.Security;\r
+using System.Security.Permissions;\r
+\r
+namespace System.Data.SqlClient {\r
+       [Serializable]\r
+       public sealed class SqlClientPermission : DBDataPermission \r
+       {\r
+               #region Fields\r
+\r
+               PermissionState state;\r
+\r
+               #endregion // Fields\r
+\r
+               #region Constructors\r
+\r
+               public SqlClientPermission ()\r
+                       : this (PermissionState.None, false)\r
+               {\r
+               }\r
+\r
+               public SqlClientPermission (PermissionState state) \r
+                       : this (state, false)\r
+               {\r
+               }\r
+\r
+               public SqlClientPermission (PermissionState state, bool allowBlankPassword) \r
+               {\r
+                       AllowBlankPassword = allowBlankPassword;\r
+               }\r
+\r
+               #endregion // Constructors\r
+\r
+               #region Methods\r
+\r
+               protected override DBDataPermission CreateInstance ()\r
+               {\r
+                       return (DBDataPermission) new SqlClientPermission ();\r
+               }\r
+\r
+               #endregion // Methods\r
+       }\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlClientPermissionAttribute.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlClientPermissionAttribute.cs
new file mode 100644 (file)
index 0000000..8ddecec
--- /dev/null
@@ -0,0 +1,43 @@
+//\r
+// System.Data.SqlClient.SqlClientPermissionAttribute.cs\r
+//\r
+// Author:\r
+//   Rodrigo Moya (rodrigo@ximian.com)\r
+//   Daniel Morgan (danmorg@sc.rr.com)\r
+//   Tim Coleman (tim@timcoleman.com)\r
+//\r
+// (C) Ximian, Inc 2002\r
+// Copyright (C) Tim Coleman, 2002\r
+//\r
+\r
+using System;\r
+using System.Data;\r
+using System.Data.Common;\r
+using System.Security;\r
+using System.Security.Permissions;\r
+\r
+namespace System.Data.SqlClient {\r
+       [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method)]\r
+       [Serializable]\r
+       public sealed class SqlClientPermissionAttribute : DBDataPermissionAttribute \r
+       {\r
+               #region Constructors\r
+\r
+               public SqlClientPermissionAttribute (SecurityAction action) \r
+                       : base (action)\r
+               {\r
+               }\r
+\r
+               #endregion // Constructors\r
+\r
+               #region Methods\r
+\r
+               [MonoTODO]\r
+               public override IPermission CreatePermission() \r
+               {\r
+                       throw new NotImplementedException ();\r
+               }\r
+\r
+               #endregion // Methods\r
+       }\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlCollation.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlCollation.cs
new file mode 100644 (file)
index 0000000..01484ab
--- /dev/null
@@ -0,0 +1,9 @@
+namespace System.Data.SqlClient
+{
+
+    public class SqlCollation
+    {
+        public int info;
+        public byte sortId;
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlCommand.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlCommand.cs
new file mode 100644 (file)
index 0000000..57de5e2
--- /dev/null
@@ -0,0 +1,168 @@
+//\r
+// System.Data.SqlClient.SqlCommand\r
+//\r
+// Author:\r
+//   Boris Kirzner (borisk@mainsoft.com)\r
+//   Konstantin Triger (kostat@mainsoft.com)\r
+//
+
+using System;
+using System.Collections;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Data;
+using System.Data.Common;
+using System.Data.ProviderBase;
+
+using java.sql;
+
+namespace System.Data.SqlClient
+{
+       public class SqlCommand : AbstractDbCommand, IDbCommand, IDisposable, ICloneable
+       {
+               #region Fields
+
+               #endregion // Fields
+
+               #region Constructors
+
+               // Initializes a new instance of the SqlCommand class.
+               // The base constructor initializes all fields to their default values.
+               // The following table shows initial property values for an instance of SqlCommand.
+               public SqlCommand() : this(null, null, null)
+               {
+               }
+
+               public SqlCommand(SqlConnection connection) : this(null, connection, null)
+               {
+               }
+
+               // Initializes a new instance of the SqlCommand class with the text of the query.
+               public SqlCommand(String cmdText) : this(cmdText, null, null)
+               {
+               }
+
+               // Initializes a new instance of the SqlCommand class with the text of the query and a SqlConnection.
+               public SqlCommand(String cmdText, SqlConnection connection) : this(cmdText, connection, null)
+               {
+               }
+
+               // Initializes a new instance of the SqlCommand class with the text of the query, a SqlConnection, and the Transaction.
+               public SqlCommand(
+                       String cmdText,
+                       SqlConnection connection,
+                       SqlTransaction transaction)
+                       : base(cmdText, connection, transaction)
+               {
+               }
+
+               #endregion // Constructors
+
+               #region Properties
+
+               public new SqlConnection Connection\r
+               {\r
+                       get { return (SqlConnection)base.Connection; }\r
+                       set { base.Connection = value; }\r
+               }
+        
+               public new SqlParameterCollection Parameters\r
+               {\r
+                       get { \r
+                               if (_parameters == null) {\r
+                                       _parameters = CreateParameterCollection(this);\r
+                               }\r
+                               return (SqlParameterCollection)_parameters; \r
+                       }\r
+               }
+
+               public new SqlTransaction Transaction\r
+               {\r
+                       get { return (SqlTransaction)base.Transaction; }\r
+                       set { base.Transaction = value; }\r
+               }
+
+#if USE_DOTNET_REGEX\r
+               protected override Regex StoredProcedureRegExp\r
+#else\r
+               protected override java.util.regex.Pattern StoredProcedureRegExp {\r
+#endif\r
+                       get { return SqlStatementsHelper.NamedParameterStoredProcedureRegExp; }\r
+               }\r
+\r
+               protected override SimpleRegex ParameterRegExp\r
+               {\r
+                       get { return SqlStatementsHelper.NamedParameterRegExp; }\r
+               }
+
+               #endregion // Properties
+
+               #region Methods
+
+               public new SqlDataReader ExecuteReader()\r
+               {\r
+                       return (SqlDataReader)ExecuteReader(CommandBehavior.Default);\r
+               }
+
+               public new SqlDataReader ExecuteReader(CommandBehavior behavior)\r
+               {\r
+                       return (SqlDataReader)base.ExecuteReader(behavior);\r
+               }
+\r
+               public new SqlParameter CreateParameter()\r
+               {\r
+                       return (SqlParameter)CreateParameterInternal();\r
+               }\r
+\r
+               protected override void CheckParameters()\r
+               {\r
+                       // do nothing\r
+               }\r
+\r
+               protected override AbstractDbParameter GetUserParameter(string parameterName, IList userParametersList, int userParametersListPosition/*,int userParametersListStart,int userParameterListCount*/)\r
+               {\r
+//                     Match match = SqlStatementsHelper.NamedParameterRegExp.Match(parameterName);
+//                     parameterName = match.Result("${USERPARAM}");\r
+//                     if (parameterName.Length == 0)\r
+//                             return null;\r
+\r
+                       for(int i=0; i < userParametersList.Count; i++) {\r
+                               AbstractDbParameter userParameter = (AbstractDbParameter)userParametersList[i];\r
+                               if (String.Compare(parameterName, userParameter.ParameterName.Trim(), true) == 0) {\r
+                                       return userParameter;\r
+                               }\r
+                       }\r
+\r
+                       return null;\r
+               }\r
+\r
+               protected override DbParameter CreateParameterInternal()\r
+               {\r
+                       return new SqlParameter();\r
+               }\r
+\r
+               protected override DbDataReader CreateReader()\r
+               {\r
+                       return new SqlDataReader(this);\r
+               }\r
+\r
+               protected override DbParameterCollection CreateParameterCollection(AbstractDbCommand parent)\r
+               {\r
+                       return new SqlParameterCollection((SqlCommand)parent);\r
+               }\r
+\r
+               public object Clone()\r
+               {\r
+                       SqlCommand clone = new SqlCommand();\r
+                       CopyTo(clone);\r
+                       return clone;\r
+               }\r
+\r
+               protected override SystemException CreateException(SQLException e)
+               {\r
+                       return new SqlException(e, Connection);         \r
+               }
+
+               #endregion // Methods\r
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlCommand.resx b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlCommand.resx
new file mode 100644 (file)
index 0000000..dd0ea4d
--- /dev/null
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8" ?>\r
+<root>\r
+       <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">\r
+               <xsd:element name="root" msdata:IsDataSet="true">\r
+                       <xsd:complexType>\r
+                               <xsd:choice maxOccurs="unbounded">\r
+                                       <xsd:element name="data">\r
+                                               <xsd:complexType>\r
+                                                       <xsd:sequence>\r
+                                                               <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
+                                                               <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />\r
+                                                       </xsd:sequence>\r
+                                                       <xsd:attribute name="name" type="xsd:string" />\r
+                                                       <xsd:attribute name="type" type="xsd:string" />\r
+                                                       <xsd:attribute name="mimetype" type="xsd:string" />\r
+                                               </xsd:complexType>\r
+                                       </xsd:element>\r
+                                       <xsd:element name="resheader">\r
+                                               <xsd:complexType>\r
+                                                       <xsd:sequence>\r
+                                                               <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
+                                                       </xsd:sequence>\r
+                                                       <xsd:attribute name="name" type="xsd:string" use="required" />\r
+                                               </xsd:complexType>\r
+                                       </xsd:element>\r
+                               </xsd:choice>\r
+                       </xsd:complexType>\r
+               </xsd:element>\r
+       </xsd:schema>\r
+       <resheader name="ResMimeType">\r
+               <value>text/microsoft-resx</value>\r
+       </resheader>\r
+       <resheader name="Version">\r
+               <value>1.0.0.0</value>\r
+       </resheader>\r
+       <resheader name="Reader">\r
+               <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+       </resheader>\r
+       <resheader name="Writer">\r
+               <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+       </resheader>\r
+</root>\r
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlCommandBuilder.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlCommandBuilder.cs
new file mode 100644 (file)
index 0000000..cfbd171
--- /dev/null
@@ -0,0 +1,496 @@
+//\r
+// System.Data.SqlClient.SqlCommandBuilder.cs\r
+//\r
+// Author:\r
+//   Tim Coleman (tim@timcoleman.com)\r
+//\r
+// Copyright (C) Tim Coleman, 2002\r
+//\r
+\r
+using System;\r
+using System.Collections;\r
+using System.ComponentModel;\r
+using System.Data;\r
+using System.Data.Common;\r
+using System.Text;\r
+\r
+namespace System.Data.SqlClient {\r
+       public sealed class SqlCommandBuilder : Component\r
+       {\r
+               #region Fields\r
+\r
+               bool disposed = false;\r
+\r
+               DataTable dbSchemaTable;\r
+               SqlDataAdapter adapter;\r
+               string quotePrefix;\r
+               string quoteSuffix;\r
+               string[] columnNames;\r
+               string tableName;\r
+       \r
+               SqlCommand deleteCommand;\r
+               SqlCommand insertCommand;\r
+               SqlCommand updateCommand;\r
+\r
+               // Used to construct WHERE clauses\r
+               static readonly string clause1 = "({0} IS NULL AND {1} IS NULL)";\r
+               static readonly string clause2 = "({0} = {1})";\r
+\r
+               #endregion // Fields\r
+\r
+               #region Constructors\r
+\r
+               public SqlCommandBuilder () \r
+               {\r
+                       dbSchemaTable = null;\r
+                       adapter = null;\r
+                       quoteSuffix = String.Empty;\r
+                       quotePrefix = String.Empty;\r
+               }\r
+\r
+               public SqlCommandBuilder (SqlDataAdapter adapter)\r
+                       : this ()\r
+               {\r
+                       DataAdapter = adapter;\r
+               }\r
+\r
+               #endregion // Constructors\r
+\r
+               #region Properties\r
+\r
+               [DataSysDescription ("The DataAdapter for which to automatically generate SqlCommands")]\r
+               [DefaultValue (null)]\r
+               public SqlDataAdapter DataAdapter {\r
+                       get { return adapter; }\r
+                       set { \r
+                               adapter = value; \r
+                               if (adapter != null)\r
+                                       adapter.RowUpdating += new SqlRowUpdatingEventHandler (RowUpdatingHandler);\r
+                       }\r
+               }\r
+\r
+               private string QuotedTableName {\r
+                       get { return GetQuotedString (tableName); }\r
+               }\r
+\r
+               [Browsable (false)]\r
+               [DataSysDescription ("The character used in a text command as the opening quote for quoting identifiers that contain special characters.")]\r
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]\r
+               public string QuotePrefix {\r
+                       get { return quotePrefix; }\r
+                       set { \r
+                               if (dbSchemaTable != null)\r
+                                       throw new InvalidOperationException ("The QuotePrefix and QuoteSuffix properties cannot be changed once an Insert, Update, or Delete command has been generated.");\r
+                               quotePrefix = value; \r
+                       }\r
+               }\r
+\r
+               [Browsable (false)]\r
+               [DataSysDescription ("The character used in a text command as the closing quote for quoting identifiers that contain special characters.")]\r
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]\r
+               public string QuoteSuffix {\r
+                       get { return quoteSuffix; }\r
+                       set {\r
+                               if (dbSchemaTable != null)\r
+                                       throw new InvalidOperationException ("The QuotePrefix and QuoteSuffix properties cannot be changed once an Insert, Update, or Delete command has been generated.");\r
+                               quoteSuffix = value; \r
+                       }\r
+               }\r
+\r
+               private SqlCommand SourceCommand {\r
+                       get {\r
+                               if (adapter != null)\r
+                                       return adapter.SelectCommand;\r
+                               return null;\r
+                       }\r
+               }\r
+\r
+               #endregion // Properties\r
+\r
+               #region Methods\r
+\r
+               private void BuildCache (bool closeConnection)\r
+               {\r
+                       SqlCommand sourceCommand = SourceCommand;\r
+                       if (sourceCommand == null)\r
+                               throw new InvalidOperationException ("The DataAdapter.SelectCommand property needs to be initialized.");\r
+                       SqlConnection connection = sourceCommand.Connection;\r
+                       if (connection == null)\r
+                               throw new InvalidOperationException ("The DataAdapter.SelectCommand.Connection property needs to be initialized.");\r
+                               \r
+                       if (dbSchemaTable == null) {\r
+                               if (connection.State == ConnectionState.Open)\r
+                                       closeConnection = false;        \r
+                               else\r
+                                       connection.Open ();\r
+       \r
+                               SqlDataReader reader = (SqlDataReader)sourceCommand.ExecuteReader (CommandBehavior.SchemaOnly | CommandBehavior.KeyInfo);\r
+                               dbSchemaTable = reader.GetSchemaTable ();\r
+                               reader.Close ();\r
+                               if (closeConnection)\r
+                                       connection.Close ();    \r
+                               BuildInformation (dbSchemaTable);\r
+                       }\r
+               }\r
+               \r
+               private void BuildInformation (DataTable schemaTable)\r
+               {\r
+                       tableName = String.Empty;\r
+                       foreach (DataRow schemaRow in schemaTable.Rows) {\r
+                               if (tableName == String.Empty) \r
+                                       tableName = (string) schemaRow ["BaseTableName"];\r
+                               if (tableName != (string) schemaRow["BaseTableName"])\r
+                                       throw new InvalidOperationException ("Dynamic SQL generation is not supported against multiple base tables.");\r
+                       }\r
+                       dbSchemaTable = schemaTable;\r
+               }\r
+\r
+               private SqlCommand CreateDeleteCommand (DataRow row, DataTableMapping tableMapping) \r
+               {\r
+                       // If no table was found, then we can't do an delete\r
+                       if (QuotedTableName == String.Empty)\r
+                               return null;\r
+\r
+\r
+                       CreateNewCommand (ref deleteCommand);\r
+\r
+                       string command = String.Format ("DELETE FROM {0} ", QuotedTableName);\r
+                       StringBuilder columns = new StringBuilder ();\r
+                       StringBuilder whereClause = new StringBuilder ();\r
+                       string dsColumnName = String.Empty;\r
+                       bool keyFound = false;\r
+                       int parmIndex = 1;\r
+\r
+                       foreach (DataRow schemaRow in dbSchemaTable.Rows) {\r
+                               if (!IncludedInWhereClause (schemaRow)) \r
+                                       continue;\r
+\r
+                               if (whereClause.Length > 0) \r
+                                       whereClause.Append (" AND ");\r
+\r
+                               bool isKey = (bool) schemaRow ["IsKey"];\r
+                               SqlParameter parameter = null;\r
+\r
+                               if (!isKey) {\r
+                                       parameter = deleteCommand.Parameters.Add (CreateParameter (parmIndex++, schemaRow));\r
+\r
+                                       dsColumnName = tableMapping.ColumnMappings [parameter.SourceColumn].DataSetColumn;\r
+                                       if (row != null)\r
+                                               parameter.Value = row [dsColumnName, DataRowVersion.Current];\r
+                                       whereClause.Append ("(");\r
+                                       whereClause.Append (String.Format (clause1, GetQuotedString (parameter.SourceColumn), parameter.ParameterName));\r
+                                       whereClause.Append (" OR ");\r
+                               }\r
+                               else\r
+                                       keyFound = true;\r
+                                       \r
+                               parameter = deleteCommand.Parameters.Add (CreateParameter (parmIndex++, schemaRow));\r
+\r
+                               dsColumnName = tableMapping.ColumnMappings [parameter.SourceColumn].DataSetColumn;\r
+                               if (row != null)\r
+                                       parameter.Value = row [dsColumnName, DataRowVersion.Current];\r
+\r
+                               whereClause.Append (String.Format (clause2, GetQuotedString (parameter.SourceColumn), parameter.ParameterName));\r
+\r
+                               if (!isKey)\r
+                                       whereClause.Append (")");\r
+                       }\r
+                       if (!keyFound)\r
+                               throw new InvalidOperationException ("Dynamic SQL generation for the DeleteCommand is not supported against a SelectCommand that does not return any key column information.");\r
+\r
+                       // We're all done, so bring it on home\r
+                       string sql = String.Format ("{0} WHERE ( {1} )", command, whereClause.ToString ());\r
+                       deleteCommand.CommandText = sql;\r
+                       return deleteCommand;\r
+               }\r
+\r
+               private SqlCommand CreateInsertCommand (DataRow row, DataTableMapping tableMapping) \r
+               {\r
+                       if (QuotedTableName == String.Empty)\r
+                               return null;\r
+\r
+                       CreateNewCommand (ref insertCommand);\r
+\r
+                       string command = String.Format ("INSERT INTO {0}", QuotedTableName);\r
+                       string sql;\r
+                       StringBuilder columns = new StringBuilder ();\r
+                       StringBuilder values = new StringBuilder ();\r
+                       string dsColumnName = String.Empty;\r
+\r
+                       int parmIndex = 1;\r
+                       foreach (DataRow schemaRow in dbSchemaTable.Rows) {\r
+                               if (!IncludedInInsert (schemaRow))\r
+                                       continue;\r
+\r
+                               if (parmIndex > 1) {\r
+                                       columns.Append (" , ");\r
+                                       values.Append (" , ");\r
+                               }\r
+\r
+                               SqlParameter parameter = insertCommand.Parameters.Add (CreateParameter (parmIndex++, schemaRow));\r
+\r
+                               dsColumnName = tableMapping.ColumnMappings [parameter.SourceColumn].DataSetColumn;\r
+                               if (row != null)\r
+                                       parameter.Value = row [dsColumnName];\r
+\r
+                               columns.Append (GetQuotedString (parameter.SourceColumn));\r
+                               values.Append (parameter.ParameterName);\r
+                       }\r
+\r
+                       sql = String.Format ("{0}( {1} ) VALUES ( {2} )", command, columns.ToString (), values.ToString ());\r
+                       insertCommand.CommandText = sql;\r
+                       return insertCommand;\r
+               }\r
+\r
+               private void CreateNewCommand (ref SqlCommand command)\r
+               {\r
+                       SqlCommand sourceCommand = SourceCommand;\r
+                       if (command == null) {\r
+                               command = sourceCommand.Connection.CreateCommand ();\r
+                               command.CommandTimeout = sourceCommand.CommandTimeout;\r
+                               command.Transaction = sourceCommand.Transaction;\r
+                       }\r
+                       command.CommandType = CommandType.Text;\r
+                       command.UpdatedRowSource = UpdateRowSource.None;\r
+               }\r
+\r
+               private SqlCommand CreateUpdateCommand (DataRow row, DataTableMapping tableMapping) \r
+               {\r
+                       // If no table was found, then we can't do an update\r
+                       if (QuotedTableName == String.Empty)\r
+                               return null;\r
+\r
+                       CreateNewCommand (ref updateCommand);\r
+\r
+                       string command = String.Format ("UPDATE {0} SET ", QuotedTableName);\r
+                       StringBuilder columns = new StringBuilder ();\r
+                       StringBuilder whereClause = new StringBuilder ();\r
+                       int parmIndex = 1;\r
+                       string dsColumnName = String.Empty;\r
+                       bool keyFound = false;\r
+\r
+                       // First, create the X=Y list for UPDATE\r
+                       foreach (DataRow schemaRow in dbSchemaTable.Rows) {\r
+                               if (columns.Length > 0) \r
+                                       columns.Append (" , ");\r
+\r
+                               SqlParameter parameter = updateCommand.Parameters.Add (CreateParameter (parmIndex++, schemaRow));\r
+\r
+                               dsColumnName = tableMapping.ColumnMappings [parameter.SourceColumn].DataSetColumn;\r
+                               if (row != null)\r
+                                       parameter.Value = row [dsColumnName, DataRowVersion.Proposed];\r
+\r
+                               columns.Append (String.Format ("{0} = {1}", GetQuotedString (parameter.SourceColumn), parameter.ParameterName));\r
+                       }\r
+\r
+                       // Now, create the WHERE clause.  This may be optimizable, but it would be ugly to incorporate\r
+                       // into the loop above.  "Premature optimization is the root of all evil." -- Knuth\r
+                       foreach (DataRow schemaRow in dbSchemaTable.Rows) {\r
+                               if (!IncludedInWhereClause (schemaRow)) \r
+                                       continue;\r
+\r
+                               if (whereClause.Length > 0) \r
+                                       whereClause.Append (" AND ");\r
+\r
+                               bool isKey = (bool) schemaRow ["IsKey"];\r
+                               SqlParameter parameter = null;\r
+\r
+\r
+                               if (!isKey) {\r
+                                       parameter = updateCommand.Parameters.Add (CreateParameter (parmIndex++, schemaRow));\r
+\r
+                                       dsColumnName = tableMapping.ColumnMappings [parameter.SourceColumn].DataSetColumn;\r
+                                       if (row != null)\r
+                                               parameter.Value = row [dsColumnName];\r
+\r
+                                       whereClause.Append ("(");\r
+                                       whereClause.Append (String.Format (clause1, GetQuotedString (parameter.SourceColumn), parameter.ParameterName));\r
+                                       whereClause.Append (" OR ");\r
+                               }\r
+                               else\r
+                                       keyFound = true;\r
+                                       \r
+                               parameter = updateCommand.Parameters.Add (CreateParameter (parmIndex++, schemaRow));\r
+\r
+                               dsColumnName = tableMapping.ColumnMappings [parameter.SourceColumn].DataSetColumn;\r
+                               if (row != null)\r
+                                       parameter.Value = row [dsColumnName];\r
+\r
+                               whereClause.Append (String.Format (clause2, GetQuotedString (parameter.SourceColumn), parameter.ParameterName));\r
+\r
+                               if (!isKey)\r
+                                       whereClause.Append (")");\r
+                       }\r
+                       if (!keyFound)\r
+                               throw new InvalidOperationException ("Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.");\r
+\r
+                       // We're all done, so bring it on home\r
+                       string sql = String.Format ("{0}{1} WHERE ( {2} )", command, columns.ToString (), whereClause.ToString ());\r
+                       updateCommand.CommandText = sql;\r
+                       return updateCommand;\r
+               }\r
+\r
+               private SqlParameter CreateParameter (int parmIndex, DataRow schemaRow)\r
+               {\r
+                       string name = String.Format ("@p{0}", parmIndex);\r
+                       string sourceColumn = (string) schemaRow ["BaseColumnName"];\r
+                       SqlDbType sqlDbType = (SqlDbType) schemaRow ["ProviderType"];\r
+                       int size = (int) schemaRow ["ColumnSize"];\r
+\r
+                       return new SqlParameter (name, sqlDbType, size, sourceColumn);\r
+               }\r
+\r
+               public static void DeriveParameters (SqlCommand command)\r
+               {\r
+                       if (command.Connection.State != ConnectionState.Open) {\r
+                               throw new InvalidOperationException("DeriveParameters requires an open and available Connection. The connection's current state is Closed.");\r
+                       }\r
+                       command.DeriveParameters ();\r
+               }\r
+\r
+               protected override void Dispose (bool disposing)\r
+               {\r
+                       if (!disposed) {\r
+                               if (disposing) {\r
+                                       if (insertCommand != null)\r
+                                               insertCommand.Dispose ();\r
+                                       if (deleteCommand != null)\r
+                                               deleteCommand.Dispose ();\r
+                                       if (updateCommand != null)\r
+                                               updateCommand.Dispose ();\r
+                                       if (dbSchemaTable != null)\r
+                                               dbSchemaTable.Dispose ();\r
+                               }\r
+                               disposed = true;\r
+                       }\r
+               }\r
+\r
+               public SqlCommand GetDeleteCommand ()\r
+               {\r
+                       BuildCache (true);\r
+                       return CreateDeleteCommand (null, null);\r
+               }\r
+\r
+               public SqlCommand GetInsertCommand ()\r
+               {\r
+                       BuildCache (true);\r
+                       return CreateInsertCommand (null, null);\r
+               }\r
+\r
+               private string GetQuotedString (string value)\r
+               {\r
+                       if (value == String.Empty || value == null)\r
+                               return value;\r
+                       if (quotePrefix == String.Empty && quoteSuffix == String.Empty)\r
+                               return value;\r
+                       return String.Format ("{0}{1}{2}", quotePrefix, value, quoteSuffix);\r
+               }\r
+\r
+               public SqlCommand GetUpdateCommand ()\r
+               {\r
+                       BuildCache (true);\r
+                       return CreateUpdateCommand (null, null);\r
+               }\r
+\r
+               private bool IncludedInInsert (DataRow schemaRow)\r
+               {\r
+                       // If the parameter has one of these properties, then we don't include it in the insert:\r
+                       // AutoIncrement, Hidden, Expression, RowVersion, ReadOnly\r
+\r
+                       if ((bool) schemaRow ["IsAutoIncrement"])\r
+                               return false;\r
+                       if ((bool) schemaRow ["IsHidden"])\r
+                               return false;\r
+                       if ((bool) schemaRow ["IsExpression"])\r
+                               return false;\r
+                       if ((bool) schemaRow ["IsRowVersion"])\r
+                               return false;\r
+                       if ((bool) schemaRow ["IsReadOnly"])\r
+                               return false;\r
+                       return true;\r
+               }\r
+\r
+               private bool IncludedInUpdate (DataRow schemaRow)\r
+               {\r
+                       // If the parameter has one of these properties, then we don't include it in the insert:\r
+                       // AutoIncrement, Hidden, RowVersion\r
+\r
+                       if ((bool) schemaRow ["IsAutoIncrement"])\r
+                               return false;\r
+                       if ((bool) schemaRow ["IsHidden"])\r
+                               return false;\r
+                       if ((bool) schemaRow ["IsRowVersion"])\r
+                               return false;\r
+                       return true;\r
+               }\r
+\r
+               private bool IncludedInWhereClause (DataRow schemaRow)\r
+               {\r
+                       if ((bool) schemaRow ["IsLong"])\r
+                               return false;\r
+                       return true;\r
+               }\r
+\r
+               [MonoTODO ("Figure out what else needs to be cleaned up when we refresh.")]\r
+               public void RefreshSchema () \r
+               {\r
+                       tableName = String.Empty;\r
+                       dbSchemaTable = null;\r
+               }\r
+\r
+               #endregion // Methods\r
+\r
+               #region Event Handlers\r
+\r
+               private void RowUpdatingHandler (object sender, SqlRowUpdatingEventArgs e)\r
+               {\r
+                       if (e.Status != UpdateStatus.Continue)\r
+                               return;\r
+\r
+                       switch (e.StatementType) {\r
+                       case StatementType.Delete:\r
+                               deleteCommand = e.Command;\r
+                               break;\r
+                       case StatementType.Insert:\r
+                               insertCommand = e.Command;\r
+                               break;\r
+                       case StatementType.Update:\r
+                               updateCommand = e.Command;\r
+                               break;\r
+                       default:\r
+                               return;\r
+                       }\r
+\r
+                       try {\r
+                               BuildCache (false);\r
+\r
+                               switch (e.StatementType) {\r
+                               case StatementType.Delete:\r
+                                       e.Command = CreateDeleteCommand (e.Row, e.TableMapping);\r
+                                       e.Status = UpdateStatus.Continue;\r
+                                       break;\r
+                               case StatementType.Insert:\r
+                                       e.Command = CreateInsertCommand (e.Row, e.TableMapping);\r
+                                       e.Status = UpdateStatus.Continue;\r
+                                       break;\r
+                               case StatementType.Update:\r
+                                       e.Command = CreateUpdateCommand (e.Row, e.TableMapping);\r
+                                       e.Status = UpdateStatus.Continue;\r
+                                       break;\r
+                               }\r
+\r
+                               if (e.Command != null && e.Row != null) {\r
+                                       e.Row.AcceptChanges ();\r
+                                       e.Status = UpdateStatus.SkipCurrentRow;\r
+                               }\r
+                       }\r
+                       catch (Exception exception) {\r
+                               e.Errors = exception;\r
+                               e.Status = UpdateStatus.ErrorsOccurred;\r
+                       }\r
+               }\r
+\r
+               #endregion // Event Handlers\r
+       }\r
+}\r
+\r
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlConnection.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlConnection.cs
new file mode 100644 (file)
index 0000000..c7b06b7
--- /dev/null
@@ -0,0 +1,227 @@
+//\r
+// System.Data.SqlClient.SqlConnection\r
+//\r
+// Author:\r
+//   Boris Kirzner (borisk@mainsoft.com)\r
+//\r
+\r
+using System.Data;\r
+using System.Data.Common;\r
+using System.Collections;\r
+\r
+using java.sql;\r
+\r
+namespace System.Data.SqlClient\r
+{\r
+       public class SqlConnection : AbstractDBConnection, IDbConnection, System.ICloneable\r
+       {\r
+               #region Fields\r
+\r
+               private const int DEFAULT_PACKET_SIZE = 8192;\r
+\r
+               protected static Hashtable _skippedUserParameters = new Hashtable(new CaseInsensitiveHashCodeProvider(),new CaseInsensitiveComparer());\r
+\r
+               private static DbStringManager _stringManager = new DbStringManager("System.Data.System.Data.ProviderBase.jvm.SqlClientStrings");\r
+\r
+               private static readonly string[] _resourceIgnoredKeys = new string[] {"CON_DATA_SOURCE","CON_DATABASE",\r
+                                                                                                                                                         "CON_PASSWORD","CON_USER_ID","CON_TIMEOUT",\r
+                                                                                                                                                         "CON_JNDI_NAME","CON_JNDI_PROVIDER","CON_JNDI_FACTORY",\r
+                                                                                                                                                         "CON_WORKSTATION_ID","CON_PACKET_SIZE"};\r
+\r
+               #endregion // Fields\r
+\r
+               #region Constructors\r
+\r
+               public SqlConnection() : this(null)\r
+               {\r
+               }\r
+\r
+               public SqlConnection(String connectionString) : base(connectionString)\r
+               {\r
+               }\r
+\r
+               #endregion // Constructors\r
+\r
+               #region Events\r
+\r
+               [DataCategory ("InfoMessage")]
+               [DataSysDescription ("Event triggered when messages arrive from the DataSource.")]
+               public event SqlInfoMessageEventHandler InfoMessage;
+
+               [DataCategory ("StateChange")]
+               [DataSysDescription ("Event triggered when the connection changes state.")]
+               public event StateChangeEventHandler StateChange;\r
+\r
+               #endregion // Events\r
+\r
+               #region Properties\r
+\r
+               public string WorkstationId\r
+               {\r
+                       get { return ConnectionStringHelper.FindValue(UserParameters,StringManager.GetStringArray("CON_WORKSTATION_ID")); }\r
+               }\r
+\r
+               protected override string JdbcDriverName\r
+               {\r
+                       get { return StringManager.GetString("JDBC_DRIVER"); }\r
+               }\r
+\r
+               protected internal override JDBC_MODE JdbcMode\r
+               {\r
+                       get {\r
+                               string[] conJndiNameStr = StringManager.GetStringArray("CON_JNDI_NAME");\r
+                               if (!String.Empty.Equals(ConnectionStringHelper.FindValue(UserParameters,conJndiNameStr))) {\r
+                                       return JDBC_MODE.DATA_SOURCE_MODE;\r
+                               }\r
+                               return JDBC_MODE.PROVIDER_MODE; \r
+                       }\r
+               }\r
+\r
+               public int PacketSize\r
+               {\r
+                       get { \r
+                               string packetSize = ConnectionStringHelper.FindValue(UserParameters,StringManager.GetStringArray("CON_PACKET_SIZE"));                           \r
+                               if (String.Empty.Equals(packetSize)) {\r
+                                       return DEFAULT_PACKET_SIZE;\r
+                               }                               \r
+                               try {\r
+                                       return Convert.ToInt32(packetSize);\r
+                               }\r
+                               catch(FormatException e) {\r
+                                       throw ExceptionHelper.InvalidValueForKey("packet size");\r
+                               }\r
+                               catch (OverflowException e) {\r
+                                       throw ExceptionHelper.InvalidValueForKey("packet size");\r
+                               }\r
+                       }\r
+               }\r
+\r
+               protected override string[] ResourceIgnoredKeys\r
+               {\r
+                       get { return _resourceIgnoredKeys; }\r
+               }\r
+\r
+               protected override Hashtable SkippedUserParameters\r
+               {\r
+                       get { return _skippedUserParameters; }\r
+               }\r
+\r
+               protected override PROVIDER_TYPE ProviderType\r
+               {\r
+                       get {\r
+                               if (JdbcMode != JDBC_MODE.PROVIDER_MODE) {\r
+                                       return PROVIDER_TYPE.NONE;\r
+                               }\r
+                               return PROVIDER_TYPE.SQLOLEDB;\r
+                       }\r
+               }\r
+\r
+               protected override DbStringManager StringManager\r
+               {\r
+                       get { return _stringManager; }\r
+               }\r
+\r
+               #endregion // Properties\r
+\r
+               #region Methods\r
+\r
+               protected internal override void ValidateConnectionString(string connectionString)\r
+               {\r
+                       base.ValidateConnectionString(connectionString);\r
+\r
+                       // FIXME : validate packet size\r
+               }\r
+\r
+               protected override DbTransaction BeginDbTransaction(IsolationLevel isolationLevel) {\r
+                       return BeginTransaction(isolationLevel);\r
+               }\r
+\r
+               public SqlTransaction BeginTransaction(String transactionName)\r
+               {\r
+                       return BeginTransaction(IsolationLevel.ReadCommitted,transactionName);\r
+               }\r
+\r
+               public new SqlTransaction BeginTransaction(IsolationLevel isolationLevel)\r
+               {\r
+                       return BeginTransaction(isolationLevel,"Transaction");\r
+               }\r
+\r
+               public new SqlTransaction BeginTransaction()\r
+               {\r
+                       return BeginTransaction(IsolationLevel.ReadCommitted);\r
+               }\r
+        \r
+               public SqlTransaction BeginTransaction(IsolationLevel isolationLevel, string transactionName)\r
+               {\r
+                       return new SqlTransaction(isolationLevel, this, transactionName);\r
+               }\r
+\r
+               public new SqlCommand CreateCommand()\r
+               {\r
+                       return new SqlCommand(this);\r
+               }\r
+\r
+               protected override DbCommand CreateDbCommand() {\r
+                       return CreateCommand();\r
+               }\r
+\r
+               internal override void OnSqlWarning(SQLWarning warning)\r
+               {\r
+                       SqlErrorCollection col = new SqlErrorCollection(warning, this);\r
+                       OnSqlInfoMessage(new SqlInfoMessageEventArgs(col));\r
+               }\r
+\r
+               protected internal override void CopyTo(AbstractDBConnection target)\r
+               {\r
+                       base.CopyTo(target);\r
+               }\r
+\r
+               public object Clone()\r
+               {\r
+                       SqlConnection clone = new SqlConnection();\r
+                       CopyTo(clone);\r
+                       return clone;\r
+               }\r
+\r
+               protected override SystemException CreateException(SQLException e)
+               {\r
+                       return new SqlException(e, this);               \r
+               }\r
+\r
+               private void OnSqlInfoMessage (SqlInfoMessageEventArgs value)
+               {
+                       if (InfoMessage != null) {
+                               InfoMessage (this, value);
+                       }
+               }
+
+               internal override void OnStateChanged(ConnectionState orig, ConnectionState current)\r
+               {\r
+                       if(StateChange != null) {\r
+                               StateChange(this, new StateChangeEventArgs(orig, current));\r
+                       }\r
+               }\r
+\r
+               public override void Close()\r
+               {\r
+                       ConnectionState orig = State;\r
+                       base.Close();\r
+                       ConnectionState current = State;\r
+                       if(current != orig) {\r
+                               OnStateChanged(orig, current);\r
+                       }\r
+               }\r
+\r
+               protected override string BuildJdbcUrl()\r
+               {\r
+                       switch (JdbcMode) {\r
+                               case JDBC_MODE.PROVIDER_MODE :\r
+                                       return BuildMsSqlUrl();\r
+                       }\r
+                       return base.BuildJdbcUrl();\r
+               }\r
+\r
+               #endregion // Methods\r
+        \r
+       }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlConnection.resx b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlConnection.resx
new file mode 100644 (file)
index 0000000..dd0ea4d
--- /dev/null
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8" ?>\r
+<root>\r
+       <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">\r
+               <xsd:element name="root" msdata:IsDataSet="true">\r
+                       <xsd:complexType>\r
+                               <xsd:choice maxOccurs="unbounded">\r
+                                       <xsd:element name="data">\r
+                                               <xsd:complexType>\r
+                                                       <xsd:sequence>\r
+                                                               <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
+                                                               <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />\r
+                                                       </xsd:sequence>\r
+                                                       <xsd:attribute name="name" type="xsd:string" />\r
+                                                       <xsd:attribute name="type" type="xsd:string" />\r
+                                                       <xsd:attribute name="mimetype" type="xsd:string" />\r
+                                               </xsd:complexType>\r
+                                       </xsd:element>\r
+                                       <xsd:element name="resheader">\r
+                                               <xsd:complexType>\r
+                                                       <xsd:sequence>\r
+                                                               <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
+                                                       </xsd:sequence>\r
+                                                       <xsd:attribute name="name" type="xsd:string" use="required" />\r
+                                               </xsd:complexType>\r
+                                       </xsd:element>\r
+                               </xsd:choice>\r
+                       </xsd:complexType>\r
+               </xsd:element>\r
+       </xsd:schema>\r
+       <resheader name="ResMimeType">\r
+               <value>text/microsoft-resx</value>\r
+       </resheader>\r
+       <resheader name="Version">\r
+               <value>1.0.0.0</value>\r
+       </resheader>\r
+       <resheader name="Reader">\r
+               <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+       </resheader>\r
+       <resheader name="Writer">\r
+               <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+       </resheader>\r
+</root>\r
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlConnectionPool.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlConnectionPool.cs
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlConvert.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlConvert.cs
new file mode 100644 (file)
index 0000000..6844197
--- /dev/null
@@ -0,0 +1,223 @@
+//\r
+// System.Data.SqlClient.SqlConvert\r
+//\r
+// Author:\r
+//   Boris Kirzner (borisk@mainsoft.com)\r
+//\r
+\r
+using System;\r
+using System.Data.Common;\r
+\r
+using java.sql;\r
+\r
+namespace System.Data.SqlClient\r
+{\r
+       internal sealed class SqlConvert : DbConvert\r
+       {\r
+               #region Methods\r
+\r
+               internal static String JdbcTypeNameToDbTypeName(string jdbcTypeName)\r
+               {\r
+                       return jdbcTypeName.Trim();\r
+               }\r
+\r
+               internal static SqlDbType JdbcTypeToSqlDbType(int jdbcType)\r
+               {\r
+                       // FIXME : other java.sql.Type\r
+                       // Types.ARRAY\r
+                       if(Types.BIGINT == jdbcType) return SqlDbType.BigInt;
+                       if(Types.BINARY == jdbcType) return SqlDbType.Binary;
+                       if(Types.BIT == jdbcType) return SqlDbType.Bit;
+                       if(Types.BLOB == jdbcType) return SqlDbType.Binary;
+                       // Types.BOOLEAN
+                       if(Types.CHAR == jdbcType) return SqlDbType.Char;
+                       if(Types.CLOB == jdbcType) return SqlDbType.Binary;
+                       if(Types.DATE == jdbcType) return SqlDbType.DateTime;
+                       if(Types.DECIMAL == jdbcType) return SqlDbType.Decimal;
+                       // Types.DISTINCT
+                       if(Types.DOUBLE == jdbcType) return SqlDbType.Float;
+                       if(Types.FLOAT == jdbcType) return SqlDbType.Float;
+                       if(Types.INTEGER == jdbcType) return SqlDbType.Int;
+                       // Types.JAVA_OBJECT
+                       if(Types.LONGVARBINARY == jdbcType) return SqlDbType.Image;
+                       if(Types.LONGVARCHAR == jdbcType) return SqlDbType.Text;
+                       // Types.NULL
+                       if(Types.NUMERIC == jdbcType) return SqlDbType.Decimal;
+                       if(Types.REAL == jdbcType) return SqlDbType.Real;
+                       // Types.REF
+                       if(Types.SMALLINT == jdbcType) return SqlDbType.SmallInt;
+                       // Types.STRUCT
+                       if(Types.TIME == jdbcType) return SqlDbType.Timestamp;
+                       if(Types.TIMESTAMP == jdbcType) return SqlDbType.Timestamp;
+                       if(Types.TINYINT == jdbcType) return SqlDbType.TinyInt;
+                       if(Types.VARBINARY == jdbcType) return SqlDbType.VarBinary;
+                       if(Types.VARCHAR == jdbcType) return SqlDbType.VarChar;
+                       return SqlDbType.Variant;\r
+               }\r
+\r
+               internal static SqlDbType ValueTypeToSqlDbType(Type type)\r
+               {\r
+                       if (type.Equals(typeof(byte[]))) return  SqlDbType.VarBinary;\r
+                       if (type.Equals(typeof(bool))) return SqlDbType.Bit;\r
+//                             if (type.Equals(typeof(string))) return OleDbType.BSTR;\r
+//                             if (type.Equals(typeof(string))) return OleDbType.Char;\r
+//                             if (type.Equals(typeof(decimal))) return OleDbType.Currency;\r
+                       if (type.Equals(typeof(DateTime))) return SqlDbType.DateTime;\r
+//                             if (type.Equals(typeof(DateTime))) return OleDbType.DBDate;\r
+//                             if (type.Equals(typeof(TimeSpan))) return OleDbType.DBTime;\r
+//                             if (type.Equals(typeof(DateTime))) return OleDbType.DBTimeStamp;\r
+                       if (type.Equals(typeof(decimal))) return SqlDbType.Decimal;\r
+//                             if (type.Equals(typeof(int))) return OleDbType.Error;\r
+//                             if (type.Equals(typeof(DateTime))) return OleDbType.Filetime;\r
+                       if (type.Equals(typeof(Guid))) return SqlDbType.UniqueIdentifier;\r
+//                             if (type.Equals(typeof(short))) return OleDbType.TinyInt;\r
+                       if (type.Equals(typeof(short))) return SqlDbType.SmallInt;\r
+                       if (type.Equals(typeof(int))) return SqlDbType.Int;\r
+                       if (type.Equals(typeof(long))) return SqlDbType.BigInt;\r
+//                             if (type.Equals(typeof(object))) return OleDbType.IDispatch;\r
+//                             if (type.Equals(typeof(object))) return OleDbType.IUnknown;\r
+//                             if (type.Equals(typeof(byte[]))) return OleDbType.LongVarBinary;\r
+//                             if (type.Equals(typeof(string))) return OleDbType.LongVarChar;\r
+//                             if (type.Equals(typeof(decimal))) return OleDbType.Numeric;\r
+//                             if (type.Equals(typeof(object))) return OleDbType.PropVariant;\r
+                       if (type.Equals(typeof(float))) return SqlDbType.Float;\r
+                       if (type.Equals(typeof(double))) return SqlDbType.Float;\r
+                       if (type.Equals(typeof(byte))) return SqlDbType.TinyInt;\r
+//                             if (type.Equals(typeof(int))) return OleDbType.UnsignedSmallInt;\r
+//                             if (type.Equals(typeof(long))) return OleDbType.UnsignedInt;\r
+//                             if (type.Equals(typeof(decimal))) return OleDbType.UnsignedBigInt;\r
+//                             if (type.Equals(typeof(byte[]))) return OleDbType.VarBinary;\r
+                       if (type.Equals(typeof(string))) return SqlDbType.VarChar;\r
+                       if (type.Equals(typeof(object))) return SqlDbType.Variant;\r
+//                             if (type.Equals(typeof(decimal))) return OleDbType.VarNumeric;\r
+//                             if (type.Equals(typeof(string))) return OleDbType.WChar;\r
+//                             if (type.Equals(typeof(string))) return OleDbType.VarWChar;\r
+//                             if (type.Equals(typeof(string))) return OleDbType.LongVarWChar;\r
+                       return SqlDbType.Variant;\r
+               }\r
+\r
+               internal static Type SqlDbTypeToValueType(SqlDbType sqlDbType)\r
+               {\r
+                       switch (sqlDbType) {\r
+                               case SqlDbType.BigInt : return typeof(long);\r
+                               case SqlDbType.Binary : return typeof(byte[]);\r
+                               case SqlDbType.Bit : return typeof(bool);\r
+                               case SqlDbType.Char : return typeof(string);\r
+                               case SqlDbType.DateTime : return typeof(DateTime);\r
+                               case SqlDbType.Decimal : return typeof(decimal);\r
+                               case SqlDbType.Float : return typeof(double);\r
+                               case SqlDbType.Image : return typeof(byte[]);\r
+                               case SqlDbType.Int : return typeof(int);\r
+                               case SqlDbType.Money : return typeof(decimal);\r
+                               case SqlDbType.NChar : return typeof(string);\r
+                               case SqlDbType.NText : return typeof(string);\r
+                               case SqlDbType.NVarChar : return typeof(string);\r
+                               case SqlDbType.Real : return typeof(Single);\r
+                               case SqlDbType.UniqueIdentifier : return typeof(Guid);\r
+                               case SqlDbType.SmallDateTime : return typeof(DateTime);\r
+                               case SqlDbType.SmallInt : return typeof(Int16);\r
+                               case SqlDbType.SmallMoney : return typeof(decimal);\r
+                               case SqlDbType.Text : return typeof(string);\r
+                               case SqlDbType.Timestamp : return typeof(byte[]);\r
+                               case SqlDbType.TinyInt : return typeof(byte);\r
+                               case SqlDbType.VarBinary : return typeof(byte[]);\r
+                               case SqlDbType.VarChar : return typeof(string);\r
+                               case SqlDbType.Variant : return typeof(object);\r
+                               default : throw ExceptionHelper.InvalidSqlDbType((int)sqlDbType);\r
+                       }\r
+               }\r
+\r
+               internal static SqlDbType DbTypeToSqlDbType(DbType dbType)\r
+               {\r
+                       switch (dbType) {\r
+                               case DbType.AnsiString : return SqlDbType.VarChar;\r
+                               case DbType.Binary : return SqlDbType.VarBinary;\r
+                               case DbType.Byte : return SqlDbType.TinyInt;\r
+                               case DbType.Boolean : return SqlDbType.Bit;\r
+                               case DbType.Currency : return SqlDbType.Money;\r
+                               case DbType.DateTime : return SqlDbType.DateTime;\r
+                               case DbType.Decimal : return SqlDbType.Decimal;\r
+                               case DbType.Double : return SqlDbType.Float;\r
+                               case DbType.Guid : return SqlDbType.UniqueIdentifier;\r
+                               case DbType.Int16 : return SqlDbType.SmallInt;\r
+                               case DbType.Int32 : return SqlDbType.Int;\r
+                               case DbType.Int64 : return SqlDbType.BigInt;\r
+                               case DbType.Object : return SqlDbType.Variant;\r
+                               case DbType.SByte : throw ExceptionHelper.UnknownDataType(dbType.ToString(),"SqlDbType");\r
+                               case DbType.Single : return SqlDbType.Real;\r
+                               case DbType.String : return SqlDbType.NVarChar;\r
+                               case DbType.UInt16 : throw ExceptionHelper.UnknownDataType(dbType.ToString(),"SqlDbType");\r
+                               case DbType.UInt32 : throw ExceptionHelper.UnknownDataType(dbType.ToString(),"SqlDbType");\r
+                               case DbType.UInt64 : throw ExceptionHelper.UnknownDataType(dbType.ToString(),"SqlDbType");\r
+                               case DbType.VarNumeric : throw ExceptionHelper.UnknownDataType(dbType.ToString(),"SqlDbType");\r
+                               case DbType.AnsiStringFixedLength : return SqlDbType.Char;\r
+                               case DbType.StringFixedLength : return SqlDbType.NChar;\r
+                               default : throw ExceptionHelper.InvalidDbType((int)dbType);\r
+                       }\r
+               }\r
+\r
+               internal static DbType SqlDbTypeToDbType(SqlDbType sqlDbType)\r
+               {\r
+                       switch (sqlDbType) {\r
+                               case SqlDbType.BigInt : return DbType.Int64;\r
+                               case SqlDbType.Binary : return DbType.Binary;\r
+                               case SqlDbType.Bit : return DbType.Boolean;\r
+                               case SqlDbType.Char : return DbType.AnsiStringFixedLength;\r
+                               case SqlDbType.DateTime : return DbType.DateTime;\r
+                               case SqlDbType.Decimal : return DbType.Decimal;\r
+                               case SqlDbType.Float : return DbType.Double;\r
+                               case SqlDbType.Image : return DbType.Binary;\r
+                               case SqlDbType.Int : return DbType.Int32;\r
+                               case SqlDbType.Money : return DbType.Currency;\r
+                               case SqlDbType.NChar : return DbType.StringFixedLength;\r
+                               case SqlDbType.NText : return DbType.String;\r
+                               case SqlDbType.NVarChar : return DbType.String;\r
+                               case SqlDbType.Real : return DbType.Single;\r
+                               case SqlDbType.UniqueIdentifier : return DbType.Guid;\r
+                               case SqlDbType.SmallDateTime : return DbType.DateTime;\r
+                               case SqlDbType.SmallInt : return DbType.Int16;\r
+                               case SqlDbType.SmallMoney : return DbType.Currency;\r
+                               case SqlDbType.Text : return DbType.AnsiString;\r
+                               case SqlDbType.Timestamp : return DbType.Binary;\r
+                               case SqlDbType.TinyInt : return DbType.Byte;\r
+                               case SqlDbType.VarBinary : return DbType.Binary;\r
+                               case SqlDbType.VarChar : return DbType.AnsiString;\r
+                               case SqlDbType.Variant : return DbType.Object;\r
+                               default : throw ExceptionHelper.InvalidSqlDbType((int)sqlDbType);\r
+                       }\r
+               }\r
+\r
+               internal static int     SqlDbTypeToJdbcType(SqlDbType sqlDbType)\r
+               {\r
+                       switch(sqlDbType) {\r
+                               case SqlDbType.BigInt : return Types.BIGINT;\r
+                               case SqlDbType.Binary : return Types.BINARY;\r
+                               case SqlDbType.Bit : return Types.BIT;\r
+                               case SqlDbType.Char : return Types.CHAR;\r
+                               case SqlDbType.DateTime : return Types.DATE;\r
+                               case SqlDbType.Decimal : return Types.DECIMAL;\r
+                               case SqlDbType.Float : return Types.FLOAT;\r
+                               case SqlDbType.Image : return Types.LONGVARBINARY;\r
+                               case SqlDbType.Int : return Types.INTEGER;\r
+                               case SqlDbType.Money : return Types.DECIMAL;\r
+                               case SqlDbType.NChar : return Types.CHAR;\r
+                               case SqlDbType.NText : return Types.LONGVARCHAR;\r
+                               case SqlDbType.NVarChar : return Types.VARCHAR;\r
+                               case SqlDbType.Real : return Types.REAL;\r
+                               case SqlDbType.UniqueIdentifier : return Types.CHAR;\r
+                               case SqlDbType.SmallDateTime : return Types.DATE;\r
+                               case SqlDbType.SmallInt : return Types.SMALLINT;\r
+                               case SqlDbType.SmallMoney : return Types.DECIMAL;\r
+                               case SqlDbType.Text : return Types.LONGVARCHAR;\r
+                               case SqlDbType.Timestamp : return Types.TIMESTAMP;\r
+                               case SqlDbType.TinyInt : return Types.TINYINT;\r
+                               case SqlDbType.VarBinary : return Types.VARBINARY;\r
+                               case SqlDbType.VarChar : return Types.VARCHAR;\r
+                               case SqlDbType.Variant : return Types.VARCHAR; // note : ms jdbc driver recognize this sqlserver as varchar\r
+                               default : throw ExceptionHelper.InvalidSqlDbType((int)sqlDbType);\r
+                       }\r
+               }\r
+\r
+               #endregion // Methods\r
+       }\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlDataAdapter.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlDataAdapter.cs
new file mode 100644 (file)
index 0000000..959e732
--- /dev/null
@@ -0,0 +1,187 @@
+//\r
+// System.Data.SqlClient.SqlDataAdapter.cs\r
+//\r
+// Author:\r
+//   Rodrigo Moya (rodrigo@ximian.com)\r
+//   Daniel Morgan (danmorg@sc.rr.com)\r
+//   Tim Coleman (tim@timcoleman.com)\r
+//\r
+// (C) Ximian, Inc 2002\r
+// Copyright (C) 2002 Tim Coleman\r
+//\r
+\r
+using System;\r
+using System.ComponentModel;\r
+using System.Data;\r
+using System.Data.Common;\r
+\r
+namespace System.Data.SqlClient {\r
+       [DefaultEvent ("RowUpdated")]\r
+       public sealed class SqlDataAdapter : DbDataAdapter, IDbDataAdapter \r
+       {\r
+               #region Fields\r
+\r
+               bool disposed = false;  \r
+               SqlCommand deleteCommand;\r
+               SqlCommand insertCommand;\r
+               SqlCommand selectCommand;\r
+               SqlCommand updateCommand;\r
+\r
+               #endregion\r
+\r
+               #region Constructors\r
+               \r
+               public SqlDataAdapter ()        \r
+                       : this (new SqlCommand ())\r
+               {\r
+               }\r
+\r
+               public SqlDataAdapter (SqlCommand selectCommand) \r
+               {\r
+                       DeleteCommand = null;\r
+                       InsertCommand = null;\r
+                       SelectCommand = selectCommand;\r
+                       UpdateCommand = null;\r
+               }\r
+\r
+               public SqlDataAdapter (string selectCommandText, SqlConnection selectConnection) \r
+                       : this (new SqlCommand (selectCommandText, selectConnection))\r
+               { \r
+               }\r
+\r
+               public SqlDataAdapter (string selectCommandText, string selectConnectionString)\r
+                       : this (selectCommandText, new SqlConnection (selectConnectionString))\r
+               {\r
+               }\r
+\r
+               #endregion\r
+\r
+               #region Properties\r
+\r
+               [DataCategory ("Update")]\r
+               [DataSysDescription ("Used during Update for deleted rows in DataSet.")]\r
+               [DefaultValue (null)]\r
+               public SqlCommand DeleteCommand {\r
+                       get { return deleteCommand; }\r
+                       set { deleteCommand = value; }\r
+               }\r
+\r
+               [DataCategory ("Update")]\r
+               [DataSysDescription ("Used during Update for new rows in DataSet.")]\r
+               [DefaultValue (null)]\r
+               public SqlCommand InsertCommand {\r
+                       get { return insertCommand; }\r
+                       set { insertCommand = value; }\r
+               }\r
+\r
+               [DataCategory ("Fill")]\r
+               [DataSysDescription ("Used during Fill/FillSchema.")]\r
+               [DefaultValue (null)]\r
+               public SqlCommand SelectCommand {\r
+                       get { return selectCommand; }\r
+                       set { selectCommand = value; }\r
+               }\r
+\r
+               [DataCategory ("Update")]\r
+               [DataSysDescription ("Used during Update for modified rows in DataSet.")]\r
+               [DefaultValue (null)]\r
+               public SqlCommand UpdateCommand {\r
+                       get { return updateCommand; }\r
+                       set { updateCommand = value; }\r
+               }\r
+\r
+               IDbCommand IDbDataAdapter.DeleteCommand {\r
+                       get { return DeleteCommand; }\r
+                       set { \r
+                               if (value != null && !(value is SqlCommand)) \r
+                                       throw new ArgumentException ("DeleteCommand is not of Type SqlCommand");\r
+                               DeleteCommand = (SqlCommand)value;\r
+                       }\r
+               }\r
+\r
+               IDbCommand IDbDataAdapter.InsertCommand {\r
+                       get { return InsertCommand; }\r
+                       set { \r
+                               if (value != null && !(value is SqlCommand)) \r
+                                       throw new ArgumentException ("InsertCommand is not of Type SqlCommand");\r
+                               InsertCommand = (SqlCommand)value;\r
+                       }\r
+               }\r
+\r
+               IDbCommand IDbDataAdapter.SelectCommand {\r
+                       get { return SelectCommand; }\r
+                       set { \r
+                               if (value != null && !(value is SqlCommand)) \r
+                                       throw new ArgumentException ("SelectCommand is not of Type SqlCommand");\r
+                               SelectCommand = (SqlCommand)value;\r
+                       }\r
+               }\r
+\r
+               IDbCommand IDbDataAdapter.UpdateCommand {\r
+                       get { return UpdateCommand; }\r
+                       set { \r
+                               if (value != null && !(value is SqlCommand)) \r
+                                       throw new ArgumentException ("UpdateCommand is not of Type SqlCommand");\r
+                               UpdateCommand = (SqlCommand)value;\r
+                       }\r
+               }\r
+\r
+\r
+               ITableMappingCollection IDataAdapter.TableMappings {\r
+                       get { return TableMappings; }\r
+               }\r
+\r
+               #endregion // Properties\r
+\r
+               #region Methods\r
+\r
+               protected override RowUpdatedEventArgs CreateRowUpdatedEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) \r
+               {\r
+                       return new SqlRowUpdatedEventArgs (dataRow, command, statementType, tableMapping);\r
+               }\r
+\r
+\r
+               protected override RowUpdatingEventArgs CreateRowUpdatingEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) \r
+               {\r
+                       return new SqlRowUpdatingEventArgs (dataRow, command, statementType, tableMapping);\r
+               }\r
+\r
+               protected override void Dispose (bool disposing)\r
+               {\r
+                       if (!disposed) {\r
+                               if (disposing) {\r
+                                       // Release managed resources\r
+                               }\r
+                               // Release unmanaged resources\r
+                               disposed = true;\r
+                       }\r
+               }\r
+\r
+               protected override void OnRowUpdated (RowUpdatedEventArgs value) \r
+               {\r
+                       if (RowUpdated != null)\r
+                               RowUpdated (this, (SqlRowUpdatedEventArgs) value);\r
+               }\r
+\r
+               protected override void OnRowUpdating (RowUpdatingEventArgs value) \r
+               {\r
+                       if (RowUpdating != null)\r
+                               RowUpdating (this, (SqlRowUpdatingEventArgs) value);\r
+               }\r
+\r
+               #endregion // Methods\r
+\r
+               #region Events and Delegates\r
+\r
+               [DataCategory ("Update")]\r
+               [DataSysDescription ("Event triggered before every DataRow during Update.")]\r
+               public event SqlRowUpdatedEventHandler RowUpdated;\r
+\r
+               [DataCategory ("Update")]\r
+               [DataSysDescription ("Event triggered after every DataRow during Update.")]\r
+               public event SqlRowUpdatingEventHandler RowUpdating;\r
+\r
+               #endregion // Events and Delegates\r
+\r
+       }\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlDataReader.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlDataReader.cs
new file mode 100644 (file)
index 0000000..65d6462
--- /dev/null
@@ -0,0 +1,273 @@
+//\r
+// System.Data.SqlClient.SqlDataReader\r
+//\r
+// Author:\r
+//   Boris Kirzner (borisk@mainsoft.com)\r
+//
+
+using System.Data.SqlTypes;
+
+using java.sql;
+
+namespace System.Data.SqlClient
+{
+    public class SqlDataReader : System.Data.Common.AbstractDataReader
+    {
+
+               #region Constructors
+
+               internal SqlDataReader(SqlCommand command) : base(command)
+        {
+        }
+
+               #endregion // Constructors
+
+               #region Properties
+
+               #endregion // Properties
+
+               #region Methods
+
+               protected override SystemException CreateException(string message, SQLException e)\r
+               {\r
+                       return new SqlException(message, e, (SqlConnection)_command.Connection);                \r
+               }\r
+\r
+               protected override SystemException CreateException(java.io.IOException e)\r
+               {\r
+                       return new SqlException(e, (SqlConnection)_command.Connection);\r
+               }\r
+\r
+               public override String GetDataTypeName(int columnIndex)\r
+               {\r
+                       try {\r
+                               string jdbcTypeName = Results.getMetaData().getColumnTypeName(columnIndex + 1);\r
+                               \r
+                               return SqlConvert.JdbcTypeNameToDbTypeName(jdbcTypeName);\r
+                       }\r
+                       catch (SQLException e) {\r
+                               throw CreateException(e);\r
+                       }\r
+               }\r
+\r
+               protected override int GetProviderType(int jdbcType)
+               {
+                       return (int)SqlConvert.JdbcTypeToSqlDbType(jdbcType);   
+               }
+
+        // Gets the value of the specified column as a SqlBinary.
+        public SqlBinary GetSqlBinary(int columnIndex)
+        {
+                       byte[] bytes = GetBytes(columnIndex);
+            if(IsDBNull(columnIndex)) {
+                               return SqlBinary.Null;
+                       }
+            else {
+                               return new SqlBinary(bytes);
+            }
+        }
+
+        // Gets the value of the specified column as a SqlBoolean.
+        public SqlBoolean GetSqlBoolean(int columnIndex)
+        {
+                       bool boolean = GetBoolean(columnIndex);
+            if(IsDBNull(columnIndex)) {
+                return SqlBoolean.Null;
+                       }
+                       else {
+                               return new SqlBoolean(boolean);\r
+            }
+        }
+
+        // Gets the value of the specified column as a SqlByte.
+        public SqlByte GetSqlByte(int columnIndex)
+        {
+                       byte byt = GetByte(columnIndex);
+            if(IsDBNull(columnIndex)) {
+                return SqlByte.Null;
+                       }
+            else {\r
+                return new SqlByte(byt);\r
+            }
+        }
+
+
+        // Gets the value of the specified column as a SqlDecimal.
+        public SqlDecimal GetSqlDecimal(int columnIndex)
+        {
+                       decimal dec = GetDecimal(columnIndex);
+            if(IsDBNull(columnIndex)) {
+                return SqlDecimal.Null;
+                       }
+            else {\r
+                return new SqlDecimal(dec);\r
+            }
+        }
+
+        // Gets the value of the specified column as a SqlDateTime.
+        public SqlDateTime GetSqlDateTime(int columnIndex)
+        {
+                       DateTime dateTime = GetDateTime(columnIndex);
+            if(IsDBNull(columnIndex)) {
+                return SqlDateTime.Null;
+                       }
+            else {\r
+                return new SqlDateTime(dateTime);\r
+            }
+        }
+
+        // Gets the value of the specified column as a SqlDouble.
+        public SqlDouble GetSqlDouble(int columnIndex)
+        {
+                       double doubl = GetDouble(columnIndex);
+            if(IsDBNull(columnIndex)) {
+                return SqlDouble.Null;
+                       }
+            else {\r
+                return new SqlDouble(doubl);\r
+            }
+        }
+
+        // Gets the value of the specified column as a SqlInt16.
+        public SqlInt16 GetSqlInt16(int columnIndex)
+        {
+                       short s = GetInt16(columnIndex);
+            if(IsDBNull(columnIndex)) {
+                return SqlInt16.Null;
+                       }
+            else {\r
+                return new SqlInt16(s);\r
+            }
+        }
+
+        // Gets the value of the specified column as a SqlInt32.
+        public SqlInt32 GetSqlInt32(int columnIndex)
+        {
+                       int i = GetInt32(columnIndex);
+            if(IsDBNull(columnIndex)) {
+                return SqlInt32.Null;
+                       }
+            else {\r
+                return new SqlInt32(i);\r
+            }
+        }
+
+        // Gets the value of the specified column as a SqlInt64.
+        public SqlInt64 GetSqlInt64(int columnIndex)
+        {
+                       long l = GetInt64(columnIndex);
+            if(IsDBNull(columnIndex)) {
+                return SqlInt64.Null;
+                       }
+            else {\r
+                return new SqlInt64(l);\r
+            }
+        }
+
+        // Gets the value of the specified column as a SqlMoney.
+        public SqlMoney GetSqlMoney(int columnIndex)
+        {
+                       decimal dec = GetDecimal(columnIndex);
+            if(IsDBNull(columnIndex)) {
+                return SqlMoney.Null;
+                       }
+                       else {
+                               return new SqlMoney(dec);
+                       }
+        }
+
+        // Gets the value of the specified column as a SqlSingle.
+        public SqlSingle GetSqlSingle(int columnIndex)
+        {
+                       float f = GetFloat(columnIndex);
+            if(IsDBNull(columnIndex)) {
+                return SqlSingle.Null;
+                       }
+            else {\r
+                return new SqlSingle(f);\r
+            }
+        }
+
+        // Gets the value of the specified column as a SqlString.
+        public SqlString GetSqlString(int columnIndex)
+        {
+                       string str = GetString(columnIndex);
+            if(IsDBNull(columnIndex)) {
+                return SqlString.Null;
+                       }
+            else {\r
+                return new SqlString(str);\r
+            }
+        }
+
+               // Gets the value of the specified column as a SqlGuid.
+        public SqlGuid GetSqlGuid(int columnIndex)
+        {
+                       object obj = GetValue(columnIndex);
+            if(IsDBNull(columnIndex)) {
+                return SqlGuid.Null;
+                       }
+            else {\r
+                               if (obj is byte[]) {\r
+                                       return new SqlGuid((byte[])obj);\r
+                               }\r
+                               else {\r
+                                       return new SqlGuid((string)obj);\r
+                               }\r
+            }
+        }
+
+               // Gets all the attribute columns in the current row.
+        public int GetSqlValues(Object[] values)
+        {
+            int columnCount = FieldCount;
+            int i = 0;
+            for (; i < values.Length && i < columnCount; i++) {
+                values[i] = GetSqlValue(i);
+            }
+            return i;
+        }
+
+               // Gets an Object that is a representation of the underlying SqlDbType Variant.
+        public Object GetSqlValue(int columnIndex)
+        {
+            try {
+                               int jdbcType = ResultsMetaData.getColumnType(columnIndex + 1);
+                               SqlDbType sqlDbType = SqlConvert.JdbcTypeToSqlDbType(jdbcType);
+
+                               switch (sqlDbType) {\r
+                                       case SqlDbType.BigInt : return GetSqlInt64(columnIndex);\r
+                                       case SqlDbType.Binary : return GetSqlBinary(columnIndex);\r
+                                       case SqlDbType.Bit : return GetSqlBoolean(columnIndex);\r
+                                       case SqlDbType.Char : return GetSqlString(columnIndex);\r
+                                       case SqlDbType.DateTime : return GetSqlDateTime(columnIndex);\r
+                                       case SqlDbType.Decimal : return GetSqlDecimal(columnIndex);\r
+                                       case SqlDbType.Float : return GetSqlDouble(columnIndex);\r
+                                       case SqlDbType.Image : return GetSqlBinary(columnIndex);\r
+                                       case SqlDbType.Int : return GetSqlInt32(columnIndex);\r
+                                       case SqlDbType.Money : return GetSqlDecimal(columnIndex);\r
+                                       case SqlDbType.NChar : return GetSqlString(columnIndex);\r
+                                       case SqlDbType.NText : return GetSqlString(columnIndex);\r
+                                       case SqlDbType.NVarChar : return GetSqlString(columnIndex);\r
+                                       case SqlDbType.Real : return GetSqlSingle(columnIndex);\r
+                                       case SqlDbType.UniqueIdentifier : return GetSqlGuid(columnIndex);\r
+                                       case SqlDbType.SmallDateTime : return GetSqlDateTime(columnIndex);\r
+                                       case SqlDbType.SmallInt : return GetSqlInt16(columnIndex);\r
+                                       case SqlDbType.SmallMoney : return GetSqlDecimal(columnIndex);\r
+                                       case SqlDbType.Text : return GetSqlString(columnIndex);\r
+                                       case SqlDbType.Timestamp : return GetSqlDateTime(columnIndex);\r
+                                       case SqlDbType.TinyInt : return GetSqlByte(columnIndex);\r
+                                       case SqlDbType.VarBinary : return GetSqlBinary(columnIndex);\r
+                                       case SqlDbType.VarChar : return GetSqlString(columnIndex);\r
+                                       case SqlDbType.Variant : return GetValue(columnIndex);\r
+                                       default : return GetValue(columnIndex);\r
+                               }
+            }
+            catch (SQLException exp) {
+                throw new Exception(exp.Message);
+            }
+        }
+
+               #endregion // Methods
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlError.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlError.cs
new file mode 100644 (file)
index 0000000..234832e
--- /dev/null
@@ -0,0 +1,155 @@
+/* 
+ * @(#)SqlError.java   1.0 01/01/03
+ *
+ * Copyright 2002 Mainsoft Corporation. All Rights Reserved.
+ *
+ * This software is the proprietary information of Mainsoft Corporation.
+ * Use is subject to license terms.
+ *
+ */
+
+namespace System.Data.SqlClient
+{
+       using System.Data.ProviderBase;
+       using java.sql;
+       using System.Data.Common;
+
+    /**
+     * Collects information relevant to a warning or error returned by SQL Server.
+     *
+     * @author  Pavel Sandler
+     * @version 1.0, 01/01/03
+     */
+
+       [Serializable]
+    public class SqlError : AbstractDbError
+    {
+               string _serverVersion;
+        /**
+         * Initialize SqlError object
+         * */
+        internal SqlError(SQLException e, AbstractDBConnection connection) : base(e, connection)
+        {
+                       if (connection != null)
+                               _serverVersion = connection.ServerVersion;
+        }
+
+        /**
+         * Overridden. Gets the complete text of the error message.
+         *
+         * @return A string representation of the current object.
+         */
+        public override String ToString()
+        {
+            return String.Concat("SqlError:", Message, _e.StackTrace);
+        }
+
+        /**
+         * Gets the name of the provider that generated the error.
+         *
+         * @return The name of the provider
+         */
+        public String Source
+        {
+            get
+            {
+                return DbSource;
+            }
+        }
+
+        /**
+         * Gets a number that identifies the type of error.
+         *
+         * @return Number of the error
+         */
+        public int Number
+        {
+            get
+            {
+                return DbErrorCode;
+            }
+        }
+
+        /**
+         * Gets a numeric error code from SQL Server that represents an error,
+         * warning or "no data found" message. For more information on how to
+         * decode these values, see SQL Server Books Online.
+         *
+         * @return Error Code
+         */
+        public byte State
+        {
+            get
+            {
+                return 0; // & BitConstants.ALL_BYTE;
+            }
+        }
+
+        /**
+         * Gets the severity level of the error returned from SQL Server.
+         *
+         * @return Severity level of the error
+         */
+        public byte Class
+        {
+            get
+            {
+                return 0; // & BitConstants.ALL_BYTE;
+            }
+        }
+
+        /**
+         * Gets the name of the instance of SQL Server that generated the error.
+         *
+         * @return The name of the server
+         */
+        public String Server
+        {
+            get
+            {
+                return _serverVersion;
+            }
+        }
+
+        /**
+         * Gets the text describing the error.
+         *
+         * @return The text describing the error
+         */
+        public String Message
+        {
+            get
+            {
+                return DbMessage;
+            }
+        }
+
+        /**
+         * Gets the name of the stored procedure or remote procedure call (RPC)
+         * that generated the error.
+         *
+         * @return The name of stored procedure that generated the error.
+         */
+        public String Procedure
+        {
+            get
+            {
+                return null;
+            }
+        }
+
+        /**
+         * Bets the line number within the Transact-SQL command batch or stored
+         * procedure that contains the error.
+         *
+         * @return Line number of error in stored procedure
+         */
+        public int LineNumber
+        {
+            get
+            {
+                return 0;
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlErrorCollection.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlErrorCollection.cs
new file mode 100644 (file)
index 0000000..ec18229
--- /dev/null
@@ -0,0 +1,51 @@
+/* 
+ * @(#)SqlErrorCollection.java 1.0 01/01/03
+ *
+ * Copyright 2002 Mainsoft Corporation. All Rights Reserved.
+ *
+ * This software is the proprietary information of Mainsoft Corporation.
+ * Use is subject to license terms.
+ *
+ */
+
+namespace System.Data.SqlClient
+{
+
+    /**
+     * Collects all errors generated by the SQL .NET Data Provider.
+     *
+     * @author  Pavel Sandler
+     * @version 1.0, 01/01/03
+     */
+
+    using System.Collections;
+       using System.Data.Common;
+       using System.Data.ProviderBase;
+       using java.sql;
+
+
+       [Serializable]
+    public class SqlErrorCollection : AbstractDbErrorCollection
+    {
+               internal SqlErrorCollection(SQLException e, AbstractDBConnection connection) : base(e, connection) {}
+        /**
+         * Gets the error at the specified index.
+         *
+         * @param index of the error
+         * @return Error on specified index
+         */
+        public SqlError this[int index]\r
+        {\r
+            get\r
+            {\r
+                return (SqlError)GetDbItem(index);\r
+            }\r
+        }\r
+\r
+               protected override AbstractDbError CreateDbError(java.sql.SQLException e, System.Data.Common.AbstractDBConnection connection) {\r
+                       return new SqlError(e, connection);\r
+               }\r
+\r
+        
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlException.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlException.cs
new file mode 100644 (file)
index 0000000..b1859c8
--- /dev/null
@@ -0,0 +1,146 @@
+/* \r
+ * @(#)SqlException.java    1.0 01/01/03\r
+ *\r
+ * Copyright 2002 Mainsoft Corporation. All Rights Reserved.\r
+ *\r
+ * This software is the proprietary information of Mainsoft Corporation.\r
+ * Use is subject to license terms.\r
+ *\r
+ */\r
+namespace System.Data.SqlClient\r
+{\r
+\r
+    using java.sql;\r
+\r
+    using System;\r
+       using System.Data.ProviderBase;\r
+\r
+    /**\r
+     * The exception that is thrown when SQL Server returns a warning or error.\r
+     * This class cannot be inherited.\r
+     *\r
+     * @author  Pavel Sandler\r
+     * @version 1.0, 01/01/03\r
+     */\r
+\r
+    /*\r
+    * CURRENT LIMITATIONS\r
+    * 1. Constructor for serialization SqlException(SerializationInfo info, StreamingContext sc) \r
+    *    is not supported.\r
+    * 2. Method "void GetObjectData(...,...)" is not supported (serialization)\r
+    */\r
+\r
+    public sealed class SqlException : AbstractDbException\r
+    {\r
+               internal SqlException(Exception cause, SqlConnection connection) : base(cause, connection) {}\r
+\r
+               internal SqlException(SQLException cause, SqlConnection connection) : base(cause, connection) {}\r
+\r
+               internal SqlException(string message, SQLException cause, SqlConnection connection) : base(message, cause, connection) {}\r
+\r
+               protected override AbstractDbErrorCollection DbErrors {\r
+                       get {\r
+                               return Errors;\r
+                       }\r
+               }\r
+\r
+        \r
+\r
+        /**\r
+         * Gets the severity level of the error returned from the SQL Server .NET \r
+         * Data Provider.\r
+         * @return severity level of the first error in the collection.\r
+         */\r
+        public byte Class\r
+        {\r
+            get\r
+            {\r
+                               SqlErrorCollection errors = Errors;\r
+                               return errors.Count > 0 ? errors[0].Class : (byte)0;\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Gets a collection of one or more SqlError objects that give detailed \r
+         * information about exceptions generated by the SQL Server .NET Data Provider.\r
+         * @return collection of SqlError objects\r
+         */\r
+        public SqlErrorCollection Errors\r
+        {\r
+            get\r
+            {\r
+                return new SqlErrorCollection(_cause, _connection);\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Gets the line number within the Transact-SQL command batch or stored \r
+         * procedure that generated the error.\r
+         * @return line number of the first error in the collection.\r
+         */\r
+        public int LineNumber\r
+        {\r
+            get\r
+            {\r
+                               SqlErrorCollection errors = Errors;\r
+                               return errors.Count > 0 ? errors[0].LineNumber : 0;\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Gets a number that identifies the type of error.\r
+         * @return number that identifies the type of first error in the collection\r
+         */\r
+        public int Number\r
+        {\r
+            get\r
+            {\r
+                               SqlErrorCollection errors = Errors;\r
+                               return errors.Count > 0 ? errors[0].Number : 0;\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Gets the name of the stored procedure or remote procedure call (RPC) \r
+         * that generated the error.\r
+         * @return name of the stored procedure \r
+         */\r
+        public String Procedure\r
+        {\r
+            get\r
+            {\r
+                               SqlErrorCollection errors = Errors;\r
+                               return errors.Count > 0 ? errors[0].Procedure : null;\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Gets the name of the computer running an instance of SQL Server \r
+         * that generated the error.\r
+         * @return name of the computer where error generated\r
+         */\r
+        public String Server\r
+        {\r
+            get\r
+            {\r
+                               SqlErrorCollection errors = Errors;\r
+                               return errors.Count > 0 ? errors[0].Server : null;\r
+            }\r
+        }\r
+\r
+\r
+        /**\r
+         * Gets a numeric error code from SQL Server that represents an error, \r
+         * warning or "no data found" message. \r
+         * @return numeric error code from SQL Server\r
+         */\r
+        public byte State\r
+        {\r
+            get\r
+            {\r
+                               SqlErrorCollection errors = Errors;\r
+                               return errors.Count > 0 ? errors[0].State : (byte)0;\r
+            }\r
+        }\r
+    }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlInfoMessageEventArgs.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlInfoMessageEventArgs.cs
new file mode 100644 (file)
index 0000000..781529e
--- /dev/null
@@ -0,0 +1,54 @@
+using System;
+using System.Data;\r
+\r
+namespace System.Data.SqlClient\r
+{\r
+       /// <summary>\r
+       /// Summary description for SqlInfoMessageEventArgs.\r
+       /// </summary>\r
+       public sealed class SqlInfoMessageEventArgs : EventArgs
+       {
+               #region Fields
+
+               SqlErrorCollection errors ;
+
+               #endregion // Fields
+
+               #region Constructors
+       
+               internal SqlInfoMessageEventArgs (SqlErrorCollection errors)
+               {
+                       this.errors = errors;
+               }
+
+               #endregion // Constructors
+
+               #region Properties
+
+               public SqlErrorCollection Errors \r
+               {
+                       get { return errors; }
+               }       
+
+               public string Message \r
+               {
+                       get { return errors[0].Message; }
+               }       
+
+               public string Source \r
+               {
+                       get { return errors[0].Source; }
+               }
+
+               #endregion // Properties
+
+               #region Methods
+
+               public override string ToString() 
+               {
+                       return Message;
+               }
+
+               #endregion // Methods
+       }\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlInfoMessageEventHandler.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlInfoMessageEventHandler.cs
new file mode 100644 (file)
index 0000000..91db287
--- /dev/null
@@ -0,0 +1,6 @@
+using System;\r
+\r
+namespace System.Data.SqlClient\r
+{\r
+       public delegate void SqlInfoMessageEventHandler (object sender, SqlInfoMessageEventArgs e);\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlParameter.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlParameter.cs
new file mode 100644 (file)
index 0000000..657ba3c
--- /dev/null
@@ -0,0 +1,217 @@
+//\r
+// System.Data.SqlClient.SqlParameter\r
+//\r
+// Author:\r
+//   Boris Kirzner (borisk@mainsoft.com)\r
+//
+
+using System;
+using System.Collections;
+using System.Data;
+using System.Data.ProviderBase;
+using System.Data.Common;
+
+using java.sql;
+
+namespace System.Data.SqlClient
+{
+       public class SqlParameter : AbstractDbParameter, IDbDataParameter, ICloneable
+       {
+               #region Fields
+
+               private SqlDbType _sqlDbType;
+
+               #endregion // Fields
+
+               #region Constructors
+
+               public SqlParameter()
+               {
+               }
+
+               public SqlParameter(String parameterName, Object value)
+                       : this(parameterName, SqlDbType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, value,false)
+               {
+               }
+
+               public SqlParameter(String parameterName, SqlDbType dbType)
+                       : this(parameterName, dbType, 0, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, null, true)
+               {
+               }
+
+        
+               public SqlParameter(String parameterName, SqlDbType dbType, int size)
+                       : this(parameterName, dbType, size, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, null, true)
+               {
+               }
+
+
+               public SqlParameter(String parameterName, SqlDbType dbType, int size, String sourceColumn)
+                       : this(parameterName, dbType, size, ParameterDirection.Input, false, 0, 0, sourceColumn, DataRowVersion.Current, null, true)
+               {
+               }
+
+        
+               public SqlParameter(
+                       String parameterName,
+                       SqlDbType dbType,
+                       int size,
+                       ParameterDirection direction,
+                       bool isNullable,
+                       byte precision,
+                       byte scale,
+                       String sourceColumn,
+                       DataRowVersion sourceVersion,
+                       Object value) : this(parameterName,dbType,size,direction,isNullable,precision,scale,sourceColumn,sourceVersion,value,true)
+               {
+               }
+
+               public SqlParameter(
+                       String parameterName,
+                       SqlDbType dbType,
+                       int size,
+                       ParameterDirection direction,
+                       bool isNullable,
+                       byte precision,
+                       byte scale,
+                       String sourceColumn,
+                       DataRowVersion sourceVersion,
+                       Object value,
+                       bool dbTypeExplicit)
+               {
+                       ParameterName = parameterName;
+                       SqlDbType = dbType;
+                       Size = size;
+                       Direction = direction;
+                       IsNullable = isNullable;
+                       Precision = precision;
+                       Scale = scale;
+                       SourceColumn = sourceColumn;
+                       SourceVersion = sourceVersion;
+                       if (!dbTypeExplicit) {
+                               _isDbTypeSet = false;
+                       }
+                       Value = value;
+               }
+
+               #endregion // Constructors
+
+               #region Properties
+
+               public override DbType DbType\r
+        {\r
+            get { return SqlConvert.SqlDbTypeToDbType(_sqlDbType); }           \r
+                       set { _sqlDbType = SqlConvert.DbTypeToSqlDbType(value); }\r
+        }                \r
+        \r
+        public SqlDbType SqlDbType\r
+        {\r
+            get { return _sqlDbType; }            \r
+                       set {\r
+                _sqlDbType = value;\r
+                               _isDbTypeSet = true;\r
+            }\r
+        }                 
+        
+               public override byte Precision
+               {
+                       get { return _precision; }
+                       set { _precision = value; }
+               }
+        
+               public override int Size
+               {
+                       get {
+                               int retVal = base.Size;
+                               return retVal;
+                       }
+                       set {
+                               if (value < 0) {
+                                       throw ExceptionHelper.InvalidSizeValue(value);
+                               }
+
+                               if (value != 0) {
+                                       base.Size = value;
+                               }
+                               else {
+                                       base.Size = -1;
+                               }
+                       }
+               }
+
+               protected internal override string Placeholder {\r
+                       get {\r
+                               return ParameterName;\r
+                       }\r
+               }\r
+
+        
+               public override Object Value
+               {
+                       get { return base.Value; }
+                       set { 
+                               if (!_isDbTypeSet && (value != null)) {\r
+                    _sqlDbType = SqlConvert.ValueTypeToSqlDbType(value.GetType());\r
+                               }
+                               base.Value = value; 
+                       }
+               }
+
+               #endregion // Properties
+
+               #region Methods
+
+               public override String ToString()
+               {
+                       return ParameterName;
+               }
+
+               public override object Clone()
+               {
+            SqlParameter clone = new SqlParameter();\r
+                       CopyTo(clone);\r
+\r
+            clone._sqlDbType = _sqlDbType;\r
+            return clone;
+               }
+
+               internal override object ConvertValue(object value)\r
+               {\r
+                       // can not convert null or DbNull to other types\r
+                       if (value == null || value == DBNull.Value) {\r
+                               return value;\r
+                       }\r
+                       // .NET throws an exception to the user.\r
+                       object convertedValue = Convert.ChangeType(value,SqlConvert.SqlDbTypeToValueType(SqlDbType));\r
+                       return convertedValue;\r
+               }
+
+               internal override void SetParameterName(ResultSet res)\r
+               {\r
+                       string name = res.getString("COLUMN_NAME");\r
+                       if (name != null && name.Length > 0 && name[0] != '@')\r
+                               name = String.Concat("@", name);\r
+                       ParameterName = name;\r
+               }\r
+\r
+               internal override void SetParameterDbType(ResultSet res)\r
+               {\r
+                       int dataType = res.getInt("DATA_TYPE");\r
+                       SqlDbType = SqlConvert.JdbcTypeToSqlDbType(dataType);\r
+                       JdbcType = (DbTypes.JavaSqlTypes) dataType;\r
+               }\r
+\r
+               internal override void SetSpecialFeatures(ResultSet res)\r
+               {\r
+                       // do nothing\r
+               }
+
+               internal override DbTypes.JavaSqlTypes JdbcTypeFromProviderType()\r
+               {\r
+                       return (DbTypes.JavaSqlTypes)SqlConvert.SqlDbTypeToJdbcType(SqlDbType);\r
+               }
+
+               #endregion // Methods  \r
+\r
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlParameterCollection.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlParameterCollection.cs
new file mode 100644 (file)
index 0000000..a058182
--- /dev/null
@@ -0,0 +1,105 @@
+//\r
+// System.Data.Common.SqlParameterCollection\r
+//\r
+// Author:\r
+//   Boris Kirzner (borisk@mainsoft.com)\r
+//\r
+\r
+/*\r
+  * Copyright (c) 2002-2004 Mainsoft Corporation.\r
+  *\r
+  * Permission is hereby granted, free of charge, to any person obtaining a\r
+  * copy of this software and associated documentation files (the "Software"),\r
+  * to deal in the Software without restriction, including without limitation\r
+  * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+  * and/or sell copies of the Software, and to permit persons to whom the\r
+  * Software is furnished to do so, subject to the following conditions:\r
+  *\r
+  * The above copyright notice and this permission notice shall be included in\r
+  * all copies or substantial portions of the Software.\r
+  *\r
+  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+  * DEALINGS IN THE SOFTWARE.\r
+  */
+
+using System.Data.ProviderBase;
+
+namespace System.Data.SqlClient
+{
+    public class SqlParameterCollection : AbstractDbParameterCollection
+    {
+               #region Constructors
+
+        public SqlParameterCollection(SqlCommand parent): base(parent)
+        {
+        }
+
+               #endregion // Constructors
+
+               #region Properties
+
+        public SqlParameter this[string parameterName]
+        {
+            get { return (SqlParameter)base[parameterName]; }\r
+            set { 
+                               OnSchemaChanging();
+                               base[parameterName] = value; 
+                       }
+        }
+
+        public SqlParameter this[int index]
+        {
+            get { return (SqlParameter)base[index]; }\r
+            set { 
+                               base.OnSchemaChanging();
+                               base[index] = value; 
+                       }
+        }
+
+               protected override Type ItemType { \r
+                       get { return typeof(SqlParameter); }\r
+               }
+
+               #endregion // Properties
+
+               #region Methods       
+
+        public SqlParameter Add(SqlParameter value)
+        {
+            base.Add(value);
+            return value;
+        }
+
+        public SqlParameter Add(string parameterName, object value)
+        {
+            SqlParameter param = new SqlParameter(parameterName,value);
+            return Add(param);
+        }
+
+        public SqlParameter Add(string parameterName, SqlDbType sqlDbType)
+        {
+            SqlParameter param = new SqlParameter(parameterName,sqlDbType);
+            return Add(param);
+        }
+
+        public SqlParameter Add(string parameterName, SqlDbType sqlDbType, int size)
+        {
+            SqlParameter param = new SqlParameter(parameterName,sqlDbType,size);
+            return Add(param);
+        }
+
+        public SqlParameter Add(string parameterName, SqlDbType sqlDbType, int size, string sourceColumn)
+        {
+            SqlParameter param = new SqlParameter(parameterName,sqlDbType,size,sourceColumn);
+            return Add(param);
+        }\r
+\r
+               #endregion // Methods\r
+
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlParameterConverter.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlParameterConverter.cs
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlResultSet.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlResultSet.cs
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlRowUpdatedEventArgs.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlRowUpdatedEventArgs.cs
new file mode 100644 (file)
index 0000000..dcee6e4
--- /dev/null
@@ -0,0 +1,37 @@
+//\r
+// System.Data.SqlClient.SqlRowUpdatedEventArgs.cs\r
+//\r
+// Author:\r
+//   Rodrigo Moya (rodrigo@ximian.com)\r
+//   Daniel Morgan (danmorg@sc.rr.com)\r
+//   Tim Coleman (tim@timcoleman.com)\r
+//\r
+// (C) Ximian, Inc 2002\r
+// Copyright (C) Tim Coleman, 2002\r
+//\r
+\r
+using System;\r
+using System.Data;\r
+using System.Data.Common;\r
+\r
+namespace System.Data.SqlClient {\r
+       public sealed class SqlRowUpdatedEventArgs : RowUpdatedEventArgs \r
+       {\r
+               #region Constructors\r
+\r
+               public SqlRowUpdatedEventArgs (DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) \r
+                       : base (row, command, statementType, tableMapping)\r
+               {\r
+               }\r
+\r
+               #endregion // Constructors\r
+\r
+               #region Properties\r
+\r
+               public new SqlCommand Command {\r
+                       get { return (SqlCommand) base.Command; }\r
+               }\r
+\r
+               #endregion // Properties\r
+       }\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlRowUpdatedEventHandler.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlRowUpdatedEventHandler.cs
new file mode 100644 (file)
index 0000000..18a9c33
--- /dev/null
@@ -0,0 +1,15 @@
+//\r
+// System.Data.SqlClient.SqlRowUpdatedEventHandler.cs\r
+//\r
+// Author:\r
+//   Rodrigo Moya (rodrigo@ximian.com)\r
+//   Daniel Morgan (danmorg@sc.rr.com)\r
+//\r
+// (C) Ximian, Inc 2002\r
+//\r
+\r
+using System;\r
+\r
+namespace System.Data.SqlClient {\r
+       public delegate void SqlRowUpdatedEventHandler (object sender, SqlRowUpdatedEventArgs e);\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlRowUpdatingEventArgs.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlRowUpdatingEventArgs.cs
new file mode 100644 (file)
index 0000000..6ef769a
--- /dev/null
@@ -0,0 +1,38 @@
+//\r
+// System.Data.SqlClient.SqlRowUpdatingEventArgs.cs\r
+//\r
+// Author:\r
+//   Rodrigo Moya (rodrigo@ximian.com)\r
+//   Daniel Morgan (danmorg@sc.rr.com)\r
+//   Tim Coleman (tim@timcoleman.com)\r
+//\r
+// (C) Ximian, Inc 2002\r
+// Copyright (C) Tim Coleman, 2002\r
+//\r
+\r
+using System;\r
+using System.Data;\r
+using System.Data.Common;\r
+\r
+namespace System.Data.SqlClient {\r
+       public sealed class SqlRowUpdatingEventArgs : RowUpdatingEventArgs\r
+       {\r
+               #region Constructors\r
+\r
+               public SqlRowUpdatingEventArgs (DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) \r
+                       : base (row, command, statementType, tableMapping)\r
+               {\r
+               }\r
+\r
+               #endregion // Constructors\r
+\r
+               #region Properties\r
+\r
+               public new SqlCommand Command {\r
+                       get { return (SqlCommand) base.Command; }\r
+                       set { base.Command = value; }\r
+               }\r
+\r
+               #endregion // Properties\r
+       }\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlRowUpdatingEventHandler.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlRowUpdatingEventHandler.cs
new file mode 100644 (file)
index 0000000..823ccb7
--- /dev/null
@@ -0,0 +1,15 @@
+//\r
+// System.Data.SqlClient.SqlRowUpdatingEventHandler.cs\r
+//\r
+// Author:\r
+//   Rodrigo Moya (rodrigo@ximian.com)\r
+//   Daniel Morgan (danmorg@sc.rr.com)\r
+//\r
+// (C) Ximian, Inc 2002\r
+//\r
+\r
+using System;\r
+\r
+namespace System.Data.SqlClient {\r
+       public delegate void SqlRowUpdatingEventHandler(object sender, SqlRowUpdatingEventArgs e);\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlStringManager.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlStringManager.cs
new file mode 100644 (file)
index 0000000..3b78161
--- /dev/null
@@ -0,0 +1,67 @@
+//namespace System.Data.SqlClient\r
+//{\r
+//\r
+//\r
+//    using java.util;\r
+//\r
+//    public class SqlStringManager : IDbStringManager\r
+//    {\r
+//\r
+//        private static readonly String BUNDLE_NAME = "SqlClientStrings"; //$NON-NLS-1$\r
+//\r
+//        private static readonly ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);\r
+//\r
+//        private SqlStringManager()\r
+//        {\r
+//        }\r
+//\r
+//        public String getString(String key)\r
+//        {\r
+//            try\r
+//            {\r
+//                return RESOURCE_BUNDLE.getString(key);\r
+//            }\r
+//            catch (MissingResourceException)\r
+//            {\r
+//                return null;\r
+//            }\r
+//        }\r
+//     \r
+//        public String getString(String key, String defaultValue)\r
+//        {\r
+//            try\r
+//            {\r
+//                return RESOURCE_BUNDLE.getString(key);\r
+//            }\r
+//            catch (MissingResourceException)\r
+//            {\r
+//                return defaultValue;\r
+//            }\r
+//        }\r
+//     \r
+//     \r
+//        public String[] getStringArray(String key)\r
+//        {\r
+//            try\r
+//            {\r
+//                String tmp = RESOURCE_BUNDLE.getString(key);\r
+//                java.util.StringTokenizer st = new java.util.StringTokenizer(tmp, ",");\r
+//                     \r
+//                String[] strArr = new String[st.countTokens()];\r
+//                     \r
+//                for (int i = 0; i < strArr.Length; i++)\r
+//                {\r
+//                    strArr[i] = st.nextToken();\r
+//                             \r
+//                }\r
+//                             \r
+//                return strArr;\r
+//                     \r
+//            }\r
+//            catch (MissingResourceException)\r
+//            {\r
+//                return null;\r
+//            }\r
+//        }\r
+//    }\r
+//}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlTransaction.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlTransaction.cs
new file mode 100644 (file)
index 0000000..cab9afd
--- /dev/null
@@ -0,0 +1,53 @@
+namespace System.Data.SqlClient
+{
+
+    /**
+     * <p>Title: </p>
+     * <p>Description: </p>
+     * <p>Copyright: Copyright (c) 2002</p>
+     * <p>Company: </p>
+     * @author unascribed
+     * @version 1.0
+     */
+
+    using System.Data;
+
+
+    /*
+    * Current Limitations:
+    * 1. Rollback(String savePoint) - not implemented.
+    * 2. Save(String) - not implemented.
+    */
+
+    public sealed class SqlTransaction : System.Data.Common.AbstractTransaction
+    {
+    
+
+        internal SqlTransaction(IsolationLevel isolationLevel, SqlConnection connection, String transactionName) : base(isolationLevel, connection, transactionName)
+        {
+        }
+
+        
+        internal SqlTransaction(SqlConnection connection) : base(IsolationLevel.ReadCommitted, connection, null)
+        {
+        }
+
+        internal SqlTransaction(SqlConnection connection, String transactionName) : base(IsolationLevel.ReadCommitted, connection, transactionName)
+        {
+        }
+
+        internal SqlTransaction(IsolationLevel isolationLevel, SqlConnection connection) : base(isolationLevel, connection, null)
+        {
+        }
+
+        public new SqlConnection Connection\r
+        {\r
+            get\r
+            {\r
+                return (SqlConnection)_connection;\r
+            }\r
+        }\r
+
+
+    
+    }}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlXmlTextReader.cs b/mcs/class/System.Data/System.Data.SqlClient.jvm/SqlXmlTextReader.cs
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/INullable.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/INullable.cs
new file mode 100644 (file)
index 0000000..2fff87d
--- /dev/null
@@ -0,0 +1,13 @@
+namespace System.Data.SqlTypes
+{
+
+
+
+    public interface INullable
+    {
+        bool IsNull
+        {
+            get;
+        }
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlBinary.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlBinary.cs
new file mode 100644 (file)
index 0000000..73cb69e
--- /dev/null
@@ -0,0 +1,422 @@
+ /*\r
+  * Copyright (c) 2002-2004 Mainsoft Corporation.\r
+  *\r
+  * Permission is hereby granted, free of charge, to any person obtaining a\r
+  * copy of this software and associated documentation files (the "Software"),\r
+  * to deal in the Software without restriction, including without limitation\r
+  * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+  * and/or sell copies of the Software, and to permit persons to whom the\r
+  * Software is furnished to do so, subject to the following conditions:\r
+  *\r
+  * The above copyright notice and this permission notice shall be included in\r
+  * all copies or substantial portions of the Software.\r
+  *\r
+  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+  * DEALINGS IN THE SOFTWARE.\r
+  */
+namespace System.Data.SqlTypes
+{
+
+    using System;
+    //using clr.exceptions;
+    //using clr.compiler.BitConstants;
+
+    /**
+     *
+     */
+    public struct SqlBinary : INullable, IComparable
+    {
+        public static readonly SqlBinary Null = new SqlBinary(true);
+        private bool _isNull;
+        private byte[] _value;
+        
+        private SqlBinary(bool isNull)
+        {
+            _isNull = isNull;
+            _value = null;
+        }
+        
+        /**
+         * Initializes a new instance of the SqlBinary instance,
+         * setting the Value property to the contents of the supplied byte array.
+         * @param value The byte array to be stored or retrieved.
+         */
+        public SqlBinary(byte[] value)
+        {
+            if (value != null && value.Length > 0)
+            {
+                _value = new byte[value.Length];
+                java.lang.System.arraycopy(value, 0, _value, 0, value.Length);
+            }
+            else
+                _value = new byte[0];
+            
+            _isNull = false;
+        }
+
+        
+        /**
+         * Indicates whether or not Value is null.
+         * @return true if Value is null, otherwise false.
+         */
+        public bool IsNull
+        {
+            get
+            {
+                return _isNull;
+            }
+        }
+
+        /**
+         * Gets the single byte from the Value property located at the position indicated by the integer parameter, index.
+         * If index indicates a position beyond the end of the byte array, a SqlNullValueException will be raised.
+         * @param index The position of the byte to be retrieved.
+         * @return The byte located at the position indicated by the integer parameter.
+         */
+        public int this[int index]
+        {
+            get
+            {
+                if (IsNull)
+                {
+                    throw new SqlNullValueException();
+                }
+                if (index >= _value.Length)
+                {
+                    throw new ArgumentOutOfRangeException("index");
+                }
+                return _value[index];// & BitConstants.ALL_BYTE;
+            }
+        }
+
+        /**
+         * Gets the length in bytes of the Value property.
+         * @return The length of the binary data in the Value property.
+         */
+        public int Length
+        {
+            get
+            {
+                if (IsNull)
+                {
+                    throw new SqlNullValueException();
+                }
+                return _value.Length;
+            }
+        }
+
+        /**
+         * Gets the value of the SqlBinary instance.
+         * @return the value of this instance
+         */
+        public byte[] Value
+        {
+            get
+            {
+                if (IsNull)
+                {
+                    throw new SqlNullValueException();
+                }
+                return _value;
+            }
+        }
+
+        /**
+         * Compares this instance to the supplied object and returns an indication of their relative values.
+         * @param obj The object to compare.
+         * @return A signed number indicating the relative values of the instance and the object.
+         * Less than zero This instance is less than object.
+         * Zero This instance is the same as object.
+         * Greater than zero This instance is greater than object -or-
+         * object is a null reference.
+         */
+        public int CompareTo(Object value)
+        {
+            if (value == null)
+                return 1;
+
+            if ((value is SqlBinary) == false)
+            {
+                throw new ArgumentException("Wrong value type " + 
+                    value.GetType().Name + "in SqlBinary.CompareTo");
+            }
+
+            SqlBinary obj = (SqlBinary)value;
+
+            if (this.IsNull)
+            {
+                if (obj.IsNull)
+                    return 0;
+                return -1;
+            }
+            else if (obj.IsNull)
+                return 1;
+
+            int length = _value.Length > obj._value.Length ? _value.Length : obj._value.Length;
+
+            for (int i = 0; i < length; i++)
+            {
+                if (_value[i] > obj._value[i])
+                    return 1;
+                if (_value[i] < obj._value[i])
+                    return -1;
+            }
+
+            if (_value.Length > obj._value.Length)
+                return 1;
+            if (_value.Length < obj._value.Length)
+                return -1;
+
+            return 0;
+
+        }
+
+        /**
+         * Concatenates two SqlBinary instances to create a new SqlBinary instance.
+         * @param x A SqlBinary instance.
+         * @param y A SqlBinary instance.
+         * @return The concatenated values of the x and y parameters.
+         */
+        public static SqlBinary Concat(SqlBinary x, SqlBinary y)
+        {
+            if (x.IsNull)
+            {
+                if (y.IsNull)
+                {
+                    return SqlBinary.Null;
+                }
+                else
+                    return new SqlBinary((byte[])y._value);
+            }
+            else if (y.IsNull)
+                return new SqlBinary((byte[])x._value);
+
+            byte[] newVal = new byte[x.Length + y.Length];
+
+            java.lang.System.arraycopy(x, 0, newVal, 0, x.Length);
+            java.lang.System.arraycopy(y, 0, newVal, x.Length, y.Length);
+
+            return new SqlBinary(newVal);
+
+        }
+
+        /**
+         * Performs a logical comparison on two instances of SqlBinary to determine if they are equal.
+         * @param x A SqlBinary instance.
+         * @param y A SqlBinary instance.
+         * @return true if the two values are equal, otherwise false.
+         * If one of the parameters is null or null value return SqlBoolean.Null.
+         */
+        public static SqlBoolean Equals(SqlBinary x, SqlBinary y)
+        {
+            if (x.IsNull || y.IsNull)
+                return SqlBoolean.Null;
+
+            if (x.Equals(y))
+                return SqlBoolean.True;
+
+            return SqlBoolean.False;
+
+        }
+
+        public bool equals(Object obj)
+        {
+            if (obj == null)
+                return false;
+
+            if (obj is SqlBinary)
+            {
+                SqlBinary o = (SqlBinary)obj;
+
+                if (IsNull && o.IsNull)
+                    return true;
+
+                if (IsNull || o.IsNull)
+                    return false;
+
+                if (_value.Length != o._value.Length)
+                    return false;
+
+                for (int i = 0; i < _value.Length; i++)
+                {
+                    if (_value[i] != o._value[i])
+                        return false;
+                }
+
+                return true;
+            }
+
+            return false;
+        }
+
+        /**
+         * Compares two instances of SqlBinary to determine if the first is greater than the second.
+         * @param x A SqlBinary instance
+         * @param y A SqlBinary instance
+         * @return A SqlBoolean that is True if the first instance is greater than the second instance, otherwise False.
+         * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.
+         */
+        public static SqlBoolean GreaterThan(SqlBinary x, SqlBinary y)
+        {
+            if (x.IsNull || y.IsNull)
+                return SqlBoolean.Null;
+
+            int i = x.CompareTo(y);
+
+            if ( i > 0)
+                return SqlBoolean.True;
+
+            return SqlBoolean.False;
+        }
+
+        /**
+         * Compares two instances of SqlBinary to determine if the first is greater than or equal to the second.
+         * @param x A SqlBinary instance
+         * @param y A SqlBinary instance
+         * @return A SqlBoolean that is True if the first instance is greaater than or equal to the second instance, otherwise False.
+         * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.
+         */
+        public static SqlBoolean GreaterThanOrEqual(SqlBinary x, SqlBinary y)
+        {
+            if (x.IsNull || y.IsNull)
+                return SqlBoolean.Null;
+
+            int i = x.CompareTo(y);
+
+            if ( i < 0)
+                return SqlBoolean.False;
+
+            return SqlBoolean.True;
+        }
+
+        /**
+         * Compares two instances of SqlBinary to determine if the first is less than the second.
+         * @param x A SqlBinary instance
+         * @param y A SqlBinary instance
+         * @return A SqlBoolean that is True if the first instance is less than the second instance, otherwise False.
+         * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.
+         */
+        public static SqlBoolean LessThan(SqlBinary x, SqlBinary y)
+        {
+            if (x.IsNull || y.IsNull)
+                return SqlBoolean.Null;
+
+            int i = x.CompareTo(y);
+
+            if ( i < 0)
+                return SqlBoolean.True;
+
+            return SqlBoolean.False;
+        }
+
+        /**
+         * Compares two instances of SqlBinary to determine if the first is less than or equal to the second.
+         * @param x A SqlBinary instance
+         * @param y A SqlBinary instance
+         * @return A SqlBoolean that is True if the first instance is less than or equal to the second instance, otherwise False.
+         * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.
+         */
+        public static SqlBoolean LessThanOrEqual(SqlBinary x, SqlBinary y)
+        {
+            if (x.IsNull || y.IsNull)
+                return SqlBoolean.Null;
+
+            int i = x.CompareTo(y);
+
+            if ( i > 0)
+                return SqlBoolean.False;
+
+            return SqlBoolean.True;
+        }
+
+        /**
+         * Compares two instances of SqlBinary to determine if they are equal.
+         * @param x A SqlBinary instance
+         * @param y A SqlBinary instance
+         * @return A SqlBoolean that is True if the two instances are not equal or False if the two instances are equal.
+         * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.
+         */
+        public static SqlBoolean NotEquals(SqlBinary x, SqlBinary y)
+        {
+            if (x.IsNull || y.IsNull)
+                return SqlBoolean.Null;
+
+            if (x.Equals(y))
+                return SqlBoolean.False;
+
+            return SqlBoolean.True;
+        }
+
+        public String toString()
+        {
+            if (IsNull)
+                return "null";
+
+            return "SqlBinary(" + _value.ToString() + ")";
+        }
+
+        public static SqlBinary op_Implicit(byte[] x)
+        {
+            return new SqlBinary(x);
+        }
+
+        public static byte[] op_Explicit(SqlBinary x)
+        {
+            return x.Value;
+        }
+
+        public static SqlBinary op_Addition(SqlBinary x, SqlBinary y)
+        {
+            throw new NotImplementedException("The method op_Addition in class SqlBinary is not supported");
+        }
+
+        public static SqlBinary op_Explicit(SqlGuid x)
+        {
+            if(x.IsNull)
+            {
+                return SqlBinary.Null;
+            }
+
+            return new SqlBinary(x.ToByteArray());
+        }
+
+        public static SqlBoolean op_Equality(SqlBinary x, SqlBinary y)
+        {
+            return Equals(x, y);
+        }
+
+        public static SqlBoolean op_Inequality(SqlBinary x, SqlBinary y)
+        {
+            return NotEquals(x, y);
+        }
+
+        public static SqlBoolean op_LessThan(SqlBinary x, SqlBinary y)
+        {
+            return LessThan(x, y);
+        }
+
+        public static SqlBoolean op_GreaterThan(SqlBinary x, SqlBinary y)
+        {
+            return GreaterThan(x, y);
+        }
+
+        public static SqlBoolean op_LessThanOrEqual(SqlBinary x, SqlBinary y)
+        {
+            return LessThanOrEqual(x, y);
+        }
+
+        public static SqlBoolean op_GreaterThanOrEqual(SqlBinary x, SqlBinary y)
+        {
+            return GreaterThanOrEqual(x, y);
+        }
+
+        public SqlGuid ToSqlGuid()
+        {
+            return SqlGuid.op_Explicit(this);
+        }
+    }}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlBoolean.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlBoolean.cs
new file mode 100644 (file)
index 0000000..15ea3c2
--- /dev/null
@@ -0,0 +1,536 @@
+namespace System.Data.SqlTypes
+{
+
+    public struct SqlBoolean : INullable, IComparable
+    {
+        private bool _value;
+        private bool _isNull;
+
+        public static readonly SqlBoolean Null = new SqlBoolean(true, false);
+        public static readonly SqlBoolean True = new SqlBoolean(true);
+        public static readonly SqlBoolean False = new SqlBoolean(false);
+        public static readonly SqlBoolean One = new SqlBoolean(1);
+        public static readonly SqlBoolean Zero = new SqlBoolean(0);
+
+        private SqlBoolean(bool isNull, bool value)
+        {
+            _isNull = isNull;
+            _value = value;
+        }
+        /**
+         * Initializes a new instance of the SqlBoolean instance using the supplied bool value.
+         * @param value The value for the new SqlBoolean instance; either true or false.
+         */
+        public SqlBoolean(bool value) 
+        {
+            _value = value;
+            _isNull = false;
+        }
+
+        /**
+         * Initializes a new instance of the SqlBoolean instance using the specified integer value.
+         * @param value The integer whose value is to be used for the new SqlBoolean instance.
+         */
+        public SqlBoolean(int value)
+        {
+            if (value == 0)
+                _value = false;
+            else
+                _value = true;
+
+            _isNull = false;
+        }
+
+        
+
+        public int hashCode()
+        {
+            if (IsNull)
+                return 0;
+        
+            return _value.GetHashCode();
+        }
+
+        /**
+         * Indicates whether or not Value is null.
+         * @return true if Value is null, otherwise false.
+         */
+        public bool IsNull
+        {
+            get
+            {
+                return _isNull;
+            }
+        }
+
+        /**
+         * Gets the value of the SqlBoolean instance as a byte.
+         * @return A byte representing the value of the SqlBoolean instance.
+         * Byte value will be 1 or 0.
+         */
+        public int ByteValue
+        {
+            get
+            {
+                if (IsNull)
+                {
+                    throw new SqlNullValueException();
+                }
+
+                if (_value)
+                    return 1;
+
+                return 0;
+            }
+        }
+
+        /**
+         * Indicates whether the current Value is False.
+         * @return true if Value is False, otherwise false.
+         */
+        public bool IsFalse
+        {
+            get
+            {
+                return Value == false;
+            }
+        }
+
+        /**
+         * Indicates whether the current Value is True.
+         * @return true if Value is True, otherwise false.
+         */
+        public bool IsTrue
+        {
+            get
+            {
+                return Value == true;
+            }
+        }
+
+        /**
+         * Gets the value of the SqlBoolean instance.
+         * @return the value of this instance
+         */
+        public bool Value
+        {
+            get
+            {
+                if (IsNull)
+                {
+                    throw new SqlNullValueException();
+                }
+                return _value;
+            }
+        }
+
+        /**
+         * Computes the bitwise AND of two specified SqlBoolean instances.
+         * @param x A SqlBoolean instance
+         * @param y A SqlBoolean instance
+         * @return The result of the logical AND operation.
+         */
+        public static SqlBoolean And(SqlBoolean x, SqlBoolean y)
+        {
+            if (x.IsNull || y.IsNull)
+                return SqlBoolean.Null;
+
+            bool res = x.IsTrue && y.IsTrue;
+            return new SqlBoolean(res);
+        }
+
+        /**
+         * Performs a bitwise OR operation on the two specified SqlBoolean instances.
+         * @param x A SqlBoolean instance
+         * @param y A SqlBoolean instance
+         * @return The result of the logical OR operation.
+         */
+        public static SqlBoolean Or(SqlBoolean x, SqlBoolean y)
+        {
+            if (x.IsNull || y.IsNull)
+                return SqlBoolean.Null;
+
+            bool res = x.IsTrue || y.IsTrue;
+            return new SqlBoolean(res);
+        }
+
+        /**
+         * Compares this instance to the supplied object and returns an indication of their relative values.
+         * @param obj The object to compare.
+         * @return A signed number indicating the relative values of the instance and the object.
+         * Less than zero This instance is less than object.
+         * Zero This instance is the same as object.
+         * Greater than zero This instance is greater than object -or-
+         * object is a null reference.
+         */
+        public int CompareTo(Object obj)
+        {
+            if (obj == null)
+                return 1;
+
+            if ((obj is SqlBoolean) == false)
+            {
+                throw new ArgumentException("Wrong value type " + 
+                    obj.GetType().Name + "in SqlBoolean.CompareTo");
+            }
+
+            SqlBoolean val = (SqlBoolean)obj;
+
+            if (this.IsNull)
+            {
+                if (val.IsNull)
+                    return 0;
+                return -1;
+            }
+            else if (val.IsNull)
+                return 1;
+
+            if (this.IsTrue && val.IsFalse)
+                return 1;
+
+            if (this.IsFalse && val.IsTrue)
+                return -1;
+        
+            return 0;
+        }
+
+        /**
+         * Compares the supplied object parameter to the Value property of the SqlBoolean object.
+         * @param obj The object to be compared.
+         * @return true if object is an instance of SqlBoolean and the two are equal; otherwise false.
+         */
+        public bool equals(Object obj)
+        {
+            if (obj == null)
+                return false;
+
+            if (obj is SqlBoolean)
+            {
+                SqlBoolean val = (SqlBoolean)obj;
+
+                if (IsNull && val.IsNull)
+                    return true;
+
+                if (IsNull || val.IsNull)
+                    return false;
+
+                return val._value == _value;
+            }
+
+            return false;
+        }
+
+        /**
+         * Performs a logical comparison on two instances of SqlBoolean to determine if they are equal.
+         * @param x A SqlBoolean instance.
+         * @param y A SqlBoolean instance.
+         * @return true if the two values are equal, otherwise false.
+         * If one of the parameters is null or null value return SqlBoolean.Null.
+         */
+        public static SqlBoolean Equals(SqlBoolean x, SqlBoolean y)
+        {
+            if (x.IsNull || y.IsNull)
+                return SqlBoolean.Null;
+
+            return new SqlBoolean(x._value == y._value);
+        }
+
+        /**
+         * Compares two instances of SqlBoolean to determine if they are equal.
+         * @param x A SqlBoolean instance
+         * @param y A SqlBoolean instance
+         * @return A SqlBoolean that is True if the two instances are not equal or False if the two instances are equal.
+         * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.
+         */
+        public static SqlBoolean NotEquals(SqlBoolean x, SqlBoolean y)
+        {
+            if (x.IsNull || y.IsNull)
+                return SqlBoolean.Null;
+
+            return new SqlBoolean(x._value != y._value);
+        }
+
+        public static SqlBoolean OnesComplement(SqlBoolean x)
+        {
+            if (x.IsNull)
+            {
+                throw new SqlNullValueException();
+            }
+            return new SqlBoolean(x._value == false);
+        }
+
+        /**
+         * Converts the String representation of a number to its bool equivalent.
+         * @param s The String to be parsed.
+         * @return A SqlBoolean containing the value represented by the String.
+         */
+        public static SqlBoolean Parse(String s)
+        {
+            int val = int.Parse(s);
+            return new SqlBoolean(val);
+        }
+
+        /**
+         * Performs a bitwise XOR operation on the two specified SqlBoolean instances.
+         * @param x A SqlBoolean instance
+         * @param y A SqlBoolean instance
+         * @return The result of the logical XOR operation.
+         */
+        public static SqlBoolean Xor(SqlBoolean x, SqlBoolean y)
+        {
+            if (x.IsNull || y.IsNull)
+                return SqlBoolean.Null;
+
+            if (x.IsTrue && y.IsTrue)
+                return new SqlBoolean(false);
+
+            if (x.IsTrue || y.IsTrue)
+                return new SqlBoolean(true);
+
+            return new SqlBoolean(false); // both args are False
+
+        }
+
+        /**
+         * Converts this SqlBoolean instance to SqlByte.
+         * @return A SqlByte instance whose Value equals the Value of this SqlDouble instance.
+         */
+        public SqlByte ToSqlByte()
+        {
+            if (IsNull)
+                return SqlByte.Null;
+
+            return new SqlByte((byte)ByteValue);
+        }
+
+        /**
+         * Converts this SqlBoolean instance to SqlDecimal.
+         * @return A SqlDecimal instance whose Value equals the Value of this SqlBoolean instance.
+         */
+        public SqlDecimal ToSqlDecimal()
+        {
+            if (IsNull)
+                return SqlDecimal.Null;
+
+            return new SqlDecimal(ByteValue);
+        }
+
+        /**
+         * Converts this SqlBoolean instance to SqlDouble.
+         * @return A SqlDouble instance whose Value equals the Value of this SqlBoolean instance.
+         */
+        public SqlDouble ToSqlDouble()
+        {
+            if (IsNull)
+                return SqlDouble.Null;
+
+            return new SqlDouble(ByteValue);
+        }
+
+        /**
+         * Converts this SqlBoolean instance to SqlSingle.
+         * @return A SqlSingle instance whose Value equals the Value of this SqlBoolean instance.
+         */
+        public SqlSingle ToSqlSingle()
+        {
+            if (IsNull)
+                return SqlSingle.Null;
+
+            return new SqlSingle(ByteValue);
+        }
+
+        /**
+         * Converts this SqlBoolean instance to SqlDouble.
+         * @return A SqlDouble instance whose Value equals the Value of this SqlBoolean instance.
+         */
+        public SqlInt16 ToSqlInt16()
+        {
+            if (IsNull)
+                return SqlInt16.Null;
+
+            return new SqlInt16(ByteValue);
+        }
+
+        /**
+         * Converts this SqlBoolean instance to SqlDouble.
+         * @return A SqlDouble instance whose Value equals the Value of this SqlBoolean instance.
+         */
+        public SqlInt32 ToSqlInt32()
+        {
+            if (IsNull)
+                return SqlInt32.Null;
+
+            return new SqlInt32(ByteValue);
+        }
+
+        /**
+         * Converts this SqlBoolean instance to SqlDouble.
+         * @return A SqlDouble instance whose Value equals the Value of this SqlBoolean instance.
+         */
+        public SqlInt64 ToSqlInt64()
+        {
+            if (IsNull)
+                return SqlInt64.Null;
+
+            return new SqlInt64(ByteValue);
+        }
+
+        /**
+         * Converts this SqlBoolean instance to SqlDecimal.
+         * @return A SqlMoney instance whose Value equals the Value of this SqlBoolean instance.
+         */
+        public SqlMoney ToSqlMoney()
+        {
+            if (IsNull)
+                return SqlMoney.Null;
+
+            return new SqlMoney(ByteValue);
+        }
+
+        /**
+         * Converts this SqlBoolean structure to SqlString.
+         * @return A SqlString structure whose value is a string representing the date and time contained in this SqlBoolean structure.
+         */
+        public SqlString ToSqlString()
+        {
+            if (IsNull)
+                return SqlString.Null;
+
+            return new SqlString(ToString());
+        }
+
+        public override String ToString()
+        {
+            if (IsNull)
+                return "null";
+
+            return _value.ToString();
+        }
+
+        public static SqlBoolean op_Implicit(bool x)
+        {
+            return new SqlBoolean(x);
+        }
+
+        public static bool op_Explicit(SqlBoolean x)
+        {
+            return x.Value;
+        }
+
+        public static SqlBoolean op_LogicalNot(SqlBoolean x)
+        {
+            return OnesComplement(x);
+        }
+
+        public static bool op_True(SqlBoolean x)
+        {
+            return x.IsTrue;
+        }
+
+        public static bool op_False(SqlBoolean x)
+        {
+            return x.IsFalse;
+        }
+
+        public static SqlBoolean op_BitwiseAnd(SqlBoolean x, SqlBoolean y)
+        {
+            return And(x, y);
+        }
+
+        public static SqlBoolean op_BitwiseOr(SqlBoolean x, SqlBoolean y)
+        {
+            return Or(x, y);
+        }
+
+        public static SqlBoolean op_OnesComplement(SqlBoolean x)
+        {
+            return OnesComplement(x);
+        }
+
+        public static SqlBoolean op_ExclusiveOr(SqlBoolean x, SqlBoolean y)
+        {
+            return Xor(x, y);
+        }
+
+        public static SqlBoolean op_Explicit(SqlByte x)
+        {
+            if (x.IsNull)
+                return SqlBoolean.Null;
+
+            return new SqlBoolean(x.Value != 0);
+        }
+
+        public static SqlBoolean op_Explicit(SqlInt16 x)
+        {
+            if (x.IsNull)
+                return SqlBoolean.Null;
+
+            return new SqlBoolean(x.Value != 0);
+        }
+
+        public static SqlBoolean op_Explicit(SqlInt32 x)
+        {
+            if (x.IsNull)
+                return SqlBoolean.Null;
+
+            return new SqlBoolean(x.Value != 0);
+        }
+
+        public static SqlBoolean op_Explicit(SqlInt64 x)
+        {
+            if (x.IsNull)
+                return SqlBoolean.Null;
+
+            return new SqlBoolean(x.Value != 0L);
+        }
+
+        public static SqlBoolean op_Explicit(SqlDouble x)
+        {
+            if (x.IsNull)
+                return SqlBoolean.Null;
+
+            return new SqlBoolean(x.Value != 0.0D);
+        }
+
+        public static SqlBoolean op_Explicit(SqlSingle x)
+        {
+            if (x.IsNull)
+                return SqlBoolean.Null;
+
+            return new SqlBoolean(x.Value != 0.0F);
+        }
+
+        public static SqlBoolean op_Explicit(SqlMoney x)
+        {
+            if (x.IsNull)
+                return SqlBoolean.Null;
+
+            return SqlMoney.NotEquals(x, SqlMoney.Zero);
+        }
+
+        public static SqlBoolean op_Explicit(SqlDecimal x)
+        {
+            if (x.IsNull)
+                return SqlBoolean.Null;
+
+            return new SqlBoolean(x.ToDouble() != 0.0D);
+        }
+
+        public static SqlBoolean op_Explicit(SqlString x)
+        {
+            if (x.IsNull)
+                return SqlBoolean.Null;
+
+            return Parse(x.Value);
+        }
+
+        public static SqlBoolean op_Equality(SqlBoolean x, SqlBoolean y)
+        {
+            return Equals(x, y);
+        }
+
+        public static SqlBoolean op_Inequality(SqlBoolean x, SqlBoolean y)
+        {
+            return NotEquals(x, y);
+        }
+    }}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlByte.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlByte.cs
new file mode 100644 (file)
index 0000000..909a4aa
--- /dev/null
@@ -0,0 +1,735 @@
+ /*\r
+  * Copyright (c) 2002-2004 Mainsoft Corporation.\r
+  *\r
+  * Permission is hereby granted, free of charge, to any person obtaining a\r
+  * copy of this software and associated documentation files (the "Software"),\r
+  * to deal in the Software without restriction, including without limitation\r
+  * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+  * and/or sell copies of the Software, and to permit persons to whom the\r
+  * Software is furnished to do so, subject to the following conditions:\r
+  *\r
+  * The above copyright notice and this permission notice shall be included in\r
+  * all copies or substantial portions of the Software.\r
+  *\r
+  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+  * DEALINGS IN THE SOFTWARE.\r
+  */\r
+namespace System.Data.SqlTypes\r
+{\r
+\r
+    using System;\r
+    using System.Data;\r
+\r
+    /**\r
+     *\r
+     */\r
+    public struct SqlByte : INullable, IComparable\r
+    {\r
+        private byte _value; // = -1;\r
+        private bool _isNull;\r
+\r
+        public static readonly SqlByte MaxValue = new SqlByte((byte)0xFF);\r
+        public static readonly SqlByte MinValue = new SqlByte((byte)0);\r
+        public static readonly SqlByte Zero = new SqlByte((byte)0);\r
+        public static readonly SqlByte Null = new SqlByte(true);\r
+\r
+        \r
+        private SqlByte(bool isNull)\r
+        {\r
+            _isNull = isNull;\r
+            _value = 0;\r
+        }\r
+        /**\r
+         * Initializes a new instance of the SqlByte instance using the specified byte value.\r
+         * @param value A byte value to be stored in the Value property of the new SqlByte instance.\r
+         */\r
+        public SqlByte(byte value)\r
+        {\r
+            _value = value;\r
+            _isNull = false;\r
+        }\r
+\r
+\r
+        public override int GetHashCode()\r
+        {\r
+            if (IsNull)\r
+                return 0;\r
+        \r
+            return _value;\r
+        }\r
+\r
+        /**\r
+         * Indicates whether or not Value is null.\r
+         * @return true if Value is null, otherwise false.\r
+         */\r
+        public bool IsNull\r
+        {\r
+            get\r
+            {\r
+                return _isNull;\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Gets the value of the SqlByte instance.\r
+         * @return the value of this instance\r
+         */\r
+        public byte Value\r
+        {\r
+            get\r
+            {\r
+                if (IsNull)\r
+                {\r
+                    throw new SqlNullValueException();\r
+                }\r
+\r
+                return _value;\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Computes the sum of the two specified SqlByte instances.\r
+         * @param x A SqlByte instance.\r
+         * @param y A SqlByte instance.\r
+         * @return A SqlByte instance whose Value property contains the results of the addition.\r
+         */\r
+        public static SqlByte Add(SqlByte x, SqlByte y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlByte.Null;\r
+\r
+            int res  = x._value + y._value;\r
+\r
+            if (res > 255)\r
+                throw new OverflowException("Arithmetic Overflow");\r
+\r
+            return new SqlByte((byte)res);\r
+        }\r
+\r
+        /**\r
+         * Computes the bitwise AND of its SqlByte operands.\r
+         * @param x A SqlByte instance.\r
+         * @param y A SqlByte instance.\r
+         * @return The results of the bitwise AND operation.\r
+         */\r
+        public static SqlByte BitwiseAnd(SqlByte x, SqlByte y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlByte.Null;\r
+\r
+            int res  = x._value & y._value;\r
+            return new SqlByte((byte)res);\r
+        }\r
+\r
+        /**\r
+         * Computes the bitwise OR of its SqlByte operands.\r
+         * @param x A SqlByte instance.\r
+         * @param y A SqlByte instance.\r
+         * @return The results of the bitwise OR operation.\r
+         */\r
+        public static SqlByte BitwiseOr(SqlByte x, SqlByte y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlByte.Null;\r
+\r
+            int res  = x._value | y._value;\r
+            return new SqlByte((byte)res);\r
+        }\r
+\r
+        /**\r
+         * Compares this instance to the supplied object and returns an indication of their relative values.\r
+         * @param obj The object to compare.\r
+         * @return A signed number indicating the relative values of the instance and the object.\r
+         * Less than zero This instance is less than object.\r
+         * Zero This instance is the same as object.\r
+         * Greater than zero This instance is greater than object -or-\r
+         * object is a null reference.\r
+         */\r
+        public int CompareTo(Object obj)\r
+        {\r
+            if (obj == null)\r
+                return 1;\r
+\r
+            if ((obj is SqlByte) == false)\r
+            {\r
+                throw new ArgumentException("Wrong value type " + \r
+                    obj.GetType().Name + "in SqlByte.CompareTo");\r
+            }\r
+\r
+            SqlByte val = (SqlByte)obj;\r
+\r
+            if (IsNull)\r
+            {\r
+                if (val.IsNull)\r
+                    return 0;\r
+                return -1;\r
+            }\r
+            else if (val.IsNull)\r
+                return 1;\r
+\r
+            if (_value > val._value)\r
+                return 1;\r
+\r
+            if (_value < val._value)\r
+                return -1;\r
+\r
+            return 0;\r
+        }\r
+\r
+\r
+        /**\r
+         * The division operator divides the first SqlByte operand by the second.\r
+         * @param x A SqlByte instance.\r
+         * @param y A SqlByte instance.\r
+         * @return A SqlByte instance containing the results of the division operation.\r
+         * If one of the parameters is null or null value - return SqlDouble.Null.\r
+         */\r
+        public static SqlByte Divide(SqlByte x, SqlByte y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlByte.Null;\r
+\r
+            if (y._value == 0)\r
+                throw new DivideByZeroException("Divide by zero error encountered.");\r
+\r
+            int val = x._value / y._value;\r
+            return new SqlByte((byte)val);\r
+        }\r
+\r
+        public override bool Equals(Object obj)\r
+        {\r
+            if (obj == null)\r
+                return false;\r
+\r
+            if (obj is SqlByte)\r
+            {\r
+                if (((SqlByte)obj)._value == this._value)\r
+                    return true;\r
+            }\r
+\r
+            return false;\r
+        }\r
+\r
+        /**\r
+         * Performs a logical comparison on two instances of SqlByte to determine if they are equal.\r
+         * @param x A SqlByte instance.\r
+         * @param y A SqlByte instance.\r
+         * @return true if the two values are equal, otherwise false.\r
+         * If one of the parameters is null or null value return SqlBoolean.Null.\r
+         */\r
+        public static SqlBoolean Equals(SqlByte x, SqlByte y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value == y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlByte to determine if the first is greater than the second.\r
+         * @param x A SqlByte instance\r
+         * @param y A SqlByte instance\r
+         * @return A SqlBoolean that is True if the first instance is greater than the second instance, otherwise False.\r
+         * If either instance of SqlByte is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean GreaterThan(SqlByte x, SqlByte y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value > y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlByte to determine if the first is greater than or equal to the second.\r
+         * @param x A SqlByte instance\r
+         * @param y A SqlByte instance\r
+         * @return A SqlBoolean that is True if the first instance is greaater than or equal to the second instance, otherwise False.\r
+         * If either instance of SqlByte is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean GreaterThanOrEqual(SqlByte x, SqlByte y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value >= y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlByte to determine if the first is less than the second.\r
+         * @param x A SqlByte instance\r
+         * @param y A SqlByte instance\r
+         * @return A SqlBoolean that is True if the first instance is less than the second instance, otherwise False.\r
+         * If either instance of SqlByte is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean LessThan(SqlByte x, SqlByte y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value < y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlByte to determine if the first is less than or equal to the second.\r
+         * @param x A SqlByte instance\r
+         * @param y A SqlByte instance\r
+         * @return A SqlBoolean that is True if the first instance is less than or equal to the second instance, otherwise False.\r
+         * If either instance of SqlByte is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean LessThanOrEqual(SqlByte x, SqlByte y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value <= y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Computes the remainder after dividing its first SqlByte operand by its second.\r
+         * @param x A SqlByte instance\r
+         * @param y A SqlByte instance\r
+         * @return A SqlByte instance whose Value contains the remainder.\r
+         */\r
+        public static SqlByte Mod(SqlByte x, SqlByte y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlByte.Null;\r
+\r
+            if (y._value == 0)\r
+                throw new DivideByZeroException("Divide by zero error encountered.");\r
+\r
+            int mod = x._value % y._value;\r
+            return new SqlByte((byte)mod);\r
+        }\r
+\r
+        /**\r
+         * The multiplication operator computes the product of the two SqlByte operands.\r
+         * @param x A SqlByte instance\r
+         * @param y A SqlByte instance\r
+         * @return The product of the two SqlByte operands.\r
+         */\r
+        public static SqlByte Multiply(SqlByte x, SqlByte y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlByte.Null;\r
+\r
+            int res = x._value * y._value;\r
+\r
+            if (res > 255)\r
+                throw new OverflowException("Arithmetic Overflow.");\r
+\r
+            return new SqlByte((byte)res);\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlByte to determine if they are equal.\r
+         * @param x A SqlByte instance\r
+         * @param y A SqlByte instance\r
+         * @return A SqlBoolean that is True if the two instances are not equal or False if the two instances are equal.\r
+         * If either instance of SqlByte is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean NotEquals(SqlByte x, SqlByte y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value != y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * The ones complement operator performs a bitwise one's complement operation on its SqlByte operand.\r
+         * @param x A SqlByte instance\r
+         * @return A SqlByte instance whose Value property contains the ones complement of the SqlByte parameter.\r
+         */\r
+        public static SqlByte OnesComplement(SqlByte x)\r
+        {\r
+            if (x.IsNull)\r
+                return SqlByte.Null;\r
+\r
+            int res  = x._value ^ 0xFF; /*@TODO Ma ze ??? */\r
+\r
+            return new SqlByte((byte)res);\r
+        }\r
+\r
+        /**\r
+         * Converts the String representation of a number to its byte equivalent.\r
+         * @param s The String to be parsed.\r
+         * @return A SqlByte containing the value represented by the String.\r
+         */\r
+        public static SqlByte Parse(String s)\r
+        {\r
+            byte val = byte.Parse(s);\r
+            return new SqlByte(val);\r
+        }\r
+\r
+        /**\r
+         * The subtraction operator the second SqlByte operand from the first.\r
+         * @param x A SqlByte instance\r
+         * @param y A SqlByte instance\r
+         * @return The results of the subtraction operation.\r
+         */\r
+        public static SqlByte Subtract(SqlByte x, SqlByte y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlByte.Null;\r
+\r
+            int res = x._value - y._value;\r
+\r
+            if (res < 0)\r
+                throw new OverflowException("Arithmetic Overflow.");\r
+\r
+            return new SqlByte((byte)res);\r
+        }\r
+\r
+\r
+        /**\r
+         * Converts this SqlByte instance to SqlBoolean.\r
+         * @return A SqlBoolean instance whose Value will be True if the SqlByte instance's Value is non-zero,\r
+         * False if the SqlByte is zero\r
+         * and Null if the SqlByte instance is Null.\r
+         */\r
+        public SqlBoolean ToSqlBoolean()\r
+        {\r
+            if (IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            return new SqlBoolean(Value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlByte instance to SqlDecimal.\r
+         * @return A SqlDecimal instance whose Value equals the Value of this SqlByte instance.\r
+         */\r
+        public SqlDecimal ToSqlDecimal()\r
+        {\r
+            if (IsNull)\r
+                return SqlDecimal.Null;\r
+\r
+            return new SqlDecimal(Value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlByte instance to SqlDouble.\r
+         * @return A SqlDouble instance whose Value equals the Value of this SqlByte instance.\r
+         */\r
+        public SqlDouble ToSqlDouble()\r
+        {\r
+            if (IsNull)\r
+                return SqlDouble.Null;\r
+\r
+            return new SqlDouble(Value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlByte instance to SqlSingle.\r
+         * @return A SqlSingle instance whose Value equals the Value of this SqlByte instance.\r
+         */\r
+        public SqlSingle ToSqlSingle()\r
+        {\r
+            if (IsNull)\r
+                return SqlSingle.Null;\r
+\r
+            return new SqlSingle(Value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlByte structure to SqlInt32.\r
+         * @return A SqlInt32 structure whose Value equals the Value of this SqlByte structure.\r
+         */\r
+        public SqlInt32 ToSqlInt32()\r
+        {\r
+            if (IsNull)\r
+                return SqlInt32.Null;\r
+\r
+            return new SqlInt32(Value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlByte structure to SqlInt32.\r
+         * @return A SqlInt32 structure whose Value equals the Value of this SqlByte structure.\r
+         */\r
+        public SqlInt64 ToSqlInt64()\r
+        {\r
+            if (IsNull)\r
+                return SqlInt64.Null;\r
+\r
+            return new SqlInt64(Value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlByte structure to SqlInt16.\r
+         * @return A SqlInt16 structure whose Value equals the Value of this SqlByte structure.\r
+         */\r
+        public SqlInt16 ToSqlInt16()\r
+        {\r
+            if (IsNull)\r
+                return SqlInt16.Null;\r
+\r
+            return new SqlInt16(Value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlByte instance to SqlDecimal.\r
+         * @return A SqlDecimal instance whose Value equals the Value of this SqlByte instance.\r
+         */\r
+        public SqlMoney ToSqlMoney()\r
+        {\r
+            if (IsNull)\r
+                return SqlMoney.Null;\r
+\r
+            return new SqlMoney(Value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlByte structure to SqlString.\r
+         * @return A SqlString structure whose value is a string representing the date and time contained in this SqlByte structure.\r
+         */\r
+        public SqlString ToSqlString()\r
+        {\r
+            if (IsNull)\r
+                return SqlString.Null;\r
+\r
+            return new SqlString(_value.ToString());\r
+        }\r
+\r
+        /**\r
+         * Performs a bitwise exclusive-OR operation on the supplied parameters.\r
+         * @param x A SqlByte instance\r
+         * @param y A SqlByte instance\r
+         * @return The results of the XOR operation.\r
+         */\r
+        public static SqlByte Xor(SqlByte x, SqlByte y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlByte.Null;\r
+\r
+            int res  = x._value ^ y._value;\r
+\r
+            return new SqlByte((byte)res);\r
+        }\r
+\r
+        public override String ToString()\r
+        {\r
+            if (IsNull)\r
+                return "null";\r
+\r
+            return _value.ToString();\r
+        }\r
+\r
+        public static SqlByte op_Implicit(byte x)\r
+        {\r
+            return new SqlByte(x);\r
+        }\r
+\r
+        public static int op_Explicit(SqlByte x)\r
+        {\r
+            return x.Value;\r
+        }\r
+\r
+        public static SqlByte op_OnesComplement(SqlByte x)\r
+        {\r
+            return OnesComplement(x);\r
+        }\r
+\r
+        public static SqlByte op_Addition(SqlByte x, SqlByte y)\r
+        {\r
+            return Add(x, y);\r
+        }\r
+\r
+        public static SqlByte op_Subtraction(SqlByte x, SqlByte y)\r
+        {\r
+            return Subtract(x, y);\r
+        }\r
+\r
+        public static SqlByte op_Multiply(SqlByte x, SqlByte y)\r
+        {\r
+            return Multiply(x, y);\r
+        }\r
+\r
+        public static SqlByte op_Division(SqlByte x, SqlByte y)\r
+        {\r
+            return Divide(x, y);\r
+        }\r
+\r
+        public static SqlByte op_Modulus(SqlByte x, SqlByte y)\r
+        {\r
+            return Mod(x, y);\r
+        }\r
+\r
+        public static SqlByte op_BitwiseAnd(SqlByte x, SqlByte y)\r
+        {\r
+            return BitwiseAnd(x, y);\r
+        }\r
+\r
+        public static SqlByte op_BitwiseOr(SqlByte x, SqlByte y)\r
+        {\r
+            return BitwiseOr(x, y);\r
+        }\r
+\r
+        public static SqlByte op_ExclusiveOr(SqlByte x, SqlByte y)\r
+        {\r
+            return Xor(x, y);\r
+        }\r
+\r
+        public static SqlByte op_Explicit(SqlBoolean x)\r
+        {\r
+            if(x.IsNull)\r
+                return SqlByte.Null;\r
+\r
+            return new SqlByte((byte)x.ByteValue);\r
+        }\r
+\r
+        public static SqlByte op_Explicit(SqlMoney x)\r
+        {\r
+            if(x.IsNull)\r
+                return SqlByte.Null;\r
+\r
+            int val = x.ToSqlInt32().Value;\r
+            if (val < 0 || val > 255)\r
+                throw new OverflowException("Arithmetic Overflow.");\r
+\r
+            return new SqlByte((byte)val);\r
+        }\r
+\r
+        public static SqlByte op_Explicit(SqlInt16 x)\r
+        {\r
+            if(x.IsNull)\r
+                return SqlByte.Null;\r
+\r
+            short val = x.Value;\r
+            if (val < 0 || val > 255)\r
+                throw new OverflowException("Arithmetic Overflow.");\r
+\r
+            return new SqlByte((byte)val);\r
+        }\r
+\r
+        public static SqlByte op_Explicit(SqlInt32 x)\r
+        {\r
+            if(x.IsNull)\r
+                return SqlByte.Null;\r
+\r
+            int val = x.Value;\r
+            if (val < 0 || val > 255)\r
+                throw new OverflowException("Arithmetic Overflow.");\r
+\r
+            return new SqlByte((byte)val);\r
+        }\r
+\r
+        public static SqlByte op_Explicit(SqlInt64 x)\r
+        {\r
+            if(x.IsNull)\r
+                return SqlByte.Null;\r
+\r
+            long val = x.Value;\r
+            if (val < 0 || val > 255)\r
+                throw new OverflowException("Arithmetic Overflow.");\r
+\r
+            return new SqlByte((byte)val);\r
+        }\r
+\r
+        public static SqlByte op_Explicit(SqlSingle x)\r
+        {\r
+            if(x.IsNull)\r
+                return SqlByte.Null;\r
+\r
+            float val = x.Value;\r
+            if (val < 0 || val > 255)\r
+                throw new OverflowException("Arithmetic Overflow.");\r
+\r
+            return new SqlByte((byte)val);\r
+        }\r
+\r
+        public static SqlByte op_Explicit(SqlDouble x)\r
+        {\r
+            if(x.IsNull)\r
+                return SqlByte.Null;\r
+\r
+            double val = x.Value;\r
+            if (val < 0 || val > 255)\r
+                throw new OverflowException("Arithmetic Overflow.");\r
+\r
+            return new SqlByte((byte)val);\r
+        }\r
+\r
+        public static SqlByte op_Explicit(SqlDecimal x)\r
+        {\r
+            if(x.IsNull)\r
+                return SqlByte.Null;\r
+\r
+            double val = x.ToDouble();\r
+            if (val < 0 || val > 255)\r
+                throw new OverflowException("Arithmetic Overflow.");\r
+\r
+            return new SqlByte((byte)val);\r
+        }\r
+\r
+        public static SqlByte op_Explicit(SqlString x)\r
+        {\r
+            if (x.IsNull)\r
+                return SqlByte.Null;\r
+\r
+            return Parse(x.Value);\r
+        }\r
+\r
+        public static SqlBoolean op_Equality(SqlByte x, SqlByte y)\r
+        {\r
+            return Equals(x, y);\r
+        }\r
+\r
+        public static SqlBoolean op_Inequality(SqlByte x, SqlByte y)\r
+        {\r
+            return NotEquals(x, y);\r
+        }\r
+\r
+        public static SqlBoolean op_LessThan(SqlByte x, SqlByte y)\r
+        {\r
+            return LessThan(x, y);\r
+        }\r
+\r
+        public static SqlBoolean op_GreaterThan(SqlByte x, SqlByte y)\r
+        {\r
+            return GreaterThan(x, y);\r
+        }\r
+\r
+        public static SqlBoolean op_LessThanOrEqual(SqlByte x, SqlByte y)\r
+        {\r
+            return LessThanOrEqual(x, y);\r
+        }\r
+\r
+        public static SqlBoolean op_GreaterThanOrEqual(SqlByte x, SqlByte y)\r
+        {\r
+            return GreaterThanOrEqual(x, y);\r
+        }\r
+\r
+        public static void main(String[] args)\r
+        {\r
+            SqlByte b = new SqlByte((byte)1);\r
+            Console.WriteLine(b);\r
+\r
+            Console.WriteLine(OnesComplement(b));\r
+        }\r
+    }}\r
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlBytes.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlBytes.cs
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlChars.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlChars.cs
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlCompareOptions.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlCompareOptions.cs
new file mode 100644 (file)
index 0000000..61abf6a
--- /dev/null
@@ -0,0 +1,41 @@
+ /*\r
+  * Copyright (c) 2002-2004 Mainsoft Corporation.\r
+  *\r
+  * Permission is hereby granted, free of charge, to any person obtaining a\r
+  * copy of this software and associated documentation files (the "Software"),\r
+  * to deal in the Software without restriction, including without limitation\r
+  * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+  * and/or sell copies of the Software, and to permit persons to whom the\r
+  * Software is furnished to do so, subject to the following conditions:\r
+  *\r
+  * The above copyright notice and this permission notice shall be included in\r
+  * all copies or substantial portions of the Software.\r
+  *\r
+  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+  * DEALINGS IN THE SOFTWARE.\r
+  */\r
+namespace System.Data.SqlTypes\r
+{\r
+\r
+    \r
+    public enum SqlCompareOptions\r
+                                                {\r
+\r
+        None = 0,\r
+\r
+        IgnoreCase = 1,\r
+\r
+        IgnoreNonSpace = 2,\r
+\r
+        IgnoreKanaType = 8,\r
+\r
+        IgnoreWidth = 16,\r
+\r
+        BinarySort = 32768,\r
+    }\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlDate.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlDate.cs
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlDateTime.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlDateTime.cs
new file mode 100644 (file)
index 0000000..de234fe
--- /dev/null
@@ -0,0 +1,436 @@
+/*\r
+* Copyright (c) 2002-2004 Mainsoft Corporation.\r
+*\r
+* Permission is hereby granted, free of charge, to any person obtaining a\r
+* copy of this software and associated documentation files (the "Software"),\r
+* to deal in the Software without restriction, including without limitation\r
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+* and/or sell copies of the Software, and to permit persons to whom the\r
+* Software is furnished to do so, subject to the following conditions:\r
+*\r
+* The above copyright notice and this permission notice shall be included in\r
+* all copies or substantial portions of the Software.\r
+*\r
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+* DEALINGS IN THE SOFTWARE.\r
+*/\r
+\r
+namespace System.Data.SqlTypes\r
+{\r
+\r
+    /**\r
+     * <p>Title: </p>\r
+     * <p>Description: </p>\r
+     * <p>Copyright: Copyright (c) 2002</p>\r
+     * <p>Company: MainSoft</p>\r
+     * @author Pavel Sandler\r
+     * @version 1.0\r
+     */\r
+\r
+    using System;\r
+\r
+\r
+    /*\r
+    * CURRENT LIMITATIONS:\r
+    * 1. Doesn't support billiseconds\r
+    * 2. public int DayTicks not implemented (I do not understand the logic)\r
+    */\r
+\r
+    public struct SqlDateTime : INullable, IComparable\r
+    {\r
+        private DateTime _value;\r
+        private bool _isNull;\r
+\r
+        public static readonly SqlDateTime MaxValue = new SqlDateTime(9999, 12, 31);\r
+        public static readonly SqlDateTime MinValue = new SqlDateTime(1753, 1, 1);\r
+        public static readonly SqlDateTime Null = new SqlDateTime(true);\r
+        public static readonly int SqlTicksPerSecond = 300;\r
+        public static readonly int SqlTicksPerMinute = 18000;\r
+        public static readonly int SqlTicksPerHour = 1080000;\r
+        \r
+        private SqlDateTime(bool isNull)\r
+        {\r
+            _isNull = isNull;\r
+            _value = DateTime.MinValue;\r
+        }\r
+\r
+        public SqlDateTime(DateTime value) \r
+        {\r
+            _value = value;\r
+            _isNull = false;\r
+        }\r
+\r
+        public SqlDateTime(int DateTicks, int TimeTicks)\r
+        {\r
+            throw new NotImplementedException("ctor SqlDateTime(int DateTicks, int TimeTicks) not implemented.");\r
+        }\r
+\r
+        /**\r
+         * Constract a new SqlDateTime object\r
+         * @param year the year\r
+         * @param month the month (1-12)\r
+         * @param day the day in the month\r
+         */\r
+        public SqlDateTime(int year, int month, int day) \r
+        : this(year, month, day, 0, 0, 0, 0)\r
+        {\r
+        }\r
+\r
+        /**\r
+         * Constract a new SqlDateTime object\r
+         * @param year the year\r
+         * @param month the month (1-12)\r
+         * @param day the day in the month\r
+         * @param hour the number of hours\r
+         */\r
+        public SqlDateTime(int year, int month, int day, int hour)\r
+            : this(year, month, day, hour, 0, 0, 0)\r
+        {\r
+        }\r
+\r
+        /**\r
+         * Constract a new SqlDateTime object\r
+         * @param year the year\r
+         * @param month the month (1-12)\r
+         * @param day the day in the month\r
+         * @param hour the number of hours\r
+         * @param minute the number of minutes\r
+         */\r
+        public SqlDateTime(int year, int month, int day, int hour, int minute)\r
+            : this(year, month, day, hour, minute, 0, 0)\r
+        { \r
+        }\r
+        /**\r
+         * Constract a new SqlDateTime object\r
+         * @param year the year\r
+         * @param month the month (1-12)\r
+         * @param day the day in the month\r
+         * @param hour the number of hours\r
+         * @param minute the number of minutes\r
+         * @param second the number of seconds\r
+         */\r
+        public SqlDateTime(int year, int month, int day, int hour, int minute, int second)\r
+            : this(year, month, day, hour, minute, second, 0)\r
+        {\r
+        }\r
+\r
+        /**\r
+         * Constract a new SqlDateTime object\r
+         * @param year the year\r
+         * @param month the month (1-12)\r
+         * @param day the day in the month\r
+         * @param hour the number of hours\r
+         * @param minute the number of minutes\r
+         * @param second the number of seconds\r
+         * @param millisecond the number of milliseconds\r
+         */\r
+        public SqlDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond)\r
+        {\r
+            _value = new DateTime(year, month, day, hour, minute, second, millisecond);\r
+            _isNull = false;\r
+        }\r
+\r
+        /**\r
+         * Indicates whether or not Value is null.\r
+         * @return true if Value is null, otherwise false.\r
+         */\r
+        public bool IsNull\r
+        {\r
+            get\r
+            {\r
+                return _isNull;\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Gets the value of the SqlDateTime instance.\r
+         * @return the value of this instance\r
+         */\r
+        public DateTime Value\r
+        {\r
+            get\r
+            {\r
+                if(IsNull)\r
+                    throw new SqlNullValueException();\r
+                return _value;\r
+            }\r
+        }\r
+\r
+        public int DayTicks\r
+        {\r
+            get\r
+            {\r
+                /** @todo find the logic */\r
+                return -1;\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Gets the number of ticks representing the time of this SqlDateTime structure.\r
+         * @return The number of ticks representing the time of this SqlDateTime structure.\r
+         */\r
+        public int TimeTicks\r
+        {\r
+            get\r
+            {\r
+                if (IsNull)\r
+                {\r
+                    int res = _value.Hour * SqlTicksPerHour;\r
+                    res += (_value.Minute * SqlTicksPerMinute);\r
+                    res += (_value.Second * SqlTicksPerSecond);\r
+                    res += (_value.Millisecond * SqlTicksPerSecond * 1000);\r
+\r
+                    return res;\r
+\r
+                }\r
+\r
+                throw new SqlNullValueException("The value of this instance is null");\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Compares this instance to the supplied object and returns an indication of their relative values.\r
+         * @param obj The object to compare.\r
+         * @return A signed number indicating the relative values of the instance and the object.\r
+         * Less than zero This instance is less than object.\r
+         * Zero This instance is the same as object.\r
+         * Greater than zero This instance is greater than object -or-\r
+         * object is a null reference.\r
+         */\r
+        public int CompareTo(Object obj)\r
+        {\r
+            if (obj == null)\r
+                return 1;\r
+\r
+            if (obj is SqlDateTime)\r
+            {\r
+                SqlDateTime value = (SqlDateTime)obj;\r
+\r
+                if (value.IsNull)\r
+                    return 1;\r
+                if (IsNull)\r
+                    return -1;\r
+\r
+                return _value.CompareTo(value._value);\r
+            }\r
+\r
+            throw new ArgumentException("parameter obj is not SqlDateTime : " + obj.GetType().Name);\r
+\r
+        }\r
+\r
+        public override bool Equals(Object obj)\r
+        {\r
+            if (obj is SqlDateTime)\r
+            {\r
+                SqlDateTime d = (SqlDateTime)obj;\r
+                \r
+                if (d.IsNull || d.IsNull)\r
+                    return false;\r
+\r
+                if (d._value  == _value)\r
+                    return true;\r
+\r
+                return _value.Equals(d._value);\r
+            }\r
+\r
+            return false;\r
+        }\r
+\r
+        \r
+        /**\r
+         * Performs a logical comparison on two instances of SqlDateTime to determine if they are equal.\r
+         * @param x A SqlDateTime instance.\r
+         * @param y A SqlDateTime instance.\r
+         * @return true if the two values are equal, otherwise false.\r
+         * If one of the parameters is null or null value return SqlBoolean.Null.\r
+         */\r
+        public static SqlBoolean Equals(SqlDateTime d1, SqlDateTime d2)\r
+        {\r
+            return d1 == d2;\r
+        }\r
+\r
+        \r
+        /**\r
+         * Compares two instances of SqlDateTime to determine if the first is greater than the second.\r
+         * @param x A SqlDateTime instance\r
+         * @param y A SqlDateTime instance\r
+         * @return A SqlBoolean that is True if the first instance is greater than the second instance, otherwise False.\r
+         * If either instance of SqlDateTime is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean GreaterThan(SqlDateTime d1, SqlDateTime d2)\r
+        {\r
+            return d1 > d2;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlDateTime to determine if the first is greater than or equal to the second.\r
+         * @param x A SqlDateTime instance\r
+         * @param y A SqlDateTime instance\r
+         * @return A SqlBoolean that is True if the first instance is greaater than or equal to the second instance, otherwise False.\r
+         * If either instance of SqlDateTime is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean GreaterThanOrEqual(SqlDateTime d1, SqlDateTime d2)\r
+        {\r
+            return d1 >= d2;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlDecimal to determine if the first is less than the second.\r
+         * @param x A SqlDateTime instance\r
+         * @param y A SqlDateTime instance\r
+         * @return A SqlBoolean that is True if the first instance is less than the second instance, otherwise False.\r
+         * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean LessThan(SqlDateTime d1, SqlDateTime d2)\r
+        {\r
+            return d1 < d2;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlDateTime to determine if the first is less than the second.\r
+         * @param x A SqlDateTime instance\r
+         * @param y A SqlDateTime instance\r
+         * @return A SqlBoolean that is True if the first instance is less than the second instance, otherwise False.\r
+         * If either instance of SqlDateTime is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean LessThanOrEqual(SqlDateTime d1, SqlDateTime d2)\r
+        {\r
+            return d1 <= d2;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlDateTime to determine if they are equal.\r
+         * @param x A SqlDateTime instance\r
+         * @param y A SqlDateTime instance\r
+         * @return A SqlBoolean that is True if the two instances are not equal or False if the two instances are equal.\r
+         * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean NotEquals(SqlDateTime d1, SqlDateTime d2)\r
+        {\r
+            return d1 != d2;\r
+        }\r
+\r
+        /**\r
+         * Converts the String representation of a number to its DateTime equivalent.\r
+         * @param s The String to be parsed.\r
+         * @return A SqlDateTime containing the value represented by the String.\r
+         */\r
+        public static SqlDateTime Parse(String s)\r
+        {\r
+            DateTime val = DateTime.Parse(s);\r
+\r
+            SqlDateTime res = new SqlDateTime(val);\r
+\r
+            if (LessThanOrEqual(res, MinValue).IsTrue || GreaterThanOrEqual(res, MinValue).IsTrue)\r
+                throw new ArgumentException("The DateTime is not valid");\r
+\r
+            return res;\r
+\r
+        }\r
+\r
+\r
+        public override String ToString()\r
+        {\r
+            if (IsNull)\r
+                return "null";\r
+\r
+            return _value.ToString();\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlDateTime structure to SqlString.\r
+         * @return A SqlString structure whose value is a string representing the date and time contained in this SqlDateTime structure.\r
+         */\r
+        public SqlString ToSqlString()\r
+        {\r
+            return new SqlString(ToString());\r
+        }\r
+        \r
+        public override int GetHashCode()\r
+        {\r
+            return _value.GetHashCode();\r
+        }\r
+\r
+        public static SqlDateTime operator + (SqlDateTime x, TimeSpan t)\r
+        {\r
+            if (x.IsNull)\r
+                return SqlDateTime.Null;\r
+                       \r
+            return new SqlDateTime (x.Value + t);\r
+        }\r
+\r
+        public static SqlBoolean operator == (SqlDateTime x, SqlDateTime y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value == y.Value);\r
+        }\r
+\r
+        public static SqlBoolean operator > (SqlDateTime x, SqlDateTime y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean(x.CompareTo(y) > 0);\r
+        }\r
+\r
+        public static SqlBoolean operator >= (SqlDateTime x, SqlDateTime y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean(x.CompareTo(y) >= 0);\r
+        }\r
+\r
+        public static SqlBoolean operator != (SqlDateTime x, SqlDateTime y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean(!(x.Value == y.Value));\r
+        }\r
+\r
+        public static SqlBoolean operator < (SqlDateTime x, SqlDateTime y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean(x.CompareTo(y) < 0);\r
+        }\r
+\r
+        public static SqlBoolean operator <= (SqlDateTime x, SqlDateTime y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean(x.CompareTo(y) <= 0);\r
+        }\r
+\r
+        public static SqlDateTime operator - (SqlDateTime x, TimeSpan t)\r
+        {\r
+            return new SqlDateTime(x.Value - t);\r
+        }\r
+\r
+        public static explicit operator DateTime (SqlDateTime x)\r
+        {\r
+            return x.Value;\r
+        }\r
+\r
+        public static explicit operator SqlDateTime (SqlString x)\r
+        {\r
+            return SqlDateTime.Parse(x.Value);\r
+        }\r
+\r
+        public static implicit operator SqlDateTime (DateTime x)\r
+        {\r
+            return new SqlDateTime(x);\r
+        }\r
+\r
+    }\r
+}\r
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlDecimal.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlDecimal.cs
new file mode 100644 (file)
index 0000000..ce0daff
--- /dev/null
@@ -0,0 +1,889 @@
+/*\r
+* Copyright (c) 2002-2004 Mainsoft Corporation.\r
+*\r
+* Permission is hereby granted, free of charge, to any person obtaining a\r
+* copy of this software and associated documentation files (the "Software"),\r
+* to deal in the Software without restriction, including without limitation\r
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+* and/or sell copies of the Software, and to permit persons to whom the\r
+* Software is furnished to do so, subject to the following conditions:\r
+*\r
+* The above copyright notice and this permission notice shall be included in\r
+* all copies or substantial portions of the Software.\r
+*\r
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+* DEALINGS IN THE SOFTWARE.\r
+*/\r
+\r
+namespace System.Data.SqlTypes\r
+{\r
+\r
+    /**\r
+     * <p>Title: </p>\r
+     * <p>Description: </p>\r
+     * <p>Copyright: Copyright (c) 2002</p>\r
+     * <p>Company: MainSoft</p>\r
+     * @author Pavel Sandler\r
+     * @version 1.0\r
+     */\r
+\r
+    using System;\r
+\r
+    using java.math;\r
+\r
+    /*\r
+    * CURRENT LIMITATIONS:\r
+    * 1. public byte[] Data not implemented.\r
+    * 2. public byte[] BinData not implemented.\r
+    * 3. Precision value is ignored.\r
+    * 4. public SqlDecimal AdjustScale(SqlDecimal n, int position) not implemented.\r
+    * 5. public SqlDecimal ConvertToPrecScale(SqlDecimal n, int precision, int scale) not implemented.\r
+    */\r
+\r
+\r
+    public struct SqlDecimal : INullable\r
+    {\r
+\r
+        private Decimal _value;\r
+        private bool _isNull;\r
+\r
+        public static readonly SqlDecimal MaxValue = new SqlDecimal(Decimal.MaxValue);\r
+        public static readonly SqlDecimal MinValue = new SqlDecimal(Decimal.MinValue);\r
+        public static readonly int MaxPrecision = 38;\r
+        public static readonly int MaxScale = MaxPrecision;\r
+        public static readonly SqlDecimal Null = new SqlDecimal(true);\r
+\r
+        private int _precision;\r
+        private int _scale;\r
+        \r
+\r
+        private SqlDecimal(bool isNull)\r
+        {\r
+            _value = Decimal.Zero;\r
+            _isNull = isNull;\r
+            _precision = 38;\r
+            _scale = 0;\r
+        }\r
+        /**\r
+         * Initializes a new instance of the SqlDecimal instance using the supplied Decimal value.\r
+         * @param value The Decimal value to be stored as a SqlDecimal instance.\r
+         */\r
+        public SqlDecimal(Decimal value) \r
+        {\r
+            _value = value;\r
+            _isNull = false;\r
+            int[] bits = Decimal.GetBits(value);\r
+            int i = bits[3] & 0xff0000;\r
+            _scale = i >> 16;\r
+            _precision = 38;\r
+        }\r
+\r
+        /**\r
+         * Initializes a new instance of the SqlDecimal instance using the supplied double value.\r
+         * @param value The double value to be stored as a SqlDecimal instance.\r
+         */\r
+        public SqlDecimal(double value) \r
+        { \r
+            _value = new Decimal(value);\r
+            _isNull = false; \r
+            int[] bits = Decimal.GetBits(_value);\r
+            int i = bits[3] & 0xff0000;\r
+            _scale = i >> 16;\r
+            _precision = 38;\r
+        }\r
+\r
+        /**\r
+         * Initializes a new instance of the SqlDecimal instance using the supplied int value.\r
+         * @param value The int value to be stored as a SqlDecimal instance.\r
+         */\r
+        public SqlDecimal(int value) \r
+        {\r
+            _value = new Decimal(value);\r
+            _isNull = false;\r
+            int[] bits = Decimal.GetBits(_value);\r
+            int i = bits[3] & 0xff0000;\r
+            _scale = i >> 16;\r
+            _precision = 38;\r
+        }\r
+\r
+        /**\r
+         * Initializes a new instance of the SqlDecimal instance using the supplied long value.\r
+         * @param value The long value to be stored as a SqlDecimal instance.\r
+         */\r
+        public SqlDecimal(long value) \r
+        {\r
+            _value = new Decimal(value);\r
+            _isNull = false;\r
+            int[] bits = Decimal.GetBits(_value);\r
+            int i = bits[3] & 0xff0000;\r
+            _scale = i >> 16;\r
+            _precision = 38;\r
+        }\r
+\r
+        \r
+        /**\r
+         * Indicates whether or not Value is null.\r
+         * @return true if Value is null, otherwise false.\r
+         */\r
+        public bool IsNull\r
+        {\r
+            get\r
+            {\r
+                return _isNull;\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Gets the value of the SqlDecimal instance.\r
+         * @return the value of this instance\r
+         */\r
+        public Decimal Value\r
+        {\r
+            get\r
+            {\r
+                if(IsNull)\r
+                    throw new SqlNullValueException();\r
+                return _value;\r
+            }\r
+        }\r
+\r
+        public byte[] BinData\r
+        {\r
+            get\r
+            {\r
+                /** @todo implement this method */\r
+                throw new NotImplementedException();\r
+            }\r
+        }\r
+\r
+        public byte[] Data\r
+        {\r
+            get\r
+            {\r
+                /** @todo implement this method */\r
+                throw new NotImplementedException();\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Indicates whether or not the Value of this SqlDecimal instance is greater than zero.\r
+         * @return true if the Value is assigned to null, otherwise false.\r
+         */\r
+        public bool IsPositive\r
+        {\r
+            get\r
+            {\r
+                if (!IsNull)\r
+                {\r
+                    if (_value >= 0)\r
+                        return true;\r
+\r
+                    return false;\r
+                }\r
+            \r
+                throw new SqlNullValueException("The value of this instance is null");\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Gets the maximum number of digits used to represent the Value property.\r
+         * @return The maximum number of digits used to represent the Value of this SqlDecimal instance.\r
+         */\r
+        public int Precision\r
+        {\r
+            get\r
+            {\r
+                return _precision;\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Gets the number of decimal places to which Value is resolved.\r
+         * @return The number of decimal places to which the Value property is resolved.\r
+         */\r
+        public int Scale\r
+        {\r
+            get\r
+            {\r
+                return  _precision;\r
+            }\r
+        }\r
+\r
+        /**\r
+         * The Abs member function gets the absolute value of the SqlDecimal parameter.\r
+         * @param n A SqlDecimal instance.\r
+         * @return A SqlDecimal instance whose Value property contains the unsigned number representing the absolute value of the SqlDecimal parameter.\r
+         */\r
+        public static SqlDecimal Abs(SqlDecimal n)\r
+        {\r
+            if (n.IsNull)\r
+                return new SqlDecimal();\r
+\r
+            Decimal val;\r
+\r
+            if (n.IsPositive)\r
+                val = n.Value;\r
+            else\r
+                val = Decimal.Negate(n._value);\r
+\r
+            return new SqlDecimal(val);\r
+\r
+        }\r
+\r
+        /**\r
+         * Calcuates the sum of the two SqlDecimal operators.\r
+         * @param x A SqlDecimal instance.\r
+         * @param y A SqlDecimal instance.\r
+         * @return A new SqlDecimal instance whose Value property contains the sum.\r
+         * If one of the parameters or their value is null return SqlDecimal.Null.\r
+         */\r
+        public static SqlDecimal Add(SqlDecimal x, SqlDecimal y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlDecimal.Null;\r
+\r
+            Decimal res = Decimal.Add(x._value, y._value);\r
+\r
+            return new SqlDecimal(res);\r
+        }\r
+\r
+        public static SqlDecimal AdjustScale(SqlDecimal n, int digits, bool fround)\r
+        {\r
+            /** @todo find out what the logic */\r
+            throw new NotImplementedException();\r
+        }\r
+\r
+        /**\r
+         * Returns the smallest whole number greater than or equal to the specified SqlDecimal instance.\r
+         * @param n The SqlDecimal instance for which the ceiling value is to be calculated.\r
+         * @return A SqlDecimal representing the smallest whole number greater than or equal to the specified SqlDecimal instance.\r
+         */\r
+        public static SqlDecimal Ceiling(SqlDecimal n)\r
+        {\r
+            if (n.IsNull)\r
+                return SqlDecimal.Null;\r
+\r
+            double d = Math.Ceiling((double)n._value);\r
+            return new SqlDecimal(d);\r
+        }\r
+\r
+        /**\r
+         * Compares this instance to the supplied object and returns an indication of their relative values.\r
+         * @param obj The object to compare.\r
+         * @return A signed number indicating the relative values of the instance and the object.\r
+         * Less than zero This instance is less than object.\r
+         * Zero This instance is the same as object.\r
+         * Greater than zero This instance is greater than object -or-\r
+         * object is a null reference.\r
+         */\r
+        public int CompareTo(Object obj)\r
+        {\r
+            if (obj == null)\r
+                return 1;\r
+\r
+            if (obj is SqlDecimal)\r
+            {\r
+                SqlDecimal value = (SqlDecimal)obj;\r
+                \r
+                if (IsNull)\r
+                    return -1;\r
+\r
+                if (value.IsNull)\r
+                    return 1;\r
+\r
+                if (_value == value._value)\r
+                    return 0;\r
+\r
+                return Decimal.Compare(_value, value._value);\r
+            }\r
+\r
+            throw new ArgumentException("parameter obj is not SqlDecimal : " + obj.GetType().Name);\r
+\r
+\r
+        }\r
+\r
+\r
+        public SqlDecimal ConvertToPrecScale(SqlDecimal n, int precision, int scale)\r
+        {\r
+            /** @todo find out what the logic */\r
+            throw new NotImplementedException();\r
+        }\r
+\r
+        /**\r
+         * The division operator divides the first SqlDecimal operand by the second.\r
+         * @param x A SqlDecimal instance.\r
+         * @param y A SqlDecimal instance.\r
+         * @return A SqlDecimal instance containing the results of the division operation.\r
+         * If one of the parameters is null or null value - return SqlDouble.Null.\r
+         */\r
+        public static SqlDecimal Divide(SqlDecimal x, SqlDecimal y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlDecimal.Null;\r
+\r
+            Decimal res = Decimal.Divide(x._value, y._value);\r
+\r
+            return new SqlDecimal(res);\r
+        }\r
+\r
+        public override bool Equals(Object obj)\r
+        {\r
+            if (obj == null)\r
+                return false;\r
+\r
+            if (obj is SqlDecimal)\r
+            {\r
+                SqlDecimal dec = (SqlDecimal)obj;\r
+\r
+                return Decimal.Equals(_value, dec._value);\r
+            }\r
+\r
+            return false;\r
+        }\r
+\r
+        \r
+        /**\r
+         * Performs a logical comparison on two instances of SqlDecimal to determine if they are equal.\r
+         * @param x A SqlDecimal instance.\r
+         * @param y A SqlDecimal instance.\r
+         * @return true if the two values are equal, otherwise false.\r
+         * If one of the parameters is null or null value return SqlBoolean.Null.\r
+         */\r
+        public static SqlBoolean Equals(SqlDecimal x, SqlDecimal y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x.Equals(y))\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Rounds a specified SqlDecimal number to the next lower whole number.\r
+         * @param n The SqlDecimal instance for which the floor value is to be calculated.\r
+         * @return A SqlDecimal instance containing the whole number portion of this SqlDecimal instance.\r
+         */\r
+        public static SqlDecimal Floor(SqlDecimal n)\r
+        {\r
+            Decimal res = Decimal.Floor(n._value);\r
+\r
+            return new SqlDecimal(res);\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlDecimal to determine if the first is greater than the second.\r
+         * @param x A SqlDecimal instance\r
+         * @param y A SqlDecimal instance\r
+         * @return A SqlBoolean that is True if the first instance is greater than the second instance, otherwise False.\r
+         * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean GreaterThan(SqlDecimal x, SqlDecimal y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x.CompareTo(y) > 0)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlDecimal to determine if the first is greater than or equal to the second.\r
+         * @param x A SqlDecimal instance\r
+         * @param y A SqlDecimal instance\r
+         * @return A SqlBoolean that is True if the first instance is greaater than or equal to the second instance, otherwise False.\r
+         * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean GreaterThanOrEqual(SqlDecimal x, SqlDecimal y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x.CompareTo(y) >= 0)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlDecimal to determine if the first is less than the second.\r
+         * @param x A SqlDecimal instance\r
+         * @param y A SqlDecimal instance\r
+         * @return A SqlBoolean that is True if the first instance is less than the second instance, otherwise False.\r
+         * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean LessThan(SqlDecimal x, SqlDecimal y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x.CompareTo(y) < 0)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlDecimal to determine if the first is less than the second.\r
+         * @param x A SqlDecimal instance\r
+         * @param y A SqlDecimal instance\r
+         * @return A SqlBoolean that is True if the first instance is less than the second instance, otherwise False.\r
+         * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean LessThanOrEqual(SqlDecimal x, SqlDecimal y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x.CompareTo(y) <= 0)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * The multiplication operator computes the product of the two SqlDecimal operands.\r
+         * @param x A SqlDecimal instance\r
+         * @param y A SqlDecimal instance\r
+         * @return The product of the two SqlDecimal operands.\r
+         */\r
+        public static SqlDecimal Multiply(SqlDecimal x, SqlDecimal y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlDecimal.Null;\r
+\r
+            Decimal res = Decimal.Multiply(x._value, y._value);\r
+\r
+            return new SqlDecimal(res);\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlDecimal to determine if they are equal.\r
+         * @param x A SqlDecimal instance\r
+         * @param y A SqlDecimal instance\r
+         * @return A SqlBoolean that is True if the two instances are not equal or False if the two instances are equal.\r
+         * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean NotEquals(SqlDecimal x, SqlDecimal y)\r
+        {\r
+            SqlBoolean eVal = Equals(x, y);\r
+\r
+            if (eVal.IsNull)\r
+                return eVal;\r
+            if (eVal.IsTrue)\r
+                return SqlBoolean.False;\r
+\r
+            return SqlBoolean.True;\r
+        }\r
+\r
+        /**\r
+         * Converts the String representation of a number to its Decimal number equivalent.\r
+         * @param s The String to be parsed.\r
+         * @return A SqlDecimal containing the value represented by the String.\r
+         */\r
+        public static SqlDecimal Parse(String s)\r
+        {\r
+            Decimal val = Decimal.Parse(s);\r
+            SqlDecimal retVal = new SqlDecimal(val);\r
+\r
+            if (GreaterThan(retVal, MaxValue).IsTrue || LessThan(retVal, MinValue).IsTrue)\r
+                throw new OverflowException("The parse of this string is overflowing : " + val);\r
+\r
+            return retVal;\r
+\r
+        }\r
+\r
+        /**\r
+         * Raises the value of the specified SqlDecimal instance to the specified exponential power.\r
+         * @param n The SqlDecimal instance to be raised to a power.\r
+         * @param exponent A double value indicating the power to which the number should be raised.\r
+         * @return A SqlDecimal instance containing the results.\r
+         */\r
+        public static SqlDecimal Power(SqlDecimal n, double exponent)\r
+        {\r
+            /** @todo decide if we treat the Decimal as a double and use Math.pow() */\r
+            \r
+            double d = (double)n._value;\r
+\r
+            d = java.lang.Math.pow(d, exponent);\r
+\r
+            return new SqlDecimal(d);\r
+        }\r
+\r
+        /**\r
+         * Gets the number nearest the specified SqlDecimal instance's value with the specified precision.\r
+         * @param n The SqlDecimal instance to be rounded.\r
+         * @param position The number of significant fractional digits (precision) in the return value.\r
+         * @return A SqlDecimal instance containing the results of the rounding operation.\r
+         */\r
+        public static SqlDecimal Round(SqlDecimal n, int position)\r
+        {\r
+            Decimal val = Decimal.Round(n._value, position);\r
+\r
+            return new SqlDecimal(val);\r
+        }\r
+\r
+        /**\r
+         * Gets a value indicating the sign of a SqlDecimal instance's Value property.\r
+         * @param n The SqlDecimal instance whose sign is to be evaluated.\r
+         * @return A number indicating the sign of the SqlDecimal instance.\r
+         */\r
+        public static int Sign(SqlDecimal n)\r
+        {\r
+            if (n._value < 0)\r
+                return -1;\r
+            if(n._value > 0)\r
+                return 1;\r
+            return 0;\r
+        }\r
+\r
+        /**\r
+         * The subtraction operator the second SqlDecimal operand from the first.\r
+         * @param x A SqlDecimal instance\r
+         * @param y A SqlDecimal instance\r
+         * @return The results of the subtraction operation.\r
+         */\r
+        public static SqlDecimal Subtract(SqlDecimal x, SqlDecimal y)\r
+        {\r
+            Decimal val = Decimal.Subtract(x._value, y._value);\r
+            SqlDecimal retVal = new SqlDecimal(val);\r
+\r
+            return retVal;\r
+\r
+        }\r
+\r
+        /**\r
+         * Returns the a double equal to the contents of the Value property of this instance.\r
+         * @return The decimal representation of the Value property.\r
+         */\r
+        public double ToDouble()\r
+        {\r
+            return Decimal.ToDouble(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlDecimal instance to SqlBoolean.\r
+         * @return A SqlBoolean instance whose Value will be True if the SqlDecimal instance's Value is non-zero,\r
+         * False if the SqlDecimal is zero\r
+         * and Null if the SqlDecimal instance is Null.\r
+         */\r
+        public SqlBoolean ToSqlBoolean()\r
+        {\r
+            if (IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            return new SqlBoolean(!_value.Equals(Decimal.Zero));\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlDecimal instance to SqlByte.\r
+         * @return A SqlByte instance whose Value equals the Value of this SqlDouble instance.\r
+         */\r
+        public SqlByte ToSqlByte()\r
+        {\r
+            if (IsNull)\r
+                return SqlByte.Null;\r
+\r
+            return new SqlByte(checked((byte)_value));\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlDecimal instance to SqlDouble.\r
+         * @return A SqlDouble instance whose Value equals the Value of this SqlDecimal instance.\r
+         */\r
+        public SqlDouble ToSqlDouble()\r
+        {\r
+            if (IsNull)\r
+                return SqlDouble.Null;\r
+\r
+            return new SqlDouble((double)_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlDouble structure to SqlInt16.\r
+         * @return A SqlInt16 structure whose Value equals the Value of this SqlDouble structure.\r
+         */\r
+        public SqlInt16 ToSqlInt16()\r
+        {\r
+            if (IsNull)\r
+                return SqlInt16.Null;\r
+\r
+            return new SqlInt16(checked((short)_value));\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlDouble structure to SqlInt32.\r
+         * @return A SqlInt32 structure whose Value equals the Value of this SqlDouble structure.\r
+         */\r
+        public SqlInt32 ToSqlInt32()\r
+        {\r
+            if (IsNull)\r
+                return SqlInt32.Null;\r
+\r
+            return new SqlInt32(checked((int)_value));\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlDecimal structure to SqlInt64.\r
+         * @return A SqlInt64 structure whose Value equals the Value of this SqlDecimal structure.\r
+         */\r
+        public SqlInt64 ToSqlInt64()\r
+        {\r
+            if (IsNull)\r
+                return SqlInt64.Null;\r
+\r
+            return new SqlInt64(checked((long)_value));\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlDecimal instance to SqlDouble.\r
+         * @return A SqlMoney instance whose Value equals the Value of this SqlDecimal instance.\r
+         */\r
+        public SqlMoney ToSqlMoney()\r
+        {\r
+            if (IsNull)\r
+                return SqlMoney.Null;\r
+\r
+            return new SqlMoney(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlDecimal instance to SqlSingle.\r
+         * @return A SqlSingle instance whose Value equals the Value of this SqlDecimal instance.\r
+         */\r
+        public SqlSingle ToSqlSingle()\r
+        {\r
+            if (IsNull)\r
+                return SqlSingle.Null;\r
+\r
+            return new SqlSingle(checked((float)_value));\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlDecimal structure to SqlString.\r
+         * @return A SqlString structure whose value is a string representing the date and time contained in this SqlDecimal structure.\r
+         */\r
+        public SqlString ToSqlString()\r
+        {\r
+            return new SqlString(ToString());\r
+        }\r
+\r
+\r
+        public override String ToString()\r
+        {\r
+            if (IsNull)\r
+                return "null";\r
+\r
+            return _value.ToString();\r
+        }\r
+\r
+        /**\r
+         * Truncates the specified SqlDecimal instance's value to the desired position.\r
+         * @param n The SqlDecimal instance to be truncated.\r
+         * @param position The decimal position to which the number will be truncated.\r
+         * @return Supply a negative value for the position parameter in order to truncate the value to the corresponding positon to the left of the decimal point.\r
+         */\r
+        public static SqlDecimal Truncate(SqlDecimal n, int position)\r
+        {\r
+            if (n.IsNull)\r
+                return n;\r
+            \r
+            Decimal tmp = Decimal.Round(n._value, position);\r
+\r
+            return new SqlDecimal(tmp);\r
+        }\r
+\r
+        public override int GetHashCode()\r
+        {\r
+            return _value.GetHashCode();\r
+        }\r
+        \r
+        public static SqlDecimal operator + (SqlDecimal x, SqlDecimal y)\r
+        {\r
+            if(x.IsNull || y.IsNull)\r
+                return SqlDecimal.Null;\r
+\r
+            return new SqlDecimal(x.Value + y.Value);\r
+        }\r
+\r
+        public static SqlDecimal operator / (SqlDecimal x, SqlDecimal y)\r
+        {\r
+            if(x.IsNull || y.IsNull)\r
+                return SqlDecimal.Null;\r
+            return new SqlDecimal (x.Value / y.Value);\r
+        }\r
+\r
+        public static SqlBoolean operator == (SqlDecimal x, SqlDecimal y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+\r
+            return new SqlBoolean(x.Value == y.Value);\r
+        }\r
+\r
+        public static SqlBoolean operator > (SqlDecimal x, SqlDecimal y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+\r
+            return new SqlBoolean(x.Value > y.Value);\r
+        }\r
+\r
+        public static SqlBoolean operator >= (SqlDecimal x, SqlDecimal y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+\r
+            return new SqlBoolean(x.Value >= y.Value);\r
+        }\r
+\r
+        public static SqlBoolean operator != (SqlDecimal x, SqlDecimal y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+\r
+            return new SqlBoolean(x.Value != y.Value);\r
+        }\r
+\r
+        public static SqlBoolean operator < (SqlDecimal x, SqlDecimal y)\r
+        {\r
+\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+\r
+            return new SqlBoolean(x.Value < y.Value);\r
+\r
+        }\r
+\r
+        public static SqlBoolean operator <= (SqlDecimal x, SqlDecimal y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+\r
+            return new SqlBoolean(x.Value <= y.Value);\r
+        }\r
+\r
+        public static SqlDecimal operator * (SqlDecimal x, SqlDecimal y)\r
+        {\r
+            // adjust the scale to the smaller of the two beforehand\r
+            if (x.Scale > y.Scale)\r
+                x = SqlDecimal.AdjustScale(x, y.Scale - x.Scale, true);\r
+            else if (y.Scale > x.Scale)\r
+                y = SqlDecimal.AdjustScale(y, x.Scale - y.Scale, true);\r
+\r
+            return new SqlDecimal(x.Value * y.Value);\r
+        }\r
+\r
+        public static SqlDecimal operator - (SqlDecimal x, SqlDecimal y)\r
+        {\r
+            if(x.IsNull || y.IsNull)\r
+                return SqlDecimal.Null;\r
+\r
+            return new SqlDecimal(x.Value - y.Value);\r
+        }\r
+\r
+        public static SqlDecimal operator - (SqlDecimal n)\r
+        {\r
+            if(n.IsNull)\r
+                return n;\r
+            return new SqlDecimal (Decimal.Negate(n.Value));\r
+        }\r
+\r
+        public static explicit operator SqlDecimal (SqlBoolean x)\r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else\r
+                return new SqlDecimal ((decimal)x.ByteValue);\r
+        }\r
+\r
+        public static explicit operator Decimal (SqlDecimal n)\r
+        {\r
+            return n.Value;\r
+        }\r
+\r
+        public static explicit operator SqlDecimal (SqlDouble x)\r
+        {\r
+            checked \r
+            {\r
+                if (x.IsNull) \r
+                    return Null;\r
+                else\r
+                    return new SqlDecimal ((decimal)x.Value);\r
+            }\r
+        }\r
+\r
+        public static explicit operator SqlDecimal (SqlSingle x)\r
+        {\r
+            checked \r
+            {\r
+                if (x.IsNull) \r
+                    return Null;\r
+                else\r
+                    return new SqlDecimal ((decimal)x.Value);\r
+            }\r
+        }\r
+\r
+        public static explicit operator SqlDecimal (SqlString x)\r
+        {\r
+            checked \r
+            {\r
+                return Parse (x.Value);\r
+            }\r
+        }\r
+\r
+        public static implicit operator SqlDecimal (decimal x)\r
+        {\r
+            return new SqlDecimal (x);\r
+        }\r
+\r
+        public static implicit operator SqlDecimal (SqlByte x)\r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else\r
+                return new SqlDecimal ((decimal)x.Value);\r
+        }\r
+\r
+        public static implicit operator SqlDecimal (SqlInt16 x)\r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else\r
+                return new SqlDecimal ((decimal)x.Value);\r
+        }\r
+\r
+        public static implicit operator SqlDecimal (SqlInt32 x)\r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else\r
+                return new SqlDecimal ((decimal)x.Value);\r
+        }\r
+\r
+        public static implicit operator SqlDecimal (SqlInt64 x)\r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else\r
+                return new SqlDecimal ((decimal)x.Value);\r
+        }\r
+\r
+        public static implicit operator SqlDecimal (SqlMoney x)\r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else\r
+                return new SqlDecimal ((decimal)x.Value);\r
+        }\r
+\r
+    }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlDouble.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlDouble.cs
new file mode 100644 (file)
index 0000000..47cf83b
--- /dev/null
@@ -0,0 +1,644 @@
+/*\r
+* Copyright (c) 2002-2004 Mainsoft Corporation.\r
+*\r
+* Permission is hereby granted, free of charge, to any person obtaining a\r
+* copy of this software and associated documentation files (the "Software"),\r
+* to deal in the Software without restriction, including without limitation\r
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+* and/or sell copies of the Software, and to permit persons to whom the\r
+* Software is furnished to do so, subject to the following conditions:\r
+*\r
+* The above copyright notice and this permission notice shall be included in\r
+* all copies or substantial portions of the Software.\r
+*\r
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+* DEALINGS IN THE SOFTWARE.\r
+*/\r
+\r
+namespace System.Data.SqlTypes\r
+{\r
+\r
+    /**\r
+     * <p>Title: </p>\r
+     * <p>Description: </p>\r
+     * <p>Copyright: Copyright (c) 2002</p>\r
+     * <p>Company: MainSoft</p>\r
+     * @author Pavel Sandler\r
+     * @version 1.0\r
+     */\r
+\r
+    using System;\r
+\r
+    public struct SqlDouble : INullable, IComparable\r
+    {\r
+\r
+        private Double _value;\r
+        private bool _isNull;\r
+\r
+        //private static double _maxVal = 1.79E+308;\r
+        //private static double _minVal = -1.79E+308;\r
+\r
+        public static readonly SqlDouble MaxValue = new SqlDouble(1.79E+308);\r
+        public static readonly SqlDouble MinValue = new SqlDouble(-1.79E+308);\r
+        public static readonly SqlDouble Null = new SqlDouble(true);\r
+        public static readonly SqlDouble Zero = new SqlDouble(0.0);\r
+\r
+        \r
+        private SqlDouble(bool isNull)\r
+        {\r
+            _value = 0;\r
+            _isNull = isNull;\r
+        }\r
+\r
+        /**\r
+         * Constructor\r
+         * @param value A double whose value will be used for the new SqlDouble.\r
+         */\r
+        public SqlDouble(double value) \r
+        { \r
+            _value = value;\r
+            _isNull = false;\r
+        }\r
+\r
+        \r
+        /**\r
+         * Indicates whether or not Value is null.\r
+         * @return true if Value is null, otherwise false.\r
+         */\r
+        public bool IsNull\r
+        {\r
+            get\r
+            {\r
+                return _isNull;\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Gets the value of the SqlDouble instance.\r
+         * @return the value of this instance\r
+         */\r
+        public double Value\r
+        {\r
+            get\r
+            {\r
+                if(IsNull)\r
+                    throw new SqlNullValueException();\r
+                return _value;\r
+            }\r
+        }\r
+\r
+        /**\r
+         * The addition operator computes the sum of the two SqlDouble operands.\r
+         * @param x A SqlDouble structure.\r
+         * @param y A SqlDouble structure.\r
+         * @return The sum of the two SqlDouble operands.\r
+         * If one of the parameters is null or null value - return SqlDouble.Null.\r
+         */\r
+        public static SqlDouble Add(SqlDouble x, SqlDouble y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlDouble.Null;\r
+\r
+            double xVal = x._value;\r
+            double yVal = y._value;\r
+\r
+            return new SqlDouble(checked(xVal + yVal));\r
+        }\r
+\r
+        /**\r
+         * Compares this instance to the supplied object and returns an indication of their relative values.\r
+         * @param obj The object to compare.\r
+         * @return A signed number indicating the relative values of the instance and the object.\r
+         * Less than zero This instance is less than object.\r
+         * Zero This instance is the same as object.\r
+         * Greater than zero This instance is greater than object -or-\r
+         * object is a null reference.\r
+         */\r
+        public int CompareTo(Object obj)\r
+        {\r
+            if (obj == null)\r
+                return 1;\r
+\r
+            if (obj is SqlDouble)\r
+            {\r
+                SqlDouble d = (SqlDouble)obj;\r
+\r
+                if (d.IsNull)\r
+                    return 1;\r
+                if (this.IsNull)\r
+                    return -1;\r
+\r
+                return this._value.CompareTo(d._value);\r
+            }\r
+\r
+            throw new ArgumentException("parameter obj is not SqlDouble : " + obj.GetType().Name);\r
+\r
+        }\r
+\r
+        /**\r
+         * The division operator divides the first SqlDouble operand by the second.\r
+         * @param x A SqlDouble instance.\r
+         * @param y A SqlDouble instance.\r
+         * @return A SqlDouble structure containing the results of the division operation.\r
+         * If one of the parameters is null or null value - return SqlDouble.Null.\r
+         */\r
+        public static SqlDouble Divide(SqlDouble x, SqlDouble y)\r
+        {\r
+\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlDouble.Null;\r
+\r
+            double xVal = x._value;\r
+            double yVal = y._value;\r
+\r
+            return new SqlDouble(checked(xVal / yVal));\r
+\r
+        }\r
+\r
+        public override bool Equals(Object obj)\r
+        {\r
+            \r
+            if (obj == null)\r
+                return false;\r
+\r
+            if (obj is SqlDouble)\r
+            {\r
+                SqlDouble d = (SqlDouble)obj;\r
+\r
+                if (IsNull && d.IsNull)\r
+                    return true;\r
+\r
+                if (IsNull || d.IsNull)\r
+                    return false;\r
+\r
+                return _value == d._value;\r
+            }\r
+\r
+            return false;\r
+        }\r
+\r
+        /**\r
+         * Performs a logical comparison on two instances of SqlDouble to determine if they are equal.\r
+         * @param x A SqlDouble instance.\r
+         * @param y A SqlDouble instance.\r
+         * @return true if the two values are equal, otherwise false.\r
+         * If one of the parameters is null or null value return SqlBoolean.Null.\r
+         */\r
+        public static SqlBoolean Equals(SqlDouble x, SqlDouble y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x.Equals(y))\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlDouble to determine if the first is greater than the second.\r
+         * @param x A SqlDouble instance\r
+         * @param y A SqlDouble instance\r
+         * @return A SqlBoolean that is True if the first instance is greater than the second instance, otherwise False.\r
+         * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean GreaterThan(SqlDouble x, SqlDouble y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value > y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlDouble to determine if the first is greater than or equal to the second.\r
+         * @param x A SqlDouble instance\r
+         * @param y A SqlDouble instance\r
+         * @return A SqlBoolean that is True if the first instance is greaater than or equal to the second instance, otherwise False.\r
+         * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean GreaterThanOrEqual(SqlDouble x, SqlDouble y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value >= y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlDouble to determine if the first is less than the second.\r
+         * @param x A SqlDouble instance\r
+         * @param y A SqlDouble instance\r
+         * @return A SqlBoolean that is True if the first instance is less than the second instance, otherwise False.\r
+         * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean LessThan(SqlDouble x, SqlDouble y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value < y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlDouble to determine if the first is less than or equal to the second.\r
+         * @param x A SqlDouble instance\r
+         * @param y A SqlDouble instance\r
+         * @return A SqlBoolean that is True if the first instance is less than or equal to the second instance, otherwise False.\r
+         * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean LessThanOrEqual(SqlDouble x, SqlDouble y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value <= y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * The multiplication operator computes the product of the two SqlDouble operands.\r
+         * @param x A SqlDouble instance\r
+         * @param y A SqlDouble instance\r
+         * @return The product of the two SqlDouble operands.\r
+         */\r
+        public static SqlDouble Multiply(SqlDouble x, SqlDouble y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlDouble.Null;\r
+\r
+            double xVal = x._value;\r
+            double yVal = y._value;\r
+\r
+            return new SqlDouble(checked(xVal * yVal));\r
+        }\r
+\r
+\r
+        /**\r
+         * Compares two instances of SqlDouble to determine if they are equal.\r
+         * @param x A SqlDouble instance\r
+         * @param y A SqlDouble instance\r
+         * @return A SqlBoolean that is True if the two instances are not equal or False if the two instances are equal.\r
+         * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean NotEquals(SqlDouble x, SqlDouble y)\r
+        {\r
+            SqlBoolean res = Equals(x, y);\r
+\r
+            if (res.IsNull)\r
+                return res;\r
+            if (res.IsFalse)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Converts the String representation of a number to its double-precision floating point number equivalent.\r
+         * @param s The String to be parsed.\r
+         * @return A SqlDouble containing the value represented by the String.\r
+         */\r
+        public static SqlDouble Parse(String s)\r
+        {\r
+            double d = double.Parse(s);\r
+            return new SqlDouble(d);\r
+        }\r
+\r
+        /**\r
+         * The subtraction operator the second SqlDouble operand from the first.\r
+         * @param x A SqlDouble instance\r
+         * @param y A SqlDouble instance\r
+         * @return The results of the subtraction operation.\r
+         */\r
+        public static SqlDouble Subtract(SqlDouble x, SqlDouble y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlDouble.Null;\r
+\r
+            double xVal = x._value;\r
+            double yVal = y._value;\r
+\r
+            return new SqlDouble(checked(xVal - yVal));\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlDouble structure to SqlBoolean.\r
+         * @return A SqlBoolean structure whose Value will be True if the SqlDouble structure's Value is non-zero, False if the SqlDouble is zero\r
+         * and Null if the SqlDouble structure is Null.\r
+         */\r
+        public SqlBoolean ToSqlBoolean()\r
+        {\r
+            if (IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (_value == 0)\r
+                return new SqlBoolean(0);\r
+\r
+            return new SqlBoolean(1);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlDouble structure to SqlByte.\r
+         * @return A SqlByte structure whose Value equals the Value of this SqlDouble structure.\r
+         */\r
+        public SqlByte ToSqlByte()\r
+        {\r
+            if (IsNull)\r
+                return SqlByte.Null;\r
+\r
+            return new SqlByte(checked((byte)_value));\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlDouble structure to SqlDecimal.\r
+         * @return A SqlDecimal structure whose Value equals the Value of this SqlDouble structure.\r
+         */\r
+        public SqlDecimal ToSqlDecimal()\r
+        {\r
+            if (IsNull)\r
+                return SqlDecimal.Null;\r
+\r
+            return new SqlDecimal(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlDouble structure to SqlInt16.\r
+         * @return A SqlInt16 structure whose Value equals the Value of this SqlDouble structure.\r
+         */\r
+        public SqlInt16 ToSqlInt16()\r
+        {\r
+            if (IsNull)\r
+                return SqlInt16.Null;\r
+\r
+            return new SqlInt16(checked((short)_value));\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlDouble structure to SqlInt32.\r
+         * @return A SqlInt32 structure whose Value equals the Value of this SqlDouble structure.\r
+         */\r
+        public SqlInt32 ToSqlInt32()\r
+        {\r
+            if (IsNull)\r
+                return SqlInt32.Null;\r
+\r
+            return new SqlInt32(checked((int)_value));\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlDouble structure to SqlInt64.\r
+         * @return A SqlInt64 structure whose Value equals the Value of this SqlDouble structure.\r
+         */\r
+        public SqlInt64 ToSqlInt64()\r
+        {\r
+            if (IsNull)\r
+                return SqlInt64.Null;\r
+\r
+            return new SqlInt64(checked((long)_value));\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlDouble instance to SqlDouble.\r
+         * @return A SqlMoney instance whose Value equals the Value of this SqlDouble instance.\r
+         */\r
+        public SqlMoney ToSqlMoney()\r
+        {\r
+            if (IsNull)\r
+                return SqlMoney.Null;\r
+\r
+            return new SqlMoney(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlMoney instance to SqlSingle.\r
+         * @return A SqlSingle instance whose Value equals the Value of this SqlMoney instance.\r
+         */\r
+        public SqlSingle ToSqlSingle()\r
+        {\r
+            if (IsNull)\r
+                return SqlSingle.Null;\r
+\r
+            return new SqlSingle(checked((float)_value));\r
+        }\r
+\r
+\r
+        /**\r
+         * Converts this SqlDouble structure to SqlString.\r
+         * @return A SqlString structure whose value is a string representing the date and time contained in this SqlDouble structure.\r
+         */\r
+        public SqlString ToSqlString()\r
+        {\r
+            return new SqlString(ToString());\r
+        }\r
+\r
+        public override String ToString()\r
+        {\r
+            if (IsNull)\r
+                return "null";\r
+\r
+\r
+            return _value.ToString();\r
+        }\r
+\r
+        public override int GetHashCode()\r
+        {\r
+            return _value.GetHashCode();\r
+        }\r
+\r
+        public static SqlDouble operator + (SqlDouble x, SqlDouble y)\r
+        {\r
+            double d = 0;\r
+            d = x.Value + y.Value;\r
+                       \r
+            if (Double.IsInfinity (d)) \r
+                throw new OverflowException ();\r
+\r
+            return new SqlDouble (d);\r
+        }\r
+\r
+        public static SqlDouble operator / (SqlDouble x, SqlDouble y)\r
+        {\r
+            double d = x.Value / y.Value;\r
+\r
+            if (Double.IsInfinity (d)) \r
+            {\r
+                if (y.Value == 0) \r
+                    throw new DivideByZeroException ();\r
+            }\r
+                               \r
+            return new SqlDouble (d);\r
+        }\r
+\r
+        public static SqlBoolean operator == (SqlDouble x, SqlDouble y)\r
+        {\r
+            if (x.IsNull || y.IsNull)  \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value == y.Value);\r
+        }\r
+\r
+        public static SqlBoolean operator > (SqlDouble x, SqlDouble y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value > y.Value);\r
+        }\r
+\r
+        public static SqlBoolean operator >= (SqlDouble x, SqlDouble y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value >= y.Value);\r
+        }\r
+\r
+        public static SqlBoolean operator != (SqlDouble x, SqlDouble y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (!(x.Value == y.Value));\r
+        }\r
+\r
+        public static SqlBoolean operator < (SqlDouble x, SqlDouble y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value < y.Value);\r
+        }\r
+\r
+        public static SqlBoolean operator <= (SqlDouble x, SqlDouble y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value <= y.Value);\r
+        }\r
+\r
+        public static SqlDouble operator * (SqlDouble x, SqlDouble y)\r
+        {\r
+            double d = x.Value * y.Value;\r
+                       \r
+            if (Double.IsInfinity (d))\r
+                throw new OverflowException ();\r
+\r
+            return new SqlDouble (d);\r
+\r
+        }\r
+\r
+        public static SqlDouble operator - (SqlDouble x, SqlDouble y)\r
+        {\r
+            double d = x.Value - y.Value;\r
+                       \r
+            if (Double.IsInfinity (d))\r
+                throw new OverflowException ();\r
+\r
+            return new SqlDouble (d);\r
+        }\r
+\r
+        public static SqlDouble operator - (SqlDouble n)\r
+        {                      \r
+            return new SqlDouble (-(n.Value));\r
+        }\r
+\r
+        public static explicit operator SqlDouble (SqlBoolean x)\r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else\r
+                return new SqlDouble ((double)x.ByteValue);\r
+        }\r
+\r
+        public static explicit operator double (SqlDouble x)\r
+        {\r
+            return x.Value;\r
+        }\r
+\r
+        public static explicit operator SqlDouble (SqlString x)\r
+        {\r
+            checked \r
+            {\r
+                return SqlDouble.Parse (x.Value);\r
+            }\r
+        }\r
+\r
+        public static implicit operator SqlDouble (double x)\r
+        {\r
+            return new SqlDouble (x);\r
+        }\r
+\r
+        public static implicit operator SqlDouble (SqlByte x)\r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else\r
+                return new SqlDouble ((double)x.Value);\r
+        }\r
+\r
+        public static implicit operator SqlDouble (SqlDecimal x)\r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else\r
+                return new SqlDouble (x.ToDouble ());\r
+        }\r
+\r
+        public static implicit operator SqlDouble (SqlInt16 x)\r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else\r
+                return new SqlDouble ((double)x.Value);\r
+        }\r
+\r
+        public static implicit operator SqlDouble (SqlInt32 x)\r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else\r
+                return new SqlDouble ((double)x.Value);\r
+        }\r
+\r
+        public static implicit operator SqlDouble (SqlInt64 x)\r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else\r
+                return new SqlDouble ((double)x.Value);\r
+        }\r
+\r
+        public static implicit operator SqlDouble (SqlMoney x)\r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else\r
+                return new SqlDouble ((double)x.Value);\r
+        }\r
+\r
+        public static implicit operator SqlDouble (SqlSingle x)\r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else\r
+                return new SqlDouble ((double)x.Value);\r
+        }\r
+   }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlGuid.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlGuid.cs
new file mode 100644 (file)
index 0000000..c3fdefd
--- /dev/null
@@ -0,0 +1,280 @@
+ /*\r
+  * Copyright (c) 2002-2004 Mainsoft Corporation.\r
+  *\r
+  * Permission is hereby granted, free of charge, to any person obtaining a\r
+  * copy of this software and associated documentation files (the "Software"),\r
+  * to deal in the Software without restriction, including without limitation\r
+  * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+  * and/or sell copies of the Software, and to permit persons to whom the\r
+  * Software is furnished to do so, subject to the following conditions:\r
+  *\r
+  * The above copyright notice and this permission notice shall be included in\r
+  * all copies or substantial portions of the Software.\r
+  *\r
+  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+  * DEALINGS IN THE SOFTWARE.\r
+  */\r
+namespace System.Data.SqlTypes\r
+{\r
+\r
+    using System;\r
+\r
+    /**\r
+     *\r
+     */\r
+    public struct SqlGuid : INullable, IComparable\r
+    {\r
+        private Guid _value;\r
+        private bool _isNull;\r
+        public static readonly SqlGuid Null = new SqlGuid();\r
+\r
+        \r
+        private SqlGuid(bool isNull)\r
+        {\r
+            _isNull = isNull;\r
+            _value = Guid.Empty;\r
+        }\r
+    \r
+        public SqlGuid(byte[] value) \r
+        {\r
+            _value = new Guid(value);\r
+            _isNull = false;\r
+        }\r
+\r
+        public SqlGuid(String s) \r
+        {\r
+            _value = new Guid(s);\r
+            _isNull = false;\r
+        }\r
+\r
+        public SqlGuid(Guid g) \r
+        {\r
+            _value = g;\r
+            _isNull = false;\r
+        }\r
+\r
+        public SqlGuid(int a, short b, short c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k)\r
+        {\r
+            _value = new Guid(a, b, c, d, e, f, g, h, i, j, k);\r
+            _isNull = false;\r
+        }\r
+\r
+        \r
+        public int CompareTo(Object obj)\r
+        {\r
+            if (obj == null)
+                return 1;
+
+            if (obj is SqlGuid)
+            {
+                SqlGuid g = (SqlGuid)obj;
+
+                if (g.IsNull)
+                    return 1;
+                if (this.IsNull)
+                    return -1;
+
+                return this._value.CompareTo(g._value);
+            }
+
+            throw new ArgumentException("parameter obj is not SqlGuid : " + obj.GetType().Name);
+\r
+        }\r
+\r
+        public bool IsNull\r
+        {\r
+            get\r
+            {\r
+                return _isNull;\r
+            }\r
+        }\r
+\r
+        public override int GetHashCode()\r
+        {\r
+            return _value.GetHashCode();\r
+        }\r
+\r
+        public override bool Equals(Object obj)\r
+        {\r
+            if (obj == null)
+                return false;
+
+            if (obj is SqlGuid)
+            {
+                SqlGuid g = (SqlGuid)obj;
+
+                if (IsNull && g.IsNull)
+                    return true;
+
+                if (IsNull || g.IsNull)
+                    return false;
+
+                return _value == g._value;
+            }
+
+            return false;\r
+        }\r
+\r
+        public override String ToString()\r
+        {\r
+            if (IsNull)
+                return "null";
+
+
+            return _value.ToString();\r
+        }\r
+\r
+        public Guid Value\r
+        {\r
+            get\r
+            {\r
+                if(IsNull)\r
+                    throw new SqlNullValueException();\r
+                return _value;\r
+            }\r
+        }\r
+\r
+        public static SqlGuid op_Implicit(Guid x)\r
+        {\r
+            return new SqlGuid(x);\r
+        }\r
+\r
+        public static Guid op_Explicit(SqlGuid x)\r
+        {\r
+            return x.Value;\r
+        }\r
+\r
+        public byte[] ToByteArray()\r
+        {\r
+            if(IsNull)\r
+                throw new SqlNullValueException();\r
+            return _value.ToByteArray();\r
+        }\r
+\r
+        public static SqlGuid Parse(String s)\r
+        {\r
+            return new SqlGuid(s);\r
+        }\r
+\r
+        public static SqlGuid op_Explicit(SqlString x)\r
+        {\r
+            return new SqlGuid(x.Value);\r
+        }\r
+\r
+        public static SqlGuid op_Explicit(SqlBinary x)\r
+        {\r
+            return new SqlGuid(x.Value);\r
+        }\r
+\r
+        public static SqlBoolean op_Equality(SqlGuid x, SqlGuid y)\r
+        {\r
+            return Equals(x, y);\r
+        }\r
+\r
+        public static SqlBoolean op_Inequality(SqlGuid x, SqlGuid y)\r
+        {\r
+            return NotEquals(x, y);\r
+        }\r
+\r
+        public static SqlBoolean op_LessThan(SqlGuid x, SqlGuid y)\r
+        {\r
+            return LessThan(x, y);\r
+        }\r
+\r
+        public static SqlBoolean op_GreaterThan(SqlGuid x, SqlGuid y)\r
+        {\r
+            return GreaterThan(x, y);\r
+        }\r
+\r
+        public static SqlBoolean op_LessThanOrEqual(SqlGuid x, SqlGuid y)\r
+        {\r
+            return LessThanOrEqual(x, y);\r
+        }\r
+\r
+        public static SqlBoolean op_GreaterThanOrEqual(SqlGuid x, SqlGuid y)\r
+        {\r
+            return GreaterThanOrEqual(x, y);\r
+        }\r
+\r
+        public static SqlBoolean Equals(SqlGuid x, SqlGuid y)\r
+        {\r
+            if(x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            return new SqlBoolean(x.Value.Equals(y.Value));\r
+        }\r
+\r
+        public static SqlBoolean NotEquals(SqlGuid x, SqlGuid y)\r
+        {\r
+            SqlBoolean res = Equals(x, y);\r
+            if(res.IsFalse)\r
+                return SqlBoolean.True;\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        public static SqlBoolean LessThan(SqlGuid x, SqlGuid y)\r
+        {\r
+            if(x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            int res = x.CompareTo(y);\r
+            if(res < 0)\r
+                return SqlBoolean.True;\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        public static SqlBoolean GreaterThan(SqlGuid x, SqlGuid y)\r
+        {\r
+            if(x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            int res = x.CompareTo(y);\r
+            if(res > 0)\r
+                return SqlBoolean.True;\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        public static SqlBoolean LessThanOrEqual(SqlGuid x, SqlGuid y)\r
+        {\r
+            if(x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            int res = x.CompareTo(y);\r
+            if(res <= 0)\r
+                return SqlBoolean.True;\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        public static SqlBoolean GreaterThanOrEqual(SqlGuid x, SqlGuid y)\r
+        {\r
+            if(x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            int res = x.CompareTo(y);\r
+            if(res >= 0)\r
+                return SqlBoolean.True;\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        public SqlString ToSqlString()\r
+        {\r
+            if(IsNull)\r
+                return SqlString.Null;\r
+\r
+            return new SqlString(ToString());\r
+        }\r
+\r
+        public SqlBinary ToSqlBinary()\r
+        {\r
+            if(IsNull)\r
+                return SqlBinary.Null;\r
+\r
+            return new SqlBinary(ToByteArray());\r
+        }\r
+    }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlInt16.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlInt16.cs
new file mode 100644 (file)
index 0000000..111ea36
--- /dev/null
@@ -0,0 +1,757 @@
+/*\r
+* Copyright (c) 2002-2004 Mainsoft Corporation.\r
+*\r
+* Permission is hereby granted, free of charge, to any person obtaining a\r
+* copy of this software and associated documentation files (the "Software"),\r
+* to deal in the Software without restriction, including without limitation\r
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+* and/or sell copies of the Software, and to permit persons to whom the\r
+* Software is furnished to do so, subject to the following conditions:\r
+*\r
+* The above copyright notice and this permission notice shall be included in\r
+* all copies or substantial portions of the Software.\r
+*\r
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+* DEALINGS IN THE SOFTWARE.\r
+*/\r
+\r
+namespace System.Data.SqlTypes\r
+{\r
+\r
+    using System;\r
+\r
+    public struct SqlInt16 : INullable, IComparable\r
+    {\r
+\r
+        private short _value;\r
+        private bool _isNull;\r
+\r
+        public static readonly SqlInt16 Null = new SqlInt16(true);\r
+        public static readonly SqlInt16 MaxValue = new SqlInt16(short.MaxValue);\r
+        public static readonly SqlInt16 MinValue = new SqlInt16(short.MinValue);\r
+        public static readonly SqlInt16 Zero = new SqlInt16(0);\r
+\r
+        \r
+        private SqlInt16(bool isNull)\r
+        {\r
+            _value = 0;\r
+            _isNull = isNull;\r
+        }\r
+        /**\r
+         * Constructor\r
+         * @param value A short whose value will be used for the new SqlInt16.\r
+         */\r
+        public SqlInt16(short value) \r
+        {\r
+            _value = value;\r
+            _isNull = false;\r
+        }\r
+\r
+        /**\r
+         * Constructor\r
+         * @param value A int whose value will be used for the new SqlInt16.\r
+         */\r
+        public SqlInt16(int value) \r
+        {\r
+            if (value > short.MaxValue || value < short.MinValue)\r
+                throw new OverflowException("the value is not legal - overflowing : " + value);\r
+\r
+            _value = (short)value;\r
+            _isNull = false;\r
+        }\r
+\r
+        \r
+        /**\r
+         * Indicates whether or not Value is null.\r
+         * @return true if Value is null, otherwise false.\r
+         */\r
+        public bool IsNull\r
+        {\r
+            get\r
+            {\r
+                return _isNull;\r
+            }\r
+        }\r
+\r
+\r
+\r
+        /**\r
+         * Gets the value of the SqlInt16 instance.\r
+         * @return the value of this instance\r
+         */\r
+        public short Value\r
+        {\r
+            get\r
+            {\r
+                if(IsNull)\r
+                    throw new SqlNullValueException();\r
+                return _value;\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Compares this instance to the supplied object and returns an indication of their relative values.\r
+         * @param obj The object to compare.\r
+         * @return A signed number indicating the relative values of the instance and the object.\r
+         * Less than zero This instance is less than object.\r
+         * Zero This instance is the same as object.\r
+         * Greater than zero This instance is greater than object -or-\r
+         * object is a null reference.\r
+         */\r
+        public int CompareTo(Object obj)\r
+        {\r
+            if (obj == null)\r
+                return 1;\r
+\r
+            if (obj is SqlInt16)\r
+            {\r
+                SqlInt16 i = (SqlInt16)obj;\r
+\r
+                if (i.IsNull)\r
+                    return 1;\r
+                if (this.IsNull)\r
+                    return -1;\r
+\r
+                return this._value.CompareTo(i._value);\r
+            }\r
+\r
+            throw new ArgumentException("parameter obj is not SqlInt16 : " + obj.GetType().Name);\r
+\r
+        }\r
+\r
+        /**\r
+         * The addition operator computes the sum of the two SqlInt16 operands.\r
+         * @param x A SqlInt16 structure.\r
+         * @param y A SqlInt16 structure.\r
+         * @return The sum of the two SqlInt16 operands.\r
+         * If one of the parameters is null or null value - return SqlInt16.Null.\r
+         */\r
+        public static SqlInt16 Add(SqlInt16 x, SqlInt16 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlInt16.Null;\r
+\r
+            int sum  = checked(x._value + y._value);\r
+\r
+            return new SqlInt16(sum);\r
+        }\r
+\r
+        /**\r
+         * Computes the bitwise AND of its SqlInt16 operands.\r
+         * @param x A SqlInt16 instance.\r
+         * @param y A SqlInt16 instance.\r
+         * @return The results of the bitwise AND operation.\r
+         */\r
+        public static SqlInt16 BitwiseAnd(SqlInt16 x, SqlInt16 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlInt16.Null;\r
+\r
+            int res  = x._value & y._value;\r
+\r
+            return new SqlInt16(res);\r
+        }\r
+\r
+        /**\r
+         * Computes the bitwise OR of its SqlInt16 operands.\r
+         * @param x A SqlInt16 instance.\r
+         * @param y A SqlInt16 instance.\r
+         * @return The results of the bitwise OR operation.\r
+         */\r
+        public static SqlInt16 BitwiseOr(SqlInt16 x, SqlInt16 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlInt16.Null;\r
+\r
+            int res  = (ushort)x._value | (ushort)y._value;\r
+\r
+            return new SqlInt16(res);\r
+        }\r
+\r
+        /**\r
+         * The division operator divides the first SqlInt16 operand by the second.\r
+         * @param x A SqlInt16 instance.\r
+         * @param y A SqlInt16 instance.\r
+         * @return A SqlInt16 instance containing the results of the division operation.\r
+         * If one of the parameters is null or null value - return SqlInt16.Null.\r
+         */\r
+        public static SqlInt16 Divide(SqlInt16 x, SqlInt16 y)\r
+        {\r
+            int val = x._value / y._value;\r
+            return new SqlInt16(val);\r
+        }\r
+\r
+        public override bool Equals(Object obj)\r
+        {\r
+            \r
+            if (obj == null)\r
+                return false;\r
+\r
+            if (obj is SqlInt16)\r
+            {\r
+                SqlInt16 i = (SqlInt16)obj;\r
+\r
+                if (IsNull && i.IsNull)\r
+                    return true;\r
+\r
+                if (IsNull || i.IsNull)\r
+                    return false;\r
+\r
+                return _value == i._value;\r
+            }\r
+\r
+            return false;\r
+        }\r
+\r
+        \r
+\r
+        /**\r
+         * Performs a logical comparison on two instances of SqlInt16 to determine if they are equal.\r
+         * @param x A SqlInt16 instance.\r
+         * @param y A SqlInt16 instance.\r
+         * @return true if the two values are equal, otherwise false.\r
+         * If one of the parameters is null or null value return SqlBoolean.Null.\r
+         */\r
+        public static SqlBoolean Equals(SqlInt16 x, SqlInt16 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value == y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+\r
+        /**\r
+         * Compares two instances of SqlByte to determine if the first is greater than the second.\r
+         * @param x A SqlByte instance\r
+         * @param y A SqlByte instance\r
+         * @return A SqlBoolean that is True if the first instance is greater than the second instance, otherwise False.\r
+         * If either instance of SqlInt16 is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean GreaterThan(SqlInt16 x, SqlInt16 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value > y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlInt16 to determine if the first is greater than or equal to the second.\r
+         * @param x A SqlInt16 instance\r
+         * @param y A SqlInt16 instance\r
+         * @return A SqlBoolean that is True if the first instance is greaater than or equal to the second instance, otherwise False.\r
+         * If either instance of SqlInt16 is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean GreaterThanOrEqual(SqlInt16 x, SqlInt16 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value >= y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlInt16 to determine if the first is less than the second.\r
+         * @param x A SqlInt16 instance\r
+         * @param y A SqlInt16 instance\r
+         * @return A SqlBoolean that is True if the first instance is less than the second instance, otherwise False.\r
+         * If either instance of SqlInt16 is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean LessThan(SqlInt16 x, SqlInt16 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value < y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlInt16 to determine if the first is less than or equal to the second.\r
+         * @param x A SqlInt16 instance\r
+         * @param y A SqlInt16 instance\r
+         * @return A SqlBoolean that is True if the first instance is less than or equal to the second instance, otherwise False.\r
+         * If either instance of SqlInt16 is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean LessThanOrEqual(SqlInt16 x, SqlInt16 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value <= y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Computes the remainder after dividing its first SqlInt16 operand by its second.\r
+         * @param x A SqlInt16 instance\r
+         * @param y A SqlInt16 instance\r
+         * @return A SqlInt16 instance whose Value contains the remainder.\r
+         */\r
+        public static SqlInt16 Mod(SqlInt16 x, SqlInt16 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlInt16.Null;\r
+\r
+            int mod = x._value % y._value;\r
+\r
+            return new SqlInt16(mod);\r
+        }\r
+\r
+        /**\r
+         * The multiplication operator computes the product of the two SqlInt16 operands.\r
+         * @param x A SqlInt16 instance\r
+         * @param y A SqlInt16 instance\r
+         * @return The product of the two SqlInt16 operands.\r
+         */\r
+        public static SqlInt16 Multiply(SqlInt16 x, SqlInt16 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlInt16.Null;\r
+\r
+            int res = checked(x._value * y._value);\r
+\r
+            return new SqlInt16(res);\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlInt16 to determine if they are equal.\r
+         * @param x A SqlInt16 instance\r
+         * @param y A SqlInt16 instance\r
+         * @return A SqlBoolean that is True if the two instances are not equal or False if the two instances are equal.\r
+         * If either instance of SqlInt16 is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean NotEquals(SqlInt16 x, SqlInt16 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value != y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * The ones complement operator performs a bitwise one's complement operation on its SqlInt16 operand.\r
+         * @param x A SqlInt16 instance\r
+         * @return A SqlInt16 instance whose Value property contains the ones complement of the SqlInt16 parameter.\r
+         */\r
+        public static SqlInt16 OnesComplement(SqlInt16 x)\r
+        {\r
+            int res  = x._value ^ 0xFFFF;\r
+\r
+            return new SqlInt16(res);\r
+        }\r
+\r
+        /**\r
+         * Converts the String representation of a number to its byte equivalent.\r
+         * @param s The String to be parsed.\r
+         * @return A SqlInt16 containing the value represented by the String.\r
+         */\r
+        public static SqlInt16 Parse(String s)\r
+        {\r
+            int res = short.Parse(s);\r
+            return new SqlInt16(res);\r
+        }\r
+\r
+        /**\r
+         * The subtraction operator the second SqlInt16 operand from the first.\r
+         * @param x A SqlInt16 instance\r
+         * @param y A SqlInt16 instance\r
+         * @return The results of the subtraction operation.\r
+         */\r
+        public static SqlInt16 Subtract(SqlInt16 x, SqlInt16 y)\r
+        {\r
+            int res = x._value - y._value;\r
+\r
+            return new SqlInt16(res);\r
+        }\r
+\r
+        /**\r
+         * Performs a bitwise exclusive-OR operation on the supplied parameters.\r
+         * @param x A SqlInt16 instance\r
+         * @param y A SqlInt16 instance\r
+         * @return The results of the XOR operation.\r
+         */\r
+        public static SqlInt16 Xor(SqlInt16 x, SqlInt16 y)\r
+        {\r
+            int res  = x._value ^ y._value;\r
+\r
+            return new SqlInt16(res);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt16 structure to SqlBoolean.\r
+         * @return A SqlBoolean structure whose Value will be True if the SqlInt16 structure's Value is non-zero, False if the SqlInt16 is zero\r
+         * and Null if the SqlInt16 structure is Null.\r
+         */\r
+        public SqlBoolean ToSqlBoolean()\r
+        {\r
+            if (IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (_value == 0)\r
+                return new SqlBoolean(0);\r
+\r
+            return new SqlBoolean(1);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt16 structure to SqlByte.\r
+         * @return A SqlByte structure whose Value equals the Value of this SqlInt16 structure.\r
+         */\r
+        public SqlByte ToSqlByte()\r
+        {\r
+            if (IsNull)\r
+                return SqlByte.Null;\r
+\r
+            int val = _value;\r
+\r
+            if (val < 0 || val > 255)\r
+                throw new OverflowException("Can not conver this instance to SqlByte - overflowing : " + val);\r
+\r
+            return new SqlByte((byte)val);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt16 structure to SqlDecimal.\r
+         * @return A SqlDecimal structure whose Value equals the Value of this SqlInt16 structure.\r
+         */\r
+        public SqlDecimal ToSqlDecimal()\r
+        {\r
+            if (IsNull)\r
+                return SqlDecimal.Null;\r
+\r
+            return new SqlDecimal(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt16 structure to SqlDecimal.\r
+         * @return A SqlDouble structure whose Value equals the Value of this SqlInt16 structure.\r
+         */\r
+        public SqlDouble ToSqlDouble()\r
+        {\r
+            if (IsNull)\r
+                return SqlDouble.Null;\r
+\r
+            return new SqlDouble(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt16 structure to SqlInt32.\r
+         * @return A SqlInt32 structure whose Value equals the Value of this SqlDouble structure.\r
+         */\r
+        public SqlInt32 ToSqlInt32()\r
+        {\r
+            if (IsNull)\r
+                return SqlInt32.Null;\r
+\r
+            return new SqlInt32(_value);\r
+        }\r
+\r
+\r
+        /**\r
+         * Converts this SqlInt16 structure to SqlInt64.\r
+         * @return A SqlInt64 structure whose Value equals the Value of this SqlInt16 structure.\r
+         */\r
+        public SqlInt64 ToSqlInt64()\r
+        {\r
+            if (IsNull)\r
+                return SqlInt64.Null;\r
+\r
+            return new SqlInt64(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt16 instance to SqlDouble.\r
+         * @return A SqlMoney instance whose Value equals the Value of this SqlInt16 instance.\r
+         */\r
+        public SqlMoney ToSqlMoney()\r
+        {\r
+            if (IsNull)\r
+                return SqlMoney.Null;\r
+\r
+            return new SqlMoney(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt16 instance to SqlSingle.\r
+         * @return A SqlSingle instance whose Value equals the Value of this SqlInt16 instance.\r
+         */\r
+        public SqlSingle ToSqlSingle()\r
+        {\r
+            if (IsNull)\r
+                return SqlSingle.Null;\r
+\r
+            return new SqlSingle(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt16 structure to SqlString.\r
+         * @return A SqlString structure whose value is a string representing the date and time contained in this SqlInt16 structure.\r
+         */\r
+        public SqlString ToSqlString()\r
+        {\r
+            return new SqlString(ToString());\r
+        }\r
+\r
+\r
+\r
+        public override String ToString()\r
+        {\r
+            if (IsNull)\r
+                return "null";\r
+            return _value.ToString();\r
+        }\r
+\r
+        public static void main(String[] args)\r
+        {\r
+            SqlInt16 i1 = new SqlInt16(-2);\r
+            SqlInt16 i2 = new SqlInt16(-2);\r
+\r
+            Console.WriteLine(BitwiseAnd(i1, i2));\r
+\r
+        }\r
+    \r
+        public override int GetHashCode()\r
+        {\r
+            return _value;\r
+        }\r
+\r
+        public static SqlInt16 operator + (SqlInt16 x, SqlInt16 y)\r
+        {\r
+            checked \r
+            {\r
+                return new SqlInt16 ((short) (x.Value + y.Value));\r
+            }\r
+        }\r
+\r
+        public static SqlInt16 operator & (SqlInt16 x, SqlInt16 y)\r
+        {\r
+            return new SqlInt16 ((short) (x.Value & y.Value));\r
+        }\r
+\r
+        public static SqlInt16 operator | (SqlInt16 x, SqlInt16 y)\r
+        {\r
+            return new SqlInt16 ((short) ( x.Value | y.Value));\r
+        }\r
+\r
+        public static SqlInt16 operator / (SqlInt16 x, SqlInt16 y)\r
+        {\r
+            checked \r
+            {\r
+                return new SqlInt16 ((short) (x.Value / y.Value));\r
+            }\r
+        }\r
+\r
+        public static SqlBoolean operator == (SqlInt16 x, SqlInt16 y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value == y.Value);\r
+        }\r
+\r
+        public static SqlInt16 operator ^ (SqlInt16 x, SqlInt16 y)\r
+        {\r
+            return new SqlInt16 ((short) (x.Value ^ y.Value));\r
+        }\r
+\r
+        public static SqlBoolean operator > (SqlInt16 x, SqlInt16 y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value > y.Value);\r
+        }\r
+\r
+        public static SqlBoolean operator >= (SqlInt16 x, SqlInt16 y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value >= y.Value);\r
+        }\r
+\r
+        public static SqlBoolean operator != (SqlInt16 x, SqlInt16 y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else \r
+                return new SqlBoolean (!(x.Value == y.Value));\r
+        }\r
+\r
+        public static SqlBoolean operator < (SqlInt16 x, SqlInt16 y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value < y.Value);\r
+        }\r
+\r
+        public static SqlBoolean operator <= (SqlInt16 x, SqlInt16 y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value <= y.Value);\r
+        }\r
+\r
+        public static SqlInt16 operator % (SqlInt16 x, SqlInt16 y)\r
+        {\r
+            return new SqlInt16 ((short) (x.Value % y.Value));\r
+        }\r
+\r
+        public static SqlInt16 operator * (SqlInt16 x, SqlInt16 y)\r
+        {\r
+            checked \r
+            {\r
+                return new SqlInt16 ((short) (x.Value * y.Value));\r
+            }\r
+        }\r
+\r
+        public static SqlInt16 operator ~ (SqlInt16 x)\r
+        {\r
+            if (x.IsNull)\r
+                return Null;\r
+                       \r
+            return new SqlInt16 ((short) (~x.Value));\r
+        }\r
+\r
+        public static SqlInt16 operator - (SqlInt16 x, SqlInt16 y)\r
+        {\r
+            checked \r
+            {\r
+                return new SqlInt16 ((short) (x.Value - y.Value));\r
+            }\r
+        }\r
+\r
+        public static SqlInt16 operator - (SqlInt16 n)\r
+        {\r
+            checked \r
+            {\r
+                return new SqlInt16 ((short) (-n.Value));\r
+            }\r
+        }\r
+\r
+        public static explicit operator SqlInt16 (SqlBoolean x)\r
+        {\r
+            if (x.IsNull)\r
+                return Null;\r
+            else\r
+                return new SqlInt16 ((short)x.ByteValue);\r
+        }\r
+\r
+        public static explicit operator SqlInt16 (SqlDecimal x)\r
+        {              \r
+            checked \r
+            {\r
+                if (x.IsNull)\r
+                    return Null;\r
+                else \r
+                    return new SqlInt16 ((short)x.Value);\r
+            }\r
+        }\r
+\r
+        public static explicit operator SqlInt16 (SqlDouble x)\r
+        {\r
+            if (x.IsNull)\r
+                return Null;\r
+            else \r
+                return new SqlInt16 (checked ((short)x.Value));\r
+        }\r
+\r
+        public static explicit operator short (SqlInt16 x)\r
+        {\r
+            return x.Value; \r
+        }\r
+\r
+        public static explicit operator SqlInt16 (SqlInt32 x)\r
+        {\r
+            checked \r
+            {\r
+                if (x.IsNull)\r
+                    return Null;\r
+                else \r
+                    return new SqlInt16 ((short)x.Value);\r
+            }\r
+        }\r
+\r
+        public static explicit operator SqlInt16 (SqlInt64 x)\r
+        {\r
+            if (x.IsNull)\r
+                return Null;\r
+            else \r
+            {\r
+                checked \r
+                {\r
+                    return new SqlInt16 ((short)x.Value);\r
+                }\r
+            }\r
+        }\r
+\r
+        public static explicit operator SqlInt16 (SqlMoney x)\r
+        {\r
+            checked \r
+            {\r
+                if (x.IsNull)\r
+                    return Null;\r
+                else \r
+                    return new SqlInt16 ((short)x.Value);\r
+            }                  \r
+        }\r
+\r
+\r
+        public static explicit operator SqlInt16 (SqlSingle x)\r
+        {\r
+            if (x.IsNull)\r
+                return Null;\r
+            else \r
+            {\r
+                checked \r
+                {\r
+                    return new SqlInt16 ((short)x.Value);\r
+                }\r
+            }\r
+        }\r
+\r
+        public static explicit operator SqlInt16 (SqlString x)\r
+        {      \r
+            if (x.IsNull)\r
+                return Null;\r
+\r
+            return SqlInt16.Parse (x.Value);\r
+        }\r
+\r
+        public static implicit operator SqlInt16 (short x)\r
+        {\r
+            return new SqlInt16 (x);\r
+        }\r
+\r
+        public static implicit operator SqlInt16 (SqlByte x)\r
+        {\r
+            return new SqlInt16 ((short)x.Value);\r
+        }\r
+\r
+\r
+    }}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlInt32.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlInt32.cs
new file mode 100644 (file)
index 0000000..17bdddc
--- /dev/null
@@ -0,0 +1,757 @@
+/*\r
+* Copyright (c) 2002-2004 Mainsoft Corporation.\r
+*\r
+* Permission is hereby granted, free of charge, to any person obtaining a\r
+* copy of this software and associated documentation files (the "Software"),\r
+* to deal in the Software without restriction, including without limitation\r
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+* and/or sell copies of the Software, and to permit persons to whom the\r
+* Software is furnished to do so, subject to the following conditions:\r
+*\r
+* The above copyright notice and this permission notice shall be included in\r
+* all copies or substantial portions of the Software.\r
+*\r
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+* DEALINGS IN THE SOFTWARE.\r
+*/\r
+\r
+namespace System.Data.SqlTypes\r
+{\r
+\r
+    using System;\r
+\r
+    public struct SqlInt32 : INullable, IComparable\r
+    {\r
+\r
+        private int _value;\r
+        private bool _isNull;\r
+\r
+        public static readonly SqlInt32 Null = new SqlInt32(true);\r
+        public static readonly SqlInt32 MaxValue = new SqlInt32(int.MaxValue);\r
+        public static readonly SqlInt32 MinValue = new SqlInt32(int.MinValue);\r
+        public static readonly SqlInt32 Zero = new SqlInt32(0);\r
+\r
+        \r
+\r
+        private SqlInt32(bool isNull)\r
+        {\r
+            _isNull = isNull;\r
+            _value = 0;\r
+        }\r
+        /**\r
+         * Constructor\r
+         * @param value A int whose value will be used for the new SqlInt32.\r
+         */\r
+        public SqlInt32(int value) \r
+        {\r
+            _value = value;\r
+            _isNull = false;\r
+        }\r
+\r
+        \r
+\r
+        /**\r
+         * Indicates whether or not Value is null.\r
+         * @return true if Value is null, otherwise false.\r
+         */\r
+        public bool IsNull\r
+        {\r
+            get\r
+            {\r
+                return _isNull;\r
+            }\r
+        }\r
+\r
+\r
+\r
+        /**\r
+         * Gets the value of the SqlInt32 instance.\r
+         * @return the value of this instance\r
+         */\r
+        public int Value\r
+        {\r
+            get\r
+            {\r
+                if(IsNull)\r
+                    throw new SqlNullValueException();\r
+                return _value;\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Compares this instance to the supplied object and returns an indication of their relative values.\r
+         * @param obj The object to compare.\r
+         * @return A signed number indicating the relative values of the instance and the object.\r
+         * Less than zero This instance is less than object.\r
+         * Zero This instance is the same as object.\r
+         * Greater than zero This instance is greater than object -or-\r
+         * object is a null reference.\r
+         */\r
+        public int CompareTo(Object obj)\r
+        {\r
+            if (obj == null)\r
+                return 1;\r
+\r
+            if (obj is SqlInt32)\r
+            {\r
+                SqlInt32 i = (SqlInt32)obj;\r
+\r
+                if (i.IsNull)\r
+                    return 1;\r
+                if (this.IsNull)\r
+                    return -1;\r
+\r
+                return this._value.CompareTo(i._value);\r
+            }\r
+\r
+            throw new ArgumentException("parameter obj is not SqlInt32 : " + obj.GetType().Name);\r
+\r
+        }\r
+\r
+        /**\r
+         * The addition operator computes the sum of the two SqlInt32 operands.\r
+         * @param x A SqlInt32 structure.\r
+         * @param y A SqlInt32 structure.\r
+         * @return The sum of the two SqlInt32 operands.\r
+         * If one of the parameters is null or null value - return SqlInt32.Null.\r
+         */\r
+        public static SqlInt32 Add(SqlInt32 x, SqlInt32 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlInt32.Null;\r
+\r
+            int xVal = x._value;\r
+            int yVal = y._value;\r
+\r
+            int sum  = checked(xVal + yVal);\r
+\r
+            return new SqlInt32(sum);\r
+        }\r
+\r
+        /**\r
+         * Computes the bitwise AND of its SqlInt32 operands.\r
+         * @param x A SqlInt32 instance.\r
+         * @param y A SqlInt32 instance.\r
+         * @return The results of the bitwise AND operation.\r
+         */\r
+        public static SqlInt32 BitwiseAnd(SqlInt32 x, SqlInt32 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlInt32.Null;\r
+\r
+            int res  = x._value & y._value;\r
+\r
+            return new SqlInt32(res);\r
+        }\r
+\r
+        /**\r
+         * Computes the bitwise OR of its SqlInt32 operands.\r
+         * @param x A SqlInt32 instance.\r
+         * @param y A SqlInt32 instance.\r
+         * @return The results of the bitwise OR operation.\r
+         */\r
+        public static SqlInt32 BitwiseOr(SqlInt32 x, SqlInt32 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlInt32.Null;\r
+\r
+            int res  = x._value | y._value;\r
+\r
+            return new SqlInt32(res);\r
+        }\r
+\r
+        /**\r
+         * The division operator divides the first SqlInt32 operand by the second.\r
+         * @param x A SqlInt32 instance.\r
+         * @param y A SqlInt32 instance.\r
+         * @return A SqlInt32 instance containing the results of the division operation.\r
+         * If one of the parameters is null or null value - return SqlInt32.Null.\r
+         */\r
+        public static SqlInt32 Divide(SqlInt32 x, SqlInt32 y)\r
+        {\r
+            int val = x._value / y._value;\r
+            return new SqlInt32(val);\r
+        }\r
+\r
+        public override bool Equals(Object obj)\r
+        {\r
+            if (obj == null)\r
+                return false;\r
+\r
+            if (obj is SqlInt32)\r
+            {\r
+                SqlInt32 i = (SqlInt32)obj;\r
+\r
+                if (IsNull && i.IsNull)\r
+                    return true;\r
+\r
+                if (IsNull || i.IsNull)\r
+                    return false;\r
+\r
+                return _value == i._value;\r
+            }\r
+\r
+            return false;\r
+        }\r
+\r
+\r
+        /**\r
+         * Performs a logical comparison on two instances of SqlInt32 to determine if they are equal.\r
+         * @param x A SqlInt32 instance.\r
+         * @param y A SqlInt32 instance.\r
+         * @return true if the two values are equal, otherwise false.\r
+         * If one of the parameters is null or null value return SqlBoolean.Null.\r
+         */\r
+        public static SqlBoolean Equals(SqlInt32 x, SqlInt32 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value == y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Returns the hash code for this SqlInt32 instance.\r
+         * @return A signed integer hash code.\r
+         */\r
+        public override int GetHashCode()\r
+        {\r
+            return _value;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlByte to determine if the first is greater than the second.\r
+         * @param x A SqlByte instance\r
+         * @param y A SqlByte instance\r
+         * @return A SqlBoolean that is True if the first instance is greater than the second instance, otherwise False.\r
+         * If either instance of SqlInt32 is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean GreaterThan(SqlInt32 x, SqlInt32 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value > y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlInt32 to determine if the first is greater than or equal to the second.\r
+         * @param x A SqlInt32 instance\r
+         * @param y A SqlInt32 instance\r
+         * @return A SqlBoolean that is True if the first instance is greaater than or equal to the second instance, otherwise False.\r
+         * If either instance of SqlInt32 is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean GreaterThanOrEqual(SqlInt32 x, SqlInt32 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value >= y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlInt32 to determine if the first is less than the second.\r
+         * @param x A SqlInt32 instance\r
+         * @param y A SqlInt32 instance\r
+         * @return A SqlBoolean that is True if the first instance is less than the second instance, otherwise False.\r
+         * If either instance of SqlInt32 is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean LessThan(SqlInt32 x, SqlInt32 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value < y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlInt32 to determine if the first is less than or equal to the second.\r
+         * @param x A SqlInt32 instance\r
+         * @param y A SqlInt32 instance\r
+         * @return A SqlBoolean that is True if the first instance is less than or equal to the second instance, otherwise False.\r
+         * If either instance of SqlInt32 is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean LessThanOrEqual(SqlInt32 x, SqlInt32 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value <= y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Computes the remainder after dividing its first SqlInt32 operand by its second.\r
+         * @param x A SqlInt32 instance\r
+         * @param y A SqlInt32 instance\r
+         * @return A SqlInt32 instance whose Value contains the remainder.\r
+         */\r
+        public static SqlInt32 Mod(SqlInt32 x, SqlInt32 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlInt32.Null;\r
+\r
+            int mod = x._value % y._value;\r
+\r
+            return new SqlInt32(mod);\r
+        }\r
+\r
+        /**\r
+         * The multiplication operator computes the product of the two SqlInt32 operands.\r
+         * @param x A SqlInt32 instance\r
+         * @param y A SqlInt32 instance\r
+         * @return The product of the two SqlInt32 operands.\r
+         */\r
+        public static SqlInt32 Multiply(SqlInt32 x, SqlInt32 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlInt32.Null;\r
+\r
+            int xVal = x._value;\r
+            int yVal = y._value;\r
+\r
+            int res = checked(xVal * yVal);\r
+\r
+            return new SqlInt32(res);\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlInt32 to determine if they are equal.\r
+         * @param x A SqlInt32 instance\r
+         * @param y A SqlInt32 instance\r
+         * @return A SqlBoolean that is True if the two instances are not equal or False if the two instances are equal.\r
+         * If either instance of SqlInt32 is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean NotEquals(SqlInt32 x, SqlInt32 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value != y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * The ones complement operator performs a bitwise one's complement operation on its SqlInt32 operand.\r
+         * @param x A SqlInt32 instance\r
+         * @return A SqlInt32 instance whose Value property contains the ones complement of the SqlInt32 parameter.\r
+         */\r
+        public static SqlInt32 OnesComplement(SqlInt32 x)\r
+        {\r
+            int res  = (int)(x._value ^ 0xFFFFFFFF);\r
+\r
+            return new SqlInt32(res);\r
+        }\r
+\r
+        /**\r
+         * Converts the String representation of a number to its byte equivalent.\r
+         * @param s The String to be parsed.\r
+         * @return A SqlInt32 containing the value represented by the String.\r
+         */\r
+        public static SqlInt32 Parse(String s)\r
+        {\r
+            int res = int.Parse(s);\r
+\r
+            return new SqlInt32(res);\r
+        }\r
+\r
+        /**\r
+         * The subtraction operator the second SqlInt32 operand from the first.\r
+         * @param x A SqlInt32 instance\r
+         * @param y A SqlInt32 instance\r
+         * @return The results of the subtraction operation.\r
+         */\r
+        public static SqlInt32 Subtract(SqlInt32 x, SqlInt32 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlInt32.Null;\r
+\r
+            int res = checked(x._value - y._value);\r
+            return new SqlInt32(res);\r
+        }\r
+\r
+        /**\r
+         * Performs a bitwise exclusive-OR operation on the supplied parameters.\r
+         * @param x A SqlInt32 instance\r
+         * @param y A SqlInt32 instance\r
+         * @return The results of the XOR operation.\r
+         */\r
+        public static SqlInt32 Xor(SqlInt32 x, SqlInt32 y)\r
+        {\r
+            int res  = x._value ^ y._value;\r
+\r
+            return new SqlInt32(res);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt32 structure to SqlBoolean.\r
+         * @return A SqlBoolean structure whose Value will be True if the SqlInt32 structure's Value is non-zero, False if the SqlInt32 is zero\r
+         * and Null if the SqlInt32 structure is Null.\r
+         */\r
+        public SqlBoolean ToSqlBoolean()\r
+        {\r
+            if (IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (_value == 0)\r
+                return new SqlBoolean(0);\r
+\r
+            return new SqlBoolean(1);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt32 structure to SqlByte.\r
+         * @return A SqlByte structure whose Value equals the Value of this SqlInt32 structure.\r
+         */\r
+        public SqlByte ToSqlByte()\r
+        {\r
+            if (IsNull)\r
+                return SqlByte.Null;\r
+\r
+            if (_value < 0 || _value > 255)\r
+                throw new OverflowException("Can not onvert this instance to SqlByte - overflowing : " + _value);\r
+\r
+            return new SqlByte((byte)_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt32 structure to SqlDecimal.\r
+         * @return A SqlDecimal structure whose Value equals the Value of this SqlInt32 structure.\r
+         */\r
+        public SqlDecimal ToSqlDecimal()\r
+        {\r
+            if (IsNull)\r
+                return SqlDecimal.Null;\r
+\r
+            return new SqlDecimal(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt32 structure to SqlDecimal.\r
+         * @return A SqlDouble structure whose Value equals the Value of this SqlInt32 structure.\r
+         */\r
+        public SqlDouble ToSqlDouble()\r
+        {\r
+            if (IsNull)\r
+                return SqlDouble.Null;\r
+\r
+            return new SqlDouble(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt32 structure to SqlInt16.\r
+         * @return A SqlInt16 structure whose Value equals the Value of this SqlInt32 structure.\r
+         */\r
+        public SqlInt16 ToSqlInt16()\r
+        {\r
+            if (IsNull)\r
+                return SqlInt16.Null;\r
+\r
+            return new SqlInt16(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt32 structure to SqlInt64.\r
+         * @return A SqlInt64 structure whose Value equals the Value of this SqlInt32 structure.\r
+         */\r
+        public SqlInt64 ToSqlInt64()\r
+        {\r
+            if (IsNull)\r
+                return SqlInt64.Null;\r
+\r
+            return new SqlInt64(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt32 instance to SqlDouble.\r
+         * @return A SqlMoney instance whose Value equals the Value of this SqlInt32 instance.\r
+         */\r
+        public SqlMoney ToSqlMoney()\r
+        {\r
+            if (IsNull)\r
+                return SqlMoney.Null;\r
+\r
+            return new SqlMoney(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt32 instance to SqlSingle.\r
+         * @return A SqlSingle instance whose Value equals the Value of this SqlInt32 instance.\r
+         */\r
+        public SqlSingle ToSqlSingle()\r
+        {\r
+            if (IsNull)\r
+                return SqlSingle.Null;\r
+\r
+            return new SqlSingle((float)_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt32 structure to SqlString.\r
+         * @return A SqlString structure whose value is a string representing the date and time contained in this SqlInt32 structure.\r
+         */\r
+        public SqlString ToSqlString()\r
+        {\r
+            return new SqlString(ToString());\r
+        }\r
+\r
+\r
+\r
+        public override String ToString()\r
+        {\r
+            if (IsNull)\r
+                return "null";\r
+            return _value.ToString();\r
+        }\r
+\r
+        // Compute Addition\r
+        public static SqlInt32 operator + (SqlInt32 x, SqlInt32 y) \r
+        {\r
+            checked \r
+            {\r
+                return new SqlInt32 (x.Value + y.Value);\r
+            }\r
+        }\r
+\r
+        // Bitwise AND\r
+        public static SqlInt32 operator & (SqlInt32 x, SqlInt32 y) \r
+        {\r
+            return new SqlInt32 (x.Value & y.Value);\r
+        }\r
+\r
+        // Bitwise OR\r
+        public static SqlInt32 operator | (SqlInt32 x, SqlInt32 y) \r
+        {\r
+            checked \r
+            {\r
+                return new SqlInt32 (x.Value | y.Value);\r
+            }\r
+        }\r
+\r
+        // Compute Division\r
+        public static SqlInt32 operator / (SqlInt32 x, SqlInt32 y) \r
+        {\r
+            checked \r
+            {\r
+                return new SqlInt32 (x.Value / y.Value);\r
+            }\r
+        }\r
+\r
+        // Compare Equality\r
+        public static SqlBoolean operator == (SqlInt32 x, SqlInt32 y) \r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value == y.Value);\r
+        }\r
+\r
+        // Bitwise Exclusive-OR (XOR)\r
+        public static SqlInt32 operator ^ (SqlInt32 x, SqlInt32 y) \r
+        {\r
+            return new SqlInt32 (x.Value ^ y.Value);\r
+        }\r
+\r
+        // > Compare\r
+        public static SqlBoolean operator >(SqlInt32 x, SqlInt32 y) \r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value > y.Value);\r
+        }\r
+\r
+        // >= Compare\r
+        public static SqlBoolean operator >= (SqlInt32 x, SqlInt32 y) \r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value >= y.Value);\r
+        }\r
+\r
+        // != Inequality Compare\r
+        public static SqlBoolean operator != (SqlInt32 x, SqlInt32 y) \r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value != y.Value);\r
+        }\r
+               \r
+        // < Compare\r
+        public static SqlBoolean operator < (SqlInt32 x, SqlInt32 y) \r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value < y.Value);\r
+        }\r
+\r
+        // <= Compare\r
+        public static SqlBoolean operator <= (SqlInt32 x, SqlInt32 y) \r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value <= y.Value);\r
+        }\r
+\r
+        // Compute Modulus\r
+        public static SqlInt32 operator % (SqlInt32 x, SqlInt32 y) \r
+        {\r
+            return new SqlInt32 (x.Value % y.Value);\r
+        }\r
+\r
+        // Compute Multiplication\r
+        public static SqlInt32 operator * (SqlInt32 x, SqlInt32 y) \r
+        {\r
+            checked \r
+            {\r
+                return new SqlInt32 (x.Value * y.Value);\r
+            }\r
+        }\r
+\r
+        // Ones Complement\r
+        public static SqlInt32 operator ~ (SqlInt32 x) \r
+        {\r
+            return new SqlInt32 (~x.Value);\r
+        }\r
+\r
+        // Subtraction\r
+        public static SqlInt32 operator - (SqlInt32 x, SqlInt32 y) \r
+        {\r
+            checked \r
+            {\r
+                return new SqlInt32 (x.Value - y.Value);\r
+            }\r
+        }\r
+\r
+        // Negates the Value\r
+        public static SqlInt32 operator - (SqlInt32 x) \r
+        {\r
+            return new SqlInt32 (-x.Value);\r
+        }\r
+\r
+        // Type Conversions\r
+        public static explicit operator SqlInt32 (SqlBoolean x) \r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else \r
+                return new SqlInt32 ((int)x.ByteValue);\r
+        }\r
+\r
+        public static explicit operator SqlInt32 (SqlDecimal x) \r
+        {\r
+            checked \r
+            {\r
+                if (x.IsNull) \r
+                    return Null;\r
+                else \r
+                    return new SqlInt32 ((int)x.Value);\r
+            }\r
+        }\r
+\r
+        public static explicit operator SqlInt32 (SqlDouble x) \r
+        {\r
+            checked \r
+            {\r
+                if (x.IsNull) \r
+                    return Null;\r
+                else \r
+                    return new SqlInt32 ((int)x.Value);\r
+            }\r
+        }\r
+\r
+        public static explicit operator int (SqlInt32 x)\r
+        {\r
+            return x.Value;\r
+        }\r
+\r
+        public static explicit operator SqlInt32 (SqlInt64 x) \r
+        {\r
+            checked \r
+            {\r
+                if (x.IsNull) \r
+                    return Null;\r
+                else \r
+                    return new SqlInt32 ((int)x.Value);\r
+            }\r
+        }\r
+\r
+        public static explicit operator SqlInt32(SqlMoney x) \r
+        {\r
+            checked \r
+            {\r
+                if (x.IsNull) \r
+                    return Null;\r
+                else \r
+                    return new SqlInt32 ((int)x.Value);\r
+            }\r
+        }\r
+\r
+        public static explicit operator SqlInt32(SqlSingle x) \r
+        {\r
+            checked \r
+            {\r
+                if (x.IsNull) \r
+                    return Null;\r
+                else \r
+                    return new SqlInt32 ((int)x.Value);\r
+            }\r
+        }\r
+\r
+        public static explicit operator SqlInt32(SqlString x) \r
+        {\r
+            checked \r
+            {\r
+                return SqlInt32.Parse (x.Value);\r
+            }\r
+        }\r
+\r
+        public static implicit operator SqlInt32(int x) \r
+        {\r
+            return new SqlInt32 (x);\r
+        }\r
+\r
+        public static implicit operator SqlInt32(SqlByte x) \r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else \r
+                return new SqlInt32 ((int)x.Value);\r
+        }\r
+\r
+        public static implicit operator SqlInt32(SqlInt16 x) \r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else \r
+                return new SqlInt32 ((int)x.Value);\r
+        }\r
+\r
+\r
+    }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlInt64.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlInt64.cs
new file mode 100644 (file)
index 0000000..734d309
--- /dev/null
@@ -0,0 +1,744 @@
+/*\r
+* Copyright (c) 2002-2004 Mainsoft Corporation.\r
+*\r
+* Permission is hereby granted, free of charge, to any person obtaining a\r
+* copy of this software and associated documentation files (the "Software"),\r
+* to deal in the Software without restriction, including without limitation\r
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+* and/or sell copies of the Software, and to permit persons to whom the\r
+* Software is furnished to do so, subject to the following conditions:\r
+*\r
+* The above copyright notice and this permission notice shall be included in\r
+* all copies or substantial portions of the Software.\r
+*\r
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+* DEALINGS IN THE SOFTWARE.\r
+*/\r
+\r
+namespace System.Data.SqlTypes\r
+{\r
+\r
+    using System;\r
+\r
+    public struct SqlInt64 : INullable, IComparable\r
+    {\r
+\r
+        private long _value;\r
+        private bool _isNull;\r
+        \r
+        public static readonly SqlInt64 Null = new SqlInt64(true);\r
+        public static readonly SqlInt64 MaxValue = new SqlInt64(int.MaxValue);\r
+        public static readonly SqlInt64 MinValue = new SqlInt64(int.MinValue);\r
+        public static readonly SqlInt64 Zero = new SqlInt64(0);\r
+\r
+        \r
+        private SqlInt64(bool isNull)\r
+        {\r
+            _value = 0;\r
+            _isNull = isNull;\r
+        }\r
+        /**\r
+         * Constructor\r
+         * @param value A long whose value will be used for the new SqlInt64.\r
+         */\r
+        public SqlInt64(long value) \r
+        { \r
+            _value = value;\r
+            _isNull = false;\r
+        }\r
+\r
+        /**\r
+         * Indicates whether or not Value is null.\r
+         * @return true if Value is null, otherwise false.\r
+         */\r
+        public bool IsNull\r
+        {\r
+            get\r
+            {\r
+                return _isNull;\r
+            }\r
+        }\r
+\r
+\r
+\r
+        /**\r
+         * Gets the value of the SqlInt64 instance.\r
+         * @return the value of this instance\r
+         */\r
+        public long Value\r
+        {\r
+            get\r
+            {\r
+                if(IsNull)\r
+                    throw new SqlNullValueException();\r
+                return _value;\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Compares this instance to the supplied object and returns an indication of their relative values.\r
+         * @param obj The object to compare.\r
+         * @return A signed number indicating the relative values of the instance and the object.\r
+         * Less than zero This instance is less than object.\r
+         * Zero This instance is the same as object.\r
+         * Greater than zero This instance is greater than object -or-\r
+         * object is a null reference.\r
+         */\r
+        public int CompareTo(Object obj)\r
+        {\r
+            if (obj == null)\r
+                return 1;\r
+\r
+            if (obj is SqlInt64)\r
+            {\r
+                SqlInt64 i = (SqlInt64)obj;\r
+\r
+                if (i.IsNull)\r
+                    return 1;\r
+                if (this.IsNull)\r
+                    return -1;\r
+\r
+                return this._value.CompareTo(i._value);\r
+            }\r
+\r
+            throw new ArgumentException("parameter obj is not SqlInt64 : " + obj.GetType().Name);\r
+\r
+        }\r
+\r
+        /**\r
+         * The addition operator computes the sum of the two SqlInt64 operands.\r
+         * @param x A SqlInt64 structure.\r
+         * @param y A SqlInt64 structure.\r
+         * @return The sum of the two SqlInt64 operands.\r
+         * If one of the parameters is null or null value - return SqlInt64.Null.\r
+         */\r
+        public static SqlInt64 Add(SqlInt64 x, SqlInt64 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlInt64.Null;\r
+\r
+            \r
+            long sum  = checked(x._value + y._value);\r
+\r
+            return new SqlInt64(sum);\r
+        }\r
+\r
+        /**\r
+         * Computes the bitwise AND of its SqlInt64 operands.\r
+         * @param x A SqlInt64 instance.\r
+         * @param y A SqlInt64 instance.\r
+         * @return The results of the bitwise AND operation.\r
+         */\r
+        public static SqlInt64 BitwiseAnd(SqlInt64 x, SqlInt64 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlInt64.Null;\r
+\r
+            long res  = x._value & y._value;\r
+\r
+            return new SqlInt64(res);\r
+        }\r
+\r
+        /**\r
+         * Computes the bitwise OR of its SqlInt64 operands.\r
+         * @param x A SqlInt64 instance.\r
+         * @param y A SqlInt64 instance.\r
+         * @return The results of the bitwise OR operation.\r
+         */\r
+        public static SqlInt64 BitwiseOr(SqlInt64 x, SqlInt64 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlInt64.Null;\r
+\r
+            long res  = x._value | y._value;\r
+\r
+            return new SqlInt64(res);\r
+        }\r
+\r
+        /**\r
+         * The division operator divides the first SqlInt64 operand by the second.\r
+         * @param x A SqlInt64 instance.\r
+         * @param y A SqlInt64 instance.\r
+         * @return A SqlInt64 instance containing the results of the division operation.\r
+         * If one of the parameters is null or null value - return SqlInt64.Null.\r
+         */\r
+        public static SqlInt64 Divide(SqlInt64 x, SqlInt64 y)\r
+        {\r
+            long val = x._value / y._value;\r
+            return new SqlInt64(val);\r
+        }\r
+\r
+        public override int GetHashCode()\r
+        {\r
+            return (int) (_value ^ (_value >> 32));\r
+        }\r
+\r
+        public override bool Equals(Object obj)\r
+        {\r
+            if (obj == null)\r
+                return false;\r
+\r
+            if (obj is SqlInt64)\r
+            {\r
+                SqlInt64 i = (SqlInt64)obj;\r
+\r
+                if (IsNull && i.IsNull)\r
+                    return true;\r
+\r
+                if (IsNull || i.IsNull)\r
+                    return false;\r
+\r
+                return _value == i._value;\r
+            }\r
+\r
+            return false;\r
+        }\r
+\r
+        \r
+\r
+        /**\r
+         * Performs a logical comparison on two instances of SqlInt64 to determine if they are equal.\r
+         * @param x A SqlInt64 instance.\r
+         * @param y A SqlInt64 instance.\r
+         * @return true if the two values are equal, otherwise false.\r
+         * If one of the parameters is null or null value return SqlBoolean.Null.\r
+         */\r
+        public static SqlBoolean Equals(SqlInt64 x, SqlInt64 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value == y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        \r
+        /**\r
+         * Compares two instances of SqlByte to determine if the first is greater than the second.\r
+         * @param x A SqlByte instance\r
+         * @param y A SqlByte instance\r
+         * @return A SqlBoolean that is True if the first instance is greater than the second instance, otherwise False.\r
+         * If either instance of SqlInt64 is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean GreaterThan(SqlInt64 x, SqlInt64 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value > y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlInt64 to determine if the first is greater than or equal to the second.\r
+         * @param x A SqlInt64 instance\r
+         * @param y A SqlInt64 instance\r
+         * @return A SqlBoolean that is True if the first instance is greaater than or equal to the second instance, otherwise False.\r
+         * If either instance of SqlInt64 is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean GreaterThanOrEqual(SqlInt64 x, SqlInt64 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value >= y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlInt64 to determine if the first is less than the second.\r
+         * @param x A SqlInt64 instance\r
+         * @param y A SqlInt64 instance\r
+         * @return A SqlBoolean that is True if the first instance is less than the second instance, otherwise False.\r
+         * If either instance of SqlInt64 is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean LessThan(SqlInt64 x, SqlInt64 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value < y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlInt64 to determine if the first is less than or equal to the second.\r
+         * @param x A SqlInt64 instance\r
+         * @param y A SqlInt64 instance\r
+         * @return A SqlBoolean that is True if the first instance is less than or equal to the second instance, otherwise False.\r
+         * If either instance of SqlInt64 is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean LessThanOrEqual(SqlInt64 x, SqlInt64 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value <= y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Computes the remainder after dividing its first SqlInt64 operand by its second.\r
+         * @param x A SqlInt64 instance\r
+         * @param y A SqlInt64 instance\r
+         * @return A SqlInt64 instance whose Value contains the remainder.\r
+         */\r
+        public static SqlInt64 Mod(SqlInt64 x, SqlInt64 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlInt64.Null;\r
+\r
+            long mod = x._value % y._value;\r
+\r
+            return new SqlInt64(mod);\r
+        }\r
+\r
+        /**\r
+         * The multiplication operator computes the product of the two SqlInt64 operands.\r
+         * @param x A SqlInt64 instance\r
+         * @param y A SqlInt64 instance\r
+         * @return The product of the two SqlInt64 operands.\r
+         */\r
+        public static SqlInt64 Multiply(SqlInt64 x, SqlInt64 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlInt64.Null;\r
+\r
+            long xVal = x._value;\r
+            long yVal = y._value;\r
+\r
+            long res = checked(xVal * yVal);\r
+\r
+            return new SqlInt64(res);\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlInt64 to determine if they are equal.\r
+         * @param x A SqlInt64 instance\r
+         * @param y A SqlInt64 instance\r
+         * @return A SqlBoolean that is True if the two instances are not equal or False if the two instances are equal.\r
+         * If either instance of SqlInt64 is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean NotEquals(SqlInt64 x, SqlInt64 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value != y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * The ones complement operator performs a bitwise one's complement operation on its SqlInt64 operand.\r
+         * @param x A SqlInt64 instance\r
+         * @return A SqlInt64 instance whose Value property contains the ones complement of the SqlInt64 parameter.\r
+         */\r
+        public static SqlInt64 OnesComplement(SqlInt64 x)\r
+        {\r
+            ulong res  = (ulong)x._value ^ 0xFFFFFFFFFFFFFFFF;\r
+\r
+            return new SqlInt64((long)res);\r
+        }\r
+\r
+        /**\r
+         * Converts the String representation of a number to its byte equivalent.\r
+         * @param s The String to be parsed.\r
+         * @return A SqlInt64 containing the value represented by the String.\r
+         */\r
+        public static SqlInt64 Parse(String s)\r
+        {\r
+            long res = long.Parse(s);\r
+\r
+            return new SqlInt64(res);\r
+        }\r
+\r
+        /**\r
+         * The subtraction operator the second SqlInt64 operand from the first.\r
+         * @param x A SqlInt64 instance\r
+         * @param y A SqlInt64 instance\r
+         * @return The results of the subtraction operation.\r
+         */\r
+        public static SqlInt64 Subtract(SqlInt64 x, SqlInt64 y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlInt64.Null;\r
+\r
+            long xVal = x._value;\r
+            long yVal = y._value;\r
+\r
+            \r
+            long res = checked(x._value - y._value);\r
+            return new SqlInt64(res);\r
+        }\r
+\r
+        /**\r
+         * Performs a bitwise exclusive-OR operation on the supplied parameters.\r
+         * @param x A SqlInt64 instance\r
+         * @param y A SqlInt64 instance\r
+         * @return The results of the XOR operation.\r
+         */\r
+        public static SqlInt64 Xor(SqlInt64 x, SqlInt64 y)\r
+        {\r
+            long res  = x._value ^ y._value;\r
+\r
+            return new SqlInt64(res);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt64 structure to SqlBoolean.\r
+         * @return A SqlBoolean structure whose Value will be True if the SqlInt64 structure's Value is non-zero, False if the SqlInt64 is zero\r
+         * and Null if the SqlInt64 structure is Null.\r
+         */\r
+        public SqlBoolean ToSqlBoolean()\r
+        {\r
+            if (IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (_value == 0)\r
+                return new SqlBoolean(0);\r
+\r
+            return new SqlBoolean(1);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt64 structure to SqlByte.\r
+         * @return A SqlByte structure whose Value equals the Value of this SqlInt64 structure.\r
+         */\r
+        public SqlByte ToSqlByte()\r
+        {\r
+            if (IsNull)\r
+                return SqlByte.Null;\r
+\r
+            if (_value < 0 || _value > 255)\r
+                throw new OverflowException("Can not convert this instance to SqlByte - overflowing : " + _value);\r
+\r
+            return new SqlByte((byte)_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt64 structure to SqlDecimal.\r
+         * @return A SqlDecimal structure whose Value equals the Value of this SqlInt64 structure.\r
+         */\r
+        public SqlDecimal ToSqlDecimal()\r
+        {\r
+            if (IsNull)\r
+                return SqlDecimal.Null;\r
+\r
+            return new SqlDecimal(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt64 structure to SqlDecimal.\r
+         * @return A SqlDouble structure whose Value equals the Value of this SqlInt64 structure.\r
+         */\r
+        public SqlDouble ToSqlDouble()\r
+        {\r
+            if (IsNull)\r
+                return SqlDouble.Null;\r
+\r
+            return new SqlDouble((double)_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt64 structure to SqlInt16.\r
+         * @return A SqlInt16 structure whose Value equals the Value of this SqlInt64 structure.\r
+         */\r
+        public SqlInt16 ToSqlInt16()\r
+        {\r
+            if (IsNull)\r
+                return SqlInt16.Null;\r
+            \r
+            if (_value > short.MaxValue || _value < short.MinValue)\r
+                throw new OverflowException("overflow - can not convert this SqlInt64 to SqlInt16 : " + _value);\r
+\r
+            return new SqlInt16((short)_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt64 structure to SqlInt32.\r
+         * @return A SqlInt32 structure whose Value equals the Value of this SqlInt64 structure.\r
+         */\r
+        public SqlInt32 ToSqlInt32()\r
+        {\r
+            if (IsNull)\r
+                return SqlInt32.Null;\r
+\r
+            if (_value > int.MaxValue || _value < int.MinValue)\r
+                throw new OverflowException("overflow - can not convert this SqlInt64 to SqlInt16 : " + _value);\r
+\r
+            return new SqlInt32((int)_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlInt64 instance to SqlDouble.\r
+         * @return A SqlMoney instance whose Value equals the Value of this SqlInt64 instance.\r
+         */\r
+        public SqlMoney ToSqlMoney()\r
+        {\r
+            if (IsNull)\r
+                return SqlMoney.Null;\r
+\r
+            return new SqlMoney(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlIn64 instance to SqlSingle.\r
+         * @return A SqlSingle instance whose Value equals the Value of this SqlInt64 instance.\r
+         */\r
+        public SqlSingle ToSqlSingle()\r
+        {\r
+            if (IsNull)\r
+                return SqlSingle.Null;\r
+            \r
+            return new SqlSingle((float)_value);\r
+        }\r
+\r
+\r
+\r
+        /**\r
+         * Converts this SqlInt64 structure to SqlString.\r
+         * @return A SqlString structure whose value is a string representing the date and time contained in this SqlInt64 structure.\r
+         */\r
+        public SqlString ToSqlString()\r
+        {\r
+            return new SqlString(ToString());\r
+        }\r
+\r
+\r
+\r
+        public override String ToString()\r
+        {\r
+            if (IsNull)\r
+                return "null";\r
+            return _value.ToString();\r
+        }\r
+\r
+        public static SqlInt64 operator + (SqlInt64 x, SqlInt64 y)\r
+        {\r
+            checked \r
+            {\r
+                return new SqlInt64 (x.Value + y.Value);\r
+            }\r
+        }\r
+\r
+        public static SqlInt64 operator & (SqlInt64 x, SqlInt64 y)\r
+        {\r
+            return new SqlInt64 (x.Value & y.Value);\r
+        }\r
+\r
+        public static SqlInt64 operator | (SqlInt64 x, SqlInt64 y)\r
+        {\r
+            return new SqlInt64 (x.Value | y.Value);\r
+        }\r
+\r
+        public static SqlInt64 operator / (SqlInt64 x, SqlInt64 y)\r
+        {\r
+            checked \r
+            {\r
+                return new SqlInt64 (x.Value / y.Value);\r
+            }\r
+        }\r
+\r
+        public static SqlBoolean operator == (SqlInt64 x, SqlInt64 y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value == y.Value);\r
+        }\r
+\r
+        public static SqlInt64 operator ^ (SqlInt64 x, SqlInt64 y)\r
+        {\r
+            return new SqlInt64 (x.Value ^ y.Value);\r
+        }\r
+\r
+        public static SqlBoolean operator > (SqlInt64 x, SqlInt64 y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value > y.Value);\r
+        }\r
+\r
+        public static SqlBoolean operator >= (SqlInt64 x, SqlInt64 y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value >= y.Value);\r
+        }\r
+\r
+        public static SqlBoolean operator != (SqlInt64 x, SqlInt64 y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (!(x.Value == y.Value));\r
+        }\r
+\r
+        public static SqlBoolean operator < (SqlInt64 x, SqlInt64 y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value < y.Value);\r
+        }\r
+\r
+        public static SqlBoolean operator <= (SqlInt64 x, SqlInt64 y)\r
+        {\r
+            if (x.IsNull || y.IsNull) \r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value <= y.Value);\r
+        }\r
+\r
+        public static SqlInt64 operator % (SqlInt64 x, SqlInt64 y)\r
+        {\r
+            return new SqlInt64(x.Value % y.Value);\r
+        }\r
+\r
+        public static SqlInt64 operator * (SqlInt64 x, SqlInt64 y)\r
+        {\r
+            checked \r
+            {\r
+                return new SqlInt64 (x.Value * y.Value);\r
+            }\r
+        }\r
+\r
+        public static SqlInt64 operator ~ (SqlInt64 x)\r
+        {\r
+            if (x.IsNull)\r
+                return SqlInt64.Null;\r
+\r
+            return new SqlInt64 (~(x.Value));\r
+        }\r
+\r
+        public static SqlInt64 operator - (SqlInt64 x, SqlInt64 y)\r
+        {\r
+            checked \r
+            {\r
+                return new SqlInt64 (x.Value - y.Value);\r
+            }\r
+        }\r
+\r
+        public static SqlInt64 operator - (SqlInt64 n)\r
+        {\r
+            return new SqlInt64 (-(n.Value));\r
+        }\r
+\r
+        public static explicit operator SqlInt64 (SqlBoolean x)\r
+        {\r
+            if (x.IsNull) \r
+                return SqlInt64.Null;\r
+            else\r
+                return new SqlInt64 ((long)x.ByteValue);\r
+        }\r
+\r
+        public static explicit operator SqlInt64 (SqlDecimal x)\r
+        {\r
+            checked \r
+            {\r
+                if (x.IsNull) \r
+                    return SqlInt64.Null;\r
+                else\r
+                    return new SqlInt64 ((long)x.Value);\r
+            }\r
+        }\r
+\r
+        public static explicit operator SqlInt64 (SqlDouble x)\r
+        {\r
+            if (x.IsNull) \r
+                return SqlInt64.Null;\r
+            else \r
+            {\r
+                checked \r
+                {\r
+                    return new SqlInt64 ((long)x.Value);\r
+                }\r
+            }\r
+        }\r
+\r
+        public static explicit operator long (SqlInt64 x)\r
+        {\r
+            return x.Value;\r
+        }\r
+\r
+        public static explicit operator SqlInt64 (SqlMoney x)\r
+        {\r
+            checked \r
+            {\r
+                if (x.IsNull) \r
+                    return SqlInt64.Null;\r
+                else\r
+                    return new SqlInt64 ((long)x.Value);\r
+            }\r
+        }\r
+\r
+        public static explicit operator SqlInt64 (SqlSingle x)\r
+        {\r
+            if (x.IsNull) \r
+                return SqlInt64.Null;\r
+            else \r
+            {\r
+                checked \r
+                {\r
+                    return new SqlInt64 ((long)x.Value);\r
+                }\r
+            }\r
+        }\r
+\r
+        public static explicit operator SqlInt64 (SqlString x)\r
+        {\r
+            checked \r
+            {\r
+                return SqlInt64.Parse (x.Value);\r
+            }\r
+        }\r
+\r
+        public static implicit operator SqlInt64 (long x)\r
+        {\r
+            return new SqlInt64 (x);\r
+        }\r
+\r
+        public static implicit operator SqlInt64 (SqlByte x)\r
+        {\r
+            if (x.IsNull) \r
+                return SqlInt64.Null;\r
+            else\r
+                return new SqlInt64 ((long)x.Value);\r
+        }\r
+\r
+        public static implicit operator SqlInt64 (SqlInt16 x)\r
+        {\r
+            if (x.IsNull) \r
+                return SqlInt64.Null;\r
+            else\r
+                return new SqlInt64 ((long)x.Value);\r
+        }\r
+\r
+        public static implicit operator SqlInt64 (SqlInt32 x)\r
+        {\r
+            if (x.IsNull) \r
+                return SqlInt64.Null;\r
+            else\r
+                return new SqlInt64 ((long)x.Value);\r
+        }\r
+\r
+    }}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlMoney.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlMoney.cs
new file mode 100644 (file)
index 0000000..ff468b2
--- /dev/null
@@ -0,0 +1,724 @@
+/*\r
+* Copyright (c) 2002-2004 Mainsoft Corporation.\r
+*\r
+* Permission is hereby granted, free of charge, to any person obtaining a\r
+* copy of this software and associated documentation files (the "Software"),\r
+* to deal in the Software without restriction, including without limitation\r
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+* and/or sell copies of the Software, and to permit persons to whom the\r
+* Software is furnished to do so, subject to the following conditions:\r
+*\r
+* The above copyright notice and this permission notice shall be included in\r
+* all copies or substantial portions of the Software.\r
+*\r
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+* DEALINGS IN THE SOFTWARE.\r
+*/\r
+\r
+namespace System.Data.SqlTypes\r
+{\r
+\r
+       /**\r
+        * <p>Title: </p>\r
+        * <p>Description: </p>\r
+        * <p>Copyright: Copyright (c) 2002</p>\r
+        * <p>Company: MainSoft</p>\r
+        * @author Pavel Sandler\r
+        * @version 1.0\r
+        */\r
+\r
+       using System;\r
+\r
+\r
+       /*\r
+       * CURRENT LIMITATIONS:\r
+       */\r
+\r
+\r
+       public struct SqlMoney : INullable\r
+       {\r
+\r
+               private Decimal _value;\r
+               private bool _isNull;\r
+\r
+               public static readonly SqlMoney MaxValue = new SqlMoney(922337203685475.5807m, true);\r
+               public static readonly SqlMoney MinValue = new SqlMoney(-922337203685477.5808m, true);\r
+               public static readonly SqlMoney Null = new SqlMoney(true);\r
+               public static readonly SqlMoney Zero = new SqlMoney(0);\r
+\r
+               // this ctor is to initailize max and min values, to avoid checks.\r
+               private SqlMoney(Decimal value, bool dummy)\r
+               {\r
+                       _value = value;\r
+                       _isNull = false;\r
+               }\r
+        \r
+               private SqlMoney(bool isNull)\r
+               {\r
+                       _isNull = true;\r
+                       _value = 0;\r
+               }\r
+               /**\r
+                * Initializes a new instance of the SqlMoney instance using the supplied Decimal value.\r
+                * @param value The Decimal value to be stored as a SqlMoney instance.\r
+                */\r
+               public SqlMoney(Decimal value) \r
+               {\r
+                       if ((value.CompareTo(MaxValue.Value) > 0 || value.CompareTo(MinValue.Value) < 0))\r
+                               throw new OverflowException("overflow - the value is out of range " + value);\r
+\r
+                       _value = value;\r
+                       _isNull = false;\r
+               }\r
+        \r
+\r
+               /**\r
+                * Initializes a new instance of the SqlMoney instance using the supplied double value.\r
+                * @param value The double value to be stored as a SqlMoney instance.\r
+                */\r
+               public SqlMoney(double value) \r
+               { \r
+                       _value = new Decimal(value);\r
+                       if (_value.CompareTo(MaxValue.Value) > 0 || _value.CompareTo(MinValue.Value) < 0)\r
+                               throw new OverflowException("overflow - the value is out of range " + value);\r
+\r
+                       _isNull = false;\r
+               }\r
+\r
+               /**\r
+                * Initializes a new instance of the SqlMoney instance using the supplied int value.\r
+                * @param value The int value to be stored as a SqlMoney instance.\r
+                */\r
+               public SqlMoney(int value) \r
+               {\r
+                       _value = new Decimal(value);\r
+                       _isNull = false;\r
+               }\r
+\r
+               /**\r
+                * Initializes a new instance of the SqlMoney instance using the supplied long value.\r
+                * @param value The long value to be stored as a SqlMoney instance.\r
+                */\r
+               public SqlMoney(long value) \r
+               {\r
+                       _value = new Decimal(value);\r
+                       if (_value.CompareTo(MaxValue.Value) > 0 || _value.CompareTo(MinValue.Value) < 0)\r
+                               throw new OverflowException("overflow - the value is out of range " + value);\r
+                       _isNull = false;\r
+               }\r
+\r
+        \r
+               /**\r
+                * Indicates whether or not Value is null.\r
+                * @return true if Value is null, otherwise false.\r
+                */\r
+               public bool IsNull\r
+               {\r
+                       get\r
+                       {\r
+                               return _isNull;\r
+                       }\r
+               }\r
+\r
+               /**\r
+                * Gets the value of the SqlMoney instance.\r
+                * @return the value of this instance\r
+                */\r
+               public Decimal Value\r
+               {\r
+                       get\r
+                       {\r
+                               if(IsNull)\r
+                                       throw new SqlNullValueException();\r
+                               return _value;\r
+                       }\r
+               }\r
+\r
+               /**\r
+                * Calcuates the sum of the two SqlMoney operators.\r
+                * @param x A SqlMoney instance.\r
+                * @param y A SqlMoney instance.\r
+                * @return A new SqlMoney instance whose Value property contains the sum.\r
+                * If one of the parameters or their value is null return SqlMoney.Null.\r
+                */\r
+               public static SqlMoney Add(SqlMoney x, SqlMoney y)\r
+               {\r
+                       if (x.IsNull || y.IsNull)\r
+                               return SqlMoney.Null;\r
+\r
+                       Decimal res = Decimal.Add(x._value, y._value);\r
+\r
+                       if (res.CompareTo(MaxValue.Value) > 0 || res.CompareTo(MinValue.Value) < 0)\r
+                               throw new OverflowException("overflow - the sum of the 2 parameters can not be SqlMoney : " + res);\r
+\r
+                       return new SqlMoney(res);\r
+               }\r
+\r
+               /**\r
+                * Compares this instance to the supplied object and returns an indication of their relative values.\r
+                * @param obj The object to compare.\r
+                * @return A signed number indicating the relative values of the instance and the object.\r
+                * Less than zero This instance is less than object.\r
+                * Zero This instance is the same as object.\r
+                * Greater than zero This instance is greater than object -or-\r
+                * object is a null reference.\r
+                */\r
+               public int CompareTo(Object obj)\r
+               {\r
+                       if (obj == null)\r
+                               return 1;\r
+\r
+                       if (obj is SqlMoney)\r
+                       {\r
+                               SqlMoney value = (SqlMoney)obj;\r
+                \r
+                               if(IsNull)\r
+                                       return -1;\r
+                \r
+                               if(value.IsNull)\r
+                                       return 1;\r
+\r
+                               return Decimal.Compare(_value, value._value);\r
+                       }\r
+\r
+                       /** @todo throwArgumentException */\r
+                       throw new ArgumentException("parameter obj is not SqlMoney : " + obj.GetType().Name);\r
+\r
+\r
+               }\r
+\r
+\r
+               /**\r
+                * The division operator divides the first SqlMoney operand by the second.\r
+                * @param x A SqlMoney instance.\r
+                * @param y A SqlMoney instance.\r
+                * @return A SqlMoney instance containing the results of the division operation.\r
+                * If one of the parameters is null or null value - return SqlDouble.Null.\r
+                */\r
+               public static SqlMoney Divide(SqlMoney x, SqlMoney y)\r
+               {\r
+                       if (x.IsNull || y.IsNull)\r
+                               return SqlMoney.Null;\r
+\r
+                       Decimal res = Decimal.Divide(x._value, y._value);\r
+\r
+                       return new SqlMoney(res);\r
+               }\r
+\r
+               public override bool Equals(Object obj)\r
+               {\r
+                       if (obj == null)\r
+                               return false;\r
+\r
+                       if (obj is SqlMoney)\r
+                       {\r
+                               SqlMoney dec = (SqlMoney)obj;\r
+\r
+                               return Decimal.Equals(_value, dec._value);\r
+                       }\r
+\r
+                       return false;\r
+               }\r
+\r
+        \r
+               /**\r
+                * Performs a logical comparison on two instances of SqlMoney to determine if they are equal.\r
+                * @param x A SqlMoney instance.\r
+                * @param y A SqlMoney instance.\r
+                * @return true if the two values are equal, otherwise false.\r
+                * If one of the parameters is null or null value return SqlBoolean.Null.\r
+                */\r
+               public static SqlBoolean Equals(SqlMoney x, SqlMoney y)\r
+               {\r
+                       if (x.IsNull || y.IsNull)\r
+                               return SqlBoolean.Null;\r
+\r
+                       if (x.Equals(y))\r
+                               return SqlBoolean.True;\r
+\r
+                       return SqlBoolean.False;\r
+               }\r
+\r
+\r
+               /**\r
+                * Compares two instances of SqlMoney to determine if the first is greater than the second.\r
+                * @param x A SqlMoney instance\r
+                * @param y A SqlMoney instance\r
+                * @return A SqlBoolean that is True if the first instance is greater than the second instance, otherwise False.\r
+                * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.\r
+                */\r
+               public static SqlBoolean GreaterThan(SqlMoney x, SqlMoney y)\r
+               {\r
+                       if (x.IsNull || y.IsNull)\r
+                               return SqlBoolean.Null;\r
+\r
+                       if (x.CompareTo(y) > 0)\r
+                               return SqlBoolean.True;\r
+\r
+                       return SqlBoolean.False;\r
+               }\r
+\r
+               /**\r
+                * Compares two instances of SqlMoney to determine if the first is greater than or equal to the second.\r
+                * @param x A SqlMoney instance\r
+                * @param y A SqlMoney instance\r
+                * @return A SqlBoolean that is True if the first instance is greaater than or equal to the second instance, otherwise False.\r
+                * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.\r
+                */\r
+               public static SqlBoolean GreaterThanOrEqual(SqlMoney x, SqlMoney y)\r
+               {\r
+                       if (x.IsNull || y.IsNull)\r
+                               return SqlBoolean.Null;\r
+\r
+                       if (x.CompareTo(y) >= 0)\r
+                               return SqlBoolean.True;\r
+\r
+                       return SqlBoolean.False;\r
+               }\r
+\r
+               /**\r
+                * Compares two instances of SqlMoney to determine if the first is less than the second.\r
+                * @param x A SqlMoney instance\r
+                * @param y A SqlMoney instance\r
+                * @return A SqlBoolean that is True if the first instance is less than the second instance, otherwise False.\r
+                * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.\r
+                */\r
+               public static SqlBoolean LessThan(SqlMoney x, SqlMoney y)\r
+               {\r
+                       if (x.IsNull || y.IsNull)\r
+                               return SqlBoolean.Null;\r
+\r
+                       if (x.CompareTo(y) < 0)\r
+                               return SqlBoolean.True;\r
+\r
+                       return SqlBoolean.False;\r
+               }\r
+\r
+               /**\r
+                * Compares two instances of SqlMoney to determine if the first is less than the second.\r
+                * @param x A SqlMoney instance\r
+                * @param y A SqlMoney instance\r
+                * @return A SqlBoolean that is True if the first instance is less than the second instance, otherwise False.\r
+                * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.\r
+                */\r
+               public static SqlBoolean LessThanOrEqual(SqlMoney x, SqlMoney y)\r
+               {\r
+                       if (x.IsNull || y.IsNull)\r
+                               return SqlBoolean.Null;\r
+\r
+                       if (x.CompareTo(y) <= 0)\r
+                               return SqlBoolean.True;\r
+\r
+                       return SqlBoolean.False;\r
+               }\r
+\r
+               /**\r
+                * The multiplication operator computes the product of the two SqlMoney operands.\r
+                * @param x A SqlMoney instance\r
+                * @param y A SqlMoney instance\r
+                * @return The product of the two SqlMoney operands.\r
+                */\r
+               public static SqlMoney Multiply(SqlMoney x, SqlMoney y)\r
+               {\r
+                       if (x.IsNull || y.IsNull)\r
+                               return SqlMoney.Null;\r
+\r
+                       Decimal res = Decimal.Multiply(x._value, y._value);\r
+\r
+                       if (res.CompareTo(MaxValue.Value) > 0 || res.CompareTo(MinValue.Value) < 0)\r
+                               throw new OverflowException("overflow - the multiply value is out of range " + res);\r
+\r
+                       return new SqlMoney(res);\r
+               }\r
+\r
+               /**\r
+                * Compares two instances of SqlMoney to determine if they are equal.\r
+                * @param x A SqlMoney instance\r
+                * @param y A SqlMoney instance\r
+                * @return A SqlBoolean that is True if the two instances are not equal or False if the two instances are equal.\r
+                * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.\r
+                */\r
+               public static SqlBoolean NotEquals(SqlMoney x, SqlMoney y)\r
+               {\r
+                       SqlBoolean eVal = Equals(x, y);\r
+\r
+                       if (eVal.IsNull)\r
+                               return eVal;\r
+                       if (eVal.IsTrue)\r
+                               return SqlBoolean.False;\r
+\r
+                       return SqlBoolean.True;\r
+               }\r
+\r
+               /**\r
+                * Converts the String representation of a number to its Decimal number equivalent.\r
+                * @param s The String to be parsed.\r
+                * @return A SqlMoney containing the value represented by the String.\r
+                */\r
+               public static SqlMoney Parse(String s)\r
+               {\r
+                       Decimal val = Decimal.Parse(s);\r
+                       SqlMoney retVal = new SqlMoney(val);\r
+\r
+                       if (GreaterThan(retVal, MaxValue).IsTrue || LessThan(retVal, MinValue).IsTrue)\r
+                               throw new OverflowException("the value is out of range : " + retVal);\r
+\r
+                       return retVal;\r
+               }\r
+\r
+               /**\r
+                * The subtraction operator the second SqlMoney operand from the first.\r
+                * @param x A SqlMoney instance\r
+                * @param y A SqlMoney instance\r
+                * @return The results of the subtraction operation.\r
+                */\r
+               public static SqlMoney Subtract(SqlMoney x, SqlMoney y)\r
+               {\r
+                       Decimal val = Decimal.Subtract(x._value, y._value);\r
+                       SqlMoney retVal = new SqlMoney(val);\r
+\r
+                       if (GreaterThan(retVal, MaxValue).IsTrue || LessThan(retVal, MinValue).IsTrue)\r
+                               throw new OverflowException("the subtract result is out of range : " + retVal);\r
+\r
+                       return retVal;\r
+\r
+               }\r
+\r
+               /**\r
+                * Returns the a double equal to the contents of the Value property of this instance.\r
+                * @return The decimal representation of the Value property.\r
+                */\r
+               public double ToDouble()\r
+               {\r
+                       return Decimal.ToDouble(_value);\r
+               }\r
+\r
+               /**\r
+                * Returns the a decimal equal to the contents of the Value property of this instance.\r
+                * @return The decimal representation of the Value property.\r
+                */\r
+               public Decimal ToDecimal()\r
+               {\r
+                       return _value;\r
+               }\r
+\r
+               /**\r
+                * Converts this SqlMoney instance to SqlBoolean.\r
+                * @return A SqlBoolean instance whose Value will be True if the SqlMoney instance's Value is non-zero,\r
+                * False if the SqlMoney is zero\r
+                * and Null if the SqlMoney instance is Null.\r
+                */\r
+               public SqlBoolean ToSqlBoolean()\r
+               {\r
+                       if (IsNull)\r
+                               return SqlBoolean.Null;\r
+\r
+                       int val = Decimal.ToInt32(_value);\r
+\r
+                       return new SqlBoolean(val);\r
+               }\r
+\r
+               /**\r
+                * Converts this SqlMoney instance to SqlByte.\r
+                * @return A SqlByte instance whose Value equals the Value of this SqlDouble instance.\r
+                */\r
+               public SqlByte ToSqlByte()\r
+               {\r
+                       if (IsNull)\r
+                               return SqlByte.Null;\r
+\r
+                       return new SqlByte(Decimal.ToByte(_value));\r
+               }\r
+\r
+               /**\r
+                * Converts this SqlMoney instance to SqlDouble.\r
+                * @return A SqlDouble instance whose Value equals the Value of this SqlMoney instance.\r
+                */\r
+               public SqlDouble ToSqlDouble()\r
+               {\r
+                       if (IsNull)\r
+                               return SqlDouble.Null;\r
+\r
+                       return new SqlDouble(Decimal.ToDouble(_value));\r
+               }\r
+\r
+               /**\r
+                * Converts this SqlMoney instance to SqlSingle.\r
+                * @return A SqlSingle instance whose Value equals the Value of this SqlMoney instance.\r
+                */\r
+               public SqlSingle ToSqlSingle()\r
+               {\r
+                       if (IsNull)\r
+                               return SqlSingle.Null;\r
+\r
+                       return new SqlSingle(Decimal.ToSingle(_value));\r
+               }\r
+\r
+               /**\r
+                * Converts this SqlMoney instance to SqlDecimal.\r
+                * @return A SqlDecimal instance whose Value equals the Value of this SqlMoney instance.\r
+                */\r
+               public SqlDecimal ToSqlDecimal()\r
+               {\r
+                       if (IsNull)\r
+                               return SqlDecimal.Null;\r
+\r
+                       return new SqlDecimal(_value);\r
+               }\r
+\r
+\r
+               /**\r
+                * Converts this SqlDouble structure to SqlInt16.\r
+                * @return A SqlInt16 structure whose Value equals the Value of this SqlDouble structure.\r
+                */\r
+               public SqlInt16 ToSqlInt16()\r
+               {\r
+                       if (IsNull)\r
+                               return SqlInt16.Null;\r
+\r
+                       return new SqlInt16(Decimal.ToInt16(_value));\r
+               }\r
+\r
+               /**\r
+                * Converts this SqlDouble structure to SqlInt32.\r
+                * @return A SqlInt32 structure whose Value equals the Value of this SqlDouble structure.\r
+                */\r
+               public SqlInt32 ToSqlInt32()\r
+               {\r
+                       if (IsNull)\r
+                               return SqlInt32.Null;\r
+\r
+                       return new SqlInt32(Decimal.ToInt32(_value));\r
+               }\r
+\r
+               /**\r
+                * Converts this SqlMoney structure to SqlInt64.\r
+                * @return A SqlInt64 structure whose Value equals the Value of this SqlMoney structure.\r
+                */\r
+               public SqlInt64 ToSqlInt64()\r
+               {\r
+                       if (IsNull)\r
+                               return SqlInt64.Null;\r
+                       return new SqlInt64(Decimal.ToInt64(_value));\r
+               }\r
+\r
+\r
+               /**\r
+                * Converts this SqlMoney structure to SqlString.\r
+                * @return A SqlString structure whose value is a string representing the date and time contained in this SqlMoney structure.\r
+                */\r
+               public SqlString ToSqlString()\r
+               {\r
+                       if (IsNull)\r
+                               return SqlString.Null;\r
+                       return new SqlString(ToString());\r
+               }\r
+\r
+               public override String ToString()\r
+               {\r
+                       if (IsNull)\r
+                               return "null";\r
+                       return _value.ToString();\r
+               }\r
+\r
+               public override int GetHashCode()\r
+               {\r
+                       if (IsNull)\r
+                               return 0;\r
+                       return _value.GetHashCode();\r
+               }\r
+\r
+               public static SqlMoney operator + (SqlMoney x, SqlMoney y)\r
+               {\r
+                       checked \r
+                       {\r
+                               return new SqlMoney (x.Value + y.Value);\r
+                       }\r
+               }\r
+\r
+               public static SqlMoney operator / (SqlMoney x, SqlMoney y)\r
+               {\r
+                       checked \r
+                       {\r
+                               return new SqlMoney (x.Value / y.Value);\r
+                       }\r
+               }\r
+\r
+               public static SqlBoolean operator == (SqlMoney x, SqlMoney y)\r
+               {\r
+                       if (x.IsNull || y.IsNull) \r
+                               return SqlBoolean.Null;\r
+                       else\r
+                               return new SqlBoolean (x.Value == y.Value);\r
+               }\r
+\r
+               public static SqlBoolean operator > (SqlMoney x, SqlMoney y)\r
+               {\r
+                       if (x.IsNull || y.IsNull) \r
+                               return SqlBoolean.Null;\r
+                       else\r
+                               return new SqlBoolean (x.Value > y.Value);\r
+               }\r
+\r
+               public static SqlBoolean operator >= (SqlMoney x, SqlMoney y)\r
+               {\r
+                       if (x.IsNull || y.IsNull) \r
+                               return SqlBoolean.Null;\r
+                       else\r
+                               return new SqlBoolean (x.Value >= y.Value);\r
+               }\r
+\r
+               public static SqlBoolean operator != (SqlMoney x, SqlMoney y)\r
+               {\r
+                       if (x.IsNull || y.IsNull) \r
+                               return SqlBoolean.Null;\r
+                       else\r
+                               return new SqlBoolean (!(x.Value == y.Value));\r
+               }\r
+\r
+               public static SqlBoolean operator < (SqlMoney x, SqlMoney y)\r
+               {\r
+                       if (x.IsNull || y.IsNull) \r
+                               return SqlBoolean.Null;\r
+                       else\r
+                               return new SqlBoolean (x.Value < y.Value);\r
+               }\r
+\r
+               public static SqlBoolean operator <= (SqlMoney x, SqlMoney y)\r
+               {\r
+                       if (x.IsNull || y.IsNull) \r
+                               return SqlBoolean.Null;\r
+                       return new SqlBoolean (x.Value <= y.Value);\r
+               }\r
+\r
+               public static SqlMoney operator * (SqlMoney x, SqlMoney y)\r
+               {\r
+                       checked \r
+                       {\r
+                               return new SqlMoney (x.Value * y.Value);\r
+                       }\r
+               }\r
+\r
+               public static SqlMoney operator - (SqlMoney x, SqlMoney y)\r
+               {\r
+                       checked \r
+                       {\r
+                               return new SqlMoney (x.Value - y.Value);\r
+                       }\r
+               }\r
+\r
+               public static SqlMoney operator - (SqlMoney n)\r
+               {\r
+                       return new SqlMoney (-(n.Value));\r
+               }\r
+\r
+               public static explicit operator SqlMoney (SqlBoolean x)\r
+               {                       \r
+                       if (x.IsNull) \r
+                               return Null;\r
+                       else \r
+                       {\r
+                               checked \r
+                               {\r
+                                       return new SqlMoney ((decimal)x.ByteValue);\r
+                               }\r
+                       }\r
+               }\r
+\r
+               public static explicit operator SqlMoney (SqlDecimal x)\r
+               {\r
+                       if (x.IsNull) \r
+                               return Null;\r
+                       else \r
+                       {\r
+                               checked \r
+                               {\r
+                                       return new SqlMoney (x.Value);\r
+                               }\r
+                       }\r
+               }\r
+\r
+               public static explicit operator SqlMoney (SqlDouble x)\r
+               {\r
+                       if (x.IsNull) \r
+                               return Null;\r
+                       else \r
+                       {\r
+                               checked \r
+                               {\r
+                                       return new SqlMoney ((decimal)x.Value);\r
+                               }\r
+                       }\r
+               }\r
+\r
+               public static explicit operator decimal (SqlMoney x)\r
+               {\r
+                       return x.Value;\r
+               }\r
+\r
+               public static explicit operator SqlMoney (SqlSingle x)\r
+               {\r
+                       if (x.IsNull) \r
+                               return Null;\r
+                       else \r
+                       {\r
+                               checked \r
+                               {\r
+                                       return new SqlMoney ((decimal)x.Value);\r
+                               }\r
+                       }\r
+               }\r
+\r
+               public static explicit operator SqlMoney (SqlString x)\r
+               {\r
+                       checked \r
+                       {\r
+                               return SqlMoney.Parse (x.Value);\r
+                       }\r
+               }\r
+\r
+               public static implicit operator SqlMoney (decimal x)\r
+               {\r
+                       return new SqlMoney (x);\r
+               }\r
+\r
+               public static implicit operator SqlMoney (SqlByte x)\r
+               {\r
+                       if (x.IsNull) \r
+                               return Null;\r
+                       else\r
+                               return new SqlMoney ((decimal)x.Value);\r
+               }\r
+\r
+               public static implicit operator SqlMoney (SqlInt16 x)\r
+               {\r
+                       if (x.IsNull) \r
+                               return Null;\r
+                       else\r
+                               return new SqlMoney ((decimal)x.Value);\r
+               }\r
+\r
+               public static implicit operator SqlMoney (SqlInt32 x)\r
+               {\r
+                       if (x.IsNull) \r
+                               return Null;\r
+                       else\r
+                               return new SqlMoney (x.Value);\r
+               }\r
+\r
+               public static implicit operator SqlMoney (SqlInt64 x)\r
+               {\r
+                       if (x.IsNull) \r
+                               return Null;\r
+                       else\r
+                               return new SqlMoney (x.Value);\r
+               }\r
+\r
+\r
+       }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlNullValueException.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlNullValueException.cs
new file mode 100644 (file)
index 0000000..4edaf21
--- /dev/null
@@ -0,0 +1,59 @@
+ /*\r
+  * Copyright (c) 2002-2004 Mainsoft Corporation.\r
+  *\r
+  * Permission is hereby granted, free of charge, to any person obtaining a\r
+  * copy of this software and associated documentation files (the "Software"),\r
+  * to deal in the Software without restriction, including without limitation\r
+  * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+  * and/or sell copies of the Software, and to permit persons to whom the\r
+  * Software is furnished to do so, subject to the following conditions:\r
+  *\r
+  * The above copyright notice and this permission notice shall be included in\r
+  * all copies or substantial portions of the Software.\r
+  *\r
+  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+  * DEALINGS IN THE SOFTWARE.\r
+  */
+
+namespace System.Data.SqlTypes
+{
+
+    /**
+     * The exception that is thrown for errors in an arithmetic, casting, or conversion operation
+     *
+     * @author  Pavel Sandler
+     * @version 1.0, 01/01/03
+     */
+
+    /*
+    * CURRENT LIMITATIONS
+    * 1. Constructor(SerializationInfo info, StreamingContext context) is not supported
+    * 2. Method "void GetObjectData(...,...)" is not supported from ISerializable
+    */
+
+       [Serializable]
+    public class SqlNullValueException : System.Data.SqlTypes.SqlTypeException
+    {
+        /**
+                                            * Initializes a new instance of the <code>SqlNullValueException</code> class.
+                                            */
+        public SqlNullValueException() : base("Data is Null. This method or property cannot be called on Null values.")
+        {
+        }
+
+        /**
+         * Initializes a new instance of the <code>SqlNullValueException</code> class
+         * with a specified error message.
+         *
+         * @param message The message that describes the error.
+         */
+        public SqlNullValueException(String message): base(message)
+        {
+        }
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlSingle.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlSingle.cs
new file mode 100644 (file)
index 0000000..fb138d1
--- /dev/null
@@ -0,0 +1,669 @@
+/*\r
+* Copyright (c) 2002-2004 Mainsoft Corporation.\r
+*\r
+* Permission is hereby granted, free of charge, to any person obtaining a\r
+* copy of this software and associated documentation files (the "Software"),\r
+* to deal in the Software without restriction, including without limitation\r
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+* and/or sell copies of the Software, and to permit persons to whom the\r
+* Software is furnished to do so, subject to the following conditions:\r
+*\r
+* The above copyright notice and this permission notice shall be included in\r
+* all copies or substantial portions of the Software.\r
+*\r
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+* DEALINGS IN THE SOFTWARE.\r
+*/\r
+\r
+namespace System.Data.SqlTypes\r
+{\r
+\r
+    /**\r
+     * <p>Title: </p>\r
+     * <p>Description: </p>\r
+     * <p>Copyright: Copyright (c) 2002</p>\r
+     * <p>Company: MainSoft</p>\r
+     * @author Pavel Sandler\r
+     * @version 1.0\r
+     */\r
+\r
+    using System;\r
+\r
+    public struct SqlSingle : INullable, IComparable\r
+    {\r
+\r
+        private float _value;\r
+\r
+        private static float _minVal = -3.40E+38F;\r
+        private static float _maxVal = 3.40E+38F;\r
+\r
+        public static readonly SqlSingle MaxValue = new SqlSingle(3.40E+38F);\r
+        public static readonly SqlSingle MinValue = new SqlSingle(-3.40E+38F);\r
+        public static readonly SqlSingle Null = new SqlSingle(true);\r
+        public static readonly SqlSingle Zero = new SqlSingle(0);\r
+\r
+        private bool _isNull;\r
+\r
+        private SqlSingle(bool isNull)\r
+        {\r
+            _isNull = isNull;\r
+            _value = 0;\r
+        }\r
+\r
+        /**\r
+         * Constructor\r
+         * @param value A float whose value will be used for the new SqlSingle.\r
+         */\r
+        public SqlSingle(float value) \r
+        { \r
+            _value = value;\r
+            _isNull = false;\r
+        }\r
+        \r
+\r
+        /**\r
+         * Indicates whether or not Value is null.\r
+         * @return true if Value is null, otherwise false.\r
+         */\r
+        public bool IsNull\r
+        {\r
+            get\r
+            {\r
+                return _isNull;\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Gets the value of the SqlSingle instance.\r
+         * @return the value of this instance\r
+         */\r
+        public float Value\r
+        {\r
+            get\r
+            {\r
+                if(IsNull)\r
+                    throw new SqlNullValueException();\r
+                return _value;\r
+            }\r
+        }\r
+\r
+        /**\r
+         * The addition operator computes the sum of the two SqlSingle operands.\r
+         * @param x A SqlSingle structure.\r
+         * @param y A SqlSingle structure.\r
+         * @return The sum of the two SqlSingle operands.\r
+         * If one of the parameters is null or null value - return SqlSingle.Null.\r
+         */\r
+        public static SqlSingle Add(SqlSingle x, SqlSingle y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlSingle.Null;\r
+\r
+            float xVal = x._value;\r
+            float yVal = y._value;\r
+\r
+            if (xVal < 0 && yVal < 0 && (_minVal - xVal > yVal))\r
+                throw new System.OverflowException("Overflow - " + x + " + " + y + " < " + _minVal);\r
+            if (xVal > 0 && yVal > 0 && (_maxVal - xVal < yVal))\r
+                throw new System.OverflowException("Overflow - " + x + " + " + y + " > " + _maxVal);\r
+\r
+\r
+            return new SqlSingle(xVal + yVal);\r
+        }\r
+\r
+        /**\r
+         * Compares this instance to the supplied object and returns an indication of their relative values.\r
+         * @param obj The object to compare.\r
+         * @return A signed number indicating the relative values of the instance and the object.\r
+         * Less than zero This instance is less than object.\r
+         * Zero This instance is the same as object.\r
+         * Greater than zero This instance is greater than object -or-\r
+         * object is a null reference.\r
+         */\r
+        public int CompareTo(Object obj)\r
+        {\r
+            if (obj == null)\r
+                return 1;\r
+\r
+            if (obj is SqlSingle)\r
+            {\r
+                SqlSingle d = (SqlSingle)obj;\r
+\r
+                if (d.IsNull)\r
+                    return 1;\r
+                if (this.IsNull)\r
+                    return -1;\r
+\r
+                return this._value.CompareTo(d._value);\r
+            }\r
+\r
+            throw new ArgumentException("parameter obj is not SqlSingle : " + obj.GetType().Name);\r
+\r
+        }\r
+\r
+        /**\r
+         * The division operator divides the first SqlSingle operand by the second.\r
+         * @param x A SqlSingle instance.\r
+         * @param y A SqlSingle instance.\r
+         * @return A SqlSingle structure containing the results of the division operation.\r
+         * If one of the parameters is null or null value - return SqlSingle.Null.\r
+         */\r
+        public static SqlSingle Divide(SqlSingle x, SqlSingle y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlSingle.Null;\r
+\r
+            float xVal = x._value;\r
+            float yVal = y._value;\r
+\r
+            if (java.lang.Math.abs(yVal) < 1)\r
+            {\r
+                if (xVal < 0 && yVal < 0 && (_maxVal * yVal > xVal))\r
+                    throw new System.OverflowException("Overflow - " + x + " / " + y + " > " + _maxVal);\r
+                if (xVal < 0 && yVal > 0 && (_minVal * yVal > xVal))\r
+                    throw new System.OverflowException("Overflow - " + x + " / " + y + " < " + _minVal);\r
+                if (xVal > 0 && yVal < 0 && (_minVal * yVal < xVal))\r
+                    throw new System.OverflowException("Overflow - " + x + " / " + y + " < " + _minVal);\r
+                if (xVal > 0 && yVal > 0 && (_maxVal * yVal < xVal))\r
+                    throw new System.OverflowException("Overflow - " + x + " / " + y + " > " + _maxVal);\r
+            }\r
+\r
+            return new SqlSingle(xVal / yVal);\r
+        }\r
+\r
+        public override bool Equals(Object obj)\r
+        {\r
+            if (Object.ReferenceEquals(obj, this))\r
+                return true;\r
+\r
+            if (obj == null)\r
+                return false;\r
+\r
+            if (obj is SqlSingle)\r
+            {\r
+                SqlSingle d = (SqlSingle)obj;\r
+\r
+                if (IsNull && d.IsNull)\r
+                    return true;\r
+\r
+                if (IsNull || d.IsNull)\r
+                    return false;\r
+\r
+                return _value.Equals(d._value);\r
+            }\r
+\r
+            return false;\r
+        }\r
+\r
+        \r
+\r
+\r
+        /**\r
+         * Performs a logical comparison on two instances of SqlSingle to determine if they are equal.\r
+         * @param x A SqlSingle instance.\r
+         * @param y A SqlSingle instance.\r
+         * @return true if the two values are equal, otherwise false.\r
+         * If one of the parameters is null or null value return SqlBoolean.Null.\r
+         */\r
+        public static SqlBoolean Equals(SqlSingle x, SqlSingle y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x.Equals(y))\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlSingle to determine if the first is greater than the second.\r
+         * @param x A SqlSingle instance\r
+         * @param y A SqlSingle instance\r
+         * @return A SqlBoolean that is True if the first instance is greater than the second instance, otherwise False.\r
+         * If either instance of SqlSingle is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean GreaterThan(SqlSingle x, SqlSingle y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value > y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlSingle to determine if the first is greater than or equal to the second.\r
+         * @param x A SqlSingle instance\r
+         * @param y A SqlSingle instance\r
+         * @return A SqlBoolean that is True if the first instance is greaater than or equal to the second instance, otherwise False.\r
+         * If either instance of SqlSingle is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean GreaterThanOrEqual(SqlSingle x, SqlSingle y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value >= y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlSingle to determine if the first is less than the second.\r
+         * @param x A SqlSingle instance\r
+         * @param y A SqlSingle instance\r
+         * @return A SqlBoolean that is True if the first instance is less than the second instance, otherwise False.\r
+         * If either instance of SqlSingle is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean LessThan(SqlSingle x, SqlSingle y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value < y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlSingle to determine if the first is less than or equal to the second.\r
+         * @param x A SqlSingle instance\r
+         * @param y A SqlSingle instance\r
+         * @return A SqlBoolean that is True if the first instance is less than or equal to the second instance, otherwise False.\r
+         * If either instance of SqlSingle is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean LessThanOrEqual(SqlSingle x, SqlSingle y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value <= y._value)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * The multiplication operator computes the product of the two SqlSingle operands.\r
+         * @param x A SqlSingle instance\r
+         * @param y A SqlSingle instance\r
+         * @return The product of the two SqlSingle operands.\r
+         */\r
+        public static SqlSingle Multiply(SqlSingle x, SqlSingle y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlSingle.Null;\r
+\r
+            float xVal = x._value;\r
+            float yVal = y._value;\r
+\r
+            if (java.lang.Math.abs(xVal) > 1 && java.lang.Math.abs(yVal) > 1)\r
+            {\r
+                if (xVal < 0 && yVal < 0 && (_maxVal / xVal > yVal))\r
+                    throw new System.OverflowException("Overflow - " + x + " * " + y + " > " + _maxVal);\r
+                if (xVal < 0 && yVal > 0 && (_minVal / xVal < yVal))\r
+                    throw new System.OverflowException("Overflow - " + x + " * " + y + " < " + _minVal);\r
+                if (xVal > 0 && yVal < 0 && (_minVal / xVal > yVal))\r
+                    throw new System.OverflowException("Overflow - " + x + " * " + y + " < " + _minVal);\r
+                if (xVal > 0 && yVal > 0 && (_maxVal / xVal < yVal))\r
+                    throw new System.OverflowException("Overflow - " + x + " * " + y + " > " + _maxVal);\r
+            }\r
+\r
+            return new SqlSingle(xVal * yVal);\r
+        }\r
+\r
+\r
+        /**\r
+         * Compares two instances of SqlSingle to determine if they are equal.\r
+         * @param x A SqlSingle instance\r
+         * @param y A SqlSingle instance\r
+         * @return A SqlBoolean that is True if the two instances are not equal or False if the two instances are equal.\r
+         * If either instance of SqlSingle is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean NotEquals(SqlSingle x, SqlSingle y)\r
+        {\r
+            SqlBoolean res = Equals(x, y);\r
+\r
+            if (res.IsNull)\r
+                return res;\r
+            if (res.IsFalse)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Converts the String representation of a number to its float-precision floating point number equivalent.\r
+         * @param s The String to be parsed.\r
+         * @return A SqlSingle containing the value represented by the String.\r
+         */\r
+        public static SqlSingle Parse(String s)\r
+        {\r
+            float d = Single.Parse(s);\r
+            return new SqlSingle(d);\r
+        }\r
+\r
+        /**\r
+         * The subtraction operator the second SqlSingle operand from the first.\r
+         * @param x A SqlSingle instance\r
+         * @param y A SqlSingle instance\r
+         * @return The results of the subtraction operation.\r
+         */\r
+        public static SqlSingle Subtract(SqlSingle x, SqlSingle y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlSingle.Null;\r
+\r
+            float xVal = x._value;\r
+            float yVal = y._value;\r
+\r
+            if (xVal < 0 && yVal > 0 && (java.lang.Math.abs(_minVal - xVal) < yVal))\r
+                throw new System.OverflowException("Overflow - " + x + " - " + y + " < " + _minVal);\r
+            if (xVal > 0 && yVal < 0 && (_maxVal - xVal < java.lang.Math.abs(yVal)))\r
+                throw new System.OverflowException("Overflow - " + x + " - " + y + " > " + _maxVal);\r
+\r
+\r
+            return new SqlSingle(x._value - y._value);\r
+\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlSingle structure to SqlBoolean.\r
+         * @return A SqlBoolean structure whose Value will be True if the SqlSingle structure's Value is non-zero, False if the SqlSingle is zero\r
+         * and Null if the SqlSingle structure is Null.\r
+         */\r
+        public SqlBoolean ToSqlBoolean()\r
+        {\r
+            if (_value == 0)\r
+                return new SqlBoolean(0);\r
+\r
+            return new SqlBoolean(1);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlSingle structure to SqlByte.\r
+         * @return A SqlByte structure whose Value equals the Value of this SqlSingle structure.\r
+         */\r
+        public SqlByte ToSqlByte()\r
+        {\r
+            int val = (int)_value;\r
+\r
+            if (val < 0 || val > 255)\r
+                throw new OverflowException("Can not conver this instance to SqlByte - overflowing : " + val);\r
+\r
+            return new SqlByte((byte)val);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlSingle structure to SqlDouble.\r
+         * @return A SqlDouble structure whose Value equals the Value of this SqlSingle structure.\r
+         */\r
+        public SqlDouble ToSqlDouble()\r
+        {\r
+            return new SqlDouble(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlSingle structure to SqlDecimal.\r
+         * @return A SqlDecimal structure whose Value equals the Value of this SqlSingle structure.\r
+         */\r
+        public SqlDecimal ToSqlDecimal()\r
+        {\r
+            return new SqlDecimal(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlSingle structure to SqlInt16.\r
+         * @return A SqlInt16 structure whose Value equals the Value of this SqlSingle structure.\r
+         */\r
+        public SqlInt16 ToSqlInt16()\r
+        {\r
+            return new SqlInt16((short)_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlSingle structure to SqlInt32.\r
+         * @return A SqlInt32 structure whose Value equals the Value of this SqlSingle structure.\r
+         */\r
+        public SqlInt32 ToSqlInt32()\r
+        {\r
+            return new SqlInt32((int)_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlSingle structure to SqlInt64.\r
+         * @return A SqlInt64 structure whose Value equals the Value of this SqlSingle structure.\r
+         */\r
+        public SqlInt64 ToSqlInt64()\r
+        {\r
+            return new SqlInt64((long)_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlSingle instance to SqlSingle.\r
+         * @return A SqlMoney instance whose Value equals the Value of this SqlSingle instance.\r
+         */\r
+        public SqlMoney ToSqlMoney()\r
+        {\r
+            return new SqlMoney(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlSingle structure to SqlString.\r
+         * @return A SqlString structure whose value is a string representing the date and time contained in this SqlSingle structure.\r
+         */\r
+        public SqlString ToSqlString()\r
+        {\r
+            return new SqlString(ToString());\r
+        }\r
+\r
+\r
+        public override String ToString()\r
+        {\r
+            if (IsNull)\r
+                return "null";\r
+\r
+            return _value.ToString();\r
+        }\r
+        \r
+        public override int GetHashCode()\r
+        {\r
+            return _value.GetHashCode();\r
+        }\r
+\r
+        public static SqlSingle operator + (SqlSingle x, SqlSingle y)\r
+        {\r
+            float f = (float)(x.Value + y.Value);\r
+\r
+            if (Single.IsInfinity (f))\r
+                throw new OverflowException ();\r
+\r
+            return new SqlSingle (f);\r
+        }\r
+\r
+        public static SqlSingle operator / (SqlSingle x, SqlSingle y)\r
+        {\r
+            float f = (float)(x.Value / y.Value);\r
+\r
+            if (Single.IsInfinity (f)) \r
+            {\r
+                               \r
+                if (y.Value == 0d) \r
+                    throw new DivideByZeroException ();\r
+            }\r
+\r
+            return new SqlSingle (x.Value / y.Value);\r
+        }\r
+\r
+        public static SqlBoolean operator == (SqlSingle x, SqlSingle y)\r
+        {\r
+            if (x.IsNull || y .IsNull) \r
+                return SqlBoolean.Null;\r
+            return new SqlBoolean (x.Value == y.Value);\r
+        }\r
+\r
+        public static SqlBoolean operator > (SqlSingle x, SqlSingle y)\r
+        {\r
+            if (x.IsNull || y .IsNull) \r
+                return SqlBoolean.Null;\r
+            return new SqlBoolean (x.Value > y.Value);\r
+        }\r
+\r
+        public static SqlBoolean operator >= (SqlSingle x, SqlSingle y)\r
+        {\r
+            if (x.IsNull || y .IsNull) \r
+                return SqlBoolean.Null;\r
+            return new SqlBoolean (x.Value >= y.Value);\r
+        }\r
+\r
+        public static SqlBoolean operator != (SqlSingle x, SqlSingle y)\r
+        {\r
+            if (x.IsNull || y .IsNull) \r
+                return SqlBoolean.Null;\r
+            return new SqlBoolean (!(x.Value == y.Value));\r
+        }\r
+\r
+        public static SqlBoolean operator < (SqlSingle x, SqlSingle y)\r
+        {\r
+            if (x.IsNull || y .IsNull) \r
+                return SqlBoolean.Null;\r
+            return new SqlBoolean (x.Value < y.Value);\r
+        }\r
+\r
+        public static SqlBoolean operator <= (SqlSingle x, SqlSingle y)\r
+        {\r
+            if (x.IsNull || y .IsNull) \r
+                return SqlBoolean.Null;\r
+            return new SqlBoolean (x.Value <= y.Value);\r
+        }\r
+\r
+        public static SqlSingle operator * (SqlSingle x, SqlSingle y)\r
+        {\r
+            float f = (float)(x.Value * y.Value);\r
+                       \r
+            if (Single.IsInfinity (f))\r
+                throw new OverflowException ();\r
+\r
+            return new SqlSingle (f);\r
+        }\r
+\r
+        public static SqlSingle operator - (SqlSingle x, SqlSingle y)\r
+        {\r
+            float f = (float)(x.Value - y.Value);\r
+\r
+            if (Single.IsInfinity (f))\r
+                throw new OverflowException ();\r
+\r
+            return new SqlSingle (f);\r
+        }\r
+\r
+        public static SqlSingle operator - (SqlSingle n)\r
+        {\r
+            return new SqlSingle (-(n.Value));\r
+        }\r
+\r
+        public static explicit operator SqlSingle (SqlBoolean x)\r
+        {\r
+            checked \r
+            {\r
+                if (x.IsNull)\r
+                    return Null;\r
+                               \r
+                return new SqlSingle((float)x.ByteValue);\r
+            }\r
+        }\r
+\r
+        public static explicit operator SqlSingle (SqlDouble x)\r
+        {\r
+            if (x.IsNull)\r
+                return Null;\r
+\r
+            float f = (float)x.Value;\r
+\r
+            if (Single.IsInfinity (f))\r
+                throw new OverflowException ();\r
+                               \r
+            return new SqlSingle(f);\r
+        }\r
+\r
+        public static explicit operator float (SqlSingle x)\r
+        {\r
+            return x.Value;\r
+        }\r
+\r
+        public static explicit operator SqlSingle (SqlString x)\r
+        {\r
+            checked \r
+            {\r
+                if (x.IsNull)\r
+                    return Null;\r
+                               \r
+                return SqlSingle.Parse (x.Value);\r
+            }\r
+        }\r
+\r
+        public static implicit operator SqlSingle (float x)\r
+        {\r
+            return new SqlSingle (x);\r
+        }\r
+\r
+        public static implicit operator SqlSingle (SqlByte x)\r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else \r
+                return new SqlSingle((float)x.Value);\r
+        }\r
+\r
+        public static implicit operator SqlSingle (SqlDecimal x)\r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else\r
+                return new SqlSingle((float)x.Value);\r
+        }\r
+\r
+        public static implicit operator SqlSingle (SqlInt16 x)\r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else\r
+                return new SqlSingle((float)x.Value);\r
+        }\r
+\r
+        public static implicit operator SqlSingle (SqlInt32 x)\r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else\r
+                return new SqlSingle((float)x.Value);\r
+        }\r
+\r
+        public static implicit operator SqlSingle (SqlInt64 x)\r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else\r
+                return new SqlSingle((float)x.Value);\r
+        }\r
+\r
+        public static implicit operator SqlSingle (SqlMoney x)\r
+        {\r
+            if (x.IsNull) \r
+                return Null;\r
+            else\r
+                return new SqlSingle((float)x.Value);\r
+        }\r
+\r
+    }\r
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlStreamChars.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlStreamChars.cs
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlString.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlString.cs
new file mode 100644 (file)
index 0000000..ed97c88
--- /dev/null
@@ -0,0 +1,616 @@
+/*\r
+* Copyright (c) 2002-2004 Mainsoft Corporation.\r
+*\r
+* Permission is hereby granted, free of charge, to any person obtaining a\r
+* copy of this software and associated documentation files (the "Software"),\r
+* to deal in the Software without restriction, including without limitation\r
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+* and/or sell copies of the Software, and to permit persons to whom the\r
+* Software is furnished to do so, subject to the following conditions:\r
+*\r
+* The above copyright notice and this permission notice shall be included in\r
+* all copies or substantial portions of the Software.\r
+*\r
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+* DEALINGS IN THE SOFTWARE.\r
+*/\r
+\r
+namespace System.Data.SqlTypes\r
+{\r
+\r
+    using System;\r
+\r
+    /*\r
+    * CURRENT LIMITATIONS:\r
+    * 1. constructor public SqlString(String, int) not supported\r
+    * 2. constructor public SqlString(int, SqlCompareOption, byte[]) not supported\r
+    * 3. constructor public SqlString(String, int, SqlCompareOption) not supported\r
+    * 4. constructor public SqlString(int, SqlCompareOption, byte[], boolen) not supported\r
+    * 5. constructor public SqlString(int, SqlCompareOption, byte[], boolen) not supported\r
+    * 6. constructor public SqlString(int, SqlCompareOption, byte[], int, int) not supported\r
+    * 7. field IgnoreKanaType is ignored\r
+    * 8. field IgnoreNonSpace is ignored\r
+    * 9. field IgnoreWidth is ignored\r
+    * 10. any Localeinformation is ignored that is the reson for limitation 1-6\r
+    * 11. property CompareInfo not implemented - it relates to the Locale issu\r
+    * 12. property CultureInfo not implemented - it relates to the Locale issu\r
+    * 12. property LCID not implemented - it relates to the Locale issu\r
+    * 13. method GetCompareOptionsFromSqlCompareOptions not implemented - it relates to the Locale issu\r
+    * 14. method GetNonUnicodeBytes() - not implemented. Need more information\r
+    * 15. method GetUnicodeBytes() - implemented - not sure the right way!!!\r
+    */\r
+\r
+\r
+    public struct SqlString : INullable, IComparable\r
+    {\r
+        private String _value;\r
+        private bool _isNull;\r
+        private SqlCompareOptions _compareOptions;\r
+\r
+        public static readonly SqlString Null = new SqlString();\r
+        public static readonly int IgnoreCase = 1;\r
+        public static readonly int IgnoreWidth = 16;\r
+        public static readonly int IgnoreNonSpace = 2;\r
+        public static readonly int IgnoreKanaType = 8;\r
+        public static readonly int BinarySort = 32786;\r
+\r
+        \r
+        private SqlString(bool isNull)\r
+        {\r
+            _isNull = isNull;\r
+            _value = String.Empty;\r
+            _compareOptions = SqlCompareOptions.None;\r
+        }\r
+\r
+        /**\r
+         * Initializes a new instance of the SqlString structure using the specified string.\r
+         * @param value The string to store.\r
+         */\r
+        public SqlString(String value) \r
+        { \r
+            _value = value;\r
+            _isNull = false;\r
+            _compareOptions = SqlCompareOptions.None;\r
+        }\r
+\r
+        \r
+        /**\r
+         * Indicates whether or not Value is null.\r
+         * @return true if Value is null, otherwise false.\r
+         */\r
+        public bool IsNull\r
+        {\r
+            get\r
+            {\r
+                return _isNull;\r
+            }\r
+        }\r
+\r
+        public SqlCompareOptions CompareOptions\r
+        {\r
+            get\r
+            {\r
+                return _compareOptions;\r
+            }\r
+        }\r
+\r
+        public String Value\r
+        {\r
+            get\r
+            {\r
+                if(IsNull)\r
+                {\r
+                    throw new SqlNullValueException();\r
+                }\r
+                return _value;\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Creates a copy of this SqlString object.\r
+         * @return A new SqlString object in which all property values are the same as the original.\r
+         */\r
+        public SqlString Clone()\r
+        {\r
+            SqlString clone;\r
+            if (_value == null)\r
+                clone = new SqlString();\r
+            else\r
+                clone = new SqlString(_value);\r
+\r
+            clone._compareOptions = _compareOptions;\r
+            return clone;\r
+        }\r
+\r
+        /**\r
+         * Compares this instance to the supplied object and returns an indication of their relative values.\r
+         * @param obj The object to compare.\r
+         * @return A signed number indicating the relative values of the instance and the object.\r
+         * Less than zero This instance is less than object.\r
+         * Zero This instance is the same as object.\r
+         * Greater than zero This instance is greater than object -or-\r
+         * object is a null reference.\r
+         */\r
+        public int CompareTo(Object obj)\r
+        {\r
+            if (obj == null)\r
+                return 1;\r
+\r
+            if (Object.ReferenceEquals(obj, this))\r
+                return 0;\r
+\r
+            if (obj is SqlString)\r
+            {\r
+                SqlString sqlStr = (SqlString)obj;\r
+\r
+                if (sqlStr._value == null && this._value == null)\r
+                    return 0;\r
+\r
+                if (sqlStr._value == null)\r
+                    return 1;\r
+                if (this._value == null)\r
+                    return -1;\r
+\r
+                if (_compareOptions == SqlCompareOptions.BinarySort ||\r
+                    _compareOptions == SqlCompareOptions.None)\r
+                    return String.Compare(this._value, sqlStr._value);\r
+\r
+                if (_compareOptions == SqlCompareOptions.IgnoreCase)\r
+                    return String.Compare(this._value, sqlStr._value, true);\r
+            }\r
+\r
+            throw new ArgumentException("parameter obj is not SqlString : " + obj.GetType().Name);\r
+\r
+        }\r
+\r
+        /**\r
+         * Concatenates the two specified SqlString structures.\r
+         * @param x A SqlString.\r
+         * @param y A SqlString.\r
+         * @return A SqlString containing the newly concatenated value representing the contents of the two SqlString parameters.\r
+         * If any of the parameters or their value equals null the returned value is SqlString.Null.\r
+         */\r
+        public static SqlString Concat(SqlString x, SqlString y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlString.Null;\r
+\r
+            return new SqlString(x._value + y._value);\r
+        }\r
+\r
+\r
+//        public bool Equals(Object obj)\r
+//        {\r
+//            if (Object.ReferenceEquals(obj, this))\r
+//                return true;\r
+//\r
+//            if (obj is SqlString)\r
+//            {\r
+//                SqlString s = (SqlString)obj;\r
+//\r
+//                if (IsNull && s.IsNull)\r
+//                    return true;\r
+//\r
+//                if (IsNull || s.IsNull)\r
+//                    return false;\r
+//\r
+//                return _value.Equals(s._value);\r
+//            }\r
+//\r
+//            return false;\r
+//        }\r
+\r
+        /**\r
+         * Performs a logical comparison on two instances of SqlString to determine if they are equal.\r
+         * @param x A SqlString instance.\r
+         * @param y A SqlString instance.\r
+         * @return true if the two values are equal, otherwise false.\r
+         * If one of the parameters is null or null value return SqlBoolean.Null.\r
+         */\r
+        public static SqlBoolean Equals(SqlString x, SqlString y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x._value.Equals(y._value))\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        public override bool Equals(object obj)\r
+        {\r
+            if(obj is SqlString)\r
+            {\r
+                SqlString sqlObj = (SqlString)obj;\r
+                if(sqlObj.IsNull && IsNull)\r
+                    return true;\r
+                if(sqlObj.IsNull || IsNull)\r
+                    return false;\r
+                return sqlObj.Value == this.Value;\r
+            }\r
+            return false;\r
+        }\r
+\r
+        public override int GetHashCode()\r
+        {\r
+            if(IsNull)\r
+                return -1;\r
+\r
+            return Value.GetHashCode();\r
+        }\r
+\r
+\r
+        /**\r
+         * Gets an array of bytes, containing the contents of the SqlString in Unicode format.\r
+         * @return An byte array, containing the contents of the SqlString in Unicode format.\r
+         */\r
+        public byte[] GetUnicodeString()\r
+        {\r
+            /** @todo check if it works */\r
+            if (IsNull)\r
+                return null;\r
+\r
+            return System.Text.Encoding.Default.GetBytes(_value);\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlString to determine if the first is greater than the second.\r
+         * @param x A SqlString instance\r
+         * @param y A SqlString instance\r
+         * @return A SqlBoolean that is True if the first instance is greater than the second instance, otherwise False.\r
+         * If either instance of SqlString is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean GreaterThan(SqlString x, SqlString y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x.CompareTo(y) > 0)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlString to determine if the first is greater than or equal to the second.\r
+         * @param x A SqlString instance\r
+         * @param y A SqlString instance\r
+         * @return A SqlBoolean that is True if the first instance is greaater than or equal to the second instance, otherwise False.\r
+         * If either instance of SqlString is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean GreaterThanOrEqual(SqlString x, SqlString y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x.CompareTo(y) >= 0)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlString to determine if the first is less than the second.\r
+         * @param x A SqlString instance\r
+         * @param y A SqlString instance\r
+         * @return A SqlBoolean that is True if the first instance is less than the second instance, otherwise False.\r
+         * If either instance of SqlString is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean LessThan(SqlString x, SqlString y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x.CompareTo(y) < 0)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+        /**\r
+         * Compares two instances of SqlString to determine if the first is less than the second.\r
+         * @param x A SqlString instance\r
+         * @param y A SqlString instance\r
+         * @return A SqlBoolean that is True if the first instance is less than the second instance, otherwise False.\r
+         * If either instance of SqlString is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean LessThanOrEqual(SqlString x, SqlString y)\r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+\r
+            if (x.CompareTo(y) <= 0)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+\r
+        /**\r
+         * Compares two instances of SqlString to determine if they are equal.\r
+         * @param x A SqlString instance\r
+         * @param y A SqlString instance\r
+         * @return A SqlBoolean that is True if the two instances are not equal or False if the two instances are equal.\r
+         * If either instance of SqlString is null, the Value of the SqlBoolean will be Null.\r
+         */\r
+        public static SqlBoolean NotEquals(SqlString x, SqlString y)\r
+        {\r
+            SqlBoolean res = Equals(x, y);\r
+\r
+            if (res.IsNull)\r
+                return res;\r
+            if (res.IsFalse)\r
+                return SqlBoolean.True;\r
+\r
+            return SqlBoolean.False;\r
+        }\r
+\r
+\r
+        /**\r
+         * Converts this SqlString structure to SqlBoolean.\r
+         * @return A SqlBoolean structure whose Value will be True if the SqlString structure's Value is non-zero, False if the SqlString is zero\r
+         * and Null if the SqlString structure is Null.\r
+         */\r
+        public SqlBoolean ToSqlBoolean()\r
+        {\r
+            return SqlBoolean.Parse(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlString structure to SqlByte.\r
+         * @return A SqlByte structure whose Value equals the Value of this SqlString structure.\r
+         */\r
+        public SqlByte ToSqlByte()\r
+        {\r
+            return SqlByte.Parse(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlString structure to SqlDecimal.\r
+         * @return A SqlDecimal structure whose Value equals the Value of this SqlString structure.\r
+         */\r
+        public SqlDecimal ToSqlDecimal()\r
+        {\r
+            return SqlDecimal.Parse(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlString structure to SqlDouble.\r
+         * @return A SqlDouble structure whose Value equals the Value of this SqlString structure.\r
+         */\r
+        public SqlDouble ToSqlDouble()\r
+        {\r
+            return SqlDouble.Parse(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlString structure to SqlSingle.\r
+         * @return A SqlDouble structure whose Value equals the Value of this SqlString structure.\r
+         */\r
+        public SqlSingle ToSqlSingle()\r
+        {\r
+            return SqlSingle.Parse(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlString structure to SqlDateTime.\r
+         * @return A SqlDateTime structure whose Value equals the Value of this SqlString structure.\r
+         */\r
+        public SqlDateTime ToSqlDateTime()\r
+        {\r
+            return SqlDateTime.Parse(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlString structure to SqlInt16.\r
+         * @return A SqlInt16 structure whose Value equals the Value of this SqlString structure.\r
+         */\r
+        public SqlInt16 ToSqlInt16()\r
+        {\r
+            return SqlInt16.Parse(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlString structure to SqlInt32.\r
+         * @return A SqlInt32 structure whose Value equals the Value of this SqlString structure.\r
+         */\r
+        public SqlInt32 ToSqlInt32()\r
+        {\r
+            return SqlInt32.Parse(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlString structure to SqlInt64.\r
+         * @return A SqlInt64 structure whose Value equals the Value of this SqlString structure.\r
+         */\r
+        public SqlInt64 ToSqlInt64()\r
+        {\r
+            return SqlInt64.Parse(_value);\r
+        }\r
+\r
+        /**\r
+         * Converts this SqlString instance to SqlString.\r
+         * @return A SqlMoney instance whose Value equals the Value of this SqlString instance.\r
+         */\r
+        public SqlMoney ToSqlMoney()\r
+        {\r
+            return SqlMoney.Parse(_value);\r
+        }\r
+\r
+        public override String ToString()\r
+        {\r
+            if(IsNull)\r
+                return "null";\r
+            return _value.ToString();\r
+        }\r
+\r
+        // Concatenates\r
+        public static SqlString operator + (SqlString x, SqlString y) \r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlString.Null;\r
+\r
+            return new SqlString (x.Value + y.Value);\r
+        }\r
+\r
+        // Equality\r
+        public static SqlBoolean operator == (SqlString x, SqlString y) \r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value == y.Value);\r
+        }\r
+\r
+        // Greater Than\r
+        public static SqlBoolean operator > (SqlString x, SqlString y) \r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.CompareTo (y) > 0);\r
+        }\r
+\r
+        // Greater Than Or Equal\r
+        public static SqlBoolean operator >= (SqlString x, SqlString y) \r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.CompareTo (y) >= 0);\r
+        }\r
+\r
+        public static SqlBoolean operator != (SqlString x, SqlString y) \r
+        { \r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.Value != y.Value);\r
+        }\r
+\r
+        // Less Than\r
+        public static SqlBoolean operator < (SqlString x, SqlString y) \r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.CompareTo (y) < 0);\r
+        }\r
+\r
+        // Less Than Or Equal\r
+        public static SqlBoolean operator <= (SqlString x, SqlString y) \r
+        {\r
+            if (x.IsNull || y.IsNull)\r
+                return SqlBoolean.Null;\r
+            else\r
+                return new SqlBoolean (x.CompareTo (y) <= 0);\r
+        }\r
+\r
+        // **************************************\r
+        // Type Conversions\r
+        // **************************************\r
+\r
+        public static explicit operator SqlString (SqlBoolean x) \r
+        {\r
+            if (x.IsNull)\r
+                return Null;\r
+            else\r
+                return new SqlString (x.Value.ToString ());\r
+        }\r
+\r
+        public static explicit operator SqlString (SqlByte x) \r
+        {\r
+            if (x.IsNull)\r
+                return Null;\r
+            else\r
+                return new SqlString (x.Value.ToString ());\r
+        }\r
+\r
+        public static explicit operator SqlString (SqlDateTime x) \r
+        {\r
+            if (x.IsNull)\r
+                return Null;\r
+            else\r
+                return new SqlString (x.Value.ToString ());\r
+        }\r
+\r
+        public static explicit operator SqlString (SqlDecimal x) \r
+        {\r
+            if (x.IsNull)\r
+                return Null;\r
+            else\r
+                return new SqlString (x.Value.ToString ());\r
+        }\r
+\r
+        public static explicit operator SqlString (SqlDouble x) \r
+        {\r
+            if (x.IsNull)\r
+                return Null;\r
+            else\r
+                return new SqlString (x.Value.ToString ());\r
+        }\r
+\r
+        public static explicit operator SqlString (SqlGuid x) \r
+        {\r
+            if (x.IsNull)\r
+                return Null;\r
+            else\r
+                return new SqlString (x.Value.ToString ());\r
+        }\r
+\r
+        public static explicit operator SqlString (SqlInt16 x) \r
+        {\r
+            if (x.IsNull)\r
+                return Null;\r
+            else\r
+                return new SqlString (x.Value.ToString ());\r
+        }\r
+\r
+        public static explicit operator SqlString (SqlInt32 x) \r
+        {\r
+            if (x.IsNull)\r
+                return Null;\r
+            else\r
+                return new SqlString (x.Value.ToString ());\r
+        }\r
+\r
+        public static explicit operator SqlString (SqlInt64 x) \r
+        {\r
+            if (x.IsNull)\r
+                return Null;\r
+            else\r
+                return new SqlString (x.Value.ToString ());\r
+        }\r
+\r
+        public static explicit operator SqlString (SqlMoney x) \r
+        {\r
+            if (x.IsNull)\r
+                return Null;\r
+            else\r
+                return new SqlString (x.Value.ToString ());\r
+        }\r
+\r
+        public static explicit operator SqlString (SqlSingle x) \r
+        {\r
+            if (x.IsNull)\r
+                return Null;\r
+            else\r
+                return new SqlString (x.Value.ToString ());\r
+        }\r
+\r
+        public static explicit operator string (SqlString x) \r
+        {\r
+            return x.Value;\r
+        }\r
+\r
+        public static implicit operator SqlString (string x) \r
+        {\r
+            return new SqlString (x);\r
+        }\r
+    }}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlTime.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlTime.cs
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlTruncateException.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlTruncateException.cs
new file mode 100644 (file)
index 0000000..3ecbc5f
--- /dev/null
@@ -0,0 +1,60 @@
+ /*\r
+  * Copyright (c) 2002-2004 Mainsoft Corporation.\r
+  *\r
+  * Permission is hereby granted, free of charge, to any person obtaining a\r
+  * copy of this software and associated documentation files (the "Software"),\r
+  * to deal in the Software without restriction, including without limitation\r
+  * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+  * and/or sell copies of the Software, and to permit persons to whom the\r
+  * Software is furnished to do so, subject to the following conditions:\r
+  *\r
+  * The above copyright notice and this permission notice shall be included in\r
+  * all copies or substantial portions of the Software.\r
+  *\r
+  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+  * DEALINGS IN THE SOFTWARE.\r
+  */
+
+namespace System.Data.SqlType
+{
+
+    /**
+     * The exception that is thrown for errors in an arithmetic, casting, or conversion operation
+     *
+     * @author  Pavel Sandler
+     * @version 1.0, 01/01/03
+     */
+
+    /*
+    * CURRENT LIMITATIONS
+    * 1. Constructor(SerializationInfo info, StreamingContext context) is not supported
+    * 2. Method "void GetObjectData(...,...)" is not supported from ISerializable
+    */
+
+       [Serializable]
+    public class SqlTruncateException : System.Data.SqlTypes.SqlTypeException
+    {
+        /**
+         * Initializes a new instance of the <code>SqlTruncateException</code> class.
+         */
+        public SqlTruncateException() : base("Numeric arithmetic causes truncation.")
+        {
+        }
+
+        /**
+         * Initializes a new instance of the <code>SqlTruncateException</code> class
+         * with a specified error message.
+         *
+         * @param message The message that describes the error.
+         */
+        public SqlTruncateException(String message) : base(message)
+        {
+        }
+    }
+
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlTypeException.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlTypeException.cs
new file mode 100644 (file)
index 0000000..1cd9f96
--- /dev/null
@@ -0,0 +1,55 @@
+ /*\r
+  * Copyright (c) 2002-2004 Mainsoft Corporation.\r
+  *\r
+  * Permission is hereby granted, free of charge, to any person obtaining a\r
+  * copy of this software and associated documentation files (the "Software"),\r
+  * to deal in the Software without restriction, including without limitation\r
+  * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+  * and/or sell copies of the Software, and to permit persons to whom the\r
+  * Software is furnished to do so, subject to the following conditions:\r
+  *\r
+  * The above copyright notice and this permission notice shall be included in\r
+  * all copies or substantial portions of the Software.\r
+  *\r
+  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
+  * DEALINGS IN THE SOFTWARE.\r
+  */
+
+namespace System.Data.SqlTypes
+{
+
+
+    /**
+     * The base exception class for the System.Data.SqlTypes .
+     *
+     * @author  Pavel Sandler
+     * @version 1.0, 01/01/03
+     */
+
+    /*
+    * CURRENT LIMITATIONS
+    * 1. Constructor(SerializationInfo info, StreamingContext context) is not supported
+    * 2. Method "void GetObjectData(...,...)" is not supported from ISerializable
+    */
+
+    using System;
+
+       [Serializable]
+    public class SqlTypeException : SystemException
+    {
+        /**
+         * Initializes a new instance of the <code>SqlTypeException</code> class
+         * with a specified error message.
+         *
+         * @param message The message that describes the error.
+         */
+        public SqlTypeException(String message) : base(message)
+        {
+        }
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlUtcDateTime.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlUtcDateTime.cs
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlXmlReader.cs b/mcs/class/System.Data/System.Data.SqlTypes.jvm/SqlXmlReader.cs
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/mcs/class/System.Data/System.Data.sln b/mcs/class/System.Data/System.Data.sln
new file mode 100644 (file)
index 0000000..a2f5703
--- /dev/null
@@ -0,0 +1,34 @@
+Microsoft Visual Studio Solution File, Format Version 8.00\r
+Project("{83B010C7-76FC-4FAD-A26C-00D7EFE60256}") = "System.Data", "System.Data.vmwcsproj", "{12CA069B-C324-48C1-9836-0014497A212C}"\r
+       ProjectSection(ProjectDependencies) = postProject\r
+       EndProjectSection\r
+EndProject\r
+Global\r
+       GlobalSection(SourceCodeControl) = preSolution\r
+               SccNumberOfProjects = 1\r
+               SccProjectUniqueName0 = System.Data.vmwcsproj\r
+               SccProjectName0 = SAK\r
+               SccLocalPath0 = .\r
+               SccProvider0 = MSSCCI:ClearCase\r
+       EndGlobalSection\r
+       GlobalSection(SolutionConfiguration) = preSolution\r
+               Debug = Debug\r
+               Debug_Java = Debug_Java\r
+               Release = Release\r
+               Release_Java = Release_Java\r
+       EndGlobalSection\r
+       GlobalSection(ProjectConfiguration) = postSolution\r
+               {12CA069B-C324-48C1-9836-0014497A212C}.Debug.ActiveCfg = Debug|.NET\r
+               {12CA069B-C324-48C1-9836-0014497A212C}.Debug.Build.0 = Debug|.NET\r
+               {12CA069B-C324-48C1-9836-0014497A212C}.Debug_Java.ActiveCfg = Debug_Java|.NET\r
+               {12CA069B-C324-48C1-9836-0014497A212C}.Debug_Java.Build.0 = Debug_Java|.NET\r
+               {12CA069B-C324-48C1-9836-0014497A212C}.Release.ActiveCfg = Release|.NET\r
+               {12CA069B-C324-48C1-9836-0014497A212C}.Release.Build.0 = Release|.NET\r
+               {12CA069B-C324-48C1-9836-0014497A212C}.Release_Java.ActiveCfg = Release_Java|.NET\r
+               {12CA069B-C324-48C1-9836-0014497A212C}.Release_Java.Build.0 = Release_Java|.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/System.Data.vmwcsproj b/mcs/class/System.Data/System.Data.vmwcsproj
new file mode 100644 (file)
index 0000000..e4c209b
--- /dev/null
@@ -0,0 +1,341 @@
+<VisualStudioProject>\r
+       <CSHARP ProjectType="Local" ProductVersion="7.10.3077" SchemaVersion="2.0" ProjectGuid="{12CA069B-C324-48C1-9836-0014497A212C}" SccProjectName="SAK" SccLocalPath="." SccProvider="MSSCCI:ClearCase">\r
+               <Build>\r
+                       <Settings ApplicationIcon="" AssemblyKeyContainerName="" AssemblyName="System.Data" AssemblyOriginatorKeyFile="" DefaultClientScript="JScript" DefaultHTMLPageLayout="Grid" DefaultTargetSchema="IE50" DelaySign="false" OutputType="Library" PreBuildEvent="" PostBuildEvent="" RootNamespace="System.Data" RunPostBuildEvent="OnBuildSuccess" StartupObject="">\r
+                               <Config Name="Debug" AllowUnsafeBlocks="false" BaseAddress="285212672" CheckForOverflowUnderflow="false" ConfigurationOverrideFile="" DefineConstants="NET_1_1;ONLY_1_1;TRACE;DEBUG;DOTNET;TARGET_JVM;" DocumentationFile="" DebugSymbols="true" FileAlignment="4096" IncrementalBuild="true" NoStdLib="false" NoWarn="" Optimize="false" OutputPath="bin\Debug\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="4"/>\r
+                               <Config Name="Release" AllowUnsafeBlocks="false" BaseAddress="285212672" CheckForOverflowUnderflow="false" ConfigurationOverrideFile="" DefineConstants="NET_1_1;ONLY_1_1;TRACE;DOTNET;TARGET_JVM;" DocumentationFile="" DebugSymbols="false" FileAlignment="4096" IncrementalBuild="false" NoStdLib="false" NoWarn="" Optimize="true" OutputPath="bin\Release\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="4"/>\r
+                               <Config Name="Debug_Java" AllowUnsafeBlocks="false" BaseAddress="285212672" CheckForOverflowUnderflow="false" ConfigurationOverrideFile="" DefineConstants="NET_1_1;ONLY_1_1;TRACE;DEBUG;DOTNET;TARGET_JVM;" DocumentationFile="" DebugSymbols="true" FileAlignment="4096" IncrementalBuild="false" NoStdLib="false" NoWarn="1595" Optimize="false" OutputPath="bin\Debug_Java\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="4"/>\r
+                               <Config Name="Release_Java" AllowUnsafeBlocks="false" BaseAddress="285212672" CheckForOverflowUnderflow="false" ConfigurationOverrideFile="" DefineConstants="NET_1_1;ONLY_1_1;TRACE;JAVA;TARGET_JVM;" DocumentationFile="" DebugSymbols="true" FileAlignment="4096" IncrementalBuild="false" NoStdLib="false" NoWarn="1595" Optimize="true" OutputPath="bin\Release_Java\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="4"/>\r
+                       </Settings>\r
+                       <References>\r
+                               <Reference Name="J2SE.Helpers" AssemblyName="J2SE.Helpers" HintPath="..\lib\J2SE.Helpers.dll" Private="True"/>\r
+                               <Reference Name="System" AssemblyName="System" HintPath="..\lib\System.dll" Private="False"/>\r
+                               <Reference Name="System.Xml" AssemblyName="System.Xml" HintPath="..\lib\System.Xml.dll" Private="False"/>\r
+                               <Reference Name="rt" AssemblyName="rt" HintPath="..\..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE\jgac\j2sdk1.4\rt.dll" Private="False"/>\r
+                       </References>\r
+               </Build>\r
+               <Files>\r
+                       <Include>\r
+                               <File RelPath="Assembly\AssemblyInfo.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="Assembly\Consts.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="Mono.Data.SqlExpressions\Aggregation.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="Mono.Data.SqlExpressions\ArithmeticExpressions.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="Mono.Data.SqlExpressions\BooleanExpressions.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="Mono.Data.SqlExpressions\ColumnReference.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="Mono.Data.SqlExpressions\Comparison.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="Mono.Data.SqlExpressions\Expressions.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="Mono.Data.SqlExpressions\Functions.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="Mono.Data.SqlExpressions\In.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="Mono.Data.SqlExpressions\Like.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="Mono.Data.SqlExpressions\Literal.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="Mono.Data.SqlExpressions\Numeric.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="Mono.Data.SqlExpressions\Parser.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="Mono.Data.SqlExpressions\StringFunctions.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="Mono.Data.SqlExpressions\Tokenizer.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\AcceptRejectRule.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\AdapterMappingException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\ColumnTypeConverter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\CommandBehavior.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\CommandType.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\ConflictOptions.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\ConnectionState.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\Constraint.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\ConstraintCollection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\ConstraintConverter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\ConstraintException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\CustomDataClassGenerator.cs" SubType="Code" BuildAction="None"/>\r
+                               <File RelPath="System.Data\DataAdapterException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataCategoryAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataColumn.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataColumnChangeEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataColumnChangeEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataColumnCollection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataColumnPropertyDescriptor.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataRelation.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataRelationCollection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataRelationPropertyDescriptor.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataRow.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataRowAction.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataRowBuilder.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataRowChangeEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataRowChangeEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataRowCollection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataRowState.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataRowVersion.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataRowView.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataSet.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataSysDescriptionAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataTable.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataTableCollection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataTablePropertyDescriptor.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataTableReader.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataTableTypeConverter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataView.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataViewManager.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataViewManagerListItemTypeDescriptor.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataViewRowState.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataViewSetting.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DataViewSettingCollection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DBConcurrencyException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DbMetaData.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DbType.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DefaultValueTypeConverter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DeletedRowInaccessibleException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\DuplicateNameException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\EvaluateException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\FillErrorEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\FillErrorEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\FillOptions.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\ForeignKeyConstraint.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\IColumnMapping.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\IColumnMappingCollection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\IDataAdapter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\IDataParameter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\IDataParameterCollection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\IDataReader.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\IDataReader2.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\IDataRecord.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\IDataRecord2.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\IDataSources.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\IDataUpdatableRecord.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\IDbAsyncCommand.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\IDbAsyncConnection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\IDbCommand.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\IDbConnection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\IDbDataAdapter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\IDbDataParameter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\IDbExecutionContext.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\IDbTransaction.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\IGetTypedData.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\InRowChangingEventException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\InternalDataCollectionBase.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\InvalidConstraintException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\InvalidExpressionException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\ISafeDataRecord.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\ISetTypedData.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\IsolationLevel.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\ITableMapping.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\ITableMappingCollection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\KeyRestrictionBehavior.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\LoadOption.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\Locale.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\MappingType.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\MergeFailedEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\MergeFailedEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\MergeManager.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\MissingMappingAction.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\MissingPrimaryKeyException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\MissingSchemaAction.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\Node.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\NoNullAllowedException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\OperationAbortedException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\ParameterDirection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\PropertyAttributes.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\PropertyCollection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\ReadOnlyException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\RelatedDataView.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\RelationshipConverter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\Res.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\ResDescriptionAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\ResultSetOptions.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\ResultSetSensitivity.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\RowNotInTableException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\Rule.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\SchemaType.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\SqlDbType.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\StateChangeEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\StateChangeEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\StatementCompletedEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\StatementCompletedEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\StatementType.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\StrongTypingException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\SyntaxErrorException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\TODOAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\TypeDataSetGeneratorException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\TypedDataSetGenerator.cs" SubType="Code" BuildAction="None"/>\r
+                               <File RelPath="System.Data\UniqueConstraint.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\UpdateOptions.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\UpdateRowSource.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\UpdateStatus.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\VersionNotFoundException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\XmlConstants.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\XmlDataInferenceLoader.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\XmlDataLoader.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\XmlDataReader.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\XmlDiffLoader.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\XmlReadMode.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\XmlSchemaDataImporter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\XmlSchemaMapper.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\XmlSchemaWriter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data\XmlWriteMode.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\CatalogLocation.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\ComparerFactory.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DataAdapter.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DataColumnMapping.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DataColumnMappingCollection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DataColumnMappingConverter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DataContainer.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DataTableMapping.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DataTableMappingCollection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DataTableMappingConverter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbCommand.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbCommandBuilder.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbCommandOptionalFeatures.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbCommandSet.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbConnection.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbConnectionString.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbConvert.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbDataAdapter.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbDataPermission.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbDataPermissionAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbDataReader.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbDataRecord.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbDataSourceEnumerator.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbDataUpdatableRecord.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbEnumerator.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbMetaDataCache.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbParameter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbParameterCollection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbProviderConfigurationHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbProviderFactories.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbProviderFactoriesConfigurationHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbProviderFactory.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbProviderSupportedClasses.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbTable.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbTransaction.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\DbTypes.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\ExceptionHelper.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\FieldNameLookup.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\GroupByBehavior.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\IdentifierCase.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\Index.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\Key.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\PermissionHelper.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\RecordCache.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\RowUpdatedEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\RowUpdatingEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\SchemaInfo.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\SchemaLocation.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\SchemaTableColumn.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Common\SchemaTableOptionalColumn.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Configuration.jvm\GlobalConfig.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Configuration.jvm\ObjectNameResolutionSectionHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Configuration.jvm\ObjectNameResolver.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.Configuration.jvm\ObjectNameResolversCollection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\libgda.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbCommand.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbCommandBuilder.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbConnection.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbConnectionFactory.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbConvert.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbDataAdapter.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbDataReader.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbError.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbErrorCollection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbInfoMessageEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbInfoMessageEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbLiteral.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbOracleDataReader.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbParameter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbParameterCollection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbPermission.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbPermissionAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbRowUpdatedEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbRowUpdatedEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbRowUpdatingEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbRowUpdatingEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbSchemaGuid.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbStringManager.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbTransaction.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.OleDb.jvm\OleDbType.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase\ChangeLog" BuildAction="None"/>\r
+                               <File RelPath="System.Data.ProviderBase\DbCommandBase.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase\DbConnectionBase.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase\DbConnectionFactory.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase\DbConnectionInternal.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase\DbConnectionPoolCounters.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase\DbConnectionPoolOptions.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase\DbDataReaderBase.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase\DbMetaDataFactory.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase\DbParameterBase.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase\DbParameterCollectionBase.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase\DbReferenceCollection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase.jvm\AbstractDataReader.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase.jvm\AbstractDBCommand.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase.jvm\AbstractDBConnection.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase.jvm\AbstractDbError.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase.jvm\AbstractDbErrorCollection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase.jvm\AbstractDbException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase.jvm\AbstractDBParameter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase.jvm\AbstractDbParameterCollection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase.jvm\AbstractTransaction.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase.jvm\DbPortResolver.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase.jvm\DbStringManager.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase.jvm\OleDbStrings.resx" BuildAction="EmbeddedResource"/>\r
+                               <File RelPath="System.Data.ProviderBase.jvm\ParameterMetadataWrapper.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase.jvm\ReaderCache.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase.jvm\regex.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.ProviderBase.jvm\SqlClientStrings.resx" BuildAction="EmbeddedResource"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\ISqlNotificationReceiver.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\MetaType.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlClientPermission.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlClientPermissionAttribute.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlCollation.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlCommand.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlCommand.resx" DependentUpon="SqlCommand.cs" BuildAction="EmbeddedResource"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlCommandBuilder.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlConnection.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlConnection.resx" DependentUpon="SqlConnection.cs" BuildAction="EmbeddedResource"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlConnectionPool.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlConvert.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlDataAdapter.cs" SubType="Component" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlDataReader.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlError.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlErrorCollection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlInfoMessageEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlInfoMessageEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlParameter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlParameterCollection.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlParameterConverter.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlResultSet.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlRowUpdatedEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlRowUpdatedEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlRowUpdatingEventArgs.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlRowUpdatingEventHandler.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlStringManager.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlTransaction.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlClient.jvm\SqlXmlTextReader.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\INullable.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlBinary.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlBoolean.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlByte.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlBytes.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlChars.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlCompareOptions.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlDate.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlDateTime.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlDecimal.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlDouble.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlGuid.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlInt16.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlInt32.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlInt64.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlMoney.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlNullValueException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlSingle.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlStreamChars.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlString.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlTime.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlTruncateException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlTypeException.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlUtcDateTime.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Data.SqlTypes.jvm\SqlXmlReader.cs" SubType="Code" BuildAction="Compile"/>\r
+                               <File RelPath="System.Xml\XmlDataDocument.cs" SubType="Code" BuildAction="Compile"/>\r
+                       </Include>\r
+               </Files>\r
+               <UserProperties jarserver="ipa" REFS.JarPath.j2se.helpers="..\lib\J2SE.Helpers.jar" project.JDKType="1.4.2_05" REFS.JarPath.j2ee="..\lib\j2ee.jar" REFS.JarPath.System.Xml="..\lib\System.Xml.jar" REFS.JarPath.vmwutils="..\lib\vmwutils.jar" REFS.JarPath.System="..\lib\System.jar" REFS.JarPath.rt="..\lib\rt.jar"/>\r
+       </CSHARP>\r
+       <VisualMainWin><Project Prop2023="1.4.2_05" Prop2024="" Prop2026="" Prop2015="" Version="1.6.0" ProjectType="1"/><References/><Configs><Config Prop2000="1" Prop2001="0" Prop2002="0" Prop2003="0" Prop2004="0" Prop2005="0" Prop2006="" Prop2007="" Prop2008="" Prop2009="" Prop2010="" Prop2011="-1" Prop2012="0" Prop2013="" Prop2014="0" Prop2016="" Prop2027="" Prop2019="-1" Prop2020="285212672" Prop2021="4096" Prop2022="0" Prop2017="0" Prop2018="0" Name="Debug"/><Config Prop2000="1" Prop2001="0" Prop2002="0" Prop2003="0" Prop2004="0" Prop2005="0" Prop2006="" Prop2007="" Prop2008="" Prop2009="" Prop2010="" Prop2011="0" Prop2012="0" Prop2013="" Prop2014="0" Prop2016="" Prop2027="" Prop2019="0" Prop2020="285212672" Prop2021="4096" Prop2022="0" Prop2017="0" Prop2018="0" Name="Release"/><Config Prop2000="0" Prop2001="0" Prop2002="0" Prop2003="0" Prop2004="0" Prop2005="3" Prop2006="" Prop2007="" Prop2008="" Prop2009="" Prop2010="" Prop2011="0" Prop2012="-1" Prop2013="" Prop2014="8009" Prop2016="" Prop2027="" Prop2019="0" Prop2020="285212672" Prop2021="4096" Prop2022="0" Prop2017="0" Prop2018="-1" Name="Debug_Java"/><Config Prop2000="0" Prop2001="0" Prop2002="0" Prop2003="0" Prop2004="0" Prop2005="0" Prop2006="" Prop2007="" Prop2008="" Prop2009="" Prop2010="" Prop2011="0" Prop2012="0" Prop2013="" Prop2014="0" Prop2016="" Prop2027="" Prop2019="0" Prop2020="285212672" Prop2021="4096" Prop2022="0" Prop2017="0" Prop2018="0" Name="Release_Java"/></Configs></VisualMainWin></VisualStudioProject>\r