Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnome.org>2010-03-02 05:40:03 +0300
committerMiguel de Icaza <miguel@gnome.org>2010-03-02 05:40:03 +0300
commitf0a7fbae0042f32a4a3b18fb26b1c2e6dee86154 (patch)
tree3d1c30111f1a221c942beff223c2443f148fac16 /mcs/class/Mono.Data.SybaseClient
parenteb44ac36f523e364cdac4e75d0ea38cd1082edec (diff)
Moved deprecated library
svn path=/trunk/mcs/; revision=152779
Diffstat (limited to 'mcs/class/Mono.Data.SybaseClient')
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Assembly/AssemblyInfo.cs31
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Assembly/ChangeLog4
-rw-r--r--mcs/class/Mono.Data.SybaseClient/ChangeLog271
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Makefile11
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient.dll.sources43
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseClientFactory.cs114
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseCommand.cs519
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseCommandBuilder.cs151
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseConnection.cs699
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseConnectionStringBuilder.cs691
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseDataAdapter.cs241
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseDataReader.cs1266
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseError.cs160
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseErrorCollection.cs109
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseException.cs126
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseInfoMessageEventArgs.cs79
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseInfoMessageEventHandler.cs36
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseParameter.cs639
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseParameterCollection.cs428
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybasePermission.cs113
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybasePermissionAttribute.cs55
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatedEventArgs.cs56
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatedEventHandler.cs36
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatingEventArgs.cs56
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatingEventHandler.cs36
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseTransaction.cs168
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseType.cs65
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseBinary.cs301
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseBoolean.cs408
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseByte.cs418
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseCompareOptions.cs51
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDateTime.cs285
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDecimal.cs1242
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDouble.cs373
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseGuid.cs243
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt16.cs418
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt32.cs438
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt64.cs421
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseMoney.cs413
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseNullValueException.cs53
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseSingle.cs356
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseString.cs514
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseTruncateException.cs53
-rw-r--r--mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseTypeException.cs53
-rw-r--r--mcs/class/Mono.Data.SybaseClient/test/ChangeLog8
-rw-r--r--mcs/class/Mono.Data.SybaseClient/test/SybaseTest.cs660
46 files changed, 0 insertions, 12911 deletions
diff --git a/mcs/class/Mono.Data.SybaseClient/Assembly/AssemblyInfo.cs b/mcs/class/Mono.Data.SybaseClient/Assembly/AssemblyInfo.cs
deleted file mode 100644
index e06154cd236..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Assembly/AssemblyInfo.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-//
-// AssemblyInfo.cs
-//
-// Author:
-// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-// (C) 2003 Ximian, Inc. http://www.ximian.com
-// (C) 2004 Novell (http://www.novell.com)
-//
-
-using System;
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyVersion (Consts.FxVersion)]
-
-/* TODO COMPLETE INFORMATION
-
-[assembly: AssemblyTitle ("")]
-[assembly: AssemblyDescription ("")]
-
-[assembly: CLSCompliant (true)]
-[assembly: AssemblyFileVersion ("0.0.0.1")]
-
-[assembly: ComVisible (false)]
-
-*/
-
-[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../mono.pub")]
-
diff --git a/mcs/class/Mono.Data.SybaseClient/Assembly/ChangeLog b/mcs/class/Mono.Data.SybaseClient/Assembly/ChangeLog
deleted file mode 100644
index 31aec914726..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Assembly/ChangeLog
+++ /dev/null
@@ -1,4 +0,0 @@
-2004-04-30 Sebastien Pouliot <sebastien@ximian.com>
-
- * AssemblyInfo.cs: Added
- * ChangeLog: Added
diff --git a/mcs/class/Mono.Data.SybaseClient/ChangeLog b/mcs/class/Mono.Data.SybaseClient/ChangeLog
deleted file mode 100644
index 62b83ef8250..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/ChangeLog
+++ /dev/null
@@ -1,271 +0,0 @@
-2009-01-24 Gonzalo Paniagua Javier <gonzalo@novell.com>
-
- * Mono.Data.SybaseClient/SybaseConnection.cs: adapt to changes in TdsConnectionPool.
-
-2008-09-06 Daniel Morgan <monodanmorg@yahoo.com>
-
- * Mono.Data.SybaseClient/SybaseClientFactory.cs:
- * Mono.Data.SybaseClient/SybaseConnectionStringBuilder.cs: add new files
- based on mono's System.Data.SqlClient implementation
-
- * Mono.Data.SybaseClient.dll.sources: add files
- to build:
- Mono.Data.SybaseClient/SybaseClientFactory.cs
- Mono.Data.SybaseClient/SybaseConnectionStringBuilder.cs
-
- * Mono.Data.SybaseClient/SybaseDataAdapter.cs
- * Mono.Data.SybaseClient/SybaseCommand.cs
- * Mono.Data.SybaseClient/SybaseParameter.cs
- * Mono.Data.SybaseClient/SybaseType.cs
- * Mono.Data.SybaseClient/SybaseTransaction.cs
- * Mono.Data.SybaseClient/SybaseCommandBuilder.cs
- * Mono.Data.SybaseClient/SybaseDataReader.cs
- * Mono.Data.SybaseClient/SybaseParameterCollection.cs
- * Mono.Data.SybaseClient/SybaseConnection.cs: modified to
- support NET_2_0 profile based on the changes done in mono's
- System.Data.SqlClient implementation.
-
- Do not forget about updating mono/data/net_2_0/machine.config
- by adding Mono.Dataq.SybaseClient to DbProvidersFactory section.
-
-2008-07-06 Sebastien Pouliot <sebastien@ximian.com>
-
- * Mono.Data.SybaseClient/SybaseDataReader.cs: Replace a few
- Type.GetType by typeof
- [Found using Gendarme AvoidTypeGetTypeForConstantStringsRule]
- * Mono.Data.SybaseClient/SybaseCommand.cs: Fix unneeded assignment
- for commandText (assigned to self). Also fix another unneeded
- assignment (already taken care by the called ctor).
- [Found using Gendarme ReviewSelfAssignmentRule]
-
-2008-07-01 Zoltan Varga <vargaz@gmail.com>
-
- * Mono.Data.SybaseClient/SybaseDataReader.cs: Fix the build after the TDS changes.
-
- * Mono.Data.SybaseClient/SybaseDataReader.cs: Fix the build after the TDS changes.
-
-2008-06-09 Ankit Jain <jankit@novell.com>
-
- * Mono.Data.SybaseClient/SybaseCommand.cs: Use Tds instead of ITds now.
- * Mono.Data.SybaseClient/SybaseConnection.cs: Likewise.
-
-2006-12-20 Nagappan A <anagappan@novell.com>
-
- * Mono.Data.SybaseClient/SybaseRowUpdatedEventArgs.cs
- (SybaseRowUpdatedEventArgs): Implemeneted constructor.
- (Command): Implemented property.
-
- * Mono.Data.SybaseClient/SybaseCommandBuilder.cs
- (SybaseCommandBuilder): Implemented constructor.
- (DataAdapter): Implemented property.
- (RowUpdatingHandler): Implemented private event handler method.
-
- * Mono.Data.SybaseClient/SybaseRowUpdatingEventArgs.cs (Command):
- Implemented property
-
-2005-12-07 Senganal T <tsenganal@novell.com>
-
- * Mono.Data.SybaseClient/SybaseConnection.cs
- - fixed ExecuteNonQuery to return the no of rows
- affected for Insert/Update/Delete Stmts.
- Fixes bug #76280
-
-2005-06-15 Atsushi Enomoto <atsushi@ximian.com>
-
- * Mono.Data.SybaseClient.dll.sources :
- remove duplicate MonoTODOAttribute.cs
-
-2005-01-10 Daniel Morgan <danielmorgan@verizon.net>
-
- * Mono.Data.SybaseClient/SybaseConnection.cs: fix
- for packetSize not being set. Fixes bug 70930
- Thanks to sebastien.robitaille@croesus.com (Sebastien Robitaille)
- for reporting this bug.
-
-2004-04-05 Lluis Sanchez Gual <lluis@ximian.com>
-
- * Mono.Data.SybaseClient.dll.sources: Removed SybaseConnectionPool.cs.
- * Mono.Data.SybaseClient/SybaseConnection.cs: Use connection pool
- implemented in Mono.Data.Tds.
-
-2004-04-01 Lluis Sanchez Gual <lluis@ximian.com>
-
- * Mono.Data.SybaseClient/SybaseDataReader.cs: Null values are now
- represented with DBNull instances. Deal with this.
- * Mono.Data.SybaseTypes/SybaseNullValueException.cs: Use a more clarifying
- error message.
-
-2003-12-19 Tim Coleman <tim@timcoleman.com>
- * Mono.Data.SybaseClient/SybasePermission.cs:
- Change constructor.
-
-2003-07-17 Peter Williams <peter@newton.cx>
-
- * Mono.Data.SybaseTypes/SybaseDecimal.cs: csc.exe is more
- stringent about namespaces than mcs. We need to disambiguate
- System.Math from Mono.Math here.
-
-2003-06-11 Tim Coleman <tim@timcoleman.com>
- * SybaseConnection.cs:
- Make connection parameter parsing "more correct"
- and throw appropriate exceptions, similar to MS SqlClient
- * SybaseBinary.cs:
- * SybaseBoolean.cs:
- * SybaseByte.cs:
- * SybaseDateTime.cs:
- * SybaseDecimal.cs:
- * SybaseDouble.cs:
- * SybaseMoney.cs:
- * SybaseString.cs:
- Mass import of code from SqlClient to make this behave
- better.
-
-2003-02-16 Daniel Morgan <danmorg@sc.rr.com>
-
- * SybaseConnection.cs: - parse data source for 2 possible uses:
- "Server=hostname",
- "Server=hostname,port" and open the connection based on the
- resulting server name and port.
-
-2002-12-01 Tim Coleman <tim@timcoleman.com>
- * Mono.Data.SybaseClient/SybaseDataReader.cs:
- Change to reflect TdsSchemaInfo -> TdsDataColumnCollection
- shift.
-
-2002-11-26 Tim Coleman <tim@timcoleman.com>
- * Mono.Data.SybaseClient.build:
- Copy dll into Test directory.
- * Mono.Data.SybaseClient/SybaseCommand.cs:
- * Mono.Data.SybaseClient/SybaseConnection.cs:
- * Mono.Data.SybaseClient/SybaseParameter.cs:
- * Mono.Data.SybaseClient/SybaseParameterCollection.cs:
- * Mono.Data.SybaseClient/SybaseTransaction.cs:
- Many changes around making PREPAREs work in
- Sybase as well as SQL Server.
-
-2002-11-21 Tim Coleman <tim@timcoleman.com>
- * Mono.Data.SybaseClient.build:
- * Mono.Data.SybaseClient/SybaseCommand.cs:
- * Mono.Data.SybaseClient/SybaseConnection.cs:
- * Mono.Data.SybaseClient/SybaseConnectionPool.cs:
- * Mono.Data.SybaseClient/SybaseDataReader.cs:
- * Mono.Data.SybaseClient/SybaseException.cs:
- * Mono.Data.SybaseClient/SybaseInfoMessageEventArgs.cs:
- * Mono.Data.SybaseClient/SybaseParameter.cs:
- * Mono.Data.SybaseClient/SybaseTransaction.cs:
- * Mono.Data.SybaseTypes/SybaseDecimal.cs:
- Modify to accept new Mono.Data.Tds.Protocol
- namespace in Mono.Data.Tds assembly, replacing
- Mono.Data.TdsClient.Internal
-
-2002-11-19 Tim Coleman <tim@timcoleman.com>
- * Mono.Data.SybaseClient/SybaseCommand.cs:
- Fix BuildExec to work.
-
-2002-11-18 Tim Coleman <tim@timcoleman.com>
- * Mono.Data.SybaseClient/SybaseCommand.cs:
- * Mono.Data.SybaseClient/SybaseConnection.cs:
- * Mono.Data.SybaseClient/SybaseDataReader.cs:
- * Mono.Data.SybaseClient/SybaseException.cs:
- * Mono.Data.SybaseClient/SybaseParameter.cs:
- * Mono.Data.SybaseClient/SybaseParameterCollection.cs:
- * Mono.Data.SybaseClient/SybaseTransaction.cs:
- * Mono.Data.SybaseTypes/SybaseDecimal.cs:
- Various changes to overhaul Sybase provider,
- and bring it closer to being in-line with
- the SqlClient. Can now connect to Sybase DB.
-
-2002-11-14 Tim Coleman <tim@timcoleman.com>
- * Mono.Data.SybaseClient/SybaseDataReader.cs:
- Change SchemaTable handling
-
-2002-11-12 Tim Coleman <tim@timcoleman.com>
- * list:
- Remove Mono.Data.TdsClient.Internal/TdsContext.cs
-
-2002-11-09 Tim Coleman <tim@timcoleman.com>
- * list:
- Add new internal tds classes
- * Mono.Data.SybaseClient/SybaseConnectionPool.cs:
- * Mono.Data.SybaseClient/SybaseConnection.cs:
- Implement connection timeouts
-
-2002-11-04 Tim Coleman <tim@timcoleman.com>
- * list:
- Add Mono.Data.TdsClient.Internal.TdsInternalError
- Add Mono.Data.TdsClient.Internal.TdsInternalErrorCollection
- Add Mono.Data.TdsClient.Internal.TdsInternalErrorMessageEventHandler
- Add Mono.Data.TdsClient.Internal.TdsInternalErrorMessageEventArgs
- Add Mono.Data.TdsClient.Internal.TdsInternalInfoMessageEventHandler
- Add Mono.Data.TdsClient.Internal.TdsInternalInfoMessageEventArgs
- Remove Mono.Data.TdsClient.Internal.TdsPacketErrorResult
- Remove Mono.Data.TdsClient.Internal.TdsPacketErrorResultCollection
- Remove Mono.Data.TdsClient.Internal.TdsPacketMessageResult
- * Mono.Data.SybaseClient/SybaseCommand.cs:
- * Mono.Data.SybaseClient/SybaseConnection.cs:
- * Mono.Data.SybaseClient/SybaseDataReader.cs:
- * Mono.Data.SybaseClient/SybaseException.cs:
- * Mono.Data.SybaseClient/SybaseInfoMessageEventArgs.cs:
- * Mono.Data.SybaseClient/SybaseTransaction.cs:
- Remove error checks in favour of event handlers
-
-2002-11-04 Tim Coleman (tim@timcoleman.com)
- * list :
- Add Mono.Data.TdsClient.Internal.TdsBigDecimal
-
-2002-11-03 Tim Coleman (tim@timcoleman.com)
- * list:
- Add Mono.Data.TdsClient.Internal.TdsColumnStatus
- * Mono.Data.SybaseClient/SybaseDataReader.cs:
- Add more schema information
-
-2002-11-01 Tim Coleman (tim@timcoleman.com)
- * Mono.Data.SybaseClient/Locale.cs:
- * Mono.Data.SybaseClient/SybaseCommand.cs:
- * Mono.Data.SybaseClient/SybaseCommandBuilder.cs:
- * Mono.Data.SybaseClient/SybaseConnection.cs:
- * Mono.Data.SybaseClient/SybaseConnectionPool.cs:
- * Mono.Data.SybaseClient/SybaseDataAdapter.cs:
- * Mono.Data.SybaseClient/SybaseDataReader.cs:
- * Mono.Data.SybaseClient/SybaseError.cs:
- * Mono.Data.SybaseClient/SybaseErrorCollection.cs:
- * Mono.Data.SybaseClient/SybaseException.cs:
- * Mono.Data.SybaseClient/SybaseInfoMessageEventArgs.cs:
- * Mono.Data.SybaseClient/SybaseInfoMessageEventHandler.cs:
- * Mono.Data.SybaseClient/SybaseParameter.cs:
- * Mono.Data.SybaseClient/SybaseParameterCollection.cs:
- * Mono.Data.SybaseClient/SybasePermission.cs:
- * Mono.Data.SybaseClient/SybasePermissionAttribute.cs:
- * Mono.Data.SybaseClient/SybaseRowUpdatedEventArgs.cs:
- * Mono.Data.SybaseClient/SybaseRowUpdatedEventHandler.cs:
- * Mono.Data.SybaseClient/SybaseRowUpdatingEventArgs.cs:
- * Mono.Data.SybaseClient/SybaseRowUpdatingEventHandler.cs:
- * Mono.Data.SybaseClient/SybaseTransaction.cs:
- * Mono.Data.SybaseClient/SybaseType.cs:
- * Mono.Data.SybaseClient/TODOAttribute.cs:
- * Mono.Data.SybaseTypes/SybaseBinary.cs:
- * Mono.Data.SybaseTypes/SybaseBoolean.cs:
- * Mono.Data.SybaseTypes/SybaseByte.cs:
- * Mono.Data.SybaseTypes/SybaseCompareOptions.cs:
- * Mono.Data.SybaseTypes/SybaseDateTime.cs:
- * Mono.Data.SybaseTypes/SybaseDecimal.cs:
- * Mono.Data.SybaseTypes/SybaseDouble.cs:
- * Mono.Data.SybaseTypes/SybaseGuid.cs:
- * Mono.Data.SybaseTypes/SybaseInt16.cs:
- * Mono.Data.SybaseTypes/SybaseInt32.cs:
- * Mono.Data.SybaseTypes/SybaseInt64.cs:
- * Mono.Data.SybaseTypes/SybaseMoney.cs:
- * Mono.Data.SybaseTypes/SybaseNullValueException.cs:
- * Mono.Data.SybaseTypes/SybaseSingle.cs:
- * Mono.Data.SybaseTypes/SybaseString.cs:
- * Mono.Data.SybaseTypes/SybaseTruncateException.cs:
- * Mono.Data.SybaseTypes/SybaseTypeException.cs:
- New classes added to start this namespace. These are mostly
- just copies of the SqlClient classes, with changed names and
- namespaces.
- * list:
- * makefile.gnu:
- * Mono.Data.SybaseClient.build:
- New files added to build this assembly
- * ChangeLog:
- New changelog added
diff --git a/mcs/class/Mono.Data.SybaseClient/Makefile b/mcs/class/Mono.Data.SybaseClient/Makefile
deleted file mode 100644
index 6c448a50695..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-thisdir = class/Mono.Data.SybaseClient
-SUBDIRS =
-include ../../build/rules.make
-
-LIBRARY = Mono.Data.SybaseClient.dll
-LIB_MCS_FLAGS = /r:$(corlib) /r:System.dll /r:System.Xml.dll \
- /r:System.EnterpriseServices.dll /r:System.Data.dll \
- /r:Mono.Data.Tds.dll
-NO_TEST = yes
-
-include ../../build/library.make
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient.dll.sources b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient.dll.sources
deleted file mode 100644
index 88c76559c9f..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient.dll.sources
+++ /dev/null
@@ -1,43 +0,0 @@
-Assembly/AssemblyInfo.cs
-../../build/common/Consts.cs
-../../build/common/Locale.cs
-../../build/common/MonoTODOAttribute.cs
-Mono.Data.SybaseClient/SybaseClientFactory.cs
-Mono.Data.SybaseClient/SybaseCommand.cs
-Mono.Data.SybaseClient/SybaseCommandBuilder.cs
-Mono.Data.SybaseClient/SybaseConnection.cs
-Mono.Data.SybaseClient/SybaseConnectionStringBuilder.cs
-Mono.Data.SybaseClient/SybaseDataAdapter.cs
-Mono.Data.SybaseClient/SybaseDataReader.cs
-Mono.Data.SybaseClient/SybaseError.cs
-Mono.Data.SybaseClient/SybaseErrorCollection.cs
-Mono.Data.SybaseClient/SybaseException.cs
-Mono.Data.SybaseClient/SybaseInfoMessageEventArgs.cs
-Mono.Data.SybaseClient/SybaseInfoMessageEventHandler.cs
-Mono.Data.SybaseClient/SybaseParameter.cs
-Mono.Data.SybaseClient/SybaseParameterCollection.cs
-Mono.Data.SybaseClient/SybasePermission.cs
-Mono.Data.SybaseClient/SybasePermissionAttribute.cs
-Mono.Data.SybaseClient/SybaseRowUpdatedEventArgs.cs
-Mono.Data.SybaseClient/SybaseRowUpdatedEventHandler.cs
-Mono.Data.SybaseClient/SybaseRowUpdatingEventArgs.cs
-Mono.Data.SybaseClient/SybaseRowUpdatingEventHandler.cs
-Mono.Data.SybaseClient/SybaseTransaction.cs
-Mono.Data.SybaseClient/SybaseType.cs
-Mono.Data.SybaseTypes/SybaseBinary.cs
-Mono.Data.SybaseTypes/SybaseBoolean.cs
-Mono.Data.SybaseTypes/SybaseByte.cs
-Mono.Data.SybaseTypes/SybaseCompareOptions.cs
-Mono.Data.SybaseTypes/SybaseDateTime.cs
-Mono.Data.SybaseTypes/SybaseDecimal.cs
-Mono.Data.SybaseTypes/SybaseDouble.cs
-Mono.Data.SybaseTypes/SybaseGuid.cs
-Mono.Data.SybaseTypes/SybaseInt16.cs
-Mono.Data.SybaseTypes/SybaseInt32.cs
-Mono.Data.SybaseTypes/SybaseInt64.cs
-Mono.Data.SybaseTypes/SybaseMoney.cs
-Mono.Data.SybaseTypes/SybaseNullValueException.cs
-Mono.Data.SybaseTypes/SybaseSingle.cs
-Mono.Data.SybaseTypes/SybaseString.cs
-Mono.Data.SybaseTypes/SybaseTruncateException.cs
-Mono.Data.SybaseTypes/SybaseTypeException.cs
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseClientFactory.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseClientFactory.cs
deleted file mode 100644
index 82ea45874d0..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseClientFactory.cs
+++ /dev/null
@@ -1,114 +0,0 @@
-//
-// Mono.Data.SybaseClient.SybaseClientFactory.cs
-//
-// Author:
-// Sureshkumar T (tsureshkumar@novell.com)
-// Daniel Morgan <monodanmorg@yahoo.com>
-//
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-// Copyright (C) 2008 Daniel Morgan
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_2_0
-using System;
-using System.Data;
-using System.Data.Common;
-using System.Data.Sql;
-using System.Security;
-using System.Security.Permissions;
-
-namespace Mono.Data.SybaseClient
-{
- public sealed class SybaseClientFactory : DbProviderFactory
- {
- #region Fields
-
- public static readonly SybaseClientFactory Instance = new SybaseClientFactory ();
-
- #endregion //Fields
-
- #region Constructors
-
- private SybaseClientFactory ()
- {
- }
-
- #endregion //Constructors
-
- #region Properties
-
- public override bool CanCreateDataSourceEnumerator {
- get { return false; }
- }
-
- #endregion //Properties
-
- #region public overrides
-
- public override DbCommand CreateCommand ()
- {
- return new SybaseCommand ();
- }
-
- public override DbCommandBuilder CreateCommandBuilder ()
- {
- //return new SybaseCommandBuilder ();
- throw new NotImplementedException ();
- }
-
- public override DbConnection CreateConnection ()
- {
- return new SybaseConnection ();
- }
-
- public override DbConnectionStringBuilder CreateConnectionStringBuilder ()
- {
- return new SybaseConnectionStringBuilder ();
- }
-
- public override DbDataAdapter CreateDataAdapter ()
- {
- return new SybaseDataAdapter ();
- }
-
- public override DbDataSourceEnumerator CreateDataSourceEnumerator ()
- {
- throw new NotImplementedException ();
- }
-
- public override DbParameter CreateParameter ()
- {
- return new SybaseParameter ();
- }
-
- public override CodeAccessPermission CreatePermission (PermissionState state)
- {
- return new SybasePermission(state);
- }
-
- #endregion // public overrides
- }
-}
-#endif // NET_2_0
-
-
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseCommand.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseCommand.cs
deleted file mode 100644
index ba01a15cfce..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseCommand.cs
+++ /dev/null
@@ -1,519 +0,0 @@
-//
-// Mono.Data.SybaseClient.SybaseCommand.cs
-//
-// Author:
-// Rodrigo Moya (rodrigo@ximian.com)
-// Daniel Morgan (monodanmorg@yahoo.com))
-// Tim Coleman (tim@timcoleman.com)
-//
-// (C) Ximian, Inc 2002 http://www.ximian.com/
-// (C) Daniel Morgan, 2002, 2008
-// Copyright (C) Tim Coleman, 2002
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.Tds;
-using Mono.Data.Tds.Protocol;
-using MDTP = Mono.Data.Tds.Protocol;
-
-using System;
-using System.Collections;
-using System.Collections.Specialized;
-using System.ComponentModel;
-using System.Data;
-using System.Data.Common;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace Mono.Data.SybaseClient {
-#if NET_2_0
- public sealed class SybaseCommand : DbCommand, IDbCommand, ICloneable
-#else
- public sealed class SybaseCommand : Component, IDbCommand, ICloneable
-#endif // NET_2_0
- {
- #region Fields
-
- bool disposed = false;
- int commandTimeout;
- bool designTimeVisible;
- string commandText;
- CommandType commandType;
- SybaseConnection connection;
- SybaseTransaction transaction;
- UpdateRowSource updatedRowSource;
- CommandBehavior behavior = CommandBehavior.Default;
- SybaseParameterCollection parameters;
- string preparedStatement = null;
-
- #endregion // Fields
-
- #region Constructors
-
- public SybaseCommand()
- : this (String.Empty, null, null)
- {
- }
-
- public SybaseCommand (string commandText)
- : this (commandText, null, null)
- {
- }
-
- public SybaseCommand (string commandText, SybaseConnection connection)
- : this (commandText, connection, null)
- {
- }
-
- public SybaseCommand (string commandText, SybaseConnection connection, SybaseTransaction transaction)
- {
- this.commandText = commandText;
- this.connection = connection;
- this.transaction = transaction;
- this.commandType = CommandType.Text;
- this.updatedRowSource = UpdateRowSource.Both;
-
- this.designTimeVisible = false;
- this.commandTimeout = 30;
- parameters = new SybaseParameterCollection (this);
- }
-
- private SybaseCommand(string commandText, SybaseConnection connection, SybaseTransaction transaction, CommandType commandType, UpdateRowSource updatedRowSource, bool designTimeVisible, int commandTimeout, SybaseParameterCollection parameters)
- {
- this.commandText = commandText;
- this.connection = connection;
- this.transaction = transaction;
- this.commandType = commandType;
- this.updatedRowSource = updatedRowSource;
- this.designTimeVisible = designTimeVisible;
- this.commandTimeout = commandTimeout;
- this.parameters = new SybaseParameterCollection(this);
- for (int i = 0;i < parameters.Count;i++)
- this.parameters.Add(((ICloneable)parameters[i]).Clone());
- }
-
- #endregion // Constructors
-
- #region Properties
-
- internal CommandBehavior CommandBehavior {
- get { return behavior; }
- }
-
- public
-#if NET_2_0
- override
-#endif //NET_2_0
- string CommandText {
- get { return commandText; }
- set {
- if (value != commandText && preparedStatement != null)
- Unprepare ();
- commandText = value;
- }
- }
-
- public
-#if NET_2_0
- override
-#endif //NET_2_0
- int CommandTimeout {
- get { return commandTimeout; }
- set {
- if (commandTimeout < 0)
- throw new ArgumentException ("The property value assigned is less than 0.");
- commandTimeout = value;
- }
- }
-
- public
-#if NET_2_0
- override
-#endif //NET_2_0
- CommandType CommandType {
- get { return commandType; }
- set {
- if (value == CommandType.TableDirect)
- throw new ArgumentException ("CommandType.TableDirect is not supported by the Mono SybaseClient Data Provider.");
- commandType = value;
- }
- }
-
- public
-#if NET_2_0
- new
-#endif //NET_2_0
- SybaseConnection Connection {
- get { return connection; }
- set {
- if (transaction != null && connection.Transaction != null && connection.Transaction.IsOpen)
- throw new InvalidOperationException ("The Connection property was changed while a transaction was in progress.");
- transaction = null;
- connection = value;
- }
- }
-
- public
-#if NET_2_0
- override
-#endif //NET_2_0
- bool DesignTimeVisible {
- get { return designTimeVisible; }
- set { designTimeVisible = value; }
- }
-
- public
-#if NET_2_0
- new
-#endif //NET_2_0
- SybaseParameterCollection Parameters {
- get { return parameters; }
- }
-
- internal MDTP.Tds Tds {
- get { return Connection.Tds; }
- }
-
-#if !NET_2_0
- IDbConnection IDbCommand.Connection {
- get { return Connection; }
- set {
- if (!(value is SybaseConnection))
- throw new InvalidCastException ("The value was not a valid SybaseConnection.");
- Connection = (SybaseConnection) value;
- }
- }
-
- IDataParameterCollection IDbCommand.Parameters {
- get { return Parameters; }
- }
-
- IDbTransaction IDbCommand.Transaction {
- get { return Transaction; }
- set {
- if (!(value is SybaseTransaction))
- throw new ArgumentException ();
- Transaction = (SybaseTransaction) value;
- }
- }
-#endif // !NET_2_0
-
- public new SybaseTransaction Transaction {
- get {
- if (transaction != null && !transaction.IsOpen)
- transaction = null;
- return transaction;
- }
- set
- {
-#if ONLY_1_1
- if (connection != null && connection.DataReader != null)
- throw new InvalidOperationException ("The connection is busy fetching data.");
-#endif
- transaction = value;
- }
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- UpdateRowSource UpdatedRowSource {
- get { return updatedRowSource; }
- set { updatedRowSource = value; }
- }
-
- #endregion // Fields
-
- #region Methods
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- void Cancel ()
- {
- if (Connection == null || Connection.Tds == null)
- return;
- Connection.Tds.Cancel ();
- }
-
-#if NET_2_0
- public SybaseCommand Clone ()
- {
- return new SybaseCommand (commandText, connection, transaction, commandType, updatedRowSource, designTimeVisible, commandTimeout, parameters);
- }
-#endif // NET_2_0
-
- internal void CloseDataReader (bool moreResults)
- {
- GetOutputParameters ();
- Connection.DataReader = null;
-
- if ((behavior & CommandBehavior.CloseConnection) != 0)
- Connection.Close ();
- }
-
- public new SybaseParameter CreateParameter ()
- {
- return new SybaseParameter ();
- }
-
- internal void DeriveParameters ()
- {
- if (commandType != CommandType.StoredProcedure)
- throw new InvalidOperationException (String.Format ("SybaseCommand DeriveParameters only supports CommandType.StoredProcedure, not CommandType.{0}", commandType));
- ValidateCommand ("DeriveParameters");
-
- SybaseParameterCollection localParameters = new SybaseParameterCollection (this);
- localParameters.Add ("@P1", SybaseType.NVarChar, commandText.Length).Value = commandText;
-
- string sql = "sp_procedure_params_rowset";
-
- Connection.Tds.ExecProc (sql, localParameters.MetaParameters, 0, true);
-
- SybaseDataReader reader = new SybaseDataReader (this);
- parameters.Clear ();
- object[] dbValues = new object[reader.FieldCount];
-
- while (reader.Read ()) {
- reader.GetValues (dbValues);
- parameters.Add (new SybaseParameter (dbValues));
- }
- reader.Close ();
- }
-
- private void Execute (CommandBehavior behavior, bool wantResults)
- {
- Tds.RecordsAffected = -1;
- TdsMetaParameterCollection parms = Parameters.MetaParameters;
- if (preparedStatement == null) {
- bool schemaOnly = ((CommandBehavior & CommandBehavior.SchemaOnly) > 0);
- bool keyInfo = ((CommandBehavior & CommandBehavior.SchemaOnly) > 0);
-
- StringBuilder sql1 = new StringBuilder ();
- StringBuilder sql2 = new StringBuilder ();
-
- if (schemaOnly || keyInfo)
- sql1.Append ("SET FMTONLY OFF;");
- if (keyInfo) {
- sql1.Append ("SET NO_BROWSETABLE ON;");
- sql2.Append ("SET NO_BROWSETABLE OFF;");
- }
- if (schemaOnly) {
- sql1.Append ("SET FMTONLY ON;");
- sql2.Append ("SET FMTONLY OFF;");
- }
-
- switch (CommandType) {
- case CommandType.StoredProcedure:
- if (keyInfo || schemaOnly)
- Connection.Tds.Execute (sql1.ToString ());
- Connection.Tds.ExecProc (CommandText, parms, CommandTimeout, wantResults);
- if (keyInfo || schemaOnly)
- Connection.Tds.Execute (sql2.ToString ());
- break;
- case CommandType.Text:
- string sql = String.Format ("{0}{1}{2}", sql1.ToString (), CommandText, sql2.ToString ());
- Connection.Tds.Execute (sql, parms, CommandTimeout, wantResults);
- break;
- }
- }
- else
- Connection.Tds.ExecPrepared (preparedStatement, parms, CommandTimeout, wantResults);
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- int ExecuteNonQuery ()
- {
- ValidateCommand ("ExecuteNonQuery");
- int result = 0;
-
- try {
- Execute (CommandBehavior.Default, false);
- result = Tds.RecordsAffected;
- }
- catch (TdsTimeoutException e) {
- throw SybaseException.FromTdsInternalException ((TdsInternalException) e);
- }
-
- GetOutputParameters ();
- return result;
- }
-
- public new SybaseDataReader ExecuteReader ()
- {
- return ExecuteReader (CommandBehavior.Default);
- }
-
- public new SybaseDataReader ExecuteReader (CommandBehavior behavior)
- {
- ValidateCommand ("ExecuteReader");
- try {
- Execute (behavior, true);
- }
- catch (TdsTimeoutException e) {
- throw SybaseException.FromTdsInternalException ((TdsInternalException) e);
- }
- Connection.DataReader = new SybaseDataReader (this);
- return Connection.DataReader;
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- object ExecuteScalar ()
- {
- ValidateCommand ("ExecuteScalar");
- try {
- Execute (CommandBehavior.Default, true);
- }
- catch (TdsTimeoutException e) {
- throw SybaseException.FromTdsInternalException ((TdsInternalException) e);
- }
-
- if (!Connection.Tds.NextResult () || !Connection.Tds.NextRow ())
- return null;
-
- object result = Connection.Tds.ColumnValues [0];
- CloseDataReader (true);
- return result;
- }
-
- internal void GetOutputParameters ()
- {
- Connection.Tds.SkipToEnd ();
-
- IList list = Connection.Tds.ColumnValues;
-
- if (list != null && list.Count > 0) {
- int index = 0;
- foreach (SybaseParameter parameter in parameters) {
- if (parameter.Direction != ParameterDirection.Input) {
- parameter.Value = list [index];
- index += 1;
- }
- if (index >= list.Count)
- break;
- }
- }
- }
-
- object ICloneable.Clone ()
- {
- return new SybaseCommand (commandText, connection, transaction, commandType, updatedRowSource, designTimeVisible, commandTimeout, parameters);
- }
-
-#if !NET_2_0
- IDbDataParameter IDbCommand.CreateParameter ()
- {
- return CreateParameter ();
- }
-
- IDataReader IDbCommand.ExecuteReader ()
- {
- return ExecuteReader ();
- }
-
- IDataReader IDbCommand.ExecuteReader (CommandBehavior behavior)
- {
- return ExecuteReader (behavior);
- }
-#endif
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- void Prepare ()
- {
-#if NET_2_0
- if (Connection == null)
- throw new NullReferenceException ();
-#endif
-
- if (CommandType == CommandType.StoredProcedure || CommandType == CommandType.Text && Parameters.Count == 0)
- return;
-
- ValidateCommand ("Prepare");
- if (CommandType == CommandType.Text)
- preparedStatement = Connection.Tds.Prepare (CommandText, Parameters.MetaParameters);
- }
-
- public void ResetCommandTimeout ()
- {
- commandTimeout = 30;
- }
-
- private void Unprepare ()
- {
- Connection.Tds.Unprepare (preparedStatement);
- preparedStatement = null;
- }
-
- private void ValidateCommand (string method)
- {
- if (Connection == null)
- throw new InvalidOperationException (String.Format ("{0} requires a Connection object to continue.", method));
- if (Connection.Transaction != null && transaction != Connection.Transaction)
- throw new InvalidOperationException ("The Connection object does not have the same transaction as the command object.");
- if (Connection.State != ConnectionState.Open)
- throw new InvalidOperationException (String.Format ("ExecuteNonQuery requires an open Connection object to continue. This connection is closed.", method));
- if (commandText == String.Empty || commandText == null)
- throw new InvalidOperationException ("The command text for this Command has not been set.");
- if (Connection.DataReader != null)
- throw new InvalidOperationException ("There is already an open DataReader associated with this Connection which must be closed first.");
- }
-#if NET_2_0
- protected override DbParameter CreateDbParameter ()
- {
- return CreateParameter ();
- }
-
- protected override DbDataReader ExecuteDbDataReader (CommandBehavior behavior)
- {
- return ExecuteReader (behavior);
- }
-
- protected override DbConnection DbConnection {
- get { return Connection; }
- set { Connection = (SybaseConnection) value; }
- }
-
- protected override DbParameterCollection DbParameterCollection {
- get { return Parameters; }
- }
-
- protected override DbTransaction DbTransaction {
- get { return Transaction; }
- set { Transaction = (SybaseTransaction) value; }
- }
-#endif // NET_2_0
-
- #endregion // Methods
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseCommandBuilder.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseCommandBuilder.cs
deleted file mode 100644
index 2809ed7a7d9..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseCommandBuilder.cs
+++ /dev/null
@@ -1,151 +0,0 @@
-//
-// Mono.Data.SybaseClient.SybaseCommandBuilder.cs
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Copyright (C) Tim Coleman, 2002
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Data;
-using System.ComponentModel;
-
-namespace Mono.Data.SybaseClient {
- [MonoTODO("Implement getting KeyInfo in SybaseDataReader before implementing SybaseCommandBuilder.")]
- public sealed class SybaseCommandBuilder : Component
- {
- #region Constructors
- SybaseDataAdapter adapter;
-
- public SybaseCommandBuilder ()
- {
- adapter = null;
- }
-
- public SybaseCommandBuilder (SybaseDataAdapter adapter) : this ()
- {
- DataAdapter = adapter;
- }
-
- #endregion // Constructors
-
- #region Properties
-
- public SybaseDataAdapter DataAdapter {
- get { return adapter; }
- set {
- if (adapter != null)
- adapter.RowUpdating -= new SybaseRowUpdatingEventHandler (RowUpdatingHandler);
-
- adapter = value;
-
- if (adapter != null)
- adapter.RowUpdating += new SybaseRowUpdatingEventHandler (RowUpdatingHandler);
- }
- }
-
- [MonoTODO]
- public string QuotePrefix {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
- }
-
- [MonoTODO]
- public string QuoteSuffix {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
- }
-
- #endregion // Properties
-
- #region Methods
-
- [MonoTODO]
- public static void DeriveParameters (SybaseCommand command)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- protected override void Dispose(bool disposing)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- public SybaseCommand GetDeleteCommand()
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- public SybaseCommand GetInsertCommand()
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- public SybaseCommand GetUpdateCommand()
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- public void RefreshSchema()
- {
- throw new NotImplementedException ();
- }
-
- #endregion // Methods
-
- #region Event Handlers
-
- private void RowUpdatingHandler (object sender, SybaseRowUpdatingEventArgs args)
- {
- if (args.Command != null)
- return;
- try {
- switch (args.StatementType) {
- case StatementType.Insert:
- args.Command = GetInsertCommand ();
- break;
- case StatementType.Update:
- args.Command = GetUpdateCommand ();
- break;
- case StatementType.Delete:
- args.Command = GetDeleteCommand ();
- break;
- }
- } catch (Exception e) {
- args.Errors = e;
- args.Status = UpdateStatus.ErrorsOccurred;
- }
-
- #endregion // Event Handlers
- }
- }
-}
-
-
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseConnection.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseConnection.cs
deleted file mode 100644
index 9ad892f9c82..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseConnection.cs
+++ /dev/null
@@ -1,699 +0,0 @@
-//
-// Mono.Data.SybaseClient.SybaseConnection.cs
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-// Daniel Morgan (monodanmorg@yahoo.com)
-//
-// Copyright (C) Tim Coleman, 2002-2003
-// Copyright (C) Daniel Morgan, 2003, 2008
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.Tds.Protocol;
-using MDTP = Mono.Data.Tds.Protocol;
-using System;
-using System.Collections;
-using System.Collections.Specialized;
-using System.ComponentModel;
-using System.Data;
-using System.Data.Common;
-using System.EnterpriseServices;
-using System.Net;
-using System.Net.Sockets;
-using System.Text;
-
-#if NET_2_0
-using System.Collections.Generic;
-#endif
-
-namespace Mono.Data.SybaseClient {
- [DefaultEvent ("InfoMessage")]
-#if NET_2_0
- public sealed class SybaseConnection : DbConnection, IDbConnection, ICloneable
-#else
- public sealed class SybaseConnection : Component, IDbConnection, ICloneable
-#endif // NET_2_0
- {
- #region Fields
- bool disposed = false;
-
- // The set of SQL connection pools
- static TdsConnectionPoolManager sybaseConnectionPools = new TdsConnectionPoolManager (TdsVersion.tds50);
-
- // The current connection pool
- TdsConnectionPool pool;
-
- // The connection string that identifies this connection
- string connectionString = null;
-
- // The transaction object for the current transaction
- SybaseTransaction transaction = null;
-
- // Connection parameters
- TdsConnectionParameters parms = new TdsConnectionParameters ();
- bool connectionReset;
- bool pooling;
- string dataSource;
- int connectionTimeout;
- int minPoolSize;
- int maxPoolSize;
- int packetSize;
- int port = 2048;
-
- // The current state
- ConnectionState state = ConnectionState.Closed;
-
- SybaseDataReader dataReader = null;
-
- // The TDS object
- MDTP.Tds tds;
-
- #endregion // Fields
-
- #region Constructors
-
- public SybaseConnection ()
- : this (String.Empty)
- {
- }
-
- public SybaseConnection (string connectionString)
- {
- ConnectionString = connectionString;
- }
-
- #endregion // Constructors
-
- #region Properties
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- string ConnectionString {
- get { return connectionString; }
- set { SetConnectionString (value); }
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- int ConnectionTimeout {
- get { return connectionTimeout; }
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- string Database {
- get { return tds.Database; }
- }
-
- internal SybaseDataReader DataReader {
- get { return dataReader; }
- set { dataReader = value; }
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- string DataSource {
- get { return dataSource; }
- }
-
- public int PacketSize {
- get { return packetSize; }
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- string ServerVersion {
- get { return tds.ServerVersion; }
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- ConnectionState State {
- get { return state; }
- }
-
- internal MDTP.Tds Tds {
- get { return tds; }
- }
-
- internal SybaseTransaction Transaction {
- get { return transaction; }
- set { transaction = value; }
- }
-
- public string WorkstationId {
- get { return parms.Hostname; }
- }
-
- #endregion // Properties
-
- #region Events and Delegates
-
- public event SybaseInfoMessageEventHandler InfoMessage;
-
-#if !NET_2_0
- public new event StateChangeEventHandler StateChange;
-#endif
-
- private void ErrorHandler (object sender, TdsInternalErrorMessageEventArgs e)
- {
- throw new SybaseException (e.Class, e.LineNumber, e.Message, e.Number, e.Procedure, e.Server, "Mono SybaseClient Data Provider", e.State);
- }
-
- private void MessageHandler (object sender, TdsInternalInfoMessageEventArgs e)
- {
- OnSybaseInfoMessage (CreateSybaseInfoMessageEvent (e.Errors));
- }
-
- #endregion // Events and Delegates
-
- #region Methods
-
- public new SybaseTransaction BeginTransaction ()
- {
- return BeginTransaction (IsolationLevel.ReadCommitted, String.Empty);
- }
-
- public new SybaseTransaction BeginTransaction (IsolationLevel iso)
- {
- return BeginTransaction (iso, String.Empty);
- }
-
- public SybaseTransaction BeginTransaction (string transactionName)
- {
- return BeginTransaction (IsolationLevel.ReadCommitted, transactionName);
- }
-
- public SybaseTransaction BeginTransaction (IsolationLevel iso, string transactionName)
- {
- if (State == ConnectionState.Closed)
- throw new InvalidOperationException ("The connection is not open.");
- if (Transaction != null)
- throw new InvalidOperationException ("SybaseConnection does not support parallel transactions.");
-
- string isolevel = String.Empty;
- switch (iso) {
- case IsolationLevel.Chaos:
- isolevel = "CHAOS";
- break;
- case IsolationLevel.ReadCommitted:
- isolevel = "READ COMMITTED";
- break;
- case IsolationLevel.ReadUncommitted:
- isolevel = "READ UNCOMMITTED";
- break;
- case IsolationLevel.RepeatableRead:
- isolevel = "REPEATABLE READ";
- break;
- case IsolationLevel.Serializable:
- isolevel = "SERIALIZABLE";
- break;
- }
-
- tds.Execute (String.Format ("SET TRANSACTION ISOLATION LEVEL {0}\nBEGIN TRANSACTION {1}", isolevel, transactionName));
- transaction = new SybaseTransaction (this, iso);
- return transaction;
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- void ChangeDatabase (string database)
- {
- if (!IsValidDatabaseName (database))
- throw new ArgumentException (String.Format ("The database name {0} is not valid."));
- if (State != ConnectionState.Open)
- throw new InvalidOperationException ("The connection is not open");
- tds.Execute (String.Format ("use {0}", database));
- }
-
- private void ChangeState (ConnectionState currentState)
- {
- ConnectionState originalState = state;
- state = currentState;
- OnStateChange (CreateStateChangeEvent (originalState, currentState));
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- void Close ()
- {
- if (transaction != null && transaction.IsOpen)
- transaction.Rollback ();
-
- if (dataReader != null) {
- if(tds != null) tds.SkipToEnd ();
- dataReader = null;
- }
-
- if (tds != null && tds.IsConnected) {
- if (pooling && tds.Pooling) {
- if(pool != null) pool.ReleaseConnection (tds);
- }else
- if(tds != null) tds.Disconnect ();
- }
-
- if (tds != null) {
- tds.TdsErrorMessage -= new TdsInternalErrorMessageEventHandler (ErrorHandler);
- tds.TdsInfoMessage -= new TdsInternalInfoMessageEventHandler (MessageHandler);
- }
-
- ChangeState (ConnectionState.Closed);
- }
-
- public new SybaseCommand CreateCommand ()
- {
- SybaseCommand command = new SybaseCommand ();
- command.Connection = this;
- return command;
- }
-
- private StateChangeEventArgs CreateStateChangeEvent (ConnectionState originalState, ConnectionState currentState)
- {
- return new StateChangeEventArgs (originalState, currentState);
- }
-
- private SybaseInfoMessageEventArgs CreateSybaseInfoMessageEvent (TdsInternalErrorCollection errors)
- {
- return new SybaseInfoMessageEventArgs (errors);
- }
-
- protected override void Dispose (bool disposing)
- {
- if (!disposed) {
- if (disposing) {
- if (State == ConnectionState.Open)
- Close ();
- parms = null;
- dataSource = null;
- }
- base.Dispose (disposing);
- disposed = true;
- }
- }
-
- [MonoTODO]
- public void EnlistDistributedTransaction (ITransaction transaction)
- {
- throw new NotImplementedException ();
- }
-
- object ICloneable.Clone ()
- {
- return new SybaseConnection (ConnectionString);
- }
-
-#if NET_2_0
- protected override DbTransaction BeginDbTransaction (IsolationLevel isolationLevel)
- {
- return BeginTransaction (isolationLevel);
- }
-
- protected override DbCommand CreateDbCommand ()
- {
- return CreateCommand ();
- }
-#else
- IDbTransaction IDbConnection.BeginTransaction ()
- {
- return BeginTransaction ();
- }
-
- IDbTransaction IDbConnection.BeginTransaction (IsolationLevel iso)
- {
- return BeginTransaction (iso);
- }
-
- IDbCommand IDbConnection.CreateCommand ()
- {
- return CreateCommand ();
- }
-#endif
-
- void IDisposable.Dispose ()
- {
- Dispose (true);
- GC.SuppressFinalize (this);
- }
-
- [MonoTODO ("Figure out the Sybase way to reset the connection.")]
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- void Open ()
- {
- string serverName = "";
- if (connectionString == null || connectionString.Equals (""))
- throw new InvalidOperationException ("Connection string has not been initialized.");
-
- try {
- if (!pooling) {
- ParseDataSource (dataSource, out port, out serverName);
- tds = new Tds50 (serverName, port, PacketSize, ConnectionTimeout);
- }
- else {
- ParseDataSource (dataSource, out port, out serverName);
- TdsConnectionInfo info = new TdsConnectionInfo (serverName, port, packetSize, ConnectionTimeout, minPoolSize, maxPoolSize);
- pool = sybaseConnectionPools.GetConnectionPool (connectionString, info);
- tds = pool.GetConnection ();
- }
- }
- catch (TdsTimeoutException e) {
- throw SybaseException.FromTdsInternalException ((TdsInternalException) e);
- }
-
- tds.TdsErrorMessage += new TdsInternalErrorMessageEventHandler (ErrorHandler);
- tds.TdsInfoMessage += new TdsInternalInfoMessageEventHandler (MessageHandler);
-
- if (!tds.IsConnected) {
- try {
- tds.Connect (parms);
- ChangeState (ConnectionState.Open);
- ChangeDatabase (parms.Database);
- }
- catch {
- if (pooling)
- pool.ReleaseConnection (tds);
- throw;
- }
- }
- else if (connectionReset) {
- // tds.ExecuteNonQuery ("EXEC sp_reset_connection"); FIXME
- ChangeState (ConnectionState.Open);
- }
- }
-
- private void ParseDataSource (string theDataSource, out int thePort, out string theServerName)
- {
- theServerName = "";
- thePort = 2048;
-
- int idx = 0;
- if ((idx = theDataSource.IndexOf (",")) > -1) {
- theServerName = theDataSource.Substring (0, idx);
- string p = theDataSource.Substring (idx + 1);
- thePort = Int32.Parse (p);
- }
- else {
- theServerName = theDataSource;
- }
- }
-
- private string ParseValue (string name, string value)
- {
- if (name.Length == 0 && value.Length > 0)
- throw new ArgumentException ("Expected '=' delimiter while parsing connection value pair.");
- if (name.Length > 0)
- return value.Trim ();
- return String.Empty;
- }
-
- private void SetConnectionString (string connectionString)
- {
- if (connectionString == String.Empty) {
- this.connectionString = connectionString;
- return;
- }
-
- NameValueCollection parameters = new NameValueCollection ();
-
- string name = String.Empty;
- string value = String.Empty;
- StringBuilder sb = new StringBuilder ();
-
- char delimiter = '\0';
-
- foreach (char c in connectionString) {
- switch (c) {
- case '\'' :
- case '"' :
- if (delimiter.Equals (c))
- delimiter = '\0';
- else if (delimiter.Equals ('\0'))
- delimiter = c;
- else
- sb.Append (c);
- break;
- case ';' :
- if (delimiter.Equals ('\0')) {
- value = ParseValue (name, sb.ToString ());
- if (!value.Equals (""))
- parameters [name.ToUpper ().Trim ()] = value;
- name = String.Empty;
- sb = new StringBuilder ();
- }
- else
- sb.Append (c);
- break;
- case '=' :
- if (delimiter.Equals ('\0')) {
- name = sb.ToString ();
- sb = new StringBuilder ();
- }
- else
- sb.Append (c);
- break;
- default:
- sb.Append (c);
- break;
- }
- }
-
- if (!delimiter.Equals ('\0'))
- throw new ArgumentException (String.Format ("Matching end delimiter {0} not found in connection option value.", delimiter));
-
- value = ParseValue (name, sb.ToString ());
- if (!value.Equals (""))
- parameters [name.ToUpper ().Trim ()] = value;
-
- SetDefaultConnectionParameters (parameters);
- SetProperties (parameters);
-
- this.connectionString = connectionString;
- }
-
- private void SetDefaultConnectionParameters (NameValueCollection parameters)
- {
- if (null == parameters.Get ("APPLICATION NAME"))
- parameters["APPLICATION NAME"] = "Mono SybaseClient Data Provider";
- if (null == parameters.Get ("CONNECT TIMEOUT") && null == parameters.Get ("CONNECTION TIMEOUT")) {
- parameters["CONNECT TIMEOUT"] = "15";
- connectionTimeout = 15;
- }
- if (null == parameters.Get ("CONNECTION LIFETIME"))
- parameters["CONNECTION LIFETIME"] = "0";
- if (null == parameters.Get ("CONNECTION RESET"))
- parameters["CONNECTION RESET"] = "true";
- if (null == parameters.Get ("ENLIST"))
- parameters["ENLIST"] = "true";
- if (null == parameters.Get ("INTEGRATED SECURITY") && null == parameters.Get ("TRUSTED_CONNECTION"))
- parameters["INTEGRATED SECURITY"] = "false";
- if (null == parameters.Get ("MAX POOL SIZE")) {
- parameters["MAX POOL SIZE"] = "100";
- maxPoolSize = 100;
- }
- if (null == parameters.Get ("MIN POOL SIZE")) {
- parameters["MIN POOL SIZE"] = "0";
- maxPoolSize = 0;
- }
- if (null == parameters.Get ("NETWORK LIBRARY") && null == parameters.Get ("NET"))
- parameters["NETWORK LIBRARY"] = "dbmssocn";
- if (null == parameters.Get ("PACKET SIZE")) {
- parameters["PACKET SIZE"] = "512";
- packetSize = 512;
- }
- if (null == parameters.Get ("PERSIST SECURITY INFO"))
- parameters["PERSIST SECURITY INFO"] = "false";
- if (null == parameters.Get ("POOLING"))
- parameters["POOLING"] = "true";
- if (null == parameters.Get ("WORKSTATION ID")) {
-#if NET_2_0
- parameters["WORKSTATION ID"] = Dns.GetHostEntry ("localhost").HostName;
-#else
- parameters["WORKSTATION ID"] = Dns.GetHostByName ("localhost").HostName;
-#endif
- }
- }
-
- private void SetProperties (NameValueCollection parameters)
- {
- string value;
- foreach (string name in parameters) {
- value = parameters [name];
-
- switch (name) {
- case "APPLICATION NAME" :
- parms.ApplicationName = value;
- break;
- case "ATTACHDBFILENAME" :
- case "EXTENDED PROPERTIES" :
- case "INITIAL FILE NAME" :
- break;
- case "CONNECT TIMEOUT" :
- case "CONNECTION TIMEOUT" :
- connectionTimeout = Int32.Parse (value);
- break;
- case "CONNECTION LIFETIME" :
- break;
- case "CONNECTION RESET" :
- connectionReset = !(value.ToUpper ().Equals ("FALSE") || value.ToUpper ().Equals ("NO"));
- break;
- case "CURRENT LANGUAGE" :
- parms.Language = value;
- break;
- case "DATA SOURCE" :
- case "SERVER" :
- case "ADDRESS" :
- case "ADDR" :
- case "NETWORK ADDRESS" :
- dataSource = value;
- break;
- case "ENLIST" :
- break;
- case "INITIAL CATALOG" :
- case "DATABASE" :
- parms.Database = value;
- break;
- case "INTEGRATED SECURITY" :
- case "TRUSTED_CONNECTION" :
- break;
- case "MAX POOL SIZE" :
- maxPoolSize = Int32.Parse (value);
- break;
- case "MIN POOL SIZE" :
- minPoolSize = Int32.Parse (value);
- break;
- case "NET" :
- case "NETWORK LIBRARY" :
- if (!value.ToUpper ().Equals ("DBMSSOCN"))
- throw new ArgumentException ("Unsupported network library.");
- break;
- case "PACKET SIZE" :
- packetSize = Int32.Parse (value);
- break;
- case "PASSWORD" :
- case "PWD" :
- parms.Password = value;
- break;
- case "PERSIST SECURITY INFO" :
- break;
- case "POOLING" :
- pooling = !(value.ToUpper ().Equals ("FALSE") || value.ToUpper ().Equals ("NO"));
- break;
- case "USER ID" :
- parms.User = value;
- break;
- case "WORKSTATION ID" :
- parms.Hostname = value;
- break;
- }
- }
- }
-
- private static bool IsValidDatabaseName (string database)
- {
- if (database.Length > 32 || database.Length < 1)
- return false;
-
- if (database[0] == '"' && database[database.Length] == '"')
- database = database.Substring (1, database.Length - 2);
- else if (Char.IsDigit (database[0]))
- return false;
-
- if (database[0] == '_')
- return false;
-
- foreach (char c in database.Substring (1, database.Length - 1))
- if (!Char.IsLetterOrDigit (c) && c != '_')
- return false;
- return true;
- }
-
- private void OnSybaseInfoMessage (SybaseInfoMessageEventArgs value)
- {
- if (InfoMessage != null)
- InfoMessage (this, value);
- }
-
-#if !NET_2_0
- private void OnStateChange (StateChangeEventArgs value)
- {
- if (StateChange != null)
- StateChange (this, value);
- }
-#endif
-
-#if NET_2_0
- public override DataTable GetSchema ()
- {
- throw new NotImplementedException ();
- }
-
- public override DataTable GetSchema (String collectionName)
- {
- throw new NotImplementedException ();
- }
-
- public override DataTable GetSchema (String collectionName, string [] restrictionValues)
- {
- throw new NotImplementedException ();
- }
-
- public static void ChangePassword (string connectionString, string newPassword)
- {
- throw new NotImplementedException ();
- }
-
- public static void ClearAllPools ()
- {
- throw new NotImplementedException ();
- }
-
- public static void ClearPool (SybaseConnection connection)
- {
- throw new NotImplementedException ();
- }
-
-#endif // NET_2_0
-
-
- #endregion // Methods
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseConnectionStringBuilder.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseConnectionStringBuilder.cs
deleted file mode 100644
index 57409e71f8a..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseConnectionStringBuilder.cs
+++ /dev/null
@@ -1,691 +0,0 @@
-//
-// Mono.Data.SybaseClient.SybaseConnectionStringBuilder.cs
-//
-// Author:
-// Sureshkumar T (tsureshkumar@novell.com)
-// Daniel Morgan <monodanmorg@yahoo.com>
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-// Copyright (C) 2008 Daniel Morgan
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_2_0
-
-using System;
-using System.Text;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-
-using System.Data;
-using System.Data.Common;
-using System.ComponentModel;
-using System.Globalization;
-
-namespace Mono.Data.SybaseClient
-{
- [DefaultPropertyAttribute ("DataSource")]
- public sealed class SybaseConnectionStringBuilder : DbConnectionStringBuilder
- {
-
- private const string DEF_APPLICATIONNAME = ".NET Sybase Data Provider";
- private const bool DEF_ASYNCHRONOUSPROCESSING = false;
- private const string DEF_ATTACHDBFILENAME = "";
- private const bool DEF_CONNECTIONRESET = true;
- private const int DEF_CONNECTTIMEOUT = 15;
- private const string DEF_CURRENTLANGUAGE = "";
- private const string DEF_DATASOURCE = "";
- private const bool DEF_ENCRYPT = false;
- private const bool DEF_ENLIST = false;
- private const string DEF_INITIALCATALOG = "";
- private const bool DEF_INTEGRATEDSECURITY = false;
- private const int DEF_LOADBALANCETIMEOUT = 0;
- private const int DEF_MAXPOOLSIZE = 100;
- private const int DEF_MINPOOLSIZE = 0;
- private const int DEF_PACKETSIZE = 8000;
- private const string DEF_PASSWORD = "";
- private const bool DEF_PERSISTSECURITYINFO = false;
- private const bool DEF_POOLING = true;
- private const bool DEF_REPLICATION = false;
- private const string DEF_USERID = "";
- private const string DEF_WORKSTATIONID = "";
-
- #region // Fields
- private string _applicationName;
- private bool _asynchronousProcessing;
- private string _attachDBFilename;
- private bool _connectionReset;
- private int _connectTimeout;
- private string _currentLanguage;
- private string _dataSource;
- private bool _encrypt;
- private bool _enlist;
- private string _initialCatalog;
- private bool _integratedSecurity;
- private int _loadBalanceTimeout;
- private int _maxPoolSize;
- private int _minPoolSize;
- private int _packetSize;
- private string _password;
- private bool _persistSecurityInfo;
- private bool _pooling;
- private string _userID;
- private string _workstationID;
-
- private static Dictionary <string, string> _keywords; // for mapping duplicate keywords
- private static Dictionary <string, object> _defaults;
- #endregion // Fields
-
- #region Constructors
- public SybaseConnectionStringBuilder () : this (String.Empty)
- {
- }
-
- public SybaseConnectionStringBuilder (string connectionString)
- {
- Init ();
- base.ConnectionString = connectionString;
- }
-
- static SybaseConnectionStringBuilder ()
- {
- _keywords = new Dictionary <string, string> ();
- _keywords ["APP"] = "Application Name";
- _keywords ["APPLICATION NAME"] = "Application Name";
- _keywords ["ATTACHDBFILENAME"] = "AttachDbFilename";
- _keywords ["EXTENDED PROPERTIES"] = "Extended Properties";
- _keywords ["INITIAL FILE NAME"] = "Initial File Name";
- _keywords ["TIMEOUT"] = "Connect Timeout";
- _keywords ["CONNECT TIMEOUT"] = "Connect Timeout";
- _keywords ["CONNECTION TIMEOUT"] = "Connect Timeout";
- _keywords ["CONNECTION RESET"] = "Connection Reset";
- _keywords ["LANGUAGE"] = "Current Language";
- _keywords ["CURRENT LANGUAGE"] = "Current Language";
- _keywords ["DATA SOURCE"] = "Data Source";
- _keywords ["SERVER"] = "Data Source";
- _keywords ["ADDRESS"] = "Data Source";
- _keywords ["ADDR"] = "Data Source";
- _keywords ["NETWORK ADDRESS"] = "Data Source";
- _keywords ["ENCRYPT"] = "Encrypt";
- _keywords ["ENLIST"] = "Enlist";
- _keywords ["INITIAL CATALOG"] = "Initial Catalog";
- _keywords ["DATABASE"] = "Initial Catalog";
- _keywords ["INTEGRATED SECURITY"] = "Integrated Security";
- _keywords ["TRUSTED_CONNECTION"] = "Integrated Security";
- _keywords ["MAX POOL SIZE"] = "Max Pool Size";
- _keywords ["MIN POOL SIZE"] = "Min Pool Size";
- _keywords ["ASYNCHRONOUS PROCESSING"] = "Asynchronous Processing";
- _keywords ["ASYNC"] = "Async";
- _keywords ["PACKET SIZE"] = "Packet Size";
- _keywords ["PASSWORD"] = "Password";
- _keywords ["PWD"] = "Password";
- _keywords ["PERSISTSECURITYINFO"] = "Persist Security Info";
- _keywords ["PERSIST SECURITY INFO"] = "Persist Security Info";
- _keywords ["POOLING"] = "Pooling";
- _keywords ["UID"] = "User ID";
- _keywords ["USER"] = "User ID";
- _keywords ["USER ID"] = "User ID";
- _keywords ["WSID"] = "Workstation ID";
- _keywords ["WORKSTATION ID"] = "Workstation ID";
-
- _defaults = new Dictionary<string, object> ();
- _defaults.Add("Data Source", DEF_DATASOURCE);
- _defaults.Add("AttachDbFilename", DEF_ATTACHDBFILENAME);
- _defaults.Add("Initial Catalog", DEF_INITIALCATALOG);
- _defaults.Add("Integrated Security", DEF_INTEGRATEDSECURITY);
- _defaults.Add("Persist Security Info", DEF_PERSISTSECURITYINFO);
- _defaults.Add("User ID", DEF_USERID);
- _defaults.Add("Password", DEF_PASSWORD);
- _defaults.Add("Enlist", DEF_ENLIST);
- _defaults.Add("Pooling", DEF_POOLING);
- _defaults.Add("Min Pool Size", DEF_MINPOOLSIZE);
- _defaults.Add("Max Pool Size", DEF_MAXPOOLSIZE);
- _defaults.Add("Asynchronous Processing", DEF_ASYNCHRONOUSPROCESSING);
- _defaults.Add("Connection Reset", DEF_CONNECTIONRESET);
- _defaults.Add("Connect Timeout", DEF_CONNECTTIMEOUT);
- _defaults.Add("Encrypt", DEF_ENCRYPT);
- _defaults.Add("Packet Size", DEF_PACKETSIZE);
- _defaults.Add("Application Name", DEF_APPLICATIONNAME);
- _defaults.Add("Current Language", DEF_CURRENTLANGUAGE);
- _defaults.Add("Workstation ID", DEF_WORKSTATIONID);
- }
- #endregion // Constructors
-
- #region Properties
- [DisplayNameAttribute ("Application Name")]
- [RefreshPropertiesAttribute (RefreshProperties.All)]
- public string ApplicationName {
- get { return _applicationName; }
- set {
- base ["Application Name"] = value;
- _applicationName = value;
- }
- }
-
- [DisplayNameAttribute ("Asynchronous Processing")]
- [RefreshPropertiesAttribute (RefreshProperties.All)]
- public bool AsynchronousProcessing {
- get { return _asynchronousProcessing; }
- set {
- base ["Asynchronous Processing"] = value;
- _asynchronousProcessing = value;
- }
- }
-
- [DisplayNameAttribute ("AttachDbFilename")]
- [RefreshPropertiesAttribute (RefreshProperties.All)]
- public string AttachDBFilename {
- get { return _attachDBFilename; }
- set {
- base ["AttachDbFilename"] = value;
- _attachDBFilename = value;
- }
- }
-
- [DisplayNameAttribute ("Connection Reset")]
- [RefreshPropertiesAttribute (RefreshProperties.All)]
- public bool ConnectionReset {
- get { return _connectionReset; }
- set {
- base ["Connection Reset"] = value;
- _connectionReset = value;
- }
- }
-
- [DisplayNameAttribute ("Connect Timeout")]
- [RefreshPropertiesAttribute (RefreshProperties.All)]
- public int ConnectTimeout {
- get { return _connectTimeout; }
- set {
- base ["Connect Timeout"] = value;
- _connectTimeout = value;
- }
- }
-
- [DisplayNameAttribute ("Current Language")]
- [RefreshPropertiesAttribute (RefreshProperties.All)]
- public string CurrentLanguage {
- get { return _currentLanguage; }
- set {
- base ["Current Language"] = value;
- _currentLanguage = value;
- }
- }
-
- [DisplayNameAttribute ("Data Source")]
- [RefreshPropertiesAttribute (RefreshProperties.All)]
- public string DataSource {
- get { return _dataSource; }
- set {
- base ["Data Source"] = value;
- _dataSource = value;
- }
- }
-
- [DisplayNameAttribute ("Encrypt")]
- [RefreshPropertiesAttribute (RefreshProperties.All)]
- public bool Encrypt {
- get { return _encrypt; }
- set {
- base ["Encrypt"] = value;
- _encrypt = value;
- }
- }
-
- [DisplayNameAttribute ("Enlist")]
- [RefreshPropertiesAttribute (RefreshProperties.All)]
- public bool Enlist {
- get { return _enlist; }
- set {
- base ["Enlist"] = value;
- _enlist = value;
- }
- }
-
- [DisplayNameAttribute ("Initial Catalog")]
- [RefreshPropertiesAttribute (RefreshProperties.All)]
- public string InitialCatalog {
- get { return _initialCatalog; }
- set {
- base ["Initial Catalog"] = value;
- _initialCatalog = value;
- }
- }
-
- [DisplayNameAttribute ("Integrated Security")]
- [RefreshPropertiesAttribute (RefreshProperties.All)]
- public bool IntegratedSecurity {
- get { return _integratedSecurity; }
- set {
- base ["Integrated Security"] = value;
- _integratedSecurity = value;
- }
- }
-
- public override bool IsFixedSize {
- get { return true; }
- }
-
- public override object this [string keyword] {
- get {
- string mapped = MapKeyword (keyword);
- if (base.ContainsKey (mapped))
- return base [mapped];
- else
- return _defaults [mapped];
- }
- set {SetValue (keyword, value);}
- }
-
- public override ICollection Keys {
- get {
- List<string> keys = new List<string>();
- keys.Add("Data Source");
- keys.Add("AttachDbFilename");
- keys.Add("Initial Catalog");
- keys.Add("Integrated Security");
- keys.Add("Persist Security Info");
- keys.Add("User ID");
- keys.Add("Password");
- keys.Add("Enlist");
- keys.Add("Pooling");
- keys.Add("Min Pool Size");
- keys.Add("Max Pool Size");
- keys.Add("Asynchronous Processing");
- keys.Add("Connection Reset");
- keys.Add("Connect Timeout");
- keys.Add("Encrypt");
- keys.Add("Packet Size");
- keys.Add("Application Name");
- keys.Add("Current Language");
- keys.Add("Workstation ID");
- ReadOnlyCollection<string> coll = new ReadOnlyCollection<string>(keys);
- return coll;
- }
- }
-
- [DisplayNameAttribute ("Max Pool Size")]
- [RefreshPropertiesAttribute (RefreshProperties.All)]
- public int MaxPoolSize {
- get { return _maxPoolSize; }
- set {
- base ["Max Pool Size"] = value;
- _maxPoolSize = value;
- }
- }
-
- [DisplayNameAttribute ("Min Pool Size")]
- [RefreshPropertiesAttribute (RefreshProperties.All)]
- public int MinPoolSize {
- get { return _minPoolSize; }
- set {
- base ["Min Pool Size"] = value;
- _minPoolSize = value;
- }
- }
-
- [DisplayNameAttribute ("Packet Size")]
- [RefreshPropertiesAttribute (RefreshProperties.All)]
- public int PacketSize {
- get { return _packetSize; }
- set {
- base ["Packet Size"] = value;
- _packetSize = value;
- }
- }
-
- [DisplayNameAttribute ("Password")]
- [PasswordPropertyTextAttribute (true)]
- [RefreshPropertiesAttribute (RefreshProperties.All)]
- public string Password {
- get { return _password; }
- set {
- base ["Password"] = value;
- _password = value;
- }
- }
-
- [DisplayNameAttribute ("Persist Security Info")]
- [RefreshPropertiesAttribute (RefreshProperties.All)]
- public bool PersistSecurityInfo {
- get { return _persistSecurityInfo; }
- set {
- base ["Persist Security Info"] = value;
- _persistSecurityInfo = value;
- }
- }
-
- [DisplayNameAttribute ("Pooling")]
- [RefreshPropertiesAttribute (RefreshProperties.All)]
- public bool Pooling {
- get { return _pooling; }
- set {
- base ["Pooling"] = value;
- _pooling = value;
- }
- }
-
- [DisplayNameAttribute ("User ID")]
- [RefreshPropertiesAttribute (RefreshProperties.All)]
- public string UserID {
- get { return _userID; }
- set {
- base ["User Id"]= value;
- _userID = value;
- }
- }
-
- public override ICollection Values {
- get {
- List<object> values = new List<object>();
- values.Add(_dataSource);
- values.Add(_attachDBFilename);
- values.Add(_initialCatalog);
- values.Add(_integratedSecurity);
- values.Add(_persistSecurityInfo);
- values.Add(_userID);
- values.Add(_password);
- values.Add(_enlist);
- values.Add(_pooling);
- values.Add(_minPoolSize);
- values.Add(_maxPoolSize);
- values.Add(_asynchronousProcessing);
- values.Add(_connectionReset);
- values.Add(_connectTimeout);
- values.Add(_encrypt);
- values.Add(_loadBalanceTimeout);
- values.Add(_packetSize);
- values.Add(_applicationName);
- values.Add(_currentLanguage);
- values.Add(_workstationID);
- ReadOnlyCollection<object> coll = new ReadOnlyCollection<object>(values);
- return coll;
- }
- }
-
- [DisplayNameAttribute ("Workstation ID")]
- [RefreshPropertiesAttribute (RefreshProperties.All)]
- public string WorkstationID {
- get { return _workstationID; }
- set {
- base ["Workstation Id"] = value;
- _workstationID = value;
- }
- }
-
- #endregion // Properties
-
- #region Methods
- private void Init ()
- {
- _applicationName = DEF_APPLICATIONNAME;
- _asynchronousProcessing = DEF_ASYNCHRONOUSPROCESSING;
- _attachDBFilename = DEF_ATTACHDBFILENAME;
- _connectionReset = DEF_CONNECTIONRESET;
- _connectTimeout = DEF_CONNECTTIMEOUT;
- _currentLanguage = DEF_CURRENTLANGUAGE;
- _dataSource = DEF_DATASOURCE;
- _encrypt = DEF_ENCRYPT;
- _enlist = DEF_ENLIST;
- _initialCatalog = DEF_INITIALCATALOG;
- _integratedSecurity = DEF_INTEGRATEDSECURITY;
- _loadBalanceTimeout = DEF_LOADBALANCETIMEOUT;
- _maxPoolSize = DEF_MAXPOOLSIZE;
- _minPoolSize = DEF_MINPOOLSIZE;
- _packetSize = DEF_PACKETSIZE;
- _password = DEF_PASSWORD;
- _persistSecurityInfo = DEF_PERSISTSECURITYINFO;
- _pooling = DEF_POOLING;
- _userID = DEF_USERID;
- _workstationID = DEF_WORKSTATIONID;
- }
-
- public override void Clear ()
- {
- base.Clear ();
- Init ();
- }
-
- public override bool ContainsKey (string keyword)
- {
- keyword = keyword.ToUpper ().Trim ();
- if (_keywords.ContainsKey (keyword))
- return base.ContainsKey (_keywords [keyword]);
- return false;
- }
-
- public override bool Remove (string keyword)
- {
- if (!ContainsKey (keyword))
- return false;
- this [keyword] = null;
- return true;
- }
-
- [MonoNotSupported ("")] // Note that base.ShouldSerialize() is called but not implemented
- public override bool ShouldSerialize (string keyword)
- {
- if (!ContainsKey (keyword))
- return false;
- keyword = keyword.ToUpper ().Trim ();
- // Assuming passwords cannot be serialized.
- if (_keywords [keyword] == "Password")
- return false;
- return base.ShouldSerialize (_keywords [keyword]);
- }
-
- public override bool TryGetValue (string keyword, out object value)
- {
- if (! ContainsKey (keyword)) {
- value = String.Empty;
- return false;
- }
- return base.TryGetValue (_keywords [keyword.ToUpper ().Trim ()], out value);
- }
-
- #endregion // Methods
-
- #region Private Methods
- private string MapKeyword (string keyword)
- {
- keyword = keyword.ToUpper ().Trim ();
- if (! _keywords.ContainsKey (keyword))
- throw new ArgumentException("Keyword not supported :" + keyword);
- return _keywords [keyword];
- }
-
- private void SetValue (string key, object value)
- {
- if (key == null)
- throw new ArgumentNullException ("key cannot be null!");
-
- string mappedKey = MapKeyword (key);
-
- switch (mappedKey.ToUpper ().Trim ()) {
- case "APPLICATION NAME" :
- if (value == null) {
- _applicationName = DEF_APPLICATIONNAME;
- base.Remove (mappedKey);
- } else
- this.ApplicationName = value.ToString ();
- break;
- case "ATTACHDBFILENAME" :
- throw new NotImplementedException ("Attachable database support is " +
- "not implemented.");
- case "CONNECT TIMEOUT" :
- if (value == null) {
- _connectTimeout = DEF_CONNECTTIMEOUT;
- base.Remove (mappedKey);
- } else
- this.ConnectTimeout = ConvertToInt32 (value);
- break;
- case "CONNECTION LIFETIME" :
- break;
- case "CONNECTION RESET" :
- if (value == null) {
- _connectionReset = DEF_CONNECTIONRESET;
- base.Remove (mappedKey);
- } else
- this.ConnectionReset = ConvertToBoolean (value);
- break;
- case "CURRENT LANGUAGE" :
- if (value == null) {
- _currentLanguage = DEF_CURRENTLANGUAGE;
- base.Remove (mappedKey);
- } else
- this.CurrentLanguage = value.ToString ();
- break;
- case "DATA SOURCE" :
- if (value == null) {
- _dataSource = DEF_DATASOURCE;
- base.Remove (mappedKey);
- } else
- this.DataSource = value.ToString ();
- break;
- case "ENCRYPT":
- if (value == null) {
- _encrypt = DEF_ENCRYPT;
- base.Remove (mappedKey);
- }else if (ConvertToBoolean(value))
- throw new NotImplementedException("SSL encryption for"
- + " data sent between client and server is not"
- + " implemented.");
- break;
- case "ENLIST" :
- if (value == null) {
- _enlist = DEF_ENLIST;
- base.Remove (mappedKey);
- } else if (!ConvertToBoolean(value))
- throw new NotImplementedException("Disabling the automatic"
- + " enlistment of connections in the thread's current"
- + " transaction context is not implemented.");
- break;
- case "INITIAL CATALOG" :
- if (value == null) {
- _initialCatalog = DEF_INITIALCATALOG;
- base.Remove (mappedKey);
- } else
- this.InitialCatalog = value.ToString ();
- break;
- case "INTEGRATED SECURITY" :
- if (value == null) {
- _integratedSecurity = DEF_INTEGRATEDSECURITY;
- base.Remove (mappedKey);
- } else
- this.IntegratedSecurity = ConvertToBoolean (value);
- break;
- case "MAX POOL SIZE" :
- if (value == null) {
- _maxPoolSize = DEF_MAXPOOLSIZE;
- base.Remove (mappedKey);
- } else
- this.MaxPoolSize = ConvertToInt32 (value);
- break;
- case "MIN POOL SIZE" :
- if (value == null) {
- _minPoolSize = DEF_MINPOOLSIZE;
- base.Remove (mappedKey);
- } else
- this.MinPoolSize = ConvertToInt32 (value);
- break;
- case "ASYNCHRONOUS PROCESSING" :
- if (value == null) {
- _asynchronousProcessing = DEF_ASYNCHRONOUSPROCESSING;
- base.Remove (mappedKey);
- } else
- this.AsynchronousProcessing = ConvertToBoolean (value);
- break;
- case "PACKET SIZE" :
- if (value == null) {
- _packetSize = DEF_PACKETSIZE;
- base.Remove (mappedKey);
- } else
- this.PacketSize = ConvertToInt32 (value);
- break;
- case "PASSWORD" :
- if (value == null) {
- _password = DEF_PASSWORD;
- base.Remove (mappedKey);
- } else
- this.Password = value.ToString ();
- break;
- case "PERSIST SECURITY INFO" :
- if (value == null) {
- _persistSecurityInfo = DEF_PERSISTSECURITYINFO;
- base.Remove (mappedKey);
- } else if (ConvertToBoolean (value))
- throw new NotImplementedException ("Persisting security info" +
- " is not yet implemented");
- break;
- case "POOLING" :
- if (value == null) {
- _pooling = DEF_POOLING;
- base.Remove (mappedKey);
- } else
- this.Pooling = ConvertToBoolean (value);
- break;
- case "USER ID" :
- if (value == null) {
- _userID = DEF_USERID;
- base.Remove (mappedKey);
- } else
- this.UserID = value.ToString ();
- break;
- case "WORKSTATION ID" :
- if (value == null) {
- _workstationID = DEF_WORKSTATIONID;
- base.Remove (mappedKey);
- } else
- this.WorkstationID = value.ToString ();
- break;
- default :
- throw new ArgumentException("Keyword not supported :" + key);
- }
- }
-
- private int ConvertToInt32 (object value)
- {
- return Int32.Parse (value.ToString (), CultureInfo.InvariantCulture);
- }
-
- private bool ConvertToBoolean (object value)
- {
- if (value == null)
- throw new ArgumentNullException ("null value cannot be converted" +
- " to boolean");
- string upper = value.ToString ().ToUpper ().Trim ();
- if (upper == "YES" || upper == "TRUE")
- return true;
- if (upper == "NO" || upper == "FALSE")
- return false;
- throw new ArgumentException (String.Format ("Invalid boolean value: {0}",
- value.ToString ()));
- }
-
- #endregion // Private Methods
- }
-
-
-}
-#endif // NET_2_0
-
-
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseDataAdapter.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseDataAdapter.cs
deleted file mode 100644
index 0f21c3c2594..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseDataAdapter.cs
+++ /dev/null
@@ -1,241 +0,0 @@
-//
-// Mono.Data.SybaseClient.SybaseDataAdapter.cs
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-// Daniel Morgan (monodanmorg@yahoo.com)
-//
-// Copyright (C) Tim Coleman, 2002
-// Copyright (C) Daniel Morgan, 2008
-//
-//
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.ComponentModel;
-using System.Data;
-using System.Data.Common;
-
-namespace Mono.Data.SybaseClient {
- [DefaultEvent ("RowUpdated")]
- public sealed class SybaseDataAdapter : DbDataAdapter, IDbDataAdapter, ICloneable
- {
- #region Fields
-
-#if !NET_2_0
- bool disposed;
-#endif
- SybaseCommand deleteCommand;
- SybaseCommand insertCommand;
- SybaseCommand selectCommand;
- SybaseCommand updateCommand;
-#if NET_2_0
- int updateBatchSize;
-#endif
-
- static readonly object EventRowUpdated = new object();
- static readonly object EventRowUpdating = new object();
-
- #endregion
-
- #region Constructors
-
- public SybaseDataAdapter () : this ((SybaseCommand) null)
- {
- }
-
- public SybaseDataAdapter (SybaseCommand selectCommand)
- {
- SelectCommand = selectCommand;
-#if NET_2_0
- UpdateBatchSize = 1;
-#endif
- }
-
- public SybaseDataAdapter (string selectCommandText, SybaseConnection selectConnection)
- : this (new SybaseCommand (selectCommandText, selectConnection))
- {
- }
-
- public SybaseDataAdapter (string selectCommandText, string selectConnectionString)
- : this (selectCommandText, new SybaseConnection (selectConnectionString))
- {
- }
-
- #endregion
-
- #region Properties
-
- public new SybaseCommand DeleteCommand {
- get { return deleteCommand; }
- set { deleteCommand = value; }
- }
-
- public new SybaseCommand InsertCommand {
- get { return insertCommand; }
- set { insertCommand = value; }
- }
-
- public new SybaseCommand SelectCommand {
- get { return selectCommand; }
- set { selectCommand = value; }
- }
-
- public new SybaseCommand UpdateCommand {
- get { return updateCommand; }
- set { updateCommand = value; }
- }
-
- IDbCommand IDbDataAdapter.DeleteCommand {
- get { return DeleteCommand; }
- set { DeleteCommand = (SybaseCommand) value; }
- }
-
- IDbCommand IDbDataAdapter.InsertCommand {
- get { return InsertCommand; }
- set { InsertCommand = (SybaseCommand) value; }
- }
-
- IDbCommand IDbDataAdapter.SelectCommand {
- get { return SelectCommand; }
- set { SelectCommand = (SybaseCommand) value; }
- }
-
- IDbCommand IDbDataAdapter.UpdateCommand {
- get { return UpdateCommand; }
- set { UpdateCommand = (SybaseCommand) value; }
- }
-
- ITableMappingCollection IDataAdapter.TableMappings {
- get { return TableMappings; }
- }
-
-#if NET_2_0
- public override int UpdateBatchSize {
- get { return updateBatchSize; }
- set {
- if (value < 0)
- throw new ArgumentOutOfRangeException ("UpdateBatchSize");
- updateBatchSize = value;
- }
- }
-#endif
-
-#if !NET_2_0
- protected override void Dispose (bool disposing)
- {
- if (!disposed) {
- if (disposing) {
- // Release managed resources
- }
- // Release unmanaged resources
- disposed = true;
- }
- base.Dispose (disposing);
- }
-#endif
-
- #endregion // Properties
-
- #region Methods
-
- protected override RowUpdatedEventArgs CreateRowUpdatedEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
- {
- return new SybaseRowUpdatedEventArgs (dataRow, command, statementType, tableMapping);
- }
-
-
- protected override RowUpdatingEventArgs CreateRowUpdatingEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
- {
- return new SybaseRowUpdatingEventArgs (dataRow, command, statementType, tableMapping);
- }
-
- protected override void OnRowUpdated (RowUpdatedEventArgs value)
- {
- SybaseRowUpdatedEventHandler handler = (SybaseRowUpdatedEventHandler) Events[EventRowUpdated];
- if ((handler != null) && (value is SybaseRowUpdatedEventArgs))
- handler(this, (SybaseRowUpdatedEventArgs) value);
- }
-
- protected override void OnRowUpdating (RowUpdatingEventArgs value)
- {
- SybaseRowUpdatingEventHandler handler = (SybaseRowUpdatingEventHandler) Events[EventRowUpdating];
- if ((handler != null) && (value is SybaseRowUpdatingEventArgs))
- handler(this, (SybaseRowUpdatingEventArgs) value);
- }
-
-#if NET_2_0
- [MonoTODO]
- protected override int AddToBatch (IDbCommand command)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- protected override void ClearBatch ()
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- protected override int ExecuteBatch ()
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- protected override IDataParameter GetBatchedParameter (int commandIdentifier, int parameterIndex)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- protected override void InitializeBatching ()
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- protected override void TerminateBatching ()
- {
- throw new NotImplementedException ();
- }
-#endif
-
- #endregion // Methods
-
- #region Events and Delegates
-
- public event SybaseRowUpdatedEventHandler RowUpdated {
- add { Events.AddHandler (EventRowUpdated, value); }
- remove { Events.RemoveHandler (EventRowUpdated, value); }
- }
-
- public event SybaseRowUpdatingEventHandler RowUpdating {
- add { Events.AddHandler (EventRowUpdating, value); }
- remove { Events.RemoveHandler (EventRowUpdating, value); }
- }
-
- #endregion // Events and Delegates
-
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseDataReader.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseDataReader.cs
deleted file mode 100644
index d1d614cdb52..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseDataReader.cs
+++ /dev/null
@@ -1,1266 +0,0 @@
-//
-// Mono.Data.SybaseClient.SybaseDataReader.cs
-//
-// Author:
-// Rodrigo Moya (rodrigo@ximian.com)
-// Daniel Morgan (monodanmorg@yahoo.com)
-// Tim Coleman (tim@timcoleman.com)
-//
-// (C) Ximian, Inc 2002
-// (C) Daniel Morgan 2002, 2008
-// Copyright (C) Tim Coleman, 2002
-//
-//
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.SybaseTypes;
-using Mono.Data.Tds.Protocol;
-using System;
-using System.Collections;
-using System.ComponentModel;
-using System.Data;
-using System.Data.Common;
-
-namespace Mono.Data.SybaseClient {
-#if NET_2_0
- public class SybaseDataReader : DbDataReader, IDataReader, IDisposable, IDataRecord
-#else
- public sealed class SybaseDataReader : MarshalByRefObject, IEnumerable, IDataReader, IDisposable, IDataRecord
-#endif // NET_2_0
- {
- #region Fields
-
- SybaseCommand command;
- ArrayList dataTypeNames;
- bool disposed = false;
- int fieldCount;
- bool isClosed;
- bool isSelect;
- bool moreResults;
- int resultsRead;
- int rowsRead;
- DataTable schemaTable;
- bool haveRead;
- bool readResult;
- bool readResultUsed;
-#if NET_2_0
- int visibleFieldCount;
-#endif
-
- #endregion // Fields
-
- const int COLUMN_NAME_IDX = 0;
- const int COLUMN_ORDINAL_IDX = 1;
- const int COLUMN_SIZE_IDX = 2;
- const int NUMERIC_PRECISION_IDX = 3;
- const int NUMERIC_SCALE_IDX = 4;
- const int IS_UNIQUE_IDX = 5;
- const int IS_KEY_IDX = 6;
- const int BASE_SERVER_NAME_IDX = 7;
- const int BASE_CATALOG_NAME_IDX = 8;
- const int BASE_COLUMN_NAME_IDX = 9;
- const int BASE_SCHEMA_NAME_IDX = 10;
- const int BASE_TABLE_NAME_IDX = 11;
- const int DATA_TYPE_IDX = 12;
- const int ALLOW_DBNULL_IDX = 13;
- const int PROVIDER_TYPE_IDX = 14;
- const int IS_ALIASED_IDX = 15;
- const int IS_EXPRESSION_IDX = 16;
- const int IS_IDENTITY_IDX = 17;
- const int IS_AUTO_INCREMENT_IDX = 18;
- const int IS_ROW_VERSION_IDX = 19;
- const int IS_HIDDEN_IDX = 20;
- const int IS_LONG_IDX = 21;
- const int IS_READ_ONLY_IDX = 22;
-
- #region Constructors
-
- internal SybaseDataReader (SybaseCommand command)
- {
- readResult = false;
- haveRead = false;
- readResultUsed = false;
- this.command = command;
- resultsRead = 0;
- isClosed = false;
- command.Tds.RecordsAffected = -1;
-#if NET_2_0
- visibleFieldCount = 0;
-#endif
- NextResult ();
- }
-
- #endregion // Constructors
-
- #region Properties
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- int Depth {
- get { return 0; }
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- int FieldCount {
- get { return command.Tds.Columns.Count; }
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- bool IsClosed {
- get { return isClosed; }
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- object this [int i] {
- get { return GetValue (i); }
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- object this [string name] {
- get { return GetValue (GetOrdinal (name)); }
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- int RecordsAffected {
- get {
- return command.Tds.RecordsAffected;
- }
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- bool HasRows {
- get {
- if (haveRead)
- return readResult;
-
- haveRead = true;
- readResult = ReadRecord ();
- return readResult;
- }
- }
-#if NET_2_0
- public override int VisibleFieldCount {
- get { return visibleFieldCount; }
- }
-
- protected SybaseConnection Connection {
- get { return command.Connection; }
- }
-
- protected bool IsCommandBehavior (CommandBehavior condition) {
- return condition == command.CommandBehavior;
- }
-#endif
-
- #endregion // Properties
-
- #region Methods
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- void Close ()
- {
- isClosed = true;
- command.CloseDataReader (moreResults);
- }
-
- private static DataTable ConstructSchemaTable ()
- {
- Type booleanType = typeof (bool);
- Type stringType = typeof (string);
- Type intType = typeof (int);
- Type typeType = typeof (Type);
- Type shortType = typeof (short);
-
- DataTable schemaTable = new DataTable ("SchemaTable");
- schemaTable.Columns.Add ("ColumnName", stringType);
- schemaTable.Columns.Add ("ColumnOrdinal", intType);
- schemaTable.Columns.Add ("ColumnSize", intType);
- schemaTable.Columns.Add ("NumericPrecision", shortType);
- schemaTable.Columns.Add ("NumericScale", shortType);
- schemaTable.Columns.Add ("IsUnique", booleanType);
- schemaTable.Columns.Add ("IsKey", booleanType);
- schemaTable.Columns.Add ("BaseServerName", stringType);
- schemaTable.Columns.Add ("BaseCatalogName", stringType);
- schemaTable.Columns.Add ("BaseColumnName", stringType);
- schemaTable.Columns.Add ("BaseSchemaName", stringType);
- schemaTable.Columns.Add ("BaseTableName", stringType);
- schemaTable.Columns.Add ("DataType", typeType);
- schemaTable.Columns.Add ("AllowDBNull", booleanType);
- schemaTable.Columns.Add ("ProviderType", intType);
- schemaTable.Columns.Add ("IsAliased", booleanType);
- schemaTable.Columns.Add ("IsExpression", booleanType);
- schemaTable.Columns.Add ("IsIdentity", booleanType);
- schemaTable.Columns.Add ("IsAutoIncrement", booleanType);
- schemaTable.Columns.Add ("IsRowVersion", booleanType);
- schemaTable.Columns.Add ("IsHidden", booleanType);
- schemaTable.Columns.Add ("IsLong", booleanType);
- schemaTable.Columns.Add ("IsReadOnly", booleanType);
-
- return schemaTable;
- }
-
- private void GetSchemaRowTypeName (TdsColumnType ctype, int csize, out string typeName)
- {
- int dbType;
- bool isLong;
- Type fieldType;
-
- GetSchemaRowType (ctype, csize, out dbType, out fieldType, out isLong, out typeName);
- }
-
- private void GetSchemaRowFieldType (TdsColumnType ctype, int csize, out Type fieldType)
- {
- int dbType;
- bool isLong;
- string typeName;
-
- GetSchemaRowType (ctype, csize, out dbType, out fieldType, out isLong, out typeName);
- }
-
- private void GetSchemaRowDbType (TdsColumnType ctype, int csize, out int dbType)
- {
- Type fieldType;
- bool isLong;
- string typeName;
-
- GetSchemaRowType (ctype, csize, out dbType, out fieldType, out isLong, out typeName);
- }
-
- private void GetSchemaRowType (TdsColumnType ctype, int csize,
- out int dbType, out Type fieldType,
- out bool isLong, out string typeName)
- {
- dbType = -1;
- typeName = string.Empty;
- isLong = false;
- fieldType = typeof (Type);
-
- switch (ctype) {
- case TdsColumnType.Int1:
- case TdsColumnType.Int2:
- case TdsColumnType.Int4:
- case TdsColumnType.IntN:
- switch (csize) {
- case 1:
- typeName = "tinyint";
- dbType = (int) SybaseType.TinyInt;
- fieldType = typeof (byte);
- isLong = false;
- break;
- case 2:
- typeName = "smallint";
- dbType = (int) SybaseType.SmallInt;
- fieldType = typeof (short);
- isLong = false;
- break;
- case 4:
- typeName = "int";
- dbType = (int) SybaseType.Int;
- fieldType = typeof (int);
- isLong = false;
- break;
- case 8:
- typeName = "bigint";
- dbType = (int) SybaseType.BigInt;
- fieldType = typeof (long);
- isLong = false;
- break;
- }
- break;
- case TdsColumnType.Real:
- case TdsColumnType.Float8:
- case TdsColumnType.FloatN:
- switch (csize) {
- case 4:
- typeName = "real";
- dbType = (int) SybaseType.Real;
- fieldType = typeof (float);
- isLong = false;
- break;
- case 8:
- typeName = "float";
- dbType = (int) SybaseType.Float;
- fieldType = typeof (double);
- isLong = false;
- break;
- }
- break;
- case TdsColumnType.Image :
- typeName = "image";
- dbType = (int) SybaseType.Image;
- fieldType = typeof (byte[]);
- isLong = true;
- break;
- case TdsColumnType.Text :
- typeName = "text";
- dbType = (int) SybaseType.Text;
- fieldType = typeof (string);
- isLong = true;
- break;
- case TdsColumnType.UniqueIdentifier :
- typeName = "uniqueidentifier";
- dbType = (int) SybaseType.UniqueIdentifier;
- fieldType = typeof (Guid);
- isLong = false;
- break;
- case TdsColumnType.VarBinary :
- case TdsColumnType.BigVarBinary :
- typeName = "varbinary";
- dbType = (int) SybaseType.VarBinary;
- fieldType = typeof (byte[]);
- isLong = true;
- break;
- case TdsColumnType.VarChar :
- case TdsColumnType.BigVarChar :
- typeName = "varchar";
- dbType = (int) SybaseType.VarChar;
- fieldType = typeof (string);
- isLong = false;
- break;
- case TdsColumnType.Binary :
- case TdsColumnType.BigBinary :
- typeName = "binary";
- dbType = (int) SybaseType.Binary;
- fieldType = typeof (byte[]);
- isLong = true;
- break;
- case TdsColumnType.Char :
- case TdsColumnType.BigChar :
- typeName = "char";
- dbType = (int) SybaseType.Char;
- fieldType = typeof (string);
- isLong = false;
- break;
- case TdsColumnType.Bit :
- case TdsColumnType.BitN :
- typeName = "bit";
- dbType = (int) SybaseType.Bit;
- fieldType = typeof (bool);
- isLong = false;
- break;
- case TdsColumnType.DateTime4 :
- case TdsColumnType.DateTime :
- case TdsColumnType.DateTimeN :
- typeName = "datetime";
- dbType = (int) SybaseType.DateTime;
- fieldType = typeof (DateTime);
- isLong = false;
- break;
- case TdsColumnType.Money :
- case TdsColumnType.MoneyN :
- case TdsColumnType.Money4 :
- typeName = "money";
- dbType = (int) SybaseType.Money;
- fieldType = typeof (decimal);
- isLong = false;
- break;
- case TdsColumnType.NText :
- typeName = "ntext";
- dbType = (int) SybaseType.NText;
- fieldType = typeof (string);
- isLong = true;
- break;
- case TdsColumnType.NVarChar :
- typeName = "nvarchar";
- dbType = (int) SybaseType.NVarChar;
- fieldType = typeof (string);
- isLong = false;
- break;
- case TdsColumnType.Decimal :
- case TdsColumnType.Numeric :
- typeName = "decimal";
- dbType = (int) SybaseType.Decimal;
- fieldType = typeof (decimal);
- isLong = false;
- break;
- case TdsColumnType.NChar :
- typeName = "nchar";
- dbType = (int) SybaseType.NChar;
- fieldType = typeof (string);
- isLong = false;
- break;
- case TdsColumnType.SmallMoney :
- typeName = "smallmoney";
- dbType = (int) SybaseType.SmallMoney;
- fieldType = typeof (decimal);
- isLong = false;
- break;
- default :
- typeName = "variant";
- dbType = (int) SybaseType.Variant;
- fieldType = typeof (object);
- isLong = false;
- break;
- }
- }
-
-#if NET_2_0
- new
-#endif
- void Dispose (bool disposing)
- {
- if (!disposed) {
- if (disposing) {
- schemaTable.Dispose ();
- Close ();
- }
- disposed = true;
- }
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- bool GetBoolean (int i)
- {
- object value = GetValue (i);
- if (!(value is bool)) {
- if (value is DBNull) throw new SybaseNullValueException ();
- throw new InvalidCastException ();
- }
- return (bool) value;
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- byte GetByte (int i)
- {
- object value = GetValue (i);
- if (!(value is byte)) {
- if (value is DBNull) throw new SybaseNullValueException ();
- throw new InvalidCastException ();
- }
- return (byte) value;
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- long GetBytes (int i, long dataIndex, byte[] buffer, int bufferIndex, int length)
- {
- object value = GetValue (i);
- if (!(value is byte [])) {
- if (value is DBNull) throw new SybaseNullValueException ();
- throw new InvalidCastException ();
- }
- Array.Copy ((byte []) value, (int) dataIndex, buffer, bufferIndex, length);
- return ((byte []) value).Length - dataIndex;
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- char GetChar (int i)
- {
- object value = GetValue (i);
- if (!(value is char)) {
- if (value is DBNull) throw new SybaseNullValueException ();
- throw new InvalidCastException ();
- }
- return (char) value;
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- long GetChars (int i, long dataIndex, char[] buffer, int bufferIndex, int length)
- {
- object value = GetValue (i);
- if (!(value is char[])) {
- if (value is DBNull) throw new SybaseNullValueException ();
- throw new InvalidCastException ();
- }
- Array.Copy ((char []) value, (int) dataIndex, buffer, bufferIndex, length);
- return ((char []) value).Length - dataIndex;
- }
-
- [MonoTODO ("Implement GetData")]
-#if !NET_2_0
- public IDataReader GetData (int i)
- {
- return ((IDataReader) this [i]);
- }
-#endif
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- string GetDataTypeName (int i)
- {
- TdsColumnType ctype;
- string datatypeName = null;
- int csize;
-
- if (i < 0 || i >= command.Tds.Columns.Count)
- throw new IndexOutOfRangeException ();
-#if NET_2_0
- ctype = (TdsColumnType) command.Tds.Columns[i].ColumnType;
- csize = (int) command.Tds.Columns[i].ColumnSize;
-#else
- ctype = (TdsColumnType) command.Tds.Columns[i]["ColumnType"];
- csize = (int) command.Tds.Columns[i]["ColumnSize"];
-#endif
- GetSchemaRowTypeName (ctype, csize, out datatypeName);
- return datatypeName;
-
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- DateTime GetDateTime (int i)
- {
- object value = GetValue (i);
- if (!(value is DateTime)) {
- if (value is DBNull) throw new SybaseNullValueException ();
- throw new InvalidCastException ();
- }
- return (DateTime) value;
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- decimal GetDecimal (int i)
- {
- object value = GetValue (i);
- if (!(value is decimal)) {
- if (value is DBNull) throw new SybaseNullValueException ();
- throw new InvalidCastException ();
- }
- return (decimal) value;
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- double GetDouble (int i)
- {
- object value = GetValue (i);
- if (!(value is double)) {
- if (value is DBNull) throw new SybaseNullValueException ();
- throw new InvalidCastException ();
- }
- return (double) value;
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- Type GetFieldType (int i)
- {
- TdsColumnType ctype;
- Type fieldType = null;
- int csize;
-
- if (i < 0 || i >= command.Tds.Columns.Count)
- throw new IndexOutOfRangeException ();
-#if NET_2_0
- ctype = (TdsColumnType) command.Tds.Columns[i].ColumnType;
- csize = (int) command.Tds.Columns[i].ColumnSize;
-#else
- ctype = (TdsColumnType) command.Tds.Columns[i]["ColumnType"];
- csize = (int) command.Tds.Columns[i]["ColumnSize"];
-#endif
- GetSchemaRowFieldType (ctype, csize, out fieldType);
- return fieldType;
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- float GetFloat (int i)
- {
- object value = GetValue (i);
- if (!(value is float)) {
- if (value is DBNull) throw new SybaseNullValueException ();
- throw new InvalidCastException ();
- }
- return (float) value;
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- Guid GetGuid (int i)
- {
- object value = GetValue (i);
- if (!(value is Guid)) {
- if (value is DBNull) throw new SybaseNullValueException ();
- throw new InvalidCastException ();
- }
- return (Guid) value;
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- short GetInt16 (int i)
- {
- object value = GetValue (i);
- if (!(value is short)) {
- if (value is DBNull) throw new SybaseNullValueException ();
- throw new InvalidCastException ();
- }
- return (short) value;
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- int GetInt32 (int i)
- {
- object value = GetValue (i);
- if (!(value is int)) {
- if (value is DBNull) throw new SybaseNullValueException ();
- throw new InvalidCastException ();
- }
- return (int) value;
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- long GetInt64 (int i)
- {
- object value = GetValue (i);
- if (!(value is long)) {
- if (value is DBNull) throw new SybaseNullValueException ();
- throw new InvalidCastException ();
- }
- return (long) value;
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- string GetName (int i)
- {
- if (i < 0 || i >= command.Tds.Columns.Count)
- throw new IndexOutOfRangeException ();
-#if NET_2_0
- return (string) command.Tds.Columns[i].ColumnName;
-#else
- return (string) command.Tds.Columns[i]["ColumnName"];
-#endif
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- int GetOrdinal (string name)
- {
- string colName;
- foreach (TdsDataColumn schema in command.Tds.Columns) {
-#if NET_2_0
- colName = schema.ColumnName;
- if (colName.Equals (name) || String.Compare (colName, name, true) == 0)
- return (int) schema.ColumnOrdinal;
-#else
- colName = (string) schema["ColumnName"];
- if (colName.Equals (name) || String.Compare (colName, name, true) == 0)
- return (int) schema["ColumnOrdinal"];
-#endif
- }
- throw new IndexOutOfRangeException ();
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- DataTable GetSchemaTable ()
- {
- ValidateState ();
-
- if (schemaTable == null)
- schemaTable = ConstructSchemaTable ();
-
- if (schemaTable.Rows != null && schemaTable.Rows.Count > 0)
- return schemaTable;
-
- if (!moreResults)
- return null;
-
- dataTypeNames = new ArrayList (command.Tds.Columns.Count);
-
- foreach (TdsDataColumn schema in command.Tds.Columns) {
- DataRow row = schemaTable.NewRow ();
-
-#if NET_2_0
- row [COLUMN_NAME_IDX] = GetSchemaValue (schema.ColumnName);
- row [COLUMN_ORDINAL_IDX] = GetSchemaValue (schema.ColumnOrdinal);
- row [IS_UNIQUE_IDX] = GetSchemaValue (schema.IsUnique);
- row [IS_AUTO_INCREMENT_IDX] = GetSchemaValue (schema.IsAutoIncrement);
- row [IS_ROW_VERSION_IDX] = GetSchemaValue (schema.IsRowVersion);
- row [IS_HIDDEN_IDX] = GetSchemaValue (schema.IsHidden);
- row [IS_IDENTITY_IDX] = GetSchemaValue (schema.IsIdentity);
- row [COLUMN_SIZE_IDX] = GetSchemaValue (schema.ColumnSize);
- row [NUMERIC_PRECISION_IDX] = GetSchemaValue (schema.NumericPrecision);
- row [NUMERIC_SCALE_IDX] = GetSchemaValue (schema.NumericScale);
- row [IS_KEY_IDX] = GetSchemaValue (schema.IsKey);
- row [IS_ALIASED_IDX] = GetSchemaValue (schema.IsAliased);
- row [IS_EXPRESSION_IDX] = GetSchemaValue (schema.IsExpression);
- row [IS_READ_ONLY_IDX] = GetSchemaValue (schema.IsReadOnly);
- row [BASE_SERVER_NAME_IDX] = GetSchemaValue (schema.BaseServerName);
- row [BASE_CATALOG_NAME_IDX] = GetSchemaValue (schema.BaseCatalogName);
- row [BASE_COLUMN_NAME_IDX] = GetSchemaValue (schema.BaseColumnName);
- row [BASE_SCHEMA_NAME_IDX] = GetSchemaValue (schema.BaseSchemaName);
- row [BASE_TABLE_NAME_IDX] = GetSchemaValue (schema.BaseTableName);
- row [ALLOW_DBNULL_IDX] = GetSchemaValue (schema.AllowDBNull);
-#else
- row ["ColumnName"] = GetSchemaValue (schema, "ColumnName");
- row ["ColumnOrdinal"] = GetSchemaValue (schema, "ColumnOrdinal");
- row ["IsUnique"] = GetSchemaValue (schema, "IsUnique");
- row ["IsAutoIncrement"] = GetSchemaValue (schema, "IsAutoIncrement");
- row ["IsRowVersion"] = GetSchemaValue (schema, "IsRowVersion");
- row ["IsHidden"] = GetSchemaValue (schema, "IsHidden");
- row ["IsIdentity"] = GetSchemaValue (schema, "IsIdentity");
- row ["ColumnSize"] = GetSchemaValue (schema, "ColumnSize");
- row ["NumericPrecision"] = GetSchemaValue (schema, "NumericPrecision");
- row ["NumericScale"] = GetSchemaValue (schema, "NumericScale");
- row ["IsKey"] = GetSchemaValue (schema, "IsKey");
- row ["IsAliased"] = GetSchemaValue (schema, "IsAliased");
- row ["IsExpression"] = GetSchemaValue (schema, "IsExpression");
- row ["IsReadOnly"] = GetSchemaValue (schema, "IsReadOnly");
- row ["BaseServerName"] = GetSchemaValue (schema, "BaseServerName");
- row ["BaseCatalogName"] = GetSchemaValue (schema, "BaseCatalogName");
- row ["BaseColumnName"] = GetSchemaValue (schema, "BaseColumnName");
- row ["BaseSchemaName"] = GetSchemaValue (schema, "BaseSchemaName");
- row ["BaseTableName"] = GetSchemaValue (schema, "BaseTableName");
- row ["AllowDBNull"] = GetSchemaValue (schema, "AllowDBNull");
-#endif
- // We don't always get the base column name.
- if (row [BASE_COLUMN_NAME_IDX] == DBNull.Value)
- row [BASE_COLUMN_NAME_IDX] = row [COLUMN_NAME_IDX];
-
- TdsColumnType ctype;
- int csize, dbType;
- Type fieldType;
- bool isLong;
- string typeName;
-#if NET_2_0
- ctype = (TdsColumnType) schema.ColumnType;
- csize = (int) schema.ColumnSize;
-#else
- ctype = (TdsColumnType) schema ["ColumnType"];
- csize = (int) schema ["ColumnSize"];
-#endif
-
- GetSchemaRowType (ctype, csize, out dbType,
- out fieldType, out isLong, out typeName);
-
- dataTypeNames.Add (typeName);
- row [PROVIDER_TYPE_IDX] = dbType;
- row [DATA_TYPE_IDX] = fieldType;
- row [IS_LONG_IDX] = isLong;
-#if NET_2_0
- if ((bool)row [IS_HIDDEN_IDX] == false)
- visibleFieldCount += 1;
-#endif
-
- schemaTable.Rows.Add (row);
- }
- return schemaTable;
- }
-
- private static object GetSchemaValue (TdsDataColumn schema, string key)
- {
- object val = schema [key];
- if (val != null)
- return val;
- else
- return DBNull.Value;
- }
-
-#if NET_2_0
- static object GetSchemaValue (object value)
- {
- if (value == null)
- return DBNull.Value;
-
- return value;
- }
-#endif
-
- public
-#if NET_2_0
- virtual
-#endif
- SybaseBinary GetSybaseBinary (int i)
- {
- throw new NotImplementedException ();
- }
-
- public
-#if NET_2_0
- virtual
-#endif
- SybaseBoolean GetSybaseBoolean (int i)
- {
- object value = GetSybaseValue (i);
- if (!(value is SybaseBoolean))
- throw new InvalidCastException ();
- return (SybaseBoolean) value;
- }
-
- public
-#if NET_2_0
- virtual
-#endif
- SybaseByte GetSybaseByte (int i)
- {
- object value = GetSybaseValue (i);
- if (!(value is SybaseByte))
- throw new InvalidCastException ();
- return (SybaseByte) value;
- }
-
- public
-#if NET_2_0
- virtual
-#endif
- SybaseDateTime GetSybaseDateTime (int i)
- {
- object value = GetSybaseValue (i);
- if (!(value is SybaseDateTime))
- throw new InvalidCastException ();
- return (SybaseDateTime) value;
- }
-
- public
-#if NET_2_0
- virtual
-#endif
- SybaseDecimal GetSybaseDecimal (int i)
- {
- object value = GetSybaseValue (i);
- if (!(value is SybaseDecimal))
- throw new InvalidCastException ();
- return (SybaseDecimal) value;
- }
-
- public
-#if NET_2_0
- virtual
-#endif
- SybaseDouble GetSybaseDouble (int i)
- {
- object value = GetSybaseValue (i);
- if (!(value is SybaseDouble))
- throw new InvalidCastException ();
- return (SybaseDouble) value;
- }
-
- public
-#if NET_2_0
- virtual
-#endif
- SybaseGuid GetSybaseGuid (int i)
- {
- object value = GetSybaseValue (i);
- if (!(value is SybaseGuid))
- throw new InvalidCastException ();
- return (SybaseGuid) value;
- }
-
- public
-#if NET_2_0
- virtual
-#endif
- SybaseInt16 GetSybaseInt16 (int i)
- {
- object value = GetSybaseValue (i);
- if (!(value is SybaseInt16))
- throw new InvalidCastException ();
- return (SybaseInt16) value;
- }
-
- public
-#if NET_2_0
- virtual
-#endif
- SybaseInt32 GetSybaseInt32 (int i)
- {
- object value = GetSybaseValue (i);
- if (!(value is SybaseInt32))
- throw new InvalidCastException ();
- return (SybaseInt32) value;
- }
-
- public
-#if NET_2_0
- virtual
-#endif
- SybaseInt64 GetSybaseInt64 (int i)
- {
- object value = GetSybaseValue (i);
- if (!(value is SybaseInt64))
- throw new InvalidCastException ();
- return (SybaseInt64) value;
- }
-
- public
-#if NET_2_0
- virtual
-#endif
- SybaseMoney GetSybaseMoney (int i)
- {
- object value = GetSybaseValue (i);
- if (!(value is SybaseMoney))
- throw new InvalidCastException ();
- return (SybaseMoney) value;
- }
-
- public
-#if NET_2_0
- virtual
-#endif
- SybaseSingle GetSybaseSingle (int i)
- {
- object value = GetSybaseValue (i);
- if (!(value is SybaseSingle))
- throw new InvalidCastException ();
- return (SybaseSingle) value;
- }
-
- public
-#if NET_2_0
- virtual
-#endif
- SybaseString GetSybaseString (int i)
- {
- object value = GetSybaseValue (i);
- if (!(value is SybaseString))
- throw new InvalidCastException ();
- return (SybaseString) value;
- }
-
- [MonoTODO ("Implement TdsBigDecimal conversion. SybaseType.Real fails tests?")]
- public
-#if NET_2_0
- virtual
-#endif
- object GetSybaseValue (int i)
- {
- SybaseType type = (SybaseType) (schemaTable.Rows [i]["ProviderType"]);
- object value = GetValue (i);
-
- switch (type) {
- case SybaseType.BigInt:
- if (value == DBNull.Value)
- return SybaseInt64.Null;
- return (SybaseInt64) ((long) value);
- case SybaseType.Binary:
- case SybaseType.Image:
- case SybaseType.VarBinary:
- case SybaseType.Timestamp:
- if (value == DBNull.Value)
- return SybaseBinary.Null;
- return (SybaseBinary) ((byte[]) value);
- case SybaseType.Bit:
- if (value == DBNull.Value)
- return SybaseBoolean.Null;
- return (SybaseBoolean) ((bool) value);
- case SybaseType.Char:
- case SybaseType.NChar:
- case SybaseType.NText:
- case SybaseType.NVarChar:
- case SybaseType.Text:
- case SybaseType.VarChar:
- if (value == DBNull.Value)
- return SybaseString.Null;
- return (SybaseString) ((string) value);
- case SybaseType.DateTime:
- case SybaseType.SmallDateTime:
- if (value == DBNull.Value)
- return SybaseDateTime.Null;
- return (SybaseDateTime) ((DateTime) value);
- case SybaseType.Decimal:
- if (value == DBNull.Value)
- return SybaseDecimal.Null;
- if (value is TdsBigDecimal)
- return SybaseDecimal.FromTdsBigDecimal ((TdsBigDecimal) value);
- return (SybaseDecimal) ((decimal) value);
- case SybaseType.Float:
- if (value == DBNull.Value)
- return SybaseDouble.Null;
- return (SybaseDouble) ((double) value);
- case SybaseType.Int:
- if (value == DBNull.Value)
- return SybaseInt32.Null;
- return (SybaseInt32) ((int) value);
- case SybaseType.Money:
- case SybaseType.SmallMoney:
- if (value == DBNull.Value)
- return SybaseMoney.Null;
- return (SybaseMoney) ((decimal) value);
- case SybaseType.Real:
- if (value == DBNull.Value)
- return SybaseSingle.Null;
- return (SybaseSingle) ((float) value);
- case SybaseType.UniqueIdentifier:
- if (value == DBNull.Value)
- return SybaseGuid.Null;
- return (SybaseGuid) ((Guid) value);
- case SybaseType.SmallInt:
- if (value == DBNull.Value)
- return SybaseInt16.Null;
- return (SybaseInt16) ((short) value);
- case SybaseType.TinyInt:
- if (value == DBNull.Value)
- return SybaseByte.Null;
- return (SybaseByte) ((byte) value);
- }
-
- throw new InvalidOperationException ("The type of this column is unknown.");
- }
-
- public
-#if NET_2_0
- virtual
-#endif
- int GetSybaseValues (object[] values)
- {
- int count = 0;
- int columnCount = schemaTable.Rows.Count;
- int arrayCount = values.Length;
-
- if (arrayCount > columnCount)
- count = columnCount;
- else
- count = arrayCount;
-
- for (int i = 0; i < count; i += 1)
- values [i] = GetSybaseValue (i);
-
- return count;
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- string GetString (int i)
- {
- object value = GetValue (i);
- if (!(value is string)) {
- if (value is DBNull) throw new SybaseNullValueException ();
- throw new InvalidCastException ();
- }
- return (string) value;
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- object GetValue (int i)
- {
- return command.Tds.ColumnValues [i];
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- int GetValues (object[] values)
- {
- int len = values.Length;
- int bigDecimalIndex = command.Tds.ColumnValues.BigDecimalIndex;
-
- // If a four-byte decimal is stored, then we can't convert to
- // a native type. Throw an OverflowException.
- if (bigDecimalIndex >= 0 && bigDecimalIndex < len)
- throw new OverflowException ();
-
- command.Tds.ColumnValues.CopyTo (0, values, 0, len);
- return (len > FieldCount ? len : FieldCount);
- }
-
- void IDisposable.Dispose ()
- {
- Dispose (true);
- GC.SuppressFinalize (this);
- }
-
-#if NET_2_0
- public override IEnumerator GetEnumerator ()
-#else
- IEnumerator IEnumerable.GetEnumerator ()
-#endif
- {
- return new DbEnumerator (this);
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- bool IsDBNull (int i)
- {
- return GetValue (i) == DBNull.Value;
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- bool NextResult ()
- {
- ValidateState ();
-
- if ((command.CommandBehavior & CommandBehavior.SingleResult) != 0 && resultsRead > 0)
- return false;
-
- try {
- moreResults = command.Tds.NextResult ();
- } catch (TdsInternalException ex) {
- command.Connection.Close ();
- throw SybaseException.FromTdsInternalException ((TdsInternalException) ex);
- }
- if (!moreResults)
- command.GetOutputParameters ();
- else {
- // new schema - don't do anything except reset schemaTable as command.Tds.Columns is already updated
- schemaTable = null;
- dataTypeNames = null;
- }
-
- rowsRead = 0;
- resultsRead += 1;
- return moreResults;
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- bool Read ()
- {
- ValidateState ();
-
- if ((command.CommandBehavior & CommandBehavior.SingleRow) != 0 && rowsRead > 0)
- return false;
- if ((command.CommandBehavior & CommandBehavior.SchemaOnly) != 0)
- return false;
- if (!moreResults)
- return false;
-
- if ((haveRead) && (!readResultUsed))
- {
- readResultUsed = true;
- return true;
- }
- return (ReadRecord ());
- }
-
- internal bool ReadRecord ()
- {
- try {
- bool result = command.Tds.NextRow ();
-
- rowsRead += 1;
- return result;
- } catch (TdsInternalException ex) {
- command.Connection.Close ();
- throw SybaseException.FromTdsInternalException ((TdsInternalException) ex);
- }
- }
-
- void ValidateState ()
- {
- if (IsClosed)
- throw new InvalidOperationException ("Invalid attempt to read data when reader is closed");
- }
-
-#if NET_2_0
- public override Type GetProviderSpecificFieldType (int i)
- {
- return (GetSybaseValue (i).GetType());
- }
-
- public override object GetProviderSpecificValue (int i)
- {
- return (GetSybaseValue (i));
- }
-
- public override int GetProviderSpecificValues (object [] values)
- {
- return (GetSybaseValues (values));
- }
-
-/* TODO: create SybaseBytes
- public virtual SybaseBytes GetSybaseBytes (int i)
- {
- Byte[] val = (byte[])GetValue(i);
- SybaseBytes sb = new SybaseBytes (val);
- return (sb);
- }
-*/
-
-#endif // NET_2_0
-
- #endregion // Methods
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseError.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseError.cs
deleted file mode 100644
index cf978b235f6..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseError.cs
+++ /dev/null
@@ -1,160 +0,0 @@
-//
-// Mono.Data.SybaseClient.SybaseError.cs
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Copyright (C) Tim Coleman, 2002
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Data;
-using System.Runtime.InteropServices;
-
-namespace Mono.Data.SybaseClient {
- [MonoTODO]
- public sealed class SybaseError
- {
- #region Fields
-
- byte theClass = 0;
- int lineNumber = 0;
- string message = "";
- int number = 0;
- string procedure = "";
- string server = "";
- string source = "";
- byte state = 0;
-
- #endregion // Fields
-
- #region Constructors
-
- internal SybaseError(byte theClass, int lineNumber,
- string message, int number, string procedure,
- string server, string source, byte state) {
- this.theClass = theClass;
- this.lineNumber = lineNumber;
- this.message = message;
- this.number = number;
- this.procedure = procedure;
- this.server = server;
- this.source = source;
- this.state = state;
- }
-
- #endregion // Constructors
-
- #region Properties
-
- [MonoTODO]
- public byte Class {
- get { return theClass; }
- }
-
- [MonoTODO]
- public int LineNumber {
- get { return lineNumber; }
- }
-
- [MonoTODO]
- public string Message {
- get { return message; }
- }
-
- [MonoTODO]
- public int Number {
- get { return number; }
- }
-
- [MonoTODO]
- public string Procedure {
- get { return procedure; }
- }
-
- [MonoTODO]
- public string Server {
- get { return server; }
- }
-
- [MonoTODO]
- public string Source {
- get { return source; }
- }
-
- [MonoTODO]
- public byte State {
- get { return state; }
- }
-
- #endregion // Properties
-
- #region Methods
-
- internal void SetClass (byte theClass) {
- this.theClass = theClass;
- }
-
- internal void SetLineNumber (int lineNumber) {
- this.lineNumber = lineNumber;
- }
-
- internal void SetMessage (string message) {
- this.message = message;
- }
-
- internal void SetNumber (int number) {
- this.number = number;
- }
-
- internal void SetProcedure (string procedure) {
- this.procedure = procedure;
- }
-
- internal void SetServer (string server) {
- this.server = server;
- }
-
- internal void SetSource (string source) {
- this.source = source;
- }
-
- internal void SetState (byte state) {
- this.state = state;
- }
-
- [MonoTODO]
- public override string ToString ()
- {
- String toStr;
- String stackTrace;
- stackTrace = " <Stack Trace>";
- // FIXME: generate the correct SQL error string
- toStr = "SybaseError:" + message + stackTrace;
- return toStr;
- }
-
- #endregion // Methods
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseErrorCollection.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseErrorCollection.cs
deleted file mode 100644
index cd8d1b711f9..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseErrorCollection.cs
+++ /dev/null
@@ -1,109 +0,0 @@
-//
-// Mono.Data.SybaseClient.SybaseErrorCollection.cs
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Copyright (C) Tim Coleman, 2002
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Collections;
-using System.Data;
-using System.Runtime.InteropServices;
-
-namespace Mono.Data.SybaseClient {
- [MonoTODO]
- public sealed class SybaseErrorCollection : ICollection, IEnumerable
- {
- #region Fields
-
- ArrayList list = new ArrayList();
-
- #endregion // Fields
-
- #region Constructors
-
- internal SybaseErrorCollection () {
- }
-
- internal SybaseErrorCollection (byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state)
- {
- Add (theClass, lineNumber, message, number, procedure, server, source, state);
- }
-
- #endregion // Constructors
-
- #region Properties
-
- public int Count {
- get { return list.Count; }
- }
-
- bool ICollection.IsSynchronized {
- get { throw new NotImplementedException (); }
- }
-
- object ICollection.SyncRoot {
- get { throw new NotImplementedException (); }
- }
-
- public SybaseError this[int index]
- {
- get { return (SybaseError) list[index]; }
- }
-
- #endregion // Properties
-
- #region Methods
-
- internal void Add(SybaseError error)
- {
- list.Add(error);
- }
-
- internal void Add(byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state)
- {
- SybaseError error = new SybaseError(theClass, lineNumber, message, number, procedure, server, source, state);
- Add(error);
- }
-
- public void CopyTo (Array array, int index)
- {
- list.CopyTo (array, index);
- }
-
- public IEnumerator GetEnumerator ()
- {
- return list.GetEnumerator ();
- }
-
- [MonoTODO]
- public override string ToString()
- {
- throw new NotImplementedException ();
- }
-
- #endregion // Methods
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseException.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseException.cs
deleted file mode 100644
index b7e5cd17d11..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseException.cs
+++ /dev/null
@@ -1,126 +0,0 @@
-//
-// Mono.Data.SybaseClient.SybaseException.cs
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Copyright (C) Tim Coleman, 2002
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.Tds.Protocol;
-using System;
-using System.Data;
-using System.Runtime.Serialization;
-using System.Text;
-
-namespace Mono.Data.SybaseClient {
- [Serializable]
- public sealed class SybaseException : SystemException
- {
- #region Fields
-
- SybaseErrorCollection errors;
-
- #endregion Fields
-
- #region Constructors
-
- internal SybaseException ()
- : base ("a SQL Exception has occurred.")
- {
- errors = new SybaseErrorCollection();
- }
-
- internal SybaseException (byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state)
- : base (message)
- {
- errors = new SybaseErrorCollection (theClass, lineNumber, message, number, procedure, server, source, state);
- }
-
- #endregion // Constructors
-
- #region Properties
-
- public byte Class {
- get { return errors [0].Class; }
- }
-
- public SybaseErrorCollection Errors {
- get { return errors; }
- }
-
- public int LineNumber {
- get { return errors [0].LineNumber; }
- }
-
- public override string Message {
- get {
- StringBuilder result = new StringBuilder ();
- foreach (SybaseError error in Errors) {
- if (result.Length > 0)
- result.Append ('\n');
- result.Append (error.Message);
- }
- return result.ToString ();
- }
- }
-
- public int Number {
- get { return errors [0].Number; }
- }
-
- public string Procedure {
- get { return errors [0].Procedure; }
- }
-
- public string Server {
- get { return errors [0].Server; }
- }
-
- public override string Source {
- get { return errors [0].Source; }
- }
-
- public byte State {
- get { return errors [0].State; }
- }
-
- #endregion // Properties
-
- #region Methods
-
- [MonoTODO]
- public override void GetObjectData (SerializationInfo si, StreamingContext context)
- {
- throw new NotImplementedException ();
- }
-
- internal static SybaseException FromTdsInternalException (TdsInternalException e)
- {
- return new SybaseException (e.Class, e.LineNumber, e.Message, e.Number, e.Procedure, e.Server, "Mono SybaseClient Data Provider", e.State);
- }
-
- #endregion // Methods
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseInfoMessageEventArgs.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseInfoMessageEventArgs.cs
deleted file mode 100644
index 18d1bb41d37..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseInfoMessageEventArgs.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-//
-// Mono.Data.SybaseClient.SybaseInfoMessageEventArgs.cs
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Copyright (C) Tim Coleman, 2002
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.Tds.Protocol;
-using System;
-using System.Data;
-
-namespace Mono.Data.SybaseClient {
- public sealed class SybaseInfoMessageEventArgs : EventArgs
- {
- #region Fields
-
- SybaseErrorCollection errors = new SybaseErrorCollection ();
-
- #endregion // Fields
-
- #region Constructors
-
- internal SybaseInfoMessageEventArgs (TdsInternalErrorCollection tdsErrors)
- {
- foreach (TdsInternalError e in tdsErrors)
- errors.Add (e.Class, e.LineNumber, e.Message, e.Number, e.Procedure, e.Server, "Mono SybaseClient Data Provider", e.State);
- }
-
- #endregion // Constructors
-
- #region Properties
-
- public SybaseErrorCollection Errors {
- get { return errors; }
- }
-
- public string Message {
- get { return errors[0].Message; }
- }
-
- public string Source {
- get { return errors[0].Source; }
- }
-
- #endregion // Properties
-
- #region Methods
-
- public override string ToString ()
- {
- return Message;
- }
-
- #endregion // Methods
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseInfoMessageEventHandler.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseInfoMessageEventHandler.cs
deleted file mode 100644
index 4ec2d99190d..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseInfoMessageEventHandler.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// Mono.Data.SybaseClient.SybaseInfoMessageEventHandler.cs
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Copyright (C) Tim Coleman, 2002
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Data;
-
-namespace Mono.Data.SybaseClient {
- public delegate void SybaseInfoMessageEventHandler (object sender, SybaseInfoMessageEventArgs e);
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseParameter.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseParameter.cs
deleted file mode 100644
index 5834136f888..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseParameter.cs
+++ /dev/null
@@ -1,639 +0,0 @@
-//
-// Mono.Data.SybaseClient.SybaseParameter.cs
-//
-// Author:
-// Rodrigo Moya (rodrigo@ximian.com)
-// Daniel Morgan (monodanmorg@yahoo.com)
-// Tim Coleman (tim@timcoleman.com)
-//
-// (C) Ximian, Inc. 2002
-// Copyright (C) Tim Coleman, 2002
-// Copyright (C) Daniel Morgan, 2008
-//
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.Tds;
-using Mono.Data.Tds.Protocol;
-using System;
-using System.ComponentModel;
-using System.Data;
-using System.Data.Common;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace Mono.Data.SybaseClient {
-#if NET_2_0
- public sealed class SybaseParameter : DbParameter, IDbDataParameter, IDataParameter, ICloneable
-#else
- public sealed class SybaseParameter : MarshalByRefObject, IDbDataParameter, IDataParameter, ICloneable
-#endif // NET_2_0
- {
- #region Fields
-
- TdsMetaParameter metaParameter;
-
- SybaseParameterCollection container = null;
- DbType dbType;
- ParameterDirection direction = ParameterDirection.Input;
- bool isNullable;
- bool isSizeSet = false;
- bool isTypeSet = false;
- int offset;
- SybaseType sybaseType;
- string sourceColumn;
- DataRowVersion sourceVersion;
-#if NET_2_0
- bool sourceColumnNullMapping;
-#endif
-
- #endregion // Fields
-
- #region Constructors
-
- public SybaseParameter ()
- : this (String.Empty, SybaseType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, null)
- {
- }
-
- public SybaseParameter (string parameterName, object value)
- {
- metaParameter = new TdsMetaParameter (parameterName, value);
- this.sourceVersion = DataRowVersion.Current;
- InferSybaseType (value);
- }
-
- public SybaseParameter (string parameterName, SybaseType dbType)
- : this (parameterName, dbType, 0, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, null)
- {
- }
-
- public SybaseParameter (string parameterName, SybaseType dbType, int size)
- : this (parameterName, dbType, size, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, null)
- {
- }
-
- public SybaseParameter (string parameterName, SybaseType dbType, int size, string sourceColumn)
- : this (parameterName, dbType, size, ParameterDirection.Input, false, 0, 0, sourceColumn, DataRowVersion.Current, null)
- {
- }
-
- [EditorBrowsable (EditorBrowsableState.Advanced)]
- public SybaseParameter (string parameterName, SybaseType dbType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value)
- {
- metaParameter = new TdsMetaParameter (parameterName, size, isNullable, precision, scale, value);
-
- SybaseType = dbType;
- Direction = direction;
- SourceColumn = sourceColumn;
- SourceVersion = sourceVersion;
- }
-
- // This constructor is used internally to construct a
- // SybaseParameter. The value array comes from sp_procedure_params_rowset.
- // This is in SybaseCommand.DeriveParameters.
- internal SybaseParameter (object[] dbValues)
- {
- Precision = 0;
- Scale = 0;
- Direction = ParameterDirection.Input;
-
- ParameterName = (string) dbValues[3];
-
- switch ((short) dbValues[5]) {
- case 1:
- Direction = ParameterDirection.Input;
- break;
- case 2:
- Direction = ParameterDirection.Output;
- break;
- case 3:
- Direction = ParameterDirection.InputOutput;
- break;
- case 4:
- Direction = ParameterDirection.ReturnValue;
- break;
- }
-
- IsNullable = (bool) dbValues[8];
-
- if (dbValues[12] != null)
- Precision = (byte) ((short) dbValues[12]);
- if (dbValues[13] != null)
- Scale = (byte) ((short) dbValues[13]);
-
- SetDbTypeName ((string) dbValues[16]);
- }
-
- #endregion // Constructors
-
- #region Properties
-
- // Used to ensure that only one collection can contain this
- // parameter
- internal SybaseParameterCollection Container {
- get { return container; }
- set { container = value; }
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- DbType DbType {
- get { return dbType; }
- set {
- SetDbType (value);
- isTypeSet = true;
- }
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- ParameterDirection Direction {
- get { return direction; }
- set {
- direction = value;
- if (direction == ParameterDirection.Output)
- MetaParameter.Direction = TdsParameterDirection.Output;
- }
- }
-
- internal TdsMetaParameter MetaParameter {
- get { return metaParameter; }
- }
-
- string IDataParameter.ParameterName {
- get { return metaParameter.ParameterName; }
- set { metaParameter.ParameterName = value; }
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- bool IsNullable {
- get { return metaParameter.IsNullable; }
- set { metaParameter.IsNullable = value; }
- }
-
- public int Offset {
- get { return offset; }
- set { offset = value; }
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- string ParameterName {
- get { return metaParameter.ParameterName; }
- set { metaParameter.ParameterName = value; }
- }
-
- public byte Precision {
- get { return metaParameter.Precision; }
- set { metaParameter.Precision = value; }
- }
-
- public byte Scale {
- get { return metaParameter.Scale; }
- set { metaParameter.Scale = value; }
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- int Size {
- get { return metaParameter.Size; }
- set { metaParameter.Size = value; }
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- string SourceColumn {
- get { return sourceColumn; }
- set { sourceColumn = value; }
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- DataRowVersion SourceVersion {
- get { return sourceVersion; }
- set { sourceVersion = value; }
- }
-
-#if NET_2_0
- [DbProviderSpecificTypeProperty(true)]
-#endif
- public SybaseType SybaseType {
- get { return sybaseType; }
- set {
- SetSybaseType (value);
- isTypeSet = true;
- }
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- object Value {
- get { return metaParameter.Value; }
- set {
- if (!isTypeSet)
- InferSybaseType (value);
- metaParameter.Value = value;
- }
- }
-
-#if NET_2_0
- public override bool SourceColumnNullMapping {
- get { return sourceColumnNullMapping; }
- set { sourceColumnNullMapping = value; }
- }
-#endif
-
- #endregion // Properties
-
- #region Methods
-
- object ICloneable.Clone ()
- {
- return new SybaseParameter (ParameterName, SybaseType, Size, Direction, IsNullable, Precision, Scale, SourceColumn, SourceVersion, Value);
- }
-
- // If the value is set without the DbType/SybaseType being set, then we
- // infer type information.
- private void InferSybaseType (object value)
- {
- Type type = value.GetType ();
-
- string exception = String.Format ("The parameter data type of {0} is invalid.", type.Name);
-
- switch (type.FullName) {
- case "System.Int64":
- SetSybaseType (SybaseType.BigInt);
- break;
- case "System.Boolean":
- SetSybaseType (SybaseType.Bit);
- break;
- case "System.String":
- SetSybaseType (SybaseType.NVarChar);
- break;
- case "System.DateTime":
- SetSybaseType (SybaseType.DateTime);
- break;
- case "System.Decimal":
- SetSybaseType (SybaseType.Decimal);
- break;
- case "System.Double":
- SetSybaseType (SybaseType.Float);
- break;
- case "System.Byte[]":
- SetSybaseType (SybaseType.VarBinary);
- break;
- case "System.Byte":
- SetSybaseType (SybaseType.TinyInt);
- break;
- case "System.Int32":
- SetSybaseType (SybaseType.Int);
- break;
- case "System.Single":
- SetSybaseType (SybaseType.Real);
- break;
- case "System.Int16":
- SetSybaseType (SybaseType.SmallInt);
- break;
- case "System.Guid":
- SetSybaseType (SybaseType.UniqueIdentifier);
- break;
- case "System.Object":
- SetSybaseType (SybaseType.Variant);
- break;
- default:
- throw new ArgumentException (exception);
- }
- }
-
- // When the DbType is set, we also set the SybaseType, as well as the SQL Server
- // string representation of the type name. If the DbType is not convertible
- // to an SybaseType, throw an exception.
- private void SetDbType (DbType type)
- {
- string exception = String.Format ("No mapping exists from DbType {0} to a known SybaseType.", type);
-
- switch (type) {
- case DbType.AnsiString:
- MetaParameter.TypeName = "varchar";
- sybaseType = SybaseType.VarChar;
- break;
- case DbType.AnsiStringFixedLength:
- MetaParameter.TypeName = "char";
- sybaseType = SybaseType.Char;
- break;
- case DbType.Binary:
- MetaParameter.TypeName = "varbinary";
- sybaseType = SybaseType.VarBinary;
- break;
- case DbType.Boolean:
- MetaParameter.TypeName = "bit";
- sybaseType = SybaseType.Bit;
- break;
- case DbType.Byte:
- MetaParameter.TypeName = "tinyint";
- sybaseType = SybaseType.TinyInt;
- break;
- case DbType.Currency:
- sybaseType = SybaseType.Money;
- MetaParameter.TypeName = "money";
- break;
- case DbType.Date:
- case DbType.DateTime:
- MetaParameter.TypeName = "datetime";
- sybaseType = SybaseType.DateTime;
- break;
- case DbType.Decimal:
- MetaParameter.TypeName = "decimal";
- sybaseType = SybaseType.Decimal;
- break;
- case DbType.Double:
- MetaParameter.TypeName = "float";
- sybaseType = SybaseType.Float;
- break;
- case DbType.Guid:
- MetaParameter.TypeName = "uniqueidentifier";
- sybaseType = SybaseType.UniqueIdentifier;
- break;
- case DbType.Int16:
- MetaParameter.TypeName = "smallint";
- sybaseType = SybaseType.SmallInt;
- break;
- case DbType.Int32:
- MetaParameter.TypeName = "int";
- sybaseType = SybaseType.Int;
- break;
- case DbType.Int64:
- MetaParameter.TypeName = "bigint";
- sybaseType = SybaseType.BigInt;
- break;
- case DbType.Object:
- MetaParameter.TypeName = "sql_variant";
- sybaseType = SybaseType.Variant;
- break;
- case DbType.Single:
- MetaParameter.TypeName = "real";
- sybaseType = SybaseType.Real;
- break;
- case DbType.String:
- MetaParameter.TypeName = "nvarchar";
- sybaseType = SybaseType.NVarChar;
- break;
- case DbType.StringFixedLength:
- MetaParameter.TypeName = "nchar";
- sybaseType = SybaseType.NChar;
- break;
- case DbType.Time:
- MetaParameter.TypeName = "datetime";
- sybaseType = SybaseType.DateTime;
- break;
- default:
- throw new ArgumentException (exception);
- }
- dbType = type;
- }
-
- // Used by internal constructor which has a SQL Server typename
- private void SetDbTypeName (string dbTypeName)
- {
- switch (dbTypeName.ToLower ()) {
- case "bigint":
- SybaseType = SybaseType.BigInt;
- break;
- case "binary":
- SybaseType = SybaseType.Binary;
- break;
- case "bit":
- SybaseType = SybaseType.Bit;
- break;
- case "char":
- SybaseType = SybaseType.Char;
- break;
- case "datetime":
- SybaseType = SybaseType.DateTime;
- break;
- case "decimal":
- SybaseType = SybaseType.Decimal;
- break;
- case "float":
- SybaseType = SybaseType.Float;
- break;
- case "image":
- SybaseType = SybaseType.Image;
- break;
- case "int":
- SybaseType = SybaseType.Int;
- break;
- case "money":
- SybaseType = SybaseType.Money;
- break;
- case "nchar":
- SybaseType = SybaseType.NChar;
- break;
- case "ntext":
- SybaseType = SybaseType.NText;
- break;
- case "nvarchar":
- SybaseType = SybaseType.NVarChar;
- break;
- case "real":
- SybaseType = SybaseType.Real;
- break;
- case "smalldatetime":
- SybaseType = SybaseType.SmallDateTime;
- break;
- case "smallint":
- SybaseType = SybaseType.SmallInt;
- break;
- case "smallmoney":
- SybaseType = SybaseType.SmallMoney;
- break;
- case "text":
- SybaseType = SybaseType.Text;
- break;
- case "timestamp":
- SybaseType = SybaseType.Timestamp;
- break;
- case "tinyint":
- SybaseType = SybaseType.TinyInt;
- break;
- case "uniqueidentifier":
- SybaseType = SybaseType.UniqueIdentifier;
- break;
- case "varbinary":
- SybaseType = SybaseType.VarBinary;
- break;
- case "varchar":
- SybaseType = SybaseType.VarChar;
- break;
- default:
- SybaseType = SybaseType.Variant;
- break;
- }
- }
-
- // When the SybaseType is set, we also set the DbType, as well as the SQL Server
- // string representation of the type name. If the SybaseType is not convertible
- // to a DbType, throw an exception.
- private void SetSybaseType (SybaseType type)
- {
- string exception = String.Format ("No mapping exists from SybaseType {0} to a known DbType.", type);
-
- switch (type) {
- case SybaseType.BigInt:
- MetaParameter.TypeName = "bigint";
- dbType = DbType.Int64;
- break;
- case SybaseType.Binary:
- MetaParameter.TypeName = "binary";
- dbType = DbType.Binary;
- break;
- case SybaseType.Timestamp:
- MetaParameter.TypeName = "timestamp";
- dbType = DbType.Binary;
- break;
- case SybaseType.VarBinary:
- MetaParameter.TypeName = "varbinary";
- dbType = DbType.Binary;
- break;
- case SybaseType.Bit:
- MetaParameter.TypeName = "bit";
- dbType = DbType.Boolean;
- break;
- case SybaseType.Char:
- MetaParameter.TypeName = "char";
- dbType = DbType.AnsiStringFixedLength;
- break;
- case SybaseType.DateTime:
- MetaParameter.TypeName = "datetime";
- dbType = DbType.DateTime;
- break;
- case SybaseType.SmallDateTime:
- MetaParameter.TypeName = "smalldatetime";
- dbType = DbType.DateTime;
- break;
- case SybaseType.Decimal:
- MetaParameter.TypeName = "decimal";
- dbType = DbType.Decimal;
- break;
- case SybaseType.Float:
- MetaParameter.TypeName = "float";
- dbType = DbType.Double;
- break;
- case SybaseType.Image:
- MetaParameter.TypeName = "image";
- dbType = DbType.Binary;
- break;
- case SybaseType.Int:
- MetaParameter.TypeName = "int";
- dbType = DbType.Int32;
- break;
- case SybaseType.Money:
- MetaParameter.TypeName = "money";
- dbType = DbType.Currency;
- break;
- case SybaseType.SmallMoney:
- MetaParameter.TypeName = "smallmoney";
- dbType = DbType.Currency;
- break;
- case SybaseType.NChar:
- MetaParameter.TypeName = "nchar";
- dbType = DbType.StringFixedLength;
- break;
- case SybaseType.NText:
- MetaParameter.TypeName = "ntext";
- dbType = DbType.String;
- break;
- case SybaseType.NVarChar:
- MetaParameter.TypeName = "nvarchar";
- dbType = DbType.String;
- break;
- case SybaseType.Real:
- MetaParameter.TypeName = "real";
- dbType = DbType.Single;
- break;
- case SybaseType.SmallInt:
- MetaParameter.TypeName = "smallint";
- dbType = DbType.Int16;
- break;
- case SybaseType.Text:
- MetaParameter.TypeName = "text";
- dbType = DbType.AnsiString;
- break;
- case SybaseType.VarChar:
- MetaParameter.TypeName = "varchar";
- dbType = DbType.AnsiString;
- break;
- case SybaseType.TinyInt:
- MetaParameter.TypeName = "tinyint";
- dbType = DbType.Byte;
- break;
- case SybaseType.UniqueIdentifier:
- MetaParameter.TypeName = "uniqueidentifier";
- dbType = DbType.Guid;
- break;
- case SybaseType.Variant:
- MetaParameter.TypeName = "sql_variant";
- dbType = DbType.Object;
- break;
- default:
- throw new ArgumentException (exception);
- }
- sybaseType = type;
- }
-
- public override string ToString()
- {
- return ParameterName;
- }
-
-#if NET_2_0
- public override void ResetDbType ()
- {
- InferSybaseType (metaParameter.Value);
- }
-
- public void ResetSybaseDbType ()
- {
- InferSybaseType (metaParameter.Value);
- }
-#endif // NET_2_0
-
- #endregion // Methods
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseParameterCollection.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseParameterCollection.cs
deleted file mode 100644
index b1ca43d5389..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseParameterCollection.cs
+++ /dev/null
@@ -1,428 +0,0 @@
-//
-// Mono.Data.SybaseClient.SybaseParameterCollection.cs
-//
-// Author:
-// Rodrigo Moya (rodrigo@ximian.com)
-// Daniel Morgan (monodanmorg@yahoo.com)
-// Tim Coleman (tim@timcoleman.com)
-//
-// (C) Ximian, Inc 2002
-// Copyright (C) Tim Coleman, 2002
-// Copyright (C) Daniel Morgan, 2008
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.Tds;
-using System;
-using System.ComponentModel;
-using System.Data;
-using System.Data.Common;
-using System.Collections;
-
-namespace Mono.Data.SybaseClient {
- [ListBindable (false)]
-#if NET_2_0
- public sealed class SybaseParameterCollection : DbParameterCollection, IDataParameterCollection, IList, ICollection, IEnumerable
-#else
- public sealed class SybaseParameterCollection : MarshalByRefObject, IDataParameterCollection, IList, ICollection, IEnumerable
-#endif // NET_2_0
- {
- #region Fields
-
- ArrayList list = new ArrayList();
- TdsMetaParameterCollection metaParameters;
- SybaseCommand command;
-
- #endregion // Fields
-
- #region Constructors
-
- internal SybaseParameterCollection (SybaseCommand command)
- {
- this.command = command;
- metaParameters = new TdsMetaParameterCollection ();
- }
-
- #endregion // Constructors
-
- #region Properties
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- int Count {
- get { return list.Count; }
- }
-
-#if NET_2_0
- public override bool IsFixedSize {
- get {
- return list.IsFixedSize;
- }
- }
-
- public override bool IsReadOnly {
- get {
- return list.IsReadOnly;
- }
- }
-
- public override bool IsSynchronized {
- get {
- return list.IsSynchronized;
- }
- }
-
- public override object SyncRoot {
- get {
- return list.SyncRoot;
- }
- }
-#else
- object IList.this [int index] {
- get { return (SybaseParameter) this [index]; }
- set { this [index] = (SybaseParameter) value; }
- }
-
- bool IList.IsFixedSize {
- get { return list.IsFixedSize; }
- }
-
- bool IList.IsReadOnly {
- get { return list.IsReadOnly; }
- }
-
- bool ICollection.IsSynchronized {
- get { return list.IsSynchronized; }
- }
-
- object ICollection.SyncRoot {
- get { return list.SyncRoot; }
- }
-
- object IDataParameterCollection.this [string index] {
- get { return this [index]; }
- set {
- if (!(value is SybaseParameter))
- throw new InvalidCastException ("Only SQLParameter objects can be used.");
- this [index] = (SybaseParameter) value;
- }
- }
-#endif
-
- [Browsable (false)]
- [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
- public
-#if NET_2_0
- new
-#endif // NET_2_0
- SybaseParameter this [int index] {
- get {
- if (index < 0 || index >= list.Count)
- throw new IndexOutOfRangeException ("The specified index is out of range.");
- return (SybaseParameter) list [index];
- }
- set {
- if (index < 0 || index >= list.Count)
- throw new IndexOutOfRangeException ("The specified index is out of range.");
- list [index] = (SybaseParameter) value;
- }
- }
-
- [Browsable (false)]
- [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
- public
-#if NET_2_0
- new
-#endif // NET_2_0
- SybaseParameter this [string parameterName] {
- get {
- foreach (SybaseParameter p in list)
- if (p.ParameterName.Equals (parameterName))
- return p;
- throw new IndexOutOfRangeException ("The specified name does not exist: " + parameterName);
- }
- set {
- if (!Contains (parameterName))
- throw new IndexOutOfRangeException("The specified name does not exist: " + parameterName);
- this [IndexOf (parameterName)] = value;
- }
- }
-
-#if NET_2_0
- protected override DbParameter GetParameter (int index)
- {
- return this [index];
- }
-
- protected override DbParameter GetParameter (string parameterName)
- {
- return this [parameterName];
- }
-
- protected override void SetParameter (int index, DbParameter value)
- {
- this [index] = (SybaseParameter) value;
- }
-
- protected override void SetParameter (string parameterName, DbParameter value)
- {
- this [parameterName] = (SybaseParameter) value;
- }
-#endif
-
- internal TdsMetaParameterCollection MetaParameters {
- get { return metaParameters; }
- }
-
- #endregion // Properties
-
- #region Methods
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- int Add (object value)
- {
- if (!(value is SybaseParameter))
- throw new InvalidCastException ("The parameter was not an SybaseParameter.");
- Add ((SybaseParameter) value);
- return IndexOf (value);
- }
-
- public SybaseParameter Add (SybaseParameter value)
- {
- if (value.Container != null)
- throw new ArgumentException ("The SybaseParameter specified in the value parameter is already added to this or another SybaseParameterCollection.");
-
- value.Container = this;
- list.Add (value);
- metaParameters.Add (value.MetaParameter);
- return value;
- }
-
-#if NET_2_0
- [Obsolete ("Do not call this method.")]
-#endif // NET_2_0
- public SybaseParameter Add (string parameterName, object value)
- {
- return Add (new SybaseParameter (parameterName, value));
- }
-
-#if NET_2_0
- public SybaseParameter AddWithValue (string parameterName, object value)
- {
- return Add (new SybaseParameter (parameterName, value));
- }
-#endif // NET_2_0
-
- public SybaseParameter Add (string parameterName, SybaseType sybaseType)
- {
- return Add (new SybaseParameter (parameterName, sybaseType));
- }
-
- public SybaseParameter Add (string parameterName, SybaseType sybaseType, int size)
- {
- return Add (new SybaseParameter (parameterName, sybaseType, size));
- }
-
- public SybaseParameter Add (string parameterName, SybaseType sybaseType, int size, string sourceColumn)
- {
- return Add (new SybaseParameter (parameterName, sybaseType, size, sourceColumn));
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- void Clear()
- {
- metaParameters.Clear ();
- list.Clear ();
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- bool Contains (object value)
- {
- if (!(value is SybaseParameter))
- throw new InvalidCastException ("The parameter was not an SybaseParameter.");
- return Contains (((SybaseParameter) value).ParameterName);
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- bool Contains (string value)
- {
- foreach (SybaseParameter p in list)
- if (p.ParameterName.Equals (value))
- return true;
- return false;
- }
-
-#if NET_2_0
- public bool Contains (SybaseParameter value)
- {
- return (this.IndexOf(value) != -1);
- }
-#endif // NET_2_0
-
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- void CopyTo (Array array, int index)
- {
- list.CopyTo (array, index);
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- IEnumerator GetEnumerator()
- {
- return list.GetEnumerator ();
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- int IndexOf (object value)
- {
- if (!(value is SybaseParameter))
- throw new InvalidCastException ("The parameter was not an SybaseParameter.");
- return IndexOf (((SybaseParameter) value).ParameterName);
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- int IndexOf (string parameterName)
- {
- return list.IndexOf (parameterName);
- }
-
-#if NET_2_0
- public int IndexOf (SybaseParameter value)
- {
- return list.IndexOf(value);
- }
-#endif // NET_2_0
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- void Insert (int index, object value)
- {
- list.Insert (index, value);
- }
-
-#if NET_2_0
- public void Insert (int index, SybaseParameter value)
- {
- list.Insert (index,value);
- }
-#endif //NET_2_0
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- void Remove (object value)
- {
- metaParameters.Remove (((SybaseParameter) value).MetaParameter);
- list.Remove (value);
- }
-
-#if NET_2_0
- public void Remove (SybaseParameter value)
- {
- //both this and the above code are the same. but need to work with
- // 1.1!
- value.Container = null;
- metaParameters.Remove (value.MetaParameter);
- list.Remove (value);
- }
-#endif //NET_2_0
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- void RemoveAt (int index)
- {
- metaParameters.RemoveAt (index);
- list.RemoveAt (index);
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- void RemoveAt (string parameterName)
- {
- RemoveAt (IndexOf (parameterName));
- }
-
-#if NET_2_0
- public override void AddRange (Array values)
- {
- if (values == null)
- throw new ArgumentNullException("The argument passed was null");
- foreach (object value in values) {
- if (!(value is SybaseParameter))
- throw new InvalidCastException ("Element in the array parameter was not an SqlParameter.");
- SybaseParameter param = (SybaseParameter) value;
- if (param.Container != null)
- throw new ArgumentException ("An SqlParameter specified in the array is already added to this or another SqlParameterCollection.");
- param.Container = this;
- list.Add (param);
- metaParameters.Add (param.MetaParameter);
- }
- }
-
- public void AddRange (SybaseParameter[] values)
- {
- AddRange((Array) values);
- }
-
- public void CopyTo (SybaseParameter[] array, int index)
- {
- list.CopyTo (array, index);
- }
-#endif
-
- #endregion // Methods
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybasePermission.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybasePermission.cs
deleted file mode 100644
index ae8d5d0f3a6..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybasePermission.cs
+++ /dev/null
@@ -1,113 +0,0 @@
-//
-// Mono.Data.SybaseClient.SybasePermission.cs
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Copyright (C) Tim Coleman, 2002
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Data;
-using System.Data.Common;
-using System.Security;
-using System.Security.Permissions;
-
-namespace Mono.Data.SybaseClient {
- public sealed class SybasePermission : DBDataPermission
- {
-#if NET_2_0
- [Obsolete ("Use SybasePermission(PermissionState.None)", true)]
-#endif
- [MonoTODO]
- public SybasePermission ()
-#if NET_2_0
- : base (PermissionState.None)
-#endif
- {
- // FIXME: do constructor
- }
-
- [MonoTODO]
- public SybasePermission (PermissionState state)
- : base (state)
- {
- // FIXME: do constructor
- }
-
-#if NET_2_0
- [Obsolete ("Use SybasePermission(PermissionState.None)", true)]
-#endif
- [MonoTODO]
- public SybasePermission (PermissionState state, bool allowBlankPassword)
-#if NET_2_0
- : base (PermissionState.None)
-#endif
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- public override IPermission Copy ()
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- public override void FromXml (SecurityElement securityElement)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- public override IPermission Intersect (IPermission target)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- public override bool IsSubsetOf (IPermission target)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- public override string ToString ()
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- public override SecurityElement ToXml ()
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- public override IPermission Union (IPermission target)
- {
- throw new NotImplementedException ();
- }
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybasePermissionAttribute.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybasePermissionAttribute.cs
deleted file mode 100644
index b20ff815ead..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybasePermissionAttribute.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// Mono.Data.SybaseClient.SybasePermissionAttribute.cs
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Copyright (C) Tim Coleman, 2002
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Data;
-using System.Data.Common;
-using System.Security;
-using System.Security.Permissions;
-
-namespace Mono.Data.SybaseClient {
- [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method)]
- [Serializable]
- public sealed class SybasePermissionAttribute : DBDataPermissionAttribute
- {
- [MonoTODO]
- public SybasePermissionAttribute(SecurityAction action)
- : base(action)
- {
- // FIXME: do constructor
- }
-
- [MonoTODO]
- public override IPermission CreatePermission()
- {
- throw new NotImplementedException ();
- }
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatedEventArgs.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatedEventArgs.cs
deleted file mode 100644
index 27bc1a31c7f..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatedEventArgs.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-//
-// System.Data.SybaseClient.SybaseRowUpdatedEventArgs.cs
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Copyright (C) Tim Coleman, 2002
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Data;
-using System.Data.Common;
-
-namespace Mono.Data.SybaseClient {
- public sealed class SybaseRowUpdatedEventArgs : RowUpdatedEventArgs
- {
- #region Constructors
-
- public SybaseRowUpdatedEventArgs (DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
- : base (row, command, statementType, tableMapping)
- {
- }
-
- #endregion // Constructors
-
- #region Properties
-
- public new SybaseCommand Command
- {
- get { return (SybaseCommand) base.Command; }
- }
-
- #endregion // Properties
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatedEventHandler.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatedEventHandler.cs
deleted file mode 100644
index fa4bf32c889..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatedEventHandler.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// Mono.Data.SybaseClient.SybaseRowUpdatedEventHandler.cs
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Copyright (C) Tim Coleman, 2002
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Data;
-
-namespace Mono.Data.SybaseClient {
- public delegate void SybaseRowUpdatedEventHandler (object sender, SybaseRowUpdatedEventArgs e);
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatingEventArgs.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatingEventArgs.cs
deleted file mode 100644
index f9c4033ce3f..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatingEventArgs.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-//
-// Mono.Data.SybaseClient.SybaseRowUpdatingEventArgs.cs
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Copyright (C) Tim Coleman, 2002
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Data;
-using System.Data.Common;
-
-namespace Mono.Data.SybaseClient {
- public sealed class SybaseRowUpdatingEventArgs : RowUpdatingEventArgs
- {
- #region Constructors
-
- public SybaseRowUpdatingEventArgs (DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
- : base (row, command, statementType, tableMapping)
- {
- }
-
- #endregion // Constructors
-
- #region Properties
-
- public new SybaseCommand Command {
- get { return (SybaseCommand) base.Command; }
- set { base.Command = value; }
- }
-
- #endregion // Properties
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatingEventHandler.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatingEventHandler.cs
deleted file mode 100644
index 7a9118694a0..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseRowUpdatingEventHandler.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// Mono.Data.SybaseClient.SybaseRowUpdatingEventHandler.cs
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Copyright (C) Tim Coleman, 2002
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Data;
-
-namespace Mono.Data.SybaseClient {
- public delegate void SybaseRowUpdatingEventHandler (object sender, SybaseRowUpdatingEventArgs e);
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseTransaction.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseTransaction.cs
deleted file mode 100644
index 609a9d88c38..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseTransaction.cs
+++ /dev/null
@@ -1,168 +0,0 @@
-//
-// Mono.Data.SybaseClient.SybaseTransaction.cs
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-// Daniel Morgan (monodanmorg@yahoo.com)
-//
-// Copyright (C) Tim Coleman, 2002, 2008
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Data;
-using System.Data.Common;
-
-namespace Mono.Data.SybaseClient {
-#if NET_2_0
- public sealed class SybaseTransaction : DbTransaction, IDbTransaction, IDisposable
-#else
- public sealed class SybaseTransaction : MarshalByRefObject, IDbTransaction, IDisposable
-#endif // NET_2_0
- {
- #region Fields
-
- bool disposed = false;
-
- SybaseConnection connection;
- IsolationLevel isolationLevel;
- bool isOpen;
-
- #endregion
-
- #region Constructors
-
- internal SybaseTransaction (SybaseConnection connection, IsolationLevel isolevel)
- {
- this.connection = connection;
- this.isolationLevel = isolevel;
- isOpen = true;
- }
-
- #endregion // Constructors
-
- #region Properties
-
- public
-#if NET_2_0
- new
-#endif // NET_2_0
- SybaseConnection Connection {
- get { return connection; }
- }
-
- internal bool IsOpen {
- get { return isOpen; }
- }
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- IsolationLevel IsolationLevel {
- get { return isolationLevel; }
- }
-
-#if NET_2_0
- protected override DbConnection DbConnection {
- get { return Connection; }
- }
-#else
- IDbConnection IDbTransaction.Connection {
- get { return Connection; }
- }
-#endif
-
- #endregion // Properties
-
- #region Methods
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- void Commit ()
- {
- if (!isOpen)
- throw new InvalidOperationException ("The Transaction was not open.");
- connection.Tds.Execute ("COMMIT TRANSACTION");
- connection.Transaction = null;
- isOpen = false;
- }
-
-#if NET_2_0
- protected override
-#endif
- void Dispose (bool disposing)
- {
- if (!disposed) {
- if (disposing)
- Rollback ();
- disposed = true;
- }
- }
-
-#if !NET_2_0
- public void Dispose ()
- {
- Dispose (true);
- GC.SuppressFinalize (this);
- }
-#endif
-
- public
-#if NET_2_0
- override
-#endif // NET_2_0
- void Rollback ()
- {
- Rollback (String.Empty);
- }
-
- public void Rollback (string transactionName)
- {
-#if NET_2_0
- if (disposed)
- return;
-#endif
-
- if (!isOpen)
- throw new InvalidOperationException ("The Transaction was not open.");
-
- connection.Tds.Execute (String.Format ("IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION {0}",
- transactionName));
- isOpen = false;
- connection.Transaction = null;
- connection = null;
- }
-
- public void Save (string savePointName)
- {
- if (!isOpen)
- throw new InvalidOperationException ("The Transaction was not open.");
- connection.Tds.Execute (String.Format ("SAVE TRANSACTION {0}", savePointName));
- }
-
- #endregion // Methods
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseType.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseType.cs
deleted file mode 100644
index 90b3cc987bf..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseClient/SybaseType.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-//
-// Mono.Data.SybaseClient.SybaseType.cs
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-// Daniel Morgan (monodanmorg@yahoo.com)
-//
-// Copyright (C) Tim Coleman, 2002
-// Copyright (C) Daniel Morgan, 2008
-//
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Mono.Data.SybaseClient {
-#if !NET_2_0
- [Serializable]
-#endif
- public enum SybaseType
- {
- BigInt = 0,
- Binary = 1,
- Bit = 2,
- Char = 3,
- DateTime = 4,
- Decimal = 5,
- Float = 6,
- Image = 7,
- Int = 8,
- Money = 9,
- NChar = 10,
- NText = 11,
- NVarChar = 12,
- Real = 13,
- UniqueIdentifier = 14,
- SmallDateTime = 15,
- SmallInt = 16,
- SmallMoney = 17,
- Text = 18,
- Timestamp = 19,
- TinyInt = 20,
- VarBinary = 21,
- VarChar = 22,
- Variant = 23
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseBinary.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseBinary.cs
deleted file mode 100644
index b7f9f61ba4c..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseBinary.cs
+++ /dev/null
@@ -1,301 +0,0 @@
-//
-// Mono.Data.SybaseTypes.SybaseBinary
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Based on System.Data.SqlTypes.SqlBinary
-//
-// (C) Ximian, Inc. 2002-2003
-// (C) Copyright Tim Coleman, 2002-2003
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.SybaseClient;
-using System;
-using System.Data.SqlTypes;
-using System.Globalization;
-
-namespace Mono.Data.SybaseTypes {
- public struct SybaseBinary : INullable, IComparable
- {
- #region Fields
-
- byte[] value;
- private bool notNull;
-
- public static readonly SybaseBinary Null;
-
- #endregion
-
- #region Constructors
-
- public SybaseBinary (byte[] value)
- {
- this.value = value;
- notNull = true;
- }
-
- #endregion
-
- #region Properties
-
- public bool IsNull {
- get { return !notNull; }
- }
-
- public byte this[int index] {
- get {
- if (this.IsNull)
- throw new SybaseNullValueException ("The property contains Null.");
- else if (index >= this.Length)
- throw new SybaseNullValueException ("The index parameter indicates a position beyond the length of the byte array.");
- else
- return value [index];
- }
- }
-
- public int Length {
- get {
- if (this.IsNull)
- throw new SybaseNullValueException ("The property contains Null.");
- else
- return value.Length;
- }
- }
-
- public byte[] Value
- {
- get {
- if (this.IsNull)
- throw new SybaseNullValueException ("The property contains Null.");
- else
- return value;
- }
- }
-
- #endregion
-
- #region Methods
-
- public int CompareTo (object value)
- {
- if (value == null)
- return 1;
- else if (!(value is SybaseBinary))
- throw new ArgumentException ("Value is not a Mono.Data.SybaseTypes.SybaseBinary.");
- else if (((SybaseBinary) value).IsNull)
- return 1;
- else
- return Compare (this, (SybaseBinary) value);
- }
-
- public static SybaseBinary Concat (SybaseBinary x, SybaseBinary y)
- {
- return (x + y);
- }
-
- public override bool Equals (object value)
- {
- if (!(value is SybaseBinary))
- return false;
- else
- return (bool) (this == (SybaseBinary)value);
- }
-
- public static SybaseBoolean Equals (SybaseBinary x, SybaseBinary y)
- {
- return (x == y);
- }
-
- public override int GetHashCode ()
- {
- int result = 10;
- for (int i = 0; i < value.Length; i += 1)
- result = 91 * result + ((int) value [i]);
- return result;
- }
-
- #endregion
-
- #region Operators
-
- public static SybaseBoolean GreaterThan (SybaseBinary x, SybaseBinary y)
- {
- return (x > y);
- }
-
- public static SybaseBoolean GreaterThanOrEqual (SybaseBinary x, SybaseBinary y)
- {
- return (x >= y);
- }
-
- public static SybaseBoolean LessThan (SybaseBinary x, SybaseBinary y)
- {
- return (x < y);
- }
-
- public static SybaseBoolean LessThanOrEqual (SybaseBinary x, SybaseBinary y)
- {
- return (x <= y);
- }
-
- public static SybaseBoolean NotEquals (SybaseBinary x, SybaseBinary y)
- {
- return (x != y);
- }
-
- public SybaseGuid ToSybaseGuid ()
- {
- return new SybaseGuid (value);
- }
-
- public override string ToString ()
- {
- if (IsNull)
- return "null";
- return String.Format ("SybaseBinary ({0})", Length);
- }
-
- #endregion
-
- #region Operators
-
- public static SybaseBinary operator + (SybaseBinary x, SybaseBinary y)
- {
- byte[] b = new byte [x.Length + y.Length];
- int j = 0;
- int i;
-
- for (i = 0; i < x.Length; i += 1)
- b [i] = x [i];
-
- for (; i < x.Length + y.Length; i += 1) {
- b [i] = y [j];
- j += 1;
- }
-
- return new SybaseBinary (b);
- }
-
- public static SybaseBoolean operator == (SybaseBinary x, SybaseBinary y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (Compare (x, y) == 0);
- }
-
- public static SybaseBoolean operator > (SybaseBinary x, SybaseBinary y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (Compare (x, y) > 0);
- }
-
- public static SybaseBoolean operator >= (SybaseBinary x, SybaseBinary y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (Compare (x, y) >= 0);
- }
-
- public static SybaseBoolean operator != (SybaseBinary x, SybaseBinary y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (Compare (x, y) != 0);
- }
-
- public static SybaseBoolean operator < (SybaseBinary x, SybaseBinary y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (Compare (x, y) < 0);
- }
-
- public static SybaseBoolean operator <= (SybaseBinary x, SybaseBinary y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (Compare (x, y) <= 0);
- }
-
- public static explicit operator byte[] (SybaseBinary x)
- {
- return x.Value;
- }
-
- public static explicit operator SybaseBinary (SybaseGuid x)
- {
- return new SybaseBinary (x.ToByteArray ());
- }
-
- public static implicit operator SybaseBinary (byte[] x)
- {
- return new SybaseBinary (x);
- }
-
- private static int Compare (SybaseBinary x, SybaseBinary y)
- {
- int lengthDiff = 0;
-
- if (x.Length != y.Length) {
- lengthDiff = x.Length - y.Length;
-
- // if diff more than 0, x is longer
- if (lengthDiff > 0) {
- for (int i = x.Length - 1; i > x.Length - lengthDiff; i -= 1)
- if (x [i] != (byte) 0)
- return 1;
- } else {
- for (int i = y.Length - 1; i > y.Length - lengthDiff; i -= 1)
- if (y [i] != (byte) 0)
- return -1;
- }
- }
-
- // choose shorter
- int len = (lengthDiff > 0) ? y.Length : x.Length;
-
- for (int i = len - 1; i > 0; i -= 1) {
- byte bx = x [i];
- byte by = y [i];
-
- if (bx > by)
- return 1;
- else if (bx < by)
- return -1;
- }
-
- return 0;
- }
-
- #endregion
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseBoolean.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseBoolean.cs
deleted file mode 100644
index 0a7c5e267f1..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseBoolean.cs
+++ /dev/null
@@ -1,408 +0,0 @@
-//
-// Mono.Data.SybaseTypes.SybaseBoolean
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Based on System.Data.SqlTypes.SqlBoolean
-//
-// (C) Ximian, Inc. 2002-2003
-// (C) Copyright Tim Coleman, 2002-2003
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.SybaseClient;
-using System;
-using System.Data.SqlTypes;
-using System.Globalization;
-
-namespace Mono.Data.SybaseTypes {
- public struct SybaseBoolean : INullable, IComparable
- {
- #region Fields
-
- byte value;
-
- // default is false
- private bool notNull;
-
- public static readonly SybaseBoolean False = new SybaseBoolean (false);
- public static readonly SybaseBoolean Null;
- public static readonly SybaseBoolean One = new SybaseBoolean (1);
- public static readonly SybaseBoolean True = new SybaseBoolean (true);
- public static readonly SybaseBoolean Zero = new SybaseBoolean (0);
-
- #endregion // Fields
-
- #region Constructors
-
- public SybaseBoolean (bool value)
- {
- this.value = (byte) (value ? 1 : 0);
- notNull = true;
- }
-
- public SybaseBoolean (int value)
- {
- this.value = (byte) (value != 0 ? 1 : 0);
- notNull = true;
- }
-
- #endregion // Constructors
-
- #region Properties
-
- public byte ByteValue {
- get {
- if (this.IsNull)
- throw new SybaseNullValueException(Locale.GetText("The property is set to null."));
- else
- return value;
- }
- }
-
- public bool IsFalse {
- get {
- if (this.IsNull)
- return false;
- else
- return (value == 0);
- }
- }
-
- public bool IsNull {
- get {
- return !notNull;
- }
- }
-
- public bool IsTrue {
- get {
- if (this.IsNull)
- return false;
- else
- return (value != 0);
- }
- }
-
- public bool Value {
- get {
- if (this.IsNull)
- throw new SybaseNullValueException(Locale.GetText("The property is set to null."));
- else
- return this.IsTrue;
- }
- }
-
- #endregion // Properties
-
- public static SybaseBoolean And (SybaseBoolean x, SybaseBoolean y)
- {
- return (x & y);
- }
-
- public int CompareTo (object value)
- {
- if (value == null)
- return 1;
- else if (!(value is SybaseBoolean))
- throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseBoolean"));
- else if (((SybaseBoolean)value).IsNull)
- return 1;
- else
- return this.value.CompareTo (((SybaseBoolean)value).ByteValue);
- }
-
- public override bool Equals(object value)
- {
- if (!(value is SybaseByte))
- return false;
- else
- return (bool) (this == (SybaseBoolean)value);
- }
-
- public static SybaseBoolean Equals(SybaseBoolean x, SybaseBoolean y)
- {
- return (x == y);
- }
-
- public override int GetHashCode()
- {
- return (int)value;
- }
-
- public static SybaseBoolean NotEquals(SybaseBoolean x, SybaseBoolean y)
- {
- return (x != y);
- }
-
- public static SybaseBoolean OnesComplement(SybaseBoolean x)
- {
- return ~x;
- }
-
- public static SybaseBoolean Or(SybaseBoolean x, SybaseBoolean y)
- {
- return (x | y);
- }
-
- public static SybaseBoolean Parse(string s)
- {
- return new SybaseBoolean (Boolean.Parse (s));
- }
-
- public SybaseByte ToSybaseByte()
- {
- return new SybaseByte (value);
- }
-
- // **************************************************
- // Conversion from SybaseBoolean to other SybaseTypes
- // **************************************************
-
- public SybaseDecimal ToSybaseDecimal()
- {
- return ((SybaseDecimal)this);
- }
-
- public SybaseDouble ToSybaseDouble()
- {
- return ((SybaseDouble)this);
- }
-
- public SybaseInt16 ToSybaseInt16()
- {
- return ((SybaseInt16)this);
- }
-
- public SybaseInt32 ToSybaseInt32()
- {
- return ((SybaseInt32)this);
- }
-
- public SybaseInt64 ToSybaseInt64()
- {
- return ((SybaseInt64)this);
- }
-
- public SybaseMoney ToSybaseMoney()
- {
- return ((SybaseMoney)this);
- }
-
- public SybaseSingle ToSybaseSingle()
- {
- return ((SybaseSingle)this);
- }
-
- public SybaseString ToSybaseString()
- {
- if (this.IsNull)
- return new SybaseString ("Null");
- if (this.IsTrue)
- return new SybaseString ("True");
- else
- return new SybaseString ("False");
- }
-
- public override string ToString()
- {
- if (this.IsNull)
- return "Null";
- if (this.IsTrue)
- return "True";
- else
- return "False";
- }
-
- // Bitwise exclusive-OR (XOR)
- public static SybaseBoolean Xor(SybaseBoolean x, SybaseBoolean y)
- {
- return (x ^ y);
- }
-
- // **************************************************
- // Public Operators
- // **************************************************
-
- // Bitwise AND
- public static SybaseBoolean operator & (SybaseBoolean x, SybaseBoolean y)
- {
- return new SybaseBoolean (x.Value & y.Value);
- }
-
- // Bitwise OR
- public static SybaseBoolean operator | (SybaseBoolean x, SybaseBoolean y)
- {
- return new SybaseBoolean (x.Value | y.Value);
-
- }
-
- // Compares two instances for equality
- public static SybaseBoolean operator == (SybaseBoolean x, SybaseBoolean y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value == y.Value);
- }
-
- // Bitwize exclusive-OR (XOR)
- public static SybaseBoolean operator ^ (SybaseBoolean x, SybaseBoolean y)
- {
- return new SybaseBoolean (x.Value ^ y.Value);
- }
-
- // test Value of SybaseBoolean to determine it is false.
- public static bool operator false (SybaseBoolean x)
- {
- return x.IsFalse;
- }
-
- // in-equality
- public static SybaseBoolean operator != (SybaseBoolean x, SybaseBoolean y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value != y.Value);
- }
-
- // Logical NOT
- public static SybaseBoolean operator ! (SybaseBoolean x)
- {
- if (x.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (!x.Value);
- }
-
- // One's Complement
- public static SybaseBoolean operator ~ (SybaseBoolean x)
- {
- return new SybaseBoolean (~x.ByteValue);
- }
-
- // test to see if value is true
- public static bool operator true (SybaseBoolean x)
- {
- return x.IsTrue;
- }
-
- // ****************************************
- // Type Conversion
- // ****************************************
-
-
- // SybaseBoolean to Boolean
- public static explicit operator bool (SybaseBoolean x)
- {
- return x.Value;
- }
-
-
- // SybaseByte to SybaseBoolean
- public static explicit operator SybaseBoolean (SybaseByte x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseBoolean ((int)x.Value);
- }
-
- // SybaseDecimal to SybaseBoolean
- public static explicit operator SybaseBoolean (SybaseDecimal x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseBoolean ((int)x.Value);
- }
-
- // SybaseDouble to SybaseBoolean
- public static explicit operator SybaseBoolean (SybaseDouble x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseBoolean ((int)x.Value);
- }
-
- // SybaseInt16 to SybaseBoolean
- public static explicit operator SybaseBoolean (SybaseInt16 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseBoolean ((int)x.Value);
- }
-
- // SybaseInt32 to SybaseBoolean
- public static explicit operator SybaseBoolean (SybaseInt32 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseBoolean (x.Value);
- }
-
- // SybaseInt64 to SybaseBoolean
- public static explicit operator SybaseBoolean (SybaseInt64 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseBoolean ((int)x.Value);
- }
-
- // SybaseMoney to SybaseBoolean
- public static explicit operator SybaseBoolean (SybaseMoney x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseBoolean ((int)x.Value);
- }
-
- // SybaseSingle to SybaseBoolean
- public static explicit operator SybaseBoolean (SybaseSingle x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseBoolean ((int)x.Value);
- }
-
- // SybaseString to SybaseBoolean
- public static explicit operator SybaseBoolean (SybaseString x)
- {
- return SybaseBoolean.Parse (x.Value);
- }
-
- // Boolean to SybaseBoolean
- public static implicit operator SybaseBoolean (bool x)
- {
- return new SybaseBoolean (x);
- }
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseByte.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseByte.cs
deleted file mode 100644
index ac9726dd248..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseByte.cs
+++ /dev/null
@@ -1,418 +0,0 @@
-//
-// Mono.Data.SybaseTypes.SybaseByte
-//
-// Author:
-// Tim Coleman <tim@timcoleman.com>
-//
-// Based on System.Data.SqlTypes.SqlByte
-//
-//
-// (C) Ximian, Inc. 2002-2003
-// (C) Copyright Tim Coleman, 2002
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.SybaseClient;
-using System;
-using System.Data.SqlTypes;
-using System.Globalization;
-
-namespace Mono.Data.SybaseTypes {
- public struct SybaseByte : INullable, IComparable
- {
- #region Fields
-
- byte value;
- private bool notNull;
-
- public static readonly SybaseByte MaxValue = new SybaseByte (0xff);
- public static readonly SybaseByte MinValue = new SybaseByte (0);
- public static readonly SybaseByte Null;
- public static readonly SybaseByte Zero = new SybaseByte (0);
-
- #endregion
-
- #region Constructors
-
- public SybaseByte (byte value)
- {
- this.value = value;
- notNull = true;
- }
-
- #endregion
-
- #region Properties
-
- public bool IsNull {
- get { return !notNull; }
- }
-
- public byte Value {
- get {
- if (this.IsNull)
- throw new SybaseNullValueException ();
- else
- return value;
- }
- }
-
- #endregion
-
- #region Methods
-
- public static SybaseByte Add (SybaseByte x, SybaseByte y)
- {
- return (x + y);
- }
-
- public static SybaseByte BitwiseAnd (SybaseByte x, SybaseByte y)
- {
- return (x & y);
- }
-
- public static SybaseByte BitwiseOr (SybaseByte x, SybaseByte y)
- {
- return (x | y);
- }
-
- public int CompareTo (object value)
- {
- if (value == null)
- return 1;
- else if (!(value is SybaseByte))
- throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseByte"));
- else if (((SybaseByte)value).IsNull)
- return 1;
- else
- return this.value.CompareTo (((SybaseByte)value).Value);
- }
-
- public static SybaseByte Divide (SybaseByte x, SybaseByte y)
- {
- return (x / y);
- }
-
- public override bool Equals (object value)
- {
- if (!(value is SybaseByte))
- return false;
- else
- return (bool) (this == (SybaseByte)value);
- }
-
- public static SybaseBoolean Equals (SybaseByte x, SybaseByte y)
- {
- return (x == y);
- }
-
- public override int GetHashCode ()
- {
- return (int)value;
- }
-
- public static SybaseBoolean GreaterThan (SybaseByte x, SybaseByte y)
- {
- return (x > y);
- }
-
- public static SybaseBoolean GreaterThanOrEqual (SybaseByte x, SybaseByte y)
- {
- return (x >= y);
- }
-
- public static SybaseBoolean LessThan (SybaseByte x, SybaseByte y)
- {
- return (x < y);
- }
-
- public static SybaseBoolean LessThanOrEqual (SybaseByte x, SybaseByte y)
- {
- return (x <= y);
- }
-
- public static SybaseByte Mod (SybaseByte x, SybaseByte y)
- {
- return (x % y);
- }
-
- public static SybaseByte Multiply (SybaseByte x, SybaseByte y)
- {
- return (x * y);
- }
-
- public static SybaseBoolean NotEquals (SybaseByte x, SybaseByte y)
- {
- return (x != y);
- }
-
- public static SybaseByte OnesComplement (SybaseByte x)
- {
- return ~x;
- }
-
- public static SybaseByte Parse (string s)
- {
- return new SybaseByte (Byte.Parse (s));
- }
-
- public static SybaseByte Subtract (SybaseByte x, SybaseByte y)
- {
- return (x - y);
- }
-
- public SybaseBoolean ToSybaseBoolean ()
- {
- return ((SybaseBoolean)this);
- }
-
- public SybaseDecimal ToSybaseDecimal ()
- {
- return ((SybaseDecimal)this);
- }
-
- public SybaseDouble ToSybaseDouble ()
- {
- return ((SybaseDouble)this);
- }
-
- public SybaseInt16 ToSybaseInt16 ()
- {
- return ((SybaseInt16)this);
- }
-
- public SybaseInt32 ToSybaseInt32 ()
- {
- return ((SybaseInt32)this);
- }
-
- public SybaseInt64 ToSybaseInt64 ()
- {
- return ((SybaseInt64)this);
- }
-
- public SybaseMoney ToSybaseMoney ()
- {
- return ((SybaseMoney)this);
- }
-
- public SybaseSingle ToSybaseSingle ()
- {
- return ((SybaseSingle)this);
- }
-
- public SybaseString ToSybaseString ()
- {
- return ((SybaseString)this);
- }
-
- public override string ToString ()
- {
- if (this.IsNull)
- return "Null";
- else
- return value.ToString ();
- }
-
- public static SybaseByte Xor (SybaseByte x, SybaseByte y)
- {
- return (x ^ y);
- }
-
- public static SybaseByte operator + (SybaseByte x, SybaseByte y)
- {
- return new SybaseByte ((byte) (x.Value + y.Value));
- }
-
- public static SybaseByte operator & (SybaseByte x, SybaseByte y)
- {
- return new SybaseByte ((byte) (x.Value & y.Value));
- }
-
- public static SybaseByte operator | (SybaseByte x, SybaseByte y)
- {
- return new SybaseByte ((byte) (x.Value | y.Value));
- }
-
- public static SybaseByte operator / (SybaseByte x, SybaseByte y)
- {
- return new SybaseByte ((byte) (x.Value / y.Value));
- }
-
- public static SybaseBoolean operator == (SybaseByte x, SybaseByte y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value == y.Value);
- }
-
- public static SybaseByte operator ^ (SybaseByte x, SybaseByte y)
- {
- return new SybaseByte ((byte) (x.Value ^ y.Value));
- }
-
- public static SybaseBoolean operator > (SybaseByte x, SybaseByte y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value > y.Value);
- }
-
- public static SybaseBoolean operator >= (SybaseByte x, SybaseByte y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value >= y.Value);
- }
-
- public static SybaseBoolean operator != (SybaseByte x, SybaseByte y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (!(x.Value == y.Value));
- }
-
- public static SybaseBoolean operator < (SybaseByte x, SybaseByte y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value < y.Value);
- }
-
- public static SybaseBoolean operator <= (SybaseByte x, SybaseByte y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value <= y.Value);
- }
-
- public static SybaseByte operator % (SybaseByte x, SybaseByte y)
- {
- return new SybaseByte ((byte) (x.Value % y.Value));
- }
-
- public static SybaseByte operator * (SybaseByte x, SybaseByte y)
- {
- return new SybaseByte ((byte) (x.Value * y.Value));
- }
-
- public static SybaseByte operator ~ (SybaseByte x)
- {
- return new SybaseByte ((byte) ~x.Value);
- }
-
- public static SybaseByte operator - (SybaseByte x, SybaseByte y)
- {
- return new SybaseByte ((byte) (x.Value - y.Value));
- }
-
- public static explicit operator SybaseByte (SybaseBoolean x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseByte (x.ByteValue);
- }
-
- public static explicit operator byte (SybaseByte x)
- {
- return x.Value;
- }
-
- public static explicit operator SybaseByte (SybaseDecimal x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseByte ((byte)x.Value);
- }
-
- public static explicit operator SybaseByte (SybaseDouble x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseByte ((byte)x.Value);
- }
-
- public static explicit operator SybaseByte (SybaseInt16 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseByte ((byte)x.Value);
- }
-
- public static explicit operator SybaseByte (SybaseInt32 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseByte ((byte)x.Value);
- }
-
- public static explicit operator SybaseByte (SybaseInt64 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseByte ((byte)x.Value);
- }
-
- public static explicit operator SybaseByte (SybaseMoney x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseByte ((byte)x.Value);
- }
-
- public static explicit operator SybaseByte (SybaseSingle x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseByte ((byte)x.Value);
- }
-
-
- public static explicit operator SybaseByte (SybaseString x)
- {
- return SybaseByte.Parse (x.Value);
- }
-
- public static implicit operator SybaseByte (byte x)
- {
- return new SybaseByte (x);
- }
-
- #endregion
- }
-}
-
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseCompareOptions.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseCompareOptions.cs
deleted file mode 100644
index 340571a7f13..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseCompareOptions.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// Mono.Data.SybaseTypes.SybaseCompareOptions.cs
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Copyright (C) Tim Coleman, 2002
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.SybaseClient;
-using System;
-
-namespace Mono.Data.SybaseTypes {
- /// <summary>
- /// Specifies the compare option values for a SybaseString structure.
- /// </summary>
- [Flags]
- [Serializable]
- public enum SybaseCompareOptions {
- BinarySort = 0x8000,
- IgnoreCase = 0x1,
- IgnoreKanaType = 0x8,
- IgnoreNonSpace = 0x2,
- IgnoreWidth = 0x10,
- None = 0
- }
-
-}
-
-
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDateTime.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDateTime.cs
deleted file mode 100644
index 895cdff6ab3..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDateTime.cs
+++ /dev/null
@@ -1,285 +0,0 @@
-//
-// Mono.Data.SybaseTypes.SybaseDateTime
-//
-// Author:
-// Tim Coleman <tim@timcoleman.com>
-//
-// Based on System.Data.SqlTypes.SqlDateTime
-//
-// (C) Ximian, Inc. 2002-2003
-// (C) Copyright Tim Coleman, 2002-2003
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.SybaseClient;
-using System;
-using System.Data.SqlTypes;
-using System.Globalization;
-
-namespace Mono.Data.SybaseTypes {
- public struct SybaseDateTime : INullable, IComparable
- {
- #region Fields
- private DateTime value;
- private bool notNull;
- private static readonly float DateTimeTicksPerHour = 3.6E+10f;
- private static readonly DateTime Epoch = new DateTime (1900, 1, 1);
-
- public static readonly SybaseDateTime MaxValue = new SybaseDateTime (9999, 12, 31, 23, 59, 59);
- public static readonly SybaseDateTime MinValue = new SybaseDateTime (1753,1,1);
- public static readonly SybaseDateTime Null;
- public static readonly int SQLTicksPerHour = 1080000;
- public static readonly int SQLTicksPerMinute = 18000;
- public static readonly int SQLTicksPerSecond = 300;
-
- #endregion
-
- #region Constructors
-
- public SybaseDateTime (DateTime value)
- {
- this.value = value;
- notNull = true;
- }
-
- public SybaseDateTime (int dayTicks, int timeTicks)
- {
- this.value = new DateTime (Epoch.Ticks + (long) (dayTicks + timeTicks));
- notNull = true;
- }
-
- public SybaseDateTime (int year, int month, int day)
- {
- this.value = new DateTime (year, month, day);
- notNull = true;
- }
-
- public SybaseDateTime (int year, int month, int day, int hour, int minute, int second)
- {
- this.value = new DateTime (year, month, day, hour, minute, second);
- notNull = true;
- }
-
- public SybaseDateTime (int year, int month, int day, int hour, int minute, int second, double millisecond)
- {
- DateTime t = new DateTime (year, month, day);
- this.value = new DateTime ((long) (t.Day * 24 * SQLTicksPerHour + hour * SQLTicksPerHour + minute * SQLTicksPerMinute + second * SQLTicksPerSecond + millisecond * 1000));
- notNull = true;
- }
-
- public SybaseDateTime (int year, int month, int day, int hour, int minute, int second, int bilisecond)
- {
- DateTime t = new DateTime (year, month, day);
- this.value = new DateTime ((long) (t.Day * 24 * SQLTicksPerHour + hour * SQLTicksPerHour + minute * SQLTicksPerMinute + second * SQLTicksPerSecond + bilisecond));
- notNull = true;
- }
-
- #endregion
-
- #region Properties
-
- public int DayTicks {
- get {
- return (int) ((this.Value.Ticks - Epoch.Ticks) / (24 * DateTimeTicksPerHour));
- }
- }
-
- public bool IsNull {
- get { return !notNull; }
- }
-
- public int TimeTicks {
- get {
- if (this.IsNull)
- throw new SybaseNullValueException ();
- return (int) (value.Hour * SQLTicksPerHour + value.Minute * SQLTicksPerMinute + value.Second * SQLTicksPerSecond + value.Millisecond);
- }
- }
-
- public DateTime Value {
- get {
- if (this.IsNull)
- throw new SybaseNullValueException ("The property contains Null.");
- else
- return value;
- }
- }
-
- #endregion
-
- #region Methods
-
- public int CompareTo (object value)
- {
- if (value == null)
- return 1;
- else if (!(value is SybaseDateTime))
- throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseDateTime"));
- else if (((SybaseDateTime)value).IsNull)
- return 1;
- else
- return this.value.CompareTo (((SybaseDateTime)value).Value);
- }
-
- public override bool Equals (object value)
- {
- if (!(value is SybaseDateTime))
- return false;
- else
- return (bool) (this == (SybaseDateTime)value);
- }
-
- public static SybaseBoolean Equals (SybaseDateTime x, SybaseDateTime y)
- {
- return (x == y);
- }
-
- public override int GetHashCode ()
- {
- return value.GetHashCode ();
- }
-
- public static SybaseBoolean GreaterThan (SybaseDateTime x, SybaseDateTime y)
- {
- return (x > y);
- }
-
- public static SybaseBoolean GreaterThanOrEqual (SybaseDateTime x, SybaseDateTime y)
- {
- return (x >= y);
- }
-
- public static SybaseBoolean LessThan (SybaseDateTime x, SybaseDateTime y)
- {
- return (x < y);
- }
-
- public static SybaseBoolean LessThanOrEqual (SybaseDateTime x, SybaseDateTime y)
- {
- return (x <= y);
- }
-
- public static SybaseBoolean NotEquals (SybaseDateTime x, SybaseDateTime y)
- {
- return (x != y);
- }
-
- public static SybaseDateTime Parse (string s)
- {
- return new SybaseDateTime (DateTime.Parse (s));
- }
-
- public SybaseString ToSybaseString ()
- {
- return ((SybaseString)this);
- }
-
- public override string ToString ()
- {
- if (this.IsNull)
- return String.Empty;
- else
- return value.ToString ();
- }
-
- public static SybaseDateTime operator + (SybaseDateTime x, TimeSpan t)
- {
- if (x.IsNull)
- return SybaseDateTime.Null;
- return new SybaseDateTime (x.Value + t);
- }
-
- public static SybaseBoolean operator == (SybaseDateTime x, SybaseDateTime y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value == y.Value);
- }
-
- public static SybaseBoolean operator > (SybaseDateTime x, SybaseDateTime y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value > y.Value);
- }
-
- public static SybaseBoolean operator >= (SybaseDateTime x, SybaseDateTime y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value >= y.Value);
- }
-
- public static SybaseBoolean operator != (SybaseDateTime x, SybaseDateTime y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (!(x.Value == y.Value));
- }
-
- public static SybaseBoolean operator < (SybaseDateTime x, SybaseDateTime y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value < y.Value);
- }
-
- public static SybaseBoolean operator <= (SybaseDateTime x, SybaseDateTime y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value <= y.Value);
- }
-
- public static SybaseDateTime operator - (SybaseDateTime x, TimeSpan t)
- {
- if (x.IsNull)
- return SybaseDateTime.Null;
- return new SybaseDateTime (x.Value - t);
- }
-
- public static explicit operator DateTime (SybaseDateTime x)
- {
- return x.Value;
- }
-
- public static explicit operator SybaseDateTime (SybaseString x)
- {
- return SybaseDateTime.Parse (x.Value);
- }
-
- public static implicit operator SybaseDateTime (DateTime x)
- {
- return new SybaseDateTime (x);
- }
-
- #endregion
- }
-}
-
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDecimal.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDecimal.cs
deleted file mode 100644
index 62a4b99cd05..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDecimal.cs
+++ /dev/null
@@ -1,1242 +0,0 @@
-//
-// Mono.Data.SybaseTypes.SybaseDecimal
-//
-// Author:
-// Tim Coleman <tim@timcoleman.com>
-//
-// Based on System.Data.SqlTypes.SqlDecimal
-//
-// (C) Ximian, Inc. 2002-2003
-// (C) Copyright Tim Coleman, 2002
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.Tds.Protocol;
-using System;
-using System.Data.SqlTypes;
-using System.Globalization;
-using System.Text;
-
-namespace Mono.Data.SybaseTypes {
- public struct SybaseDecimal : INullable, IComparable
- {
-
- #region Fields
-
- int[] value;
- byte precision;
- byte scale;
- bool positive;
-
- bool notNull;
-
- // borrowed from System.Decimal
- const int SCALE_SHIFT = 16;
- const int SIGN_SHIFT = 31;
- const int RESERVED_SS32_BITS = 0x7F00FFFF;
- const ulong LIT_GUINT64_HIGHBIT = 0x8000000000000000;
- const ulong LIT_GUINT32_HIGHBIT = 0x80000000;
- const byte DECIMAL_MAX_INTFACTORS = 9;
- static uint [] constantsDecadeInt32Factors = new uint [10]
- {
- 1u, 10u, 100u, 1000u, 10000u, 100000u, 1000000u,
- 10000000u, 100000000u, 1000000000u
- };
-
- public static readonly byte MaxPrecision = 38;
- public static readonly byte MaxScale = 38;
-
- public static readonly SybaseDecimal MaxValue = new SybaseDecimal (MaxPrecision, (byte)0, true, (int)716002642, Int32.MaxValue, (int)1518778966, (int)1262177448);
- public static readonly SybaseDecimal MinValue = new SybaseDecimal (MaxPrecision, (byte)0, false, (int)716002642, Int32.MaxValue, (int)1518778966, (int)1262177448);
- public static readonly SybaseDecimal Null;
-
- #endregion
-
- #region Constructors
-
- public SybaseDecimal (decimal value)
- {
- int[] binData = Decimal.GetBits (value);
-
- this.scale = (byte)(binData[3] >> SCALE_SHIFT);
- if (this.scale > MaxScale || (this.scale & RESERVED_SS32_BITS) != 0)
- throw new ArgumentException(Locale.GetText ("Invalid scale"));
-
- this.value = new int[4];
- this.value[0] = binData[0];
- this.value[1] = binData[1];
- this.value[2] = binData[2];
- this.value[3] = 0;
- notNull = true;
-
- positive = (value >= 0);
- precision = GetPrecision (value);
- }
-
- public SybaseDecimal (double value) : this ((decimal)value) { }
- public SybaseDecimal (int value) : this ((decimal)value) { }
- public SybaseDecimal (long value) : this ((decimal)value) { }
-
- public SybaseDecimal (byte bPrecision, byte bScale, bool fPositive, int[] bits) : this (bPrecision, bScale, fPositive, bits[0], bits[1], bits[2], bits[3]) { }
-
- public SybaseDecimal (byte bPrecision, byte bScale, bool fPositive, int data1, int data2, int data3, int data4)
- {
- this.precision = bPrecision;
- this.scale = bScale;
- this.positive = fPositive;
- this.value = new int[4];
- this.value[0] = data1;
- this.value[1] = data2;
- this.value[2] = data3;
- this.value[3] = data4;
- notNull = true;
-
- if (precision < scale)
- throw new ArgumentException ("Invalid scale");
- if (this.ToDouble () > (System.Math.Pow (10, 38) -1) || this.ToDouble () < -(System.Math.Pow (10, 38)))
- throw new SybaseTypeException ("Can't convert to SybaseDecimal.");
- }
-
- #endregion
-
- #region Properties
-
- public byte[] BinData {
- get {
- byte[] b = new byte [value.Length * 4];
- int j = 0;
- for (int i = 0; i < value.Length; i += 1) {
- b [j++] = (byte) (0xff & value [i]);
- b [j++] = (byte) (0xff & value [i] >> 8);
- b [j++] = (byte) (0xff & value [i] >> 16);
- b [j++] = (byte) (0xff & value [i] >> 24);
- }
- return b;
- }
- }
-
- public int[] Data {
- get {
- if (this.IsNull)
- throw new SybaseNullValueException ();
- else
- return (value);
- }
- }
-
- public bool IsNull {
- get { return !notNull; }
- }
-
- public bool IsPositive {
- get { return positive; }
- }
-
- public byte Precision {
- get { return precision; }
- }
-
- public byte Scale {
- get { return scale; }
- }
-
- public decimal Value {
- get {
- if (this.IsNull)
- throw new SybaseNullValueException ();
- if (this.value[3] > 0)
- throw new OverflowException ();
- return new decimal (value[0], value[1], value[2], !positive, scale);
- }
- }
-
- #endregion
-
- #region Methods
-
- public static SybaseDecimal Abs (SybaseDecimal n)
- {
- return new SybaseDecimal (n.Precision, n.Scale, true, n.BinData [0], n.BinData [1], n.BinData [2], n.BinData [3]);
- }
-
- public static SybaseDecimal Add (SybaseDecimal x, SybaseDecimal y)
- {
- return (x + y);
- }
-
- public static SybaseDecimal AdjustScale (SybaseDecimal n, int digits, bool fRound)
- {
- byte prec = n.Precision;
- if (n.IsNull)
- throw new SybaseNullValueException ();
- if (digits > 0)
- prec = (byte) (prec + digits);
- if (fRound)
- n = Round (n, digits + n.Scale);
- return new SybaseDecimal (prec, (byte) (n.Scale + digits), n.IsPositive, n.Data);
- }
-
- public static SybaseDecimal Ceiling (SybaseDecimal n)
- {
- return AdjustScale (n, -(n.Scale), true);
- }
-
- public int CompareTo (object value)
- {
- if (value == null)
- return 1;
- else if (!(value is SybaseDecimal))
- throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseDecimal"));
- else if (((SybaseDecimal)value).IsNull)
- return 1;
- else
- return this.Value.CompareTo (((SybaseDecimal)value).Value);
- }
-
- public static SybaseDecimal ConvertToPrecScale (SybaseDecimal n, int precision, int scale)
- {
- return new SybaseDecimal ((byte) precision, (byte) scale, n.IsPositive, n.Data);
- }
-
- public static SybaseDecimal Divide (SybaseDecimal x, SybaseDecimal y)
- {
- return (x / y);
- }
-
- public override bool Equals (object value)
- {
- if (!(value is SybaseDecimal))
- return false;
- else if (this.IsNull && ((SybaseDecimal) value).IsNull)
- return true;
- else if (((SybaseDecimal) value).IsNull)
- return false;
- else
- return (bool) (this == (SybaseDecimal)value);
- }
-
- public static SybaseBoolean Equals (SybaseDecimal x, SybaseDecimal y)
- {
- return (x == y);
- }
-
- public static SybaseDecimal Floor (SybaseDecimal n)
- {
- return AdjustScale (n, -(n.Scale), false);
- }
-
- internal static SybaseDecimal FromTdsBigDecimal (TdsBigDecimal x)
- {
- if (x == null)
- return Null;
- else
- return new SybaseDecimal (x.Precision, x.Scale, !x.IsNegative, x.Data);
- }
-
- public override int GetHashCode ()
- {
- int result = 10;
- result = 91 * result + this.Data [0];
- result = 91 * result + this.Data [1];
- result = 91 * result + this.Data [2];
- result = 91 * result + this.Data [3];
- result = 91 * result + (int) this.Scale;
- result = 91 * result + (int) this.Precision;
-
- return result;
- }
-
- public static SybaseBoolean GreaterThan (SybaseDecimal x, SybaseDecimal y)
- {
- return (x > y);
- }
-
- public static SybaseBoolean GreaterThanOrEqual (SybaseDecimal x, SybaseDecimal y)
- {
- return (x >= y);
- }
-
- public static SybaseBoolean LessThan (SybaseDecimal x, SybaseDecimal y)
- {
- return (x < y);
- }
-
- public static SybaseBoolean LessThanOrEqual (SybaseDecimal x, SybaseDecimal y)
- {
- return (x <= y);
- }
-
- public static SybaseDecimal Multiply (SybaseDecimal x, SybaseDecimal y)
- {
- return (x * y);
- }
-
- public static SybaseBoolean NotEquals (SybaseDecimal x, SybaseDecimal y)
- {
- return (x != y);
- }
-
- public static SybaseDecimal Parse (string s)
- {
- if (s == null)
- throw new ArgumentNullException ();
- else
- return SybaseDouble.Parse (s).ToSybaseDecimal ();
- }
-
- public static SybaseDecimal Power (SybaseDecimal n, double exp)
- {
- if (n.IsNull)
- return SybaseDecimal.Null;
- return new SybaseDecimal (System.Math.Pow (n.ToDouble (), exp));
- }
-
- public static SybaseDecimal Round (SybaseDecimal n, int position)
- {
- if (n.IsNull)
- throw new SybaseNullValueException ();
- SybaseDecimal result = new SybaseDecimal (System.Math.Round ((double) (n.ToDouble () * System.Math.Pow (10, position))));
- result = result / new SybaseDecimal (System.Math.Pow (10, position));
- return result;
- }
-
- public static SybaseInt32 Sign (SybaseDecimal n)
- {
- SybaseInt32 result = 0;
- if (n >= new SybaseDecimal (0))
- result = 1;
- else
- result = -1;
- return result;
- }
-
- public static SybaseDecimal Subtract (SybaseDecimal x, SybaseDecimal y)
- {
- return (x - y);
- }
-
- private static byte GetPrecision (decimal value)
- {
- string str = value.ToString ();
- byte result = 0;
- foreach (char c in str)
- if (c >= '0' && c <= '9')
- result ++;
- return result;
- }
-
- public double ToDouble ()
- {
- // FIXME: This is the wrong way to do this
- double d = (uint) this.Data [0];
- d += ((uint) this.Data [1]) * System.Math.Pow (2, 32);
- d += ((uint) this.Data [2]) * System.Math.Pow (2, 64);
- d += ((uint) this.Data [3]) * System.Math.Pow (2, 96);
- d /= System.Math.Pow (10, scale);
- return d;
- }
-
- public SybaseBoolean ToSybaseBoolean ()
- {
- return ((SybaseBoolean)this);
- }
-
- public SybaseByte ToSybaseByte ()
- {
- return ((SybaseByte)this);
- }
-
- public SybaseDouble ToSybaseDouble ()
- {
- return ((SybaseDouble)this);
- }
-
- public SybaseInt16 ToSybaseInt16 ()
- {
- return ((SybaseInt16)this);
- }
-
- public SybaseInt32 ToSybaseInt32 ()
- {
- return ((SybaseInt32)this);
- }
-
- public SybaseInt64 ToSybaseInt64 ()
- {
- return ((SybaseInt64)this);
- }
-
- public SybaseMoney ToSybaseMoney ()
- {
- return ((SybaseMoney)this);
- }
-
- public SybaseSingle ToSybaseSingle ()
- {
- return ((SybaseSingle)this);
- }
-
- public SybaseString ToSybaseString ()
- {
- return ((SybaseString)this);
- }
-
- public override string ToString ()
- {
- if (this.IsNull)
- return String.Empty;
-
- // convert int [4] -> ulong [2]
- ulong lo = (uint) this.Data [0] + (ulong) ((ulong) this.Data [1] << 32);
- ulong hi = (uint) this.Data [2] + (ulong) ((ulong) this.Data [3] << 32);
-
- uint rest = 0;
- StringBuilder result = new StringBuilder ();
- for (int i = 0; lo != 0 || hi != 0; i += 1) {
- Div128By32 (ref hi, ref lo, 10, ref rest);
- result.Insert (0, rest.ToString ());
- }
- while (result.Length < Precision)
- result.Append ("0");
- while (result.Length > Precision)
- result.Remove (result.Length - 1, 1);
- if (Scale > 0)
- result.Insert (result.Length - Scale, ".");
- return result.ToString ();
- }
-
- // from decimal.c
- private static int Div128By32 (ref ulong hi, ref ulong lo, uint divider)
- {
- uint t = 0;
- return Div128By32 (ref hi, ref lo, divider, ref t);
- }
-
- // from decimal.c
- private static int Div128By32 (ref ulong hi, ref ulong lo, uint divider, ref uint rest)
- {
- ulong a = 0;
- ulong b = 0;
- ulong c = 0;
-
- a = (uint) (hi >> 32);
- b = a / divider;
- a -= b * divider;
- a <<= 32;
- a |= (uint) hi;
- c = a / divider;
- a -= c * divider;
- a <<= 32;
- hi = b << 32 | (uint) c;
-
- a = (uint) (lo >> 32);
- b = a / divider;
- a -= b * divider;
- a <<= 32;
- a |= (uint) lo;
- c = a / divider;
- a -= c * divider;
- a <<= 32;
- lo = b << 32 | (uint) c;
-
- rest = (uint) a;
- a <<= 1;
-
- return (a > divider || (a == divider && (c & 1) == 1)) ? 1 : 0;
- }
-
- [MonoTODO ("Find out what is the right way to set scale and precision")]
- private static SybaseDecimal DecimalDiv (SybaseDecimal x, SybaseDecimal y)
- {
- ulong lo = 0;
- ulong hi = 0;
- int sc = 0; // scale
- int texp = 0;
- byte prec = 0;
-
- prec = x.Precision >= y.Precision ? x.Precision : y.Precision;
- DecimalDivSub (ref x, ref y, ref lo, ref hi, ref texp);
-
- sc = x.Scale - y.Scale;
-
- Rescale128 (ref lo, ref hi, ref sc, texp, 0, 38, 1);
-
- uint r = 0;
- while (prec < sc) {
- Div128By32 (ref hi, ref lo, 10, ref r);
- sc -= 1;
- }
-
- if (r >= 5)
- lo += 1;
-
- while ((((double) hi) * System.Math.Pow (2, 64) + lo) - System.Math.Pow (10, prec) > 0)
- prec += 1;
-
- while ((prec + sc) > MaxScale) {
- Div128By32 (ref hi, ref lo, 10, ref r);
- sc -= 1;
- if (r >= 5)
- lo += 1;
- }
-
- int resultLo = (int) lo;
- int resultMi = (int) (lo >> 32);
- int resultMi2 = (int) hi;
- int resultHi = (int) (hi >> 32);
-
- return new SybaseDecimal (prec, (byte) sc, true, resultLo, resultMi, resultMi2, resultHi);
- }
-
- // From decimal.c
- private static void Rescale128 (ref ulong clo, ref ulong chi, ref int scale, int texp, int minScale, int maxScale, int roundFlag)
- {
- uint factor = 0;
- uint overhang = 0;
- int sc = 0;
- int i = 0;
- int roundBit = 0;
-
- sc = scale;
- if (texp > 0) {
- // reduce exp
- while (texp > 0 && sc <= maxScale) {
- overhang = (uint) (chi >> 64);
- while (texp > 0 && (((clo & 1) == 0) || overhang > 0)) {
- if (--texp == 0)
- roundBit = (int) (clo & 1);
- RShift128 (ref clo, ref chi);
- overhang = (uint) (chi >> 32);
- }
-
- if (texp > DECIMAL_MAX_INTFACTORS)
- i = DECIMAL_MAX_INTFACTORS;
- else
- i = texp;
-
- if (sc + i > maxScale)
- i = maxScale - sc;
- if (i == 0)
- break;
-
- texp -= i;
- sc += i;
-
- // 10^i/2^i=5^i
- factor = constantsDecadeInt32Factors [i] >> i;
- Mult128By32 (ref clo, ref chi, factor, 0);
- }
-
- while (texp > 0) {
- if (--texp == 0)
- roundBit = (int) (clo & 1);
- RShift128 (ref clo, ref chi);
-
- }
- }
-
- while (sc > maxScale) {
- i = scale - maxScale;
- if (i > DECIMAL_MAX_INTFACTORS)
- i = DECIMAL_MAX_INTFACTORS;
- sc -= i;
- roundBit = Div128By32 (ref clo, ref chi, constantsDecadeInt32Factors [i]);
- }
-
- while (sc < minScale) {
- if (roundFlag == 0)
- roundBit = 0;
- i = minScale - sc;
- if (i > DECIMAL_MAX_INTFACTORS)
- i = DECIMAL_MAX_INTFACTORS;
- sc += i;
- Mult128By32 (ref clo, ref chi, constantsDecadeInt32Factors [i], roundBit);
- roundBit = 0;
- }
- scale = sc;
- Normalize128 (ref clo, ref chi, ref sc, roundFlag, roundBit);
- }
-
- // from decimal.c
- private static void Normalize128 (ref ulong clo, ref ulong chi, ref int scale, int roundFlag, int roundBit)
- {
- if ((roundFlag != 0) && (roundBit != 0))
- RoundUp128 (ref clo, ref chi);
- }
-
- // from decimal.c
- private static void RoundUp128 (ref ulong lo, ref ulong hi)
- {
- if ((++lo) == 0)
- ++hi;
- }
-
- // from decimal.c
- private static void DecimalDivSub (ref SybaseDecimal x, ref SybaseDecimal y, ref ulong clo, ref ulong chi, ref int exp)
- {
- ulong xlo, xmi, xhi;
- ulong tlo = 0;
- ulong tmi = 0;
- ulong thi = 0;
- uint ylo = 0;
- uint ymi = 0;
- uint ymi2 = 0;
- uint yhi = 0;
- int ashift = 0;
- int bshift = 0;
- int extraBit = 0;
-
- xhi = (ulong) ((ulong) x.Data [3] << 32) | (ulong) x.Data [2];
- xmi = (ulong) ((ulong) x.Data [1] << 32) | (ulong) x.Data [0];
- xlo = (uint) 0;
- ylo = (uint) y.Data [0];
- ymi = (uint) y.Data [1];
- ymi2 = (uint) y.Data [2];
- yhi = (uint) y.Data [3];
-
- if (ylo == 0 && ymi == 0 && ymi2 == 0 && yhi == 0)
- throw new DivideByZeroException ();
- if (xmi == 0 && xhi == 0) {
- clo = chi = 0;
- return;
- }
-
- // enlarge dividend to get maximal precision
- for (ashift = 0; (xhi & LIT_GUINT64_HIGHBIT) == 0; ++ashift)
- LShift128 (ref xmi, ref xhi);
-
- // ensure that divisor is at least 2^95
- for (bshift = 0; (yhi & LIT_GUINT32_HIGHBIT) == 0; ++bshift)
- LShift128 (ref ylo, ref ymi, ref ymi2, ref yhi);
-
- thi = ((ulong) yhi) << 32 | (ulong) ymi2;
- tmi = ((ulong) ymi) << 32 | (ulong) ylo;
- tlo = 0;
-
- if (xhi > thi || (xhi == thi && xmi >= tmi)) {
- Sub192 (xlo, xmi, xhi, tlo, tmi, thi, ref xlo, ref xmi, ref xhi);
- extraBit = 1;
- } else {
- extraBit = 0;
- }
-
- Div192By128To128 (xlo, xmi, xhi, ylo, ymi, ymi2, yhi, ref clo, ref chi);
-
- exp = 128 + ashift - bshift;
-
- if (extraBit != 0) {
- RShift128 (ref clo, ref chi);
- chi += LIT_GUINT64_HIGHBIT;
- exp -= 1;
- }
-
- // try loss free right shift
- while (exp > 0 && (clo & 1) == 0) {
- RShift128 (ref clo, ref chi);
- exp -= 1;
- }
- }
-
- // From decimal.c
- private static void RShift192 (ref ulong lo, ref ulong mi, ref ulong hi)
- {
- lo >>= 1;
- if ((mi & 1) != 0)
- lo |= LIT_GUINT64_HIGHBIT;
-
- mi >>= 1;
- if ((hi & 1) != 0)
- mi |= LIT_GUINT64_HIGHBIT;
-
- hi >>= 1;
- }
-
- // From decimal.c
- private static void RShift128 (ref ulong lo, ref ulong hi)
- {
- lo >>= 1;
- if ((hi & 1) != 0)
- lo |= LIT_GUINT64_HIGHBIT;
- hi >>= 1;
- }
-
- // From decimal.c
- private static void LShift128 (ref ulong lo, ref ulong hi)
- {
- hi <<= 1;
-
- if ((lo & LIT_GUINT64_HIGHBIT) != 0)
- hi += 1;
-
- lo <<= 1;
- }
-
- // From decimal.c
- private static void LShift128 (ref uint lo, ref uint mi, ref uint mi2, ref uint hi)
- {
- hi <<= 1;
- if ((mi2 & LIT_GUINT32_HIGHBIT) != 0)
- hi += 1;
-
- mi2 <<= 1;
- if ((mi & LIT_GUINT32_HIGHBIT) != 0)
- mi2 += 1;
-
- mi <<= 1;
- if ((lo & LIT_GUINT32_HIGHBIT) != 0)
- mi += 1;
-
- lo <<= 1;
- }
-
- // From decimal.c
- private static void Div192By128To128 (ulong xlo, ulong xmi, ulong xhi, uint ylo, uint ymi, uint ymi2, uint yhi, ref ulong clo, ref ulong chi)
- {
- ulong rlo, rmi, rhi; // remainders
- uint h, c;
-
- rlo = xlo;
- rmi = xmi;
- rhi = xhi;
-
- h = Div192By128To32WithRest (ref rlo, ref rmi, ref rhi, ylo, ymi, ymi2, yhi);
-
- // mid 32 bit
- rhi = (rhi << 32) | (rmi >> 32);
- rmi = (rmi << 32) | (rlo >> 32);
- rlo <<= 32;
-
- chi = (((ulong)h) << 32) | Div192By128To32WithRest (ref rlo, ref rmi, ref rhi, ylo, ymi, ymi2, yhi);
-
- // low 32 bit
- rhi = (rhi << 32) | (rmi >> 32);
- rmi = (rmi << 32) | (rlo >> 32);
- rlo <<= 32;
-
- h = Div192By128To32WithRest (ref rlo, ref rmi, ref rhi, ylo, ymi, ymi2, yhi);
-
- // estimate lowest 32 bit (two last bits may be wrong)
- if (rhi >= yhi)
- c = 0xFFFFFFFF;
- else {
- rhi <<= 32;
- c = (uint)(rhi / yhi);
- }
-
- clo = (((ulong)h) << 32) | c;
- }
-
- // From decimal.c
- private static uint Div192By128To32WithRest (ref ulong xlo, ref ulong xmi, ref ulong xhi, uint ylo, uint ymi, uint ymi2, uint yhi)
- {
- ulong rlo, rmi, rhi; // remainder
- ulong tlo = 0;
- ulong thi = 0;
- uint c;
-
- rlo = xlo;
- rmi = xmi;
- rhi = xhi;
-
- if (rhi >= (((ulong)yhi << 32)))
- c = 0xFFFFFFFF;
- else
- c = (uint) (rhi / yhi);
-
- Mult128By32To128 (ylo, ymi, ymi2, yhi, c, ref tlo, ref thi);
- Sub192 (rlo, rmi, rhi, 0, tlo, thi, ref rlo, ref rmi, ref rhi);
-
- while (((long)rhi) < 0) {
- c--;
- Add192 (rlo, rmi, rhi, 0, (((ulong)ymi) << 32) | ylo, yhi | ymi2, ref rlo, ref rmi, ref rhi);
- }
- xlo = rlo;
- xmi = rmi;
- xhi = rhi;
-
- return c;
- }
-
- // From decimal.c
- private static void Mult192By32 (ref ulong clo, ref ulong cmi, ref ulong chi, ulong factor, int roundBit)
- {
- ulong a = 0;
- uint h0 = 0;
- uint h1 = 0;
-
- a = ((ulong)(uint)clo) * factor;
-
- if (roundBit != 0)
- a += factor / 2;
-
- h0 = (uint)a;
- a >>= 32;
- a += (clo >> 32) * factor;
- h1 = (uint)a;
-
- clo = ((ulong)h1) << 32 | h0;
-
- a >>= 32;
- a += ((ulong)(uint)cmi) * factor;
- h0 = (uint)a;
-
- a >>= 32;
- a += (cmi >> 32) * factor;
- h1 = (uint)a;
-
- cmi = ((ulong)h1) << 32 | h0;
- a >>= 32;
- a += ((ulong)(uint)chi) * factor;
- h0 = (uint)a;
-
- a >>= 32;
- a += (chi >> 32) * factor;
- h1 = (uint)a;
- chi = ((ulong)h1) << 32 | h0;
- }
-
- // From decimal.c
- private static void Mult128By32 (ref ulong clo, ref ulong chi, uint factor, int roundBit)
- {
- ulong a = 0;
- uint h0 = 0;
- uint h1 = 0;
-
- a = ((ulong)(uint)clo) * factor;
-
- if (roundBit != 0)
- a += factor / 2;
-
- h0 = (uint)a;
-
- a >>= 32;
- a += (clo >> 32) * factor;
- h1 = (uint)a;
-
- clo = ((ulong)h1) << 32 | h0;
-
- a >>= 32;
- a += ((ulong)(uint)chi) * factor;
- h0 = (uint)a;
-
- a >>= 32;
- a += (chi >> 32) * factor;
- h1 = (uint)a;
-
- chi = ((ulong)h1) << 32 | h0;
- }
-
- // From decimal.c
- private static void Mult128By32To128 (uint xlo, uint xmi, uint xmi2, uint xhi, uint factor, ref ulong clo, ref ulong chi)
- {
- ulong a;
- uint h0, h1, h2;
-
- a = ((ulong)xlo) * factor;
- h0 = (uint)a;
-
- a >>= 32;
- a += ((ulong)xmi) * factor;
- h1 = (uint)a;
-
- a >>= 32;
- a += ((ulong)xmi2) * factor;
- h2 = (uint)a;
-
- a >>= 32;
- a += ((ulong)xhi) * factor;
-
- clo = ((ulong)h1) << 32 | h0;
- chi = a | h2;
- }
-
- // From decimal.c
- private static void Add192 (ulong xlo, ulong xmi, ulong xhi, ulong ylo, ulong ymi, ulong yhi, ref ulong clo, ref ulong cmi, ref ulong chi)
- {
- xlo += ylo;
- if (xlo < ylo) {
- xmi++;
- if (xmi == 0)
- xhi++;
- }
-
- xmi += ymi;
-
- if (xmi < ymi)
- xmi++;
-
- xhi += yhi;
- clo = xlo;
- cmi = xmi;
- chi = xhi;
- }
-
- // From decimal.c
- private static void Sub192 (ulong xlo, ulong xmi, ulong xhi, ulong ylo, ulong ymi, ulong yhi, ref ulong lo, ref ulong mi, ref ulong hi)
- {
- ulong clo = 0;
- ulong cmi = 0;
- ulong chi = 0;
-
- clo = xlo - ylo;
- cmi = xmi - ymi;
- chi = xhi - yhi;
-
- if (xlo < ylo) {
- if (cmi == 0)
- chi--;
- cmi--;
- }
-
- if (xmi < ymi)
- chi--;
-
- lo = clo;
- mi = cmi;
- hi = chi;
- }
-
- public static SybaseDecimal Truncate (SybaseDecimal n, int position)
- {
- return new SybaseDecimal ((byte) n.Precision, (byte) position, n.IsPositive, n.Data);
- }
-
- public static SybaseDecimal operator + (SybaseDecimal x, SybaseDecimal y)
- {
- // if one of them is negative, perform subtraction
- if (x.IsPositive && !y.IsPositive) return x - y;
- if (y.IsPositive && !x.IsPositive) return y - x;
-
- // adjust the scale to the smaller of the two beforehand
- if (x.Scale > y.Scale)
- x = SybaseDecimal.AdjustScale(x, y.Scale - x.Scale, true);
- else if (y.Scale > x.Scale)
- y = SybaseDecimal.AdjustScale(y, x.Scale - y.Scale, true);
-
- // set the precision to the greater of the two
- byte resultPrecision;
- if (x.Precision > y.Precision)
- resultPrecision = x.Precision;
- else
- resultPrecision = y.Precision;
-
- int[] xData = x.Data;
- int[] yData = y.Data;
- int[] resultBits = new int[4];
-
- ulong res;
- ulong carry = 0;
-
- // add one at a time, and carry the results over to the next
- for (int i = 0; i < 4; i +=1)
- {
- carry = 0;
- res = (ulong)(xData[i]) + (ulong)(yData[i]) + carry;
- if (res > Int32.MaxValue)
- {
- carry = res - Int32.MaxValue;
- res = Int32.MaxValue;
- }
- resultBits [i] = (int)res;
- }
-
- // if we have carry left, then throw an exception
- if (carry > 0)
- throw new OverflowException ();
- else
- return new SybaseDecimal (resultPrecision, x.Scale, x.IsPositive, resultBits);
- }
-
- public static SybaseDecimal operator / (SybaseDecimal x, SybaseDecimal y)
- {
- return DecimalDiv (x, y);
- }
-
- public static SybaseBoolean operator == (SybaseDecimal x, SybaseDecimal y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
-
- if (x.Scale > y.Scale)
- x = SybaseDecimal.AdjustScale(x, y.Scale - x.Scale, true);
- else if (y.Scale > x.Scale)
- y = SybaseDecimal.AdjustScale(y, x.Scale - y.Scale, true);
-
- for (int i = 0; i < 4; i += 1)
- {
- if (x.Data[i] != y.Data[i])
- return new SybaseBoolean (false);
- }
- return new SybaseBoolean (true);
- }
-
- public static SybaseBoolean operator > (SybaseDecimal x, SybaseDecimal y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
-
- if (x.Scale > y.Scale)
- x = SybaseDecimal.AdjustScale(x, y.Scale - x.Scale, true);
- else if (y.Scale > x.Scale)
- y = SybaseDecimal.AdjustScale(y, x.Scale - y.Scale, true);
-
- for (int i = 3; i >= 0; i -= 1)
- {
- if (x.Data[i] == 0 && y.Data[i] == 0)
- continue;
- else
- return new SybaseBoolean (x.Data[i] > y.Data[i]);
- }
- return new SybaseBoolean (false);
- }
-
- public static SybaseBoolean operator >= (SybaseDecimal x, SybaseDecimal y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
-
- if (x.Scale > y.Scale)
- x = SybaseDecimal.AdjustScale(x, y.Scale - x.Scale, true);
- else if (y.Scale > x.Scale)
- y = SybaseDecimal.AdjustScale(y, x.Scale - y.Scale, true);
-
- for (int i = 3; i >= 0; i -= 1)
- {
- if (x.Data[i] == 0 && y.Data[i] == 0)
- continue;
- else
- return new SybaseBoolean (x.Data[i] >= y.Data[i]);
- }
- return new SybaseBoolean (true);
- }
-
- public static SybaseBoolean operator != (SybaseDecimal x, SybaseDecimal y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
-
- if (x.Scale > y.Scale)
- x = SybaseDecimal.AdjustScale(x, y.Scale - x.Scale, true);
- else if (y.Scale > x.Scale)
- y = SybaseDecimal.AdjustScale(y, x.Scale - y.Scale, true);
-
- for (int i = 0; i < 4; i += 1)
- {
- if (x.Data[i] != y.Data[i])
- return new SybaseBoolean (true);
- }
- return new SybaseBoolean (false);
- }
-
- public static SybaseBoolean operator < (SybaseDecimal x, SybaseDecimal y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
-
- if (x.Scale > y.Scale)
- x = SybaseDecimal.AdjustScale(x, y.Scale - x.Scale, true);
- else if (y.Scale > x.Scale)
- y = SybaseDecimal.AdjustScale(y, x.Scale - y.Scale, true);
-
- for (int i = 3; i >= 0; i -= 1)
- {
- if (x.Data[i] == 0 && y.Data[i] == 0)
- continue;
-
- return new SybaseBoolean (x.Data[i] < y.Data[i]);
- }
- return new SybaseBoolean (false);
- }
-
- public static SybaseBoolean operator <= (SybaseDecimal x, SybaseDecimal y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
-
- if (x.Scale > y.Scale)
- x = SybaseDecimal.AdjustScale(x, y.Scale - x.Scale, true);
- else if (y.Scale > x.Scale)
- y = SybaseDecimal.AdjustScale(y, x.Scale - y.Scale, true);
-
- for (int i = 3; i >= 0; i -= 1)
- {
- if (x.Data[i] == 0 && y.Data[i] == 0)
- continue;
- else
- return new SybaseBoolean (x.Data[i] <= y.Data[i]);
- }
- return new SybaseBoolean (true);
- }
-
- public static SybaseDecimal operator * (SybaseDecimal x, SybaseDecimal y)
- {
- // adjust the scale to the smaller of the two beforehand
- if (x.Scale > y.Scale)
- x = SybaseDecimal.AdjustScale(x, y.Scale - x.Scale, true);
- else if (y.Scale > x.Scale)
- y = SybaseDecimal.AdjustScale(y, x.Scale - y.Scale, true);
-
- // set the precision to the greater of the two
- byte resultPrecision;
- if (x.Precision > y.Precision)
- resultPrecision = x.Precision;
- else
- resultPrecision = y.Precision;
-
- int[] xData = x.Data;
- int[] yData = y.Data;
- int[] resultBits = new int[4];
-
- ulong res;
- ulong carry = 0;
-
- // multiply one at a time, and carry the results over to the next
- for (int i = 0; i < 4; i +=1)
- {
- carry = 0;
- res = (ulong)(xData[i]) * (ulong)(yData[i]) + carry;
- if (res > Int32.MaxValue)
- {
- carry = res - Int32.MaxValue;
- res = Int32.MaxValue;
- }
- resultBits [i] = (int)res;
- }
-
- // if we have carry left, then throw an exception
- if (carry > 0)
- throw new OverflowException ();
- else
- return new SybaseDecimal (resultPrecision, x.Scale, (x.IsPositive == y.IsPositive), resultBits);
-
- }
-
- public static SybaseDecimal operator - (SybaseDecimal x, SybaseDecimal y)
- {
- if (x.IsPositive && !y.IsPositive) return x + y;
- if (!x.IsPositive && y.IsPositive) return -(x + y);
- if (!x.IsPositive && !y.IsPositive) return y - x;
-
- // otherwise, x is positive and y is positive
- bool resultPositive = (bool)(x > y);
- int[] yData = y.Data;
-
- for (int i = 0; i < 4; i += 1) yData[i] = -yData[i];
-
- SybaseDecimal yInverse = new SybaseDecimal (y.Precision, y.Scale, y.IsPositive, yData);
-
- if (resultPositive)
- return x + yInverse;
- else
- return -(x + yInverse);
- }
-
- public static SybaseDecimal operator - (SybaseDecimal n)
- {
- return new SybaseDecimal (n.Precision, n.Scale, !n.IsPositive, n.Data);
- }
-
- public static explicit operator SybaseDecimal (SybaseBoolean x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseDecimal ((decimal)x.ByteValue);
- }
-
- public static explicit operator Decimal (SybaseDecimal n)
- {
- return n.Value;
- }
-
- public static explicit operator SybaseDecimal (SybaseDouble x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseDecimal ((decimal)x.Value);
- }
-
- public static explicit operator SybaseDecimal (SybaseSingle x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseDecimal ((decimal)x.Value);
- }
-
- [MonoTODO]
- public static explicit operator SybaseDecimal (SybaseString x)
- {
- throw new NotImplementedException ();
- }
-
- public static implicit operator SybaseDecimal (decimal x)
- {
- return new SybaseDecimal (x);
- }
-
- public static implicit operator SybaseDecimal (SybaseByte x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseDecimal ((decimal)x.Value);
- }
-
- public static implicit operator SybaseDecimal (SybaseInt16 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseDecimal ((decimal)x.Value);
- }
-
- public static implicit operator SybaseDecimal (SybaseInt32 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseDecimal ((decimal)x.Value);
- }
-
- public static implicit operator SybaseDecimal (SybaseInt64 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseDecimal ((decimal)x.Value);
- }
-
- public static implicit operator SybaseDecimal (SybaseMoney x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseDecimal ((decimal)x.Value);
- }
-
- #endregion
- }
-}
-
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDouble.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDouble.cs
deleted file mode 100644
index 549ec601d1a..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseDouble.cs
+++ /dev/null
@@ -1,373 +0,0 @@
-//
-// Mono.Data.SybaseTypes.SybaseDouble
-//
-// Author:
-// Tim Coleman <tim@timcoleman.com>
-//
-// Based on System.Data.SqlTypes.SqlDouble
-//
-// (C) Ximian, Inc. 2002-2003
-// (C) Copyright Tim Coleman, 2002-2003
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.SybaseClient;
-using System;
-using System.Data.SqlTypes;
-using System.Globalization;
-
-namespace Mono.Data.SybaseTypes {
- public struct SybaseDouble : INullable, IComparable
- {
- #region Fields
- double value;
-
- private bool notNull;
-
- public static readonly SybaseDouble MaxValue = new SybaseDouble (1.7976931348623157E+308);
- public static readonly SybaseDouble MinValue = new SybaseDouble (-1.7976931348623157E+308);
- public static readonly SybaseDouble Null;
- public static readonly SybaseDouble Zero = new SybaseDouble (0);
-
- #endregion
-
- #region Constructors
-
- public SybaseDouble (double value)
- {
- this.value = value;
- notNull = true;
- }
-
- #endregion
-
- #region Properties
-
- public bool IsNull {
- get { return !notNull; }
- }
-
- public double Value {
- get {
- if (this.IsNull)
- throw new SybaseNullValueException ();
- else
- return value;
- }
- }
-
- #endregion
-
- #region Methods
-
- public static SybaseDouble Add (SybaseDouble x, SybaseDouble y)
- {
- return (x + y);
- }
-
- public int CompareTo (object value)
- {
- if (value == null)
- return 1;
- else if (!(value is SybaseDouble))
- throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseDouble"));
- else if (((SybaseDouble)value).IsNull)
- return 1;
- else
- return this.value.CompareTo (((SybaseDouble)value).Value);
- }
-
- public static SybaseDouble Divide (SybaseDouble x, SybaseDouble y)
- {
- return (x / y);
- }
-
- public override bool Equals (object value)
- {
- if (!(value is SybaseDouble))
- return false;
- else
- return (bool) (this == (SybaseDouble)value);
- }
-
- public static SybaseBoolean Equals (SybaseDouble x, SybaseDouble y)
- {
- return (x == y);
- }
-
- public override int GetHashCode ()
- {
- long LongValue = (long)value;
- return (int)(LongValue ^ (LongValue >> 32));
-
- }
-
- public static SybaseBoolean GreaterThan (SybaseDouble x, SybaseDouble y)
- {
- return (x > y);
- }
-
- public static SybaseBoolean GreaterThanOrEqual (SybaseDouble x, SybaseDouble y)
- {
- return (x >= y);
- }
-
- public static SybaseBoolean LessThan (SybaseDouble x, SybaseDouble y)
- {
- return (x < y);
- }
-
- public static SybaseBoolean LessThanOrEqual (SybaseDouble x, SybaseDouble y)
- {
- return (x <= y);
- }
-
- public static SybaseDouble Multiply (SybaseDouble x, SybaseDouble y)
- {
- return (x * y);
- }
-
- public static SybaseBoolean NotEquals (SybaseDouble x, SybaseDouble y)
- {
- return (x != y);
- }
-
- public static SybaseDouble Parse (string s)
- {
- return new SybaseDouble (Double.Parse (s));
- }
-
- public static SybaseDouble Subtract (SybaseDouble x, SybaseDouble y)
- {
- return (x - y);
- }
-
- public SybaseBoolean ToSybaseBoolean ()
- {
- return ((SybaseBoolean)this);
- }
-
- public SybaseByte ToSybaseByte ()
- {
- return ((SybaseByte)this);
- }
-
- public SybaseDecimal ToSybaseDecimal ()
- {
- return ((SybaseDecimal)this);
- }
-
- public SybaseInt16 ToSybaseInt16 ()
- {
- return ((SybaseInt16)this);
- }
-
- public SybaseInt32 ToSybaseInt32 ()
- {
- return ((SybaseInt32)this);
- }
-
- public SybaseInt64 ToSybaseInt64 ()
- {
- return ((SybaseInt64)this);
- }
-
- public SybaseMoney ToSybaseMoney ()
- {
- return ((SybaseMoney)this);
- }
-
- public SybaseSingle ToSybaseSingle ()
- {
- return ((SybaseSingle)this);
- }
-
- public SybaseString ToSybaseString ()
- {
- return ((SybaseString)this);
- }
-
- public override string ToString ()
- {
- if (this.IsNull)
- return String.Empty;
- else
- return value.ToString ();
- }
-
- public static SybaseDouble operator + (SybaseDouble x, SybaseDouble y)
- {
- return new SybaseDouble (x.Value + y.Value);
- }
-
- public static SybaseDouble operator / (SybaseDouble x, SybaseDouble y)
- {
- return new SybaseDouble (x.Value / y.Value);
- }
-
- public static SybaseBoolean operator == (SybaseDouble x, SybaseDouble y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value == y.Value);
- }
-
- public static SybaseBoolean operator > (SybaseDouble x, SybaseDouble y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value > y.Value);
- }
-
- public static SybaseBoolean operator >= (SybaseDouble x, SybaseDouble y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value >= y.Value);
- }
-
- public static SybaseBoolean operator != (SybaseDouble x, SybaseDouble y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (!(x.Value == y.Value));
- }
-
- public static SybaseBoolean operator < (SybaseDouble x, SybaseDouble y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value < y.Value);
- }
-
- public static SybaseBoolean operator <= (SybaseDouble x, SybaseDouble y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value <= y.Value);
- }
-
- public static SybaseDouble operator * (SybaseDouble x, SybaseDouble y)
- {
- return new SybaseDouble (x.Value * y.Value);
- }
-
- public static SybaseDouble operator - (SybaseDouble x, SybaseDouble y)
- {
- return new SybaseDouble (x.Value - y.Value);
- }
-
- public static SybaseDouble operator - (SybaseDouble n)
- {
- return new SybaseDouble (-(n.Value));
- }
-
- public static explicit operator SybaseDouble (SybaseBoolean x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseDouble ((double)x.ByteValue);
- }
-
- public static explicit operator double (SybaseDouble x)
- {
- return x.Value;
- }
-
- public static explicit operator SybaseDouble (SybaseString x)
- {
- return SybaseDouble.Parse (x.Value);
- }
-
- public static implicit operator SybaseDouble (double x)
- {
- return new SybaseDouble (x);
- }
-
- public static implicit operator SybaseDouble (SybaseByte x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseDouble ((double)x.Value);
- }
-
- public static implicit operator SybaseDouble (SybaseDecimal x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseDouble ((double)x.Value);
- }
-
- public static implicit operator SybaseDouble (SybaseInt16 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseDouble ((double)x.Value);
- }
-
- public static implicit operator SybaseDouble (SybaseInt32 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseDouble ((double)x.Value);
- }
-
- public static implicit operator SybaseDouble (SybaseInt64 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseDouble ((double)x.Value);
- }
-
- public static implicit operator SybaseDouble (SybaseMoney x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseDouble ((double)x.Value);
- }
-
- public static implicit operator SybaseDouble (SybaseSingle x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseDouble ((double)x.Value);
- }
-
- #endregion
- }
-}
-
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseGuid.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseGuid.cs
deleted file mode 100644
index f8290e22b98..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseGuid.cs
+++ /dev/null
@@ -1,243 +0,0 @@
-//
-// Mono.Data.SybaseTypes.SybaseGuid
-//
-// Author:
-// Tim Coleman <tim@timcoleman.com>
-//
-// (C) Copyright Tim Coleman, 2002
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.SybaseClient;
-using System;
-using System.Data.SqlTypes;
-using System.Globalization;
-
-namespace Mono.Data.SybaseTypes {
- public struct SybaseGuid : INullable, IComparable
- {
- #region Fields
-
- Guid value;
-
- private bool notNull;
-
- public static readonly SybaseGuid Null;
-
- #endregion
-
- #region Constructors
-
- public SybaseGuid (byte[] value)
- {
- this.value = new Guid (value);
- notNull = true;
- }
-
- public SybaseGuid (Guid g)
- {
- this.value = g;
- notNull = true;
- }
-
- public SybaseGuid (string s)
- {
- this.value = new Guid (s);
- notNull = true;
- }
-
- public SybaseGuid (int a, short b, short c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k)
- {
- this.value = new Guid (a, b, c, d, e, f, g, h, i, j, k);
- notNull = true;
- }
-
- #endregion
-
- #region Properties
-
- public bool IsNull {
- get { return !notNull; }
- }
-
- public Guid Value {
- get {
- if (this.IsNull)
- throw new SybaseNullValueException ("The property contains Null.");
- else
- return value;
- }
- }
-
- #endregion
-
- #region Methods
-
- public int CompareTo (object value)
- {
- if (value == null)
- return 1;
- else if (!(value is SybaseGuid))
- throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseGuid"));
- else if (((SybaseGuid)value).IsNull)
- return 1;
- else
- return this.value.CompareTo (((SybaseGuid)value).Value);
- }
-
- public override bool Equals (object value)
- {
- if (!(value is SybaseGuid))
- return false;
- else
- return (bool) (this == (SybaseGuid)value);
- }
-
- public static SybaseBoolean Equals (SybaseGuid x, SybaseGuid y)
- {
- return (x == y);
- }
-
- [MonoTODO]
- public override int GetHashCode ()
- {
- return 42;
- }
-
- public static SybaseBoolean GreaterThan (SybaseGuid x, SybaseGuid y)
- {
- return (x > y);
- }
-
- public static SybaseBoolean GreaterThanOrEqual (SybaseGuid x, SybaseGuid y)
- {
- return (x >= y);
- }
-
- public static SybaseBoolean LessThan (SybaseGuid x, SybaseGuid y)
- {
- return (x < y);
- }
-
- public static SybaseBoolean LessThanOrEqual (SybaseGuid x, SybaseGuid y)
- {
- return (x <= y);
- }
-
- public static SybaseBoolean NotEquals (SybaseGuid x, SybaseGuid y)
- {
- return (x != y);
- }
-
- [MonoTODO]
- public static SybaseGuid Parse (string s)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- public byte[] ToByteArray()
- {
- throw new NotImplementedException ();
- }
-
- public SybaseBinary ToSybaseBinary ()
- {
- return ((SybaseBinary)this);
- }
-
- public SybaseString ToSybaseString ()
- {
- return ((SybaseString)this);
- }
-
- public override string ToString ()
- {
- if (this.IsNull)
- return String.Empty;
- else
- return value.ToString ();
- }
-
- public static SybaseBoolean operator == (SybaseGuid x, SybaseGuid y)
- {
- if (x.IsNull || y.IsNull) return SybaseBoolean.Null;
- return new SybaseBoolean (x.Value == y.Value);
- }
-
- [MonoTODO]
- public static SybaseBoolean operator > (SybaseGuid x, SybaseGuid y)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- public static SybaseBoolean operator >= (SybaseGuid x, SybaseGuid y)
- {
- throw new NotImplementedException ();
- }
-
- public static SybaseBoolean operator != (SybaseGuid x, SybaseGuid y)
- {
- if (x.IsNull || y.IsNull) return SybaseBoolean.Null;
- return new SybaseBoolean (!(x.Value == y.Value));
- }
-
- [MonoTODO]
- public static SybaseBoolean operator < (SybaseGuid x, SybaseGuid y)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- public static SybaseBoolean operator <= (SybaseGuid x, SybaseGuid y)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- public static explicit operator SybaseGuid (SybaseBinary x)
- {
- throw new NotImplementedException ();
- }
-
- public static explicit operator Guid (SybaseGuid x)
- {
- return x.Value;
- }
-
- [MonoTODO]
- public static explicit operator SybaseGuid (SybaseString x)
- {
- throw new NotImplementedException ();
- }
-
- public static implicit operator SybaseGuid (Guid x)
- {
- return new SybaseGuid (x);
- }
-
- #endregion
- }
-}
-
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt16.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt16.cs
deleted file mode 100644
index a4d32dc2958..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt16.cs
+++ /dev/null
@@ -1,418 +0,0 @@
-//
-// Mono.Data.SybaseTypes.SybaseInt16
-//
-// Author:
-// Tim Coleman <tim@timcoleman.com>
-//
-// (C) Copyright Tim Coleman, 2002
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.SybaseClient;
-using System;
-using System.Data.SqlTypes;
-using System.Globalization;
-
-namespace Mono.Data.SybaseTypes {
- public struct SybaseInt16 : INullable, IComparable
- {
- #region Fields
-
- short value;
- private bool notNull;
-
- public static readonly SybaseInt16 MaxValue = new SybaseInt16 (32767);
- public static readonly SybaseInt16 MinValue = new SybaseInt16 (-32768);
- public static readonly SybaseInt16 Null;
- public static readonly SybaseInt16 Zero = new SybaseInt16 (0);
-
- #endregion
-
- #region Constructors
-
- public SybaseInt16 (short value)
- {
- this.value = value;
- notNull = true;;
- }
-
- #endregion
-
- #region Properties
-
- public bool IsNull {
- get { return !notNull; }
- }
-
- public short Value {
- get {
- if (this.IsNull)
- throw new SybaseNullValueException ();
- else
- return value;
- }
- }
-
- #endregion
-
- #region Methods
-
- public static SybaseInt16 Add (SybaseInt16 x, SybaseInt16 y)
- {
- return (x + y);
- }
-
- public static SybaseInt16 BitwiseAnd (SybaseInt16 x, SybaseInt16 y)
- {
- return (x & y);
- }
-
- public static SybaseInt16 BitwiseOr (SybaseInt16 x, SybaseInt16 y)
- {
- return (x | y);
- }
-
- public int CompareTo (object value)
- {
- if (value == null)
- return 1;
- else if (!(value is SybaseInt16))
- throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseInt16"));
- else if (((SybaseInt16)value).IsNull)
- return 1;
- else
- return this.value.CompareTo (((SybaseInt16)value).Value);
- }
-
- public static SybaseInt16 Divide (SybaseInt16 x, SybaseInt16 y)
- {
- return (x / y);
- }
-
- public override bool Equals (object value)
- {
- if (!(value is SybaseInt16))
- return false;
- else
- return (bool) (this == (SybaseInt16)value);
- }
-
- public static SybaseBoolean Equals (SybaseInt16 x, SybaseInt16 y)
- {
- return (x == y);
- }
-
- public override int GetHashCode ()
- {
- return (int)value;
- }
-
- public static SybaseBoolean GreaterThan (SybaseInt16 x, SybaseInt16 y)
- {
- return (x > y);
- }
-
- public static SybaseBoolean GreaterThanOrEqual (SybaseInt16 x, SybaseInt16 y)
- {
- return (x >= y);
- }
-
- public static SybaseBoolean LessThan (SybaseInt16 x, SybaseInt16 y)
- {
- return (x < y);
- }
-
- public static SybaseBoolean LessThanOrEqual (SybaseInt16 x, SybaseInt16 y)
- {
- return (x <= y);
- }
-
- public static SybaseInt16 Mod (SybaseInt16 x, SybaseInt16 y)
- {
- return (x % y);
- }
-
- public static SybaseInt16 Multiply (SybaseInt16 x, SybaseInt16 y)
- {
- return (x * y);
- }
-
- public static SybaseBoolean NotEquals (SybaseInt16 x, SybaseInt16 y)
- {
- return (x != y);
- }
-
- public static SybaseInt16 OnesComplement (SybaseInt16 x)
- {
- return ~x;
- }
-
- public static SybaseInt16 Parse (string s)
- {
- return new SybaseInt16 (Int16.Parse (s));
- }
-
- public static SybaseInt16 Subtract (SybaseInt16 x, SybaseInt16 y)
- {
- return (x - y);
- }
-
- public SybaseBoolean ToSybaseBoolean ()
- {
- return ((SybaseBoolean)this);
- }
-
- public SybaseByte ToSybaseByte ()
- {
- return ((SybaseByte)this);
- }
-
- public SybaseDecimal ToSybaseDecimal ()
- {
- return ((SybaseDecimal)this);
- }
-
- public SybaseDouble ToSybaseDouble ()
- {
- return ((SybaseDouble)this);
- }
-
- public SybaseInt32 ToSybaseInt32 ()
- {
- return ((SybaseInt32)this);
- }
-
- public SybaseInt64 ToSybaseInt64 ()
- {
- return ((SybaseInt64)this);
- }
-
- public SybaseMoney ToSybaseMoney ()
- {
- return ((SybaseMoney)this);
- }
-
- public SybaseSingle ToSybaseSingle ()
- {
- return ((SybaseSingle)this);
- }
-
- public SybaseString ToSybaseString ()
- {
- return ((SybaseString)this);
- }
-
- public override string ToString ()
- {
- if (this.IsNull)
- return "Null";
- else
- return value.ToString ();
- }
-
- public static SybaseInt16 Xor (SybaseInt16 x, SybaseInt16 y)
- {
- return (x ^ y);
- }
-
- public static SybaseInt16 operator + (SybaseInt16 x, SybaseInt16 y)
- {
- return new SybaseInt16 ((short) (x.Value + y.Value));
- }
-
- public static SybaseInt16 operator & (SybaseInt16 x, SybaseInt16 y)
- {
- return new SybaseInt16 ((short) (x.value & y.Value));
- }
-
- public static SybaseInt16 operator | (SybaseInt16 x, SybaseInt16 y)
- {
- return new SybaseInt16 ((short) ((byte) x.Value | (byte) y.Value));
- }
-
- public static SybaseInt16 operator / (SybaseInt16 x, SybaseInt16 y)
- {
- return new SybaseInt16 ((short) (x.Value / y.Value));
- }
-
- public static SybaseBoolean operator == (SybaseInt16 x, SybaseInt16 y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value == y.Value);
- }
-
- public static SybaseInt16 operator ^ (SybaseInt16 x, SybaseInt16 y)
- {
- return new SybaseInt16 ((short) (x.Value ^ y.Value));
- }
-
- public static SybaseBoolean operator > (SybaseInt16 x, SybaseInt16 y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value > y.Value);
- }
-
- public static SybaseBoolean operator >= (SybaseInt16 x, SybaseInt16 y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value >= y.Value);
- }
-
- public static SybaseBoolean operator != (SybaseInt16 x, SybaseInt16 y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (!(x.Value == y.Value));
- }
-
- public static SybaseBoolean operator < (SybaseInt16 x, SybaseInt16 y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value < y.Value);
- }
-
- public static SybaseBoolean operator <= (SybaseInt16 x, SybaseInt16 y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value <= y.Value);
- }
-
- public static SybaseInt16 operator % (SybaseInt16 x, SybaseInt16 y)
- {
- return new SybaseInt16 ((short) (x.Value % y.Value));
- }
-
- public static SybaseInt16 operator * (SybaseInt16 x, SybaseInt16 y)
- {
- return new SybaseInt16 ((short) (x.Value * y.Value));
- }
-
- public static SybaseInt16 operator ~ (SybaseInt16 x)
- {
- return new SybaseInt16 ((short) (~x.Value));
- }
-
- public static SybaseInt16 operator - (SybaseInt16 x, SybaseInt16 y)
- {
- return new SybaseInt16 ((short) (x.Value - y.Value));
- }
-
- public static SybaseInt16 operator - (SybaseInt16 n)
- {
- return new SybaseInt16 ((short) (-n.Value));
- }
-
- public static explicit operator SybaseInt16 (SybaseBoolean x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseInt16 ((short)x.ByteValue);
- }
-
- public static explicit operator SybaseInt16 (SybaseDecimal x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseInt16 ((short)x.Value);
- }
-
- public static explicit operator SybaseInt16 (SybaseDouble x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseInt16 ((short)x.Value);
- }
-
- public static explicit operator short (SybaseInt16 x)
- {
- return x.Value;
- }
-
- public static explicit operator SybaseInt16 (SybaseInt32 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseInt16 ((short)x.Value);
- }
-
- public static explicit operator SybaseInt16 (SybaseInt64 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseInt16 ((short)x.Value);
- }
-
- public static explicit operator SybaseInt16 (SybaseMoney x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseInt16 ((short)x.Value);
- }
-
- public static explicit operator SybaseInt16 (SybaseSingle x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseInt16 ((short)x.Value);
- }
-
- public static explicit operator SybaseInt16 (SybaseString x)
- {
- return SybaseInt16.Parse (x.Value);
- }
-
- public static implicit operator SybaseInt16 (short x)
- {
- return new SybaseInt16 (x);
- }
-
- public static implicit operator SybaseInt16 (SybaseByte x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseInt16 ((short)x.Value);
- }
-
- #endregion
- }
-}
-
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt32.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt32.cs
deleted file mode 100644
index cf181bfcc9c..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt32.cs
+++ /dev/null
@@ -1,438 +0,0 @@
-//
-// Mono.Data.SybaseTypes.SybaseInt32
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-//
-// (C) Copyright Tim Coleman, 2002
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.SybaseClient;
-using System;
-using System.Data.SqlTypes;
-using System.Globalization;
-
-namespace Mono.Data.SybaseTypes {
- public struct SybaseInt32 : INullable, IComparable
- {
- #region Fields
-
- int value;
- private bool notNull;
-
- public static readonly SybaseInt32 MaxValue = new SybaseInt32 (2147483647);
- public static readonly SybaseInt32 MinValue = new SybaseInt32 (-2147483648);
- public static readonly SybaseInt32 Null;
- public static readonly SybaseInt32 Zero = new SybaseInt32 (0);
-
- #endregion
-
- #region Constructors
-
- public SybaseInt32(int value)
- {
- this.value = value;
- notNull = true;
- }
-
- #endregion
-
- #region Properties
-
- public bool IsNull {
- get { return !notNull; }
- }
-
- public int Value {
- get {
- if (this.IsNull)
- throw new SybaseNullValueException ();
- else
- return value;
- }
- }
-
- #endregion
-
- #region Methods
-
- public static SybaseInt32 Add (SybaseInt32 x, SybaseInt32 y)
- {
- return (x + y);
- }
-
- public static SybaseInt32 BitwiseAnd(SybaseInt32 x, SybaseInt32 y)
- {
- return (x & y);
- }
-
- public static SybaseInt32 BitwiseOr(SybaseInt32 x, SybaseInt32 y)
- {
- return (x | y);
- }
-
- public int CompareTo(object value)
- {
- if (value == null)
- return 1;
- else if (!(value is SybaseInt32))
- throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseInt32"));
- else if (((SybaseInt32)value).IsNull)
- return 1;
- else
- return this.value.CompareTo (((SybaseInt32)value).Value);
- }
-
- public static SybaseInt32 Divide(SybaseInt32 x, SybaseInt32 y)
- {
- return (x / y);
- }
-
- public override bool Equals(object value)
- {
- if (!(value is SybaseInt32))
- return false;
- else
- return (bool) (this == (SybaseInt32)value);
- }
-
- public static SybaseBoolean Equals(SybaseInt32 x, SybaseInt32 y)
- {
- return (x == y);
- }
-
- public override int GetHashCode()
- {
- return value;
- }
-
- public static SybaseBoolean GreaterThan (SybaseInt32 x, SybaseInt32 y)
- {
- return (x > y);
- }
-
- public static SybaseBoolean GreaterThanOrEqual (SybaseInt32 x, SybaseInt32 y)
- {
- return (x >= y);
- }
-
- public static SybaseBoolean LessThan(SybaseInt32 x, SybaseInt32 y)
- {
- return (x < y);
- }
-
- public static SybaseBoolean LessThanOrEqual(SybaseInt32 x, SybaseInt32 y)
- {
- return (x <= y);
- }
-
- public static SybaseInt32 Mod(SybaseInt32 x, SybaseInt32 y)
- {
- return (x % y);
- }
-
- public static SybaseInt32 Multiply(SybaseInt32 x, SybaseInt32 y)
- {
- return (x * y);
- }
-
- public static SybaseBoolean NotEquals(SybaseInt32 x, SybaseInt32 y)
- {
- return (x != y);
- }
-
- public static SybaseInt32 OnesComplement(SybaseInt32 x)
- {
- return ~x;
- }
-
- public static SybaseInt32 Parse(string s)
- {
- return new SybaseInt32 (Int32.Parse (s));
- }
-
- public static SybaseInt32 Subtract(SybaseInt32 x, SybaseInt32 y)
- {
- return (x - y);
- }
-
- public SybaseBoolean ToSybaseBoolean()
- {
- return ((SybaseBoolean)this);
- }
-
- public SybaseByte ToSybaseByte()
- {
- return ((SybaseByte)this);
- }
-
- public SybaseDecimal ToSybaseDecimal()
- {
- return ((SybaseDecimal)this);
- }
-
- public SybaseDouble ToSybaseDouble()
- {
- return ((SybaseDouble)this);
- }
-
- public SybaseInt16 ToSybaseInt16()
- {
- return ((SybaseInt16)this);
- }
-
- public SybaseInt64 ToSybaseInt64()
- {
- return ((SybaseInt64)this);
- }
-
- public SybaseMoney ToSybaseMoney()
- {
- return ((SybaseMoney)this);
- }
-
- public SybaseSingle ToSybaseSingle()
- {
- return ((SybaseSingle)this);
- }
-
- public SybaseString ToSybaseString ()
- {
- return ((SybaseString)this);
- }
-
- public override string ToString()
- {
- if (this.IsNull)
- return "Null";
- else
- return value.ToString ();
- }
-
- public static SybaseInt32 Xor(SybaseInt32 x, SybaseInt32 y)
- {
- return (x ^ y);
- }
-
- #endregion
-
- #region Operators
-
- // Compute Addition
- public static SybaseInt32 operator + (SybaseInt32 x, SybaseInt32 y)
- {
- return new SybaseInt32 (x.Value + y.Value);
- }
-
- // Bitwise AND
- public static SybaseInt32 operator & (SybaseInt32 x, SybaseInt32 y)
- {
- return new SybaseInt32 (x.Value & y.Value);
- }
-
- // Bitwise OR
- public static SybaseInt32 operator | (SybaseInt32 x, SybaseInt32 y)
- {
- return new SybaseInt32 (x.Value | y.Value);
- }
-
- // Compute Division
- public static SybaseInt32 operator / (SybaseInt32 x, SybaseInt32 y)
- {
- return new SybaseInt32 (x.Value / y.Value);
- }
-
- // Compare Equality
- public static SybaseBoolean operator == (SybaseInt32 x, SybaseInt32 y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value == y.Value);
- }
-
- // Bitwise Exclusive-OR (XOR)
- public static SybaseInt32 operator ^ (SybaseInt32 x, SybaseInt32 y)
- {
- return new SybaseInt32 (x.Value ^ y.Value);
- }
-
- // > Compare
- public static SybaseBoolean operator >(SybaseInt32 x, SybaseInt32 y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value > y.Value);
- }
-
- // >= Compare
- public static SybaseBoolean operator >= (SybaseInt32 x, SybaseInt32 y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value >= y.Value);
- }
-
- // != Inequality Compare
- public static SybaseBoolean operator != (SybaseInt32 x, SybaseInt32 y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value != y.Value);
- }
-
- // < Compare
- public static SybaseBoolean operator < (SybaseInt32 x, SybaseInt32 y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value < y.Value);
- }
-
- // <= Compare
- public static SybaseBoolean operator <= (SybaseInt32 x, SybaseInt32 y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value <= y.Value);
- }
-
- // Compute Modulus
- public static SybaseInt32 operator % (SybaseInt32 x, SybaseInt32 y)
- {
- return new SybaseInt32 (x.Value % y.Value);
- }
-
- // Compute Multiplication
- public static SybaseInt32 operator * (SybaseInt32 x, SybaseInt32 y)
- {
- return new SybaseInt32 (x.Value * y.Value);
- }
-
- // Ones Complement
- public static SybaseInt32 operator ~ (SybaseInt32 x)
- {
- return new SybaseInt32 (~x.Value);
- }
-
- // Subtraction
- public static SybaseInt32 operator - (SybaseInt32 x, SybaseInt32 y)
- {
- return new SybaseInt32 (x.Value - y.Value);
- }
-
- // Negates the Value
- public static SybaseInt32 operator - (SybaseInt32 x)
- {
- return new SybaseInt32 (-x.Value);
- }
-
- // Type Conversions
- public static explicit operator SybaseInt32 (SybaseBoolean x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseInt32 ((int)x.ByteValue);
- }
-
- public static explicit operator SybaseInt32 (SybaseDecimal x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseInt32 ((int)x.Value);
- }
-
- public static explicit operator SybaseInt32 (SybaseDouble x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseInt32 ((int)x.Value);
- }
-
- public static explicit operator int (SybaseInt32 x)
- {
- return x.Value;
- }
-
- public static explicit operator SybaseInt32 (SybaseInt64 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseInt32 ((int)x.Value);
- }
-
- public static explicit operator SybaseInt32(SybaseMoney x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseInt32 ((int)x.Value);
- }
-
- public static explicit operator SybaseInt32(SybaseSingle x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseInt32 ((int)x.Value);
- }
-
- public static explicit operator SybaseInt32(SybaseString x)
- {
- return SybaseInt32.Parse (x.Value);
- }
-
- public static implicit operator SybaseInt32(int x)
- {
- return new SybaseInt32 (x);
- }
-
- public static implicit operator SybaseInt32(SybaseByte x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseInt32 ((int)x.Value);
- }
-
- public static implicit operator SybaseInt32(SybaseInt16 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseInt32 ((int)x.Value);
- }
-
- #endregion
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt64.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt64.cs
deleted file mode 100644
index 82e4e87f7c5..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseInt64.cs
+++ /dev/null
@@ -1,421 +0,0 @@
-//
-// Mono.Data.SybaseTypes.SybaseInt64
-//
-// Author:
-// Tim Coleman <tim@timcoleman.com>
-//
-// (C) Copyright Tim Coleman, 2002
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.SybaseClient;
-using System;
-using System.Data.SqlTypes;
-using System.Globalization;
-
-namespace Mono.Data.SybaseTypes {
- public struct SybaseInt64 : INullable, IComparable
- {
- #region Fields
-
- long value;
-
- private bool notNull;
-
- public static readonly SybaseInt64 MaxValue = new SybaseInt64 (9223372036854775807);
- public static readonly SybaseInt64 MinValue = new SybaseInt64 (-9223372036854775808);
-
- public static readonly SybaseInt64 Null;
- public static readonly SybaseInt64 Zero = new SybaseInt64 (0);
-
- #endregion
-
- #region Constructors
-
- public SybaseInt64 (long value)
- {
- this.value = value;
- notNull = true;
- }
-
- #endregion
-
- #region Properties
-
- public bool IsNull {
- get { return !notNull; }
- }
-
- public long Value {
- get {
- if (this.IsNull)
- throw new SybaseNullValueException ();
- else
- return value;
- }
- }
-
- #endregion
-
- #region Methods
-
- public static SybaseInt64 Add (SybaseInt64 x, SybaseInt64 y)
- {
- return (x + y);
- }
-
- public static SybaseInt64 BitwiseAnd (SybaseInt64 x, SybaseInt64 y)
- {
- return (x & y);
- }
-
- public static SybaseInt64 BitwiseOr (SybaseInt64 x, SybaseInt64 y)
- {
- return (x | y);
- }
-
- public int CompareTo (object value)
- {
- if (value == null)
- return 1;
- else if (!(value is SybaseInt64))
- throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseInt64"));
- else if (((SybaseInt64)value).IsNull)
- return 1;
- else
- return this.value.CompareTo (((SybaseInt64)value).Value);
- }
-
- public static SybaseInt64 Divide (SybaseInt64 x, SybaseInt64 y)
- {
- return (x / y);
- }
-
- public override bool Equals (object value)
- {
- if (!(value is SybaseInt64))
- return false;
- else
- return (bool) (this == (SybaseInt64)value);
- }
-
- public static SybaseBoolean Equals (SybaseInt64 x, SybaseInt64 y)
- {
- return (x == y);
- }
-
- public override int GetHashCode ()
- {
- return (int)(value & 0xffffffff) ^ (int)(value >> 32);
- }
-
- public static SybaseBoolean GreaterThan (SybaseInt64 x, SybaseInt64 y)
- {
- return (x > y);
- }
-
- public static SybaseBoolean GreaterThanOrEqual (SybaseInt64 x, SybaseInt64 y)
- {
- return (x >= y);
- }
-
- public static SybaseBoolean LessThan (SybaseInt64 x, SybaseInt64 y)
- {
- return (x < y);
- }
-
- public static SybaseBoolean LessThanOrEqual (SybaseInt64 x, SybaseInt64 y)
- {
- return (x <= y);
- }
-
- public static SybaseInt64 Mod (SybaseInt64 x, SybaseInt64 y)
- {
- return (x % y);
- }
-
- public static SybaseInt64 Multiply (SybaseInt64 x, SybaseInt64 y)
- {
- return (x * y);
- }
-
- public static SybaseBoolean NotEquals (SybaseInt64 x, SybaseInt64 y)
- {
- return (x != y);
- }
-
- public static SybaseInt64 OnesComplement (SybaseInt64 x)
- {
- return ~x;
- }
-
-
- public static SybaseInt64 Parse (string s)
- {
- return new SybaseInt64 (Int64.Parse (s));
- }
-
- public static SybaseInt64 Subtract (SybaseInt64 x, SybaseInt64 y)
- {
- return (x - y);
- }
-
- public SybaseBoolean ToSybaseBoolean ()
- {
- return ((SybaseBoolean)this);
- }
-
- public SybaseByte ToSybaseByte ()
- {
- return ((SybaseByte)this);
- }
-
- public SybaseDecimal ToSybaseDecimal ()
- {
- return ((SybaseDecimal)this);
- }
-
- public SybaseDouble ToSybaseDouble ()
- {
- return ((SybaseDouble)this);
- }
-
- public SybaseInt16 ToSybaseInt16 ()
- {
- return ((SybaseInt16)this);
- }
-
- public SybaseInt32 ToSybaseInt32 ()
- {
- return ((SybaseInt32)this);
- }
-
- public SybaseMoney ToSybaseMoney ()
- {
- return ((SybaseMoney)this);
- }
-
- public SybaseSingle ToSybaseSingle ()
- {
- return ((SybaseSingle)this);
- }
-
- public SybaseString ToSybaseString ()
- {
- return ((SybaseString)this);
- }
-
- public override string ToString ()
- {
- if (this.IsNull)
- return "Null";
-
- return value.ToString ();
- }
-
- public static SybaseInt64 Xor (SybaseInt64 x, SybaseInt64 y)
- {
- return (x ^ y);
- }
-
- public static SybaseInt64 operator + (SybaseInt64 x, SybaseInt64 y)
- {
- return new SybaseInt64 (x.Value + y.Value);
- }
-
- public static SybaseInt64 operator & (SybaseInt64 x, SybaseInt64 y)
- {
- return new SybaseInt64 (x.value & y.Value);
- }
-
- public static SybaseInt64 operator | (SybaseInt64 x, SybaseInt64 y)
- {
- return new SybaseInt64 (x.value | y.Value);
- }
-
- public static SybaseInt64 operator / (SybaseInt64 x, SybaseInt64 y)
- {
- return new SybaseInt64 (x.Value / y.Value);
- }
-
- public static SybaseBoolean operator == (SybaseInt64 x, SybaseInt64 y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value == y.Value);
- }
-
- public static SybaseInt64 operator ^ (SybaseInt64 x, SybaseInt64 y)
- {
- return new SybaseInt64 (x.Value ^ y.Value);
- }
-
- public static SybaseBoolean operator > (SybaseInt64 x, SybaseInt64 y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value > y.Value);
- }
-
- public static SybaseBoolean operator >= (SybaseInt64 x, SybaseInt64 y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value >= y.Value);
- }
-
- public static SybaseBoolean operator != (SybaseInt64 x, SybaseInt64 y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (!(x.Value == y.Value));
- }
-
- public static SybaseBoolean operator < (SybaseInt64 x, SybaseInt64 y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value < y.Value);
- }
-
- public static SybaseBoolean operator <= (SybaseInt64 x, SybaseInt64 y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value <= y.Value);
- }
-
- public static SybaseInt64 operator % (SybaseInt64 x, SybaseInt64 y)
- {
- return new SybaseInt64(x.Value % y.Value);
- }
-
- public static SybaseInt64 operator * (SybaseInt64 x, SybaseInt64 y)
- {
- return new SybaseInt64 (x.Value * y.Value);
- }
-
- public static SybaseInt64 operator ~ (SybaseInt64 x)
- {
- return new SybaseInt64 (~(x.Value));
- }
-
- public static SybaseInt64 operator - (SybaseInt64 x, SybaseInt64 y)
- {
- return new SybaseInt64 (x.Value - y.Value);
- }
-
- public static SybaseInt64 operator - (SybaseInt64 n)
- {
- return new SybaseInt64 (-(n.Value));
- }
-
- public static explicit operator SybaseInt64 (SybaseBoolean x)
- {
- if (x.IsNull)
- return SybaseInt64.Null;
- else
- return new SybaseInt64 ((long)x.ByteValue);
- }
-
- public static explicit operator SybaseInt64 (SybaseDecimal x)
- {
- if (x.IsNull)
- return SybaseInt64.Null;
- else
- return new SybaseInt64 ((long)x.Value);
- }
-
- public static explicit operator SybaseInt64 (SybaseDouble x)
- {
- if (x.IsNull)
- return SybaseInt64.Null;
- else
- return new SybaseInt64 ((long)x.Value);
- }
-
- public static explicit operator long (SybaseInt64 x)
- {
- return x.Value;
- }
-
- public static explicit operator SybaseInt64 (SybaseMoney x)
- {
- if (x.IsNull)
- return SybaseInt64.Null;
- else
- return new SybaseInt64 ((long)x.Value);
- }
-
- public static explicit operator SybaseInt64 (SybaseSingle x)
- {
- if (x.IsNull)
- return SybaseInt64.Null;
- else
- return new SybaseInt64 ((long)x.Value);
- }
-
- public static explicit operator SybaseInt64 (SybaseString x)
- {
- return SybaseInt64.Parse (x.Value);
- }
-
- public static implicit operator SybaseInt64 (long x)
- {
- return new SybaseInt64 (x);
- }
-
- public static implicit operator SybaseInt64 (SybaseByte x)
- {
- if (x.IsNull)
- return SybaseInt64.Null;
- else
- return new SybaseInt64 ((long)x.Value);
- }
-
- public static implicit operator SybaseInt64 (SybaseInt16 x)
- {
- if (x.IsNull)
- return SybaseInt64.Null;
- else
- return new SybaseInt64 ((long)x.Value);
- }
-
- public static implicit operator SybaseInt64 (SybaseInt32 x)
- {
- if (x.IsNull)
- return SybaseInt64.Null;
- else
- return new SybaseInt64 ((long)x.Value);
- }
-
- #endregion
- }
-}
-
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseMoney.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseMoney.cs
deleted file mode 100644
index 107615e8ff6..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseMoney.cs
+++ /dev/null
@@ -1,413 +0,0 @@
-//
-// Mono.Data.SybaseTypes.SybaseMoney
-//
-// Author:
-// Tim Coleman <tim@timcoleman.com>
-//
-// Based on System.Data.SqlTypes.SqlMoney
-//
-// (C) Ximian, Inc. 2002-2003
-// (C) Copyright Tim Coleman, 2002-2003
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.SybaseClient;
-using System;
-using System.Data.SqlTypes;
-using System.Globalization;
-
-namespace Mono.Data.SybaseTypes {
- public struct SybaseMoney : INullable, IComparable
- {
- #region Fields
-
- decimal value;
-
- private bool notNull;
-
- public static readonly SybaseMoney MaxValue = new SybaseMoney (922337203685477.5807);
- public static readonly SybaseMoney MinValue = new SybaseMoney (-922337203685477.5808);
- public static readonly SybaseMoney Null;
- public static readonly SybaseMoney Zero = new SybaseMoney (0);
-
- #endregion
-
- #region Constructors
-
- public SybaseMoney (decimal value)
- {
- this.value = value;
- notNull = true;
- }
-
- public SybaseMoney (double value)
- {
- this.value = (decimal)value;
- notNull = true;
- }
-
- public SybaseMoney (int value)
- {
- this.value = (decimal)value;
- notNull = true;
- }
-
- public SybaseMoney (long value)
- {
- this.value = (decimal)value;
- notNull = true;
- }
-
- #endregion
-
- #region Properties
-
- public bool IsNull {
- get { return !notNull; }
- }
-
- public decimal Value {
- get {
- if (this.IsNull)
- throw new SybaseNullValueException ();
- else
- return value;
- }
- }
-
- #endregion
-
- #region Methods
-
- public static SybaseMoney Add (SybaseMoney x, SybaseMoney y)
- {
- return (x + y);
- }
-
- public int CompareTo (object value)
- {
- if (value == null)
- return 1;
- else if (!(value is SybaseMoney))
- throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseMoney"));
- else if (((SybaseMoney)value).IsNull)
- return 1;
- else
- return this.value.CompareTo (((SybaseMoney)value).Value);
- }
-
- public static SybaseMoney Divide (SybaseMoney x, SybaseMoney y)
- {
- return (x / y);
- }
-
- public override bool Equals (object value)
- {
- if (!(value is SybaseMoney))
- return false;
- else
- return (bool) (this == (SybaseMoney)value);
- }
-
- public static SybaseBoolean Equals (SybaseMoney x, SybaseMoney y)
- {
- return (x == y);
- }
-
- public override int GetHashCode ()
- {
- return (int)value;
- }
-
- public static SybaseBoolean GreaterThan (SybaseMoney x, SybaseMoney y)
- {
- return (x > y);
- }
-
- public static SybaseBoolean GreaterThanOrEqual (SybaseMoney x, SybaseMoney y)
- {
- return (x >= y);
- }
-
- public static SybaseBoolean LessThan (SybaseMoney x, SybaseMoney y)
- {
- return (x < y);
- }
-
- public static SybaseBoolean LessThanOrEqual (SybaseMoney x, SybaseMoney y)
- {
- return (x <= y);
- }
-
- public static SybaseMoney Multiply (SybaseMoney x, SybaseMoney y)
- {
- return (x * y);
- }
-
- public static SybaseBoolean NotEquals (SybaseMoney x, SybaseMoney y)
- {
- return (x != y);
- }
-
- public static SybaseMoney Parse (string s)
- {
- decimal d = Decimal.Parse (s);
-
- if (d > SybaseMoney.MaxValue.Value || d < SybaseMoney.MinValue.Value)
- throw new OverflowException ("");
-
- return new SybaseMoney (d);
- }
-
- public static SybaseMoney Subtract (SybaseMoney x, SybaseMoney y)
- {
- return (x - y);
- }
-
- public decimal ToDecimal ()
- {
- return value;
- }
-
- public double ToDouble ()
- {
- return (double)value;
- }
-
- public int ToInt32 ()
- {
- return (int)value;
- }
-
- public long ToInt64 ()
- {
- return (long)value;
- }
-
- public SybaseBoolean ToSybaseBoolean ()
- {
- return ((SybaseBoolean)this);
- }
-
- public SybaseByte ToSybaseByte ()
- {
- return ((SybaseByte)this);
- }
-
- public SybaseDecimal ToSybaseDecimal ()
- {
- return ((SybaseDecimal)this);
- }
-
- public SybaseDouble ToSybaseDouble ()
- {
- return ((SybaseDouble)this);
- }
-
- public SybaseInt16 ToSybaseInt16 ()
- {
- return ((SybaseInt16)this);
- }
-
- public SybaseInt32 ToSybaseInt32 ()
- {
- return ((SybaseInt32)this);
- }
-
- public SybaseInt64 ToSybaseInt64 ()
- {
- return ((SybaseInt64)this);
- }
-
- public SybaseSingle ToSybaseSingle ()
- {
- return ((SybaseSingle)this);
- }
-
- public SybaseString ToSybaseString ()
- {
- return ((SybaseString)this);
- }
-
- public override string ToString ()
- {
- if (this.IsNull)
- return String.Empty;
- else
- return value.ToString ();
- }
-
- public static SybaseMoney operator + (SybaseMoney x, SybaseMoney y)
- {
- return new SybaseMoney (x.Value + y.Value);
- }
-
- public static SybaseMoney operator / (SybaseMoney x, SybaseMoney y)
- {
- return new SybaseMoney (x.Value / y.Value);
- }
-
- public static SybaseBoolean operator == (SybaseMoney x, SybaseMoney y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value == y.Value);
- }
-
- public static SybaseBoolean operator > (SybaseMoney x, SybaseMoney y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value > y.Value);
- }
-
- public static SybaseBoolean operator >= (SybaseMoney x, SybaseMoney y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value >= y.Value);
- }
-
- public static SybaseBoolean operator != (SybaseMoney x, SybaseMoney y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (!(x.Value == y.Value));
- }
-
- public static SybaseBoolean operator < (SybaseMoney x, SybaseMoney y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value < y.Value);
- }
-
- public static SybaseBoolean operator <= (SybaseMoney x, SybaseMoney y)
- {
- if (x.IsNull || y.IsNull) return SybaseBoolean.Null;
- return new SybaseBoolean (x.Value <= y.Value);
- }
-
- public static SybaseMoney operator * (SybaseMoney x, SybaseMoney y)
- {
- return new SybaseMoney (x.Value * y.Value);
- }
-
- public static SybaseMoney operator - (SybaseMoney x, SybaseMoney y)
- {
- return new SybaseMoney (x.Value - y.Value);
- }
-
- public static SybaseMoney operator - (SybaseMoney n)
- {
- return new SybaseMoney (-(n.Value));
- }
-
- public static explicit operator SybaseMoney (SybaseBoolean x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseMoney ((decimal)x.ByteValue);
- }
-
- public static explicit operator SybaseMoney (SybaseDecimal x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseMoney (x.Value);
- }
-
- public static explicit operator SybaseMoney (SybaseDouble x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseMoney ((decimal)x.Value);
- }
-
- public static explicit operator decimal (SybaseMoney x)
- {
- return x.Value;
- }
-
- public static explicit operator SybaseMoney (SybaseSingle x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseMoney ((decimal)x.Value);
- }
-
- public static explicit operator SybaseMoney (SybaseString x)
- {
- return SybaseMoney.Parse (x.Value);
- }
-
- public static implicit operator SybaseMoney (decimal x)
- {
- return new SybaseMoney (x);
- }
-
- public static implicit operator SybaseMoney (SybaseByte x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseMoney ((decimal)x.Value);
- }
-
- public static implicit operator SybaseMoney (SybaseInt16 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseMoney ((decimal)x.Value);
- }
-
- public static implicit operator SybaseMoney (SybaseInt32 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseMoney ((decimal)x.Value);
- }
-
- public static implicit operator SybaseMoney (SybaseInt64 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseMoney ((decimal)x.Value);
- }
-
- #endregion
- }
-}
-
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseNullValueException.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseNullValueException.cs
deleted file mode 100644
index 84b04c98f69..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseNullValueException.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// Mono.Data.SybaseTypes.SybaseNullValueException.cs
-//
-// Authors:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Copyright (C) Tim Coleman, 2002
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.SybaseClient;
-using System;
-using System.Globalization;
-using System.Runtime.Serialization;
-
-namespace Mono.Data.SybaseTypes {
- [Serializable]
- public class SybaseNullValueException : SybaseTypeException
- {
- #region Constructors
-
- public SybaseNullValueException ()
- : base (Locale.GetText ("Data is Null. This method or property cannot be called on Null values."))
- {
- }
-
- public SybaseNullValueException (string message)
- : base (message)
- {
- }
-
- #endregion // Constructors
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseSingle.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseSingle.cs
deleted file mode 100644
index 0573e32286b..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseSingle.cs
+++ /dev/null
@@ -1,356 +0,0 @@
-//
-// System.Data.SybaseTypes.SybaseSingle
-//
-// Author:
-// Tim Coleman <tim@timcoleman.com>
-//
-// (C) Copyright 2002 Tim Coleman
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.SybaseClient;
-using System;
-using System.Data.SqlTypes;
-using System.Globalization;
-
-namespace Mono.Data.SybaseTypes {
- public struct SybaseSingle : INullable, IComparable
- {
- #region Fields
-
- float value;
-
- private bool notNull;
-
- public static readonly SybaseSingle MaxValue = new SybaseSingle (3.40282346638528859e38);
- public static readonly SybaseSingle MinValue = new SybaseSingle (-3.40282346638528859e38);
- public static readonly SybaseSingle Null;
- public static readonly SybaseSingle Zero = new SybaseSingle (0);
-
- #endregion
-
- #region Constructors
-
- public SybaseSingle (double value)
- {
- this.value = (float)value;
- notNull = true;
- }
-
- public SybaseSingle (float value)
- {
- this.value = value;
- notNull = true;
- }
-
- #endregion
-
- #region Properties
-
- public bool IsNull {
- get { return !notNull; }
- }
-
- public float Value {
- get {
- if (this.IsNull)
- throw new SybaseNullValueException ();
- else
- return value;
- }
- }
-
- #endregion
-
- #region Methods
-
- public static SybaseSingle Add (SybaseSingle x, SybaseSingle y)
- {
- return (x + y);
- }
-
- public int CompareTo (object value)
- {
- if (value == null)
- return 1;
- else if (!(value is SybaseSingle))
- throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseSingle"));
- else if (((SybaseSingle)value).IsNull)
- return 1;
- else
- return this.value.CompareTo (((SybaseSingle)value).Value);
- }
-
- public static SybaseSingle Divide (SybaseSingle x, SybaseSingle y)
- {
- return (x / y);
- }
-
- public override bool Equals (object value)
- {
- if (!(value is SybaseSingle))
- return false;
- else
- return (bool) (this == (SybaseSingle)value);
- }
-
- public static SybaseBoolean Equals (SybaseSingle x, SybaseSingle y)
- {
- return (x == y);
- }
-
- public override int GetHashCode ()
- {
- long LongValue = (long) value;
- return (int)(LongValue ^ (LongValue >> 32));
- }
-
- public static SybaseBoolean GreaterThan (SybaseSingle x, SybaseSingle y)
- {
- return (x > y);
- }
-
- public static SybaseBoolean GreaterThanOrEqual (SybaseSingle x, SybaseSingle y)
- {
- return (x >= y);
- }
-
- public static SybaseBoolean LessThan (SybaseSingle x, SybaseSingle y)
- {
- return (x < y);
- }
-
- public static SybaseBoolean LessThanOrEqual (SybaseSingle x, SybaseSingle y)
- {
- return (x <= y);
- }
-
- public static SybaseSingle Multiply (SybaseSingle x, SybaseSingle y)
- {
- return (x * y);
- }
-
- public static SybaseBoolean NotEquals (SybaseSingle x, SybaseSingle y)
- {
- return (x != y);
- }
-
- public static SybaseSingle Parse (string s)
- {
- return new SybaseSingle (Single.Parse (s));
- }
-
- public static SybaseSingle Subtract (SybaseSingle x, SybaseSingle y)
- {
- return (x - y);
- }
-
- public SybaseBoolean ToSybaseBoolean ()
- {
- return ((SybaseBoolean)this);
- }
-
- public SybaseByte ToSybaseByte ()
- {
- return ((SybaseByte)this);
- }
-
- public SybaseDecimal ToSybaseDecimal ()
- {
- return ((SybaseDecimal)this);
- }
-
- public SybaseDouble ToSybaseDouble ()
- {
- return ((SybaseDouble)this);
- }
-
- public SybaseInt16 ToSybaseInt16 ()
- {
- return ((SybaseInt16)this);
- }
-
- public SybaseInt32 ToSybaseInt32 ()
- {
- return ((SybaseInt32)this);
- }
-
- public SybaseInt64 ToSybaseInt64 ()
- {
- return ((SybaseInt64)this);
- }
-
- public SybaseMoney ToSybaseMoney ()
- {
- return ((SybaseMoney)this);
- }
-
-
- public SybaseString ToSybaseString ()
- {
- return ((SybaseString)this);
- }
-
- public override string ToString ()
- {
- return value.ToString ();
- }
-
- public static SybaseSingle operator + (SybaseSingle x, SybaseSingle y)
- {
- return new SybaseSingle (x.Value + y.Value);
- }
-
- public static SybaseSingle operator / (SybaseSingle x, SybaseSingle y)
- {
- return new SybaseSingle (x.Value / y.Value);
- }
-
- public static SybaseBoolean operator == (SybaseSingle x, SybaseSingle y)
- {
- if (x.IsNull || y .IsNull) return SybaseBoolean.Null;
- return new SybaseBoolean (x.Value == y.Value);
- }
-
- public static SybaseBoolean operator > (SybaseSingle x, SybaseSingle y)
- {
- if (x.IsNull || y .IsNull) return SybaseBoolean.Null;
- return new SybaseBoolean (x.Value > y.Value);
- }
-
- public static SybaseBoolean operator >= (SybaseSingle x, SybaseSingle y)
- {
- if (x.IsNull || y .IsNull) return SybaseBoolean.Null;
- return new SybaseBoolean (x.Value >= y.Value);
- }
-
- public static SybaseBoolean operator != (SybaseSingle x, SybaseSingle y)
- {
- if (x.IsNull || y .IsNull) return SybaseBoolean.Null;
- return new SybaseBoolean (!(x.Value == y.Value));
- }
-
- public static SybaseBoolean operator < (SybaseSingle x, SybaseSingle y)
- {
- if (x.IsNull || y .IsNull) return SybaseBoolean.Null;
- return new SybaseBoolean (x.Value < y.Value);
- }
-
- public static SybaseBoolean operator <= (SybaseSingle x, SybaseSingle y)
- {
- if (x.IsNull || y .IsNull) return SybaseBoolean.Null;
- return new SybaseBoolean (x.Value <= y.Value);
- }
-
- public static SybaseSingle operator * (SybaseSingle x, SybaseSingle y)
- {
- return new SybaseSingle (x.Value * y.Value);
- }
-
- public static SybaseSingle operator - (SybaseSingle x, SybaseSingle y)
- {
- return new SybaseSingle (x.Value - y.Value);
- }
-
- public static SybaseSingle operator - (SybaseSingle n)
- {
- return new SybaseSingle (-(n.Value));
- }
-
- public static explicit operator SybaseSingle (SybaseBoolean x)
- {
- return new SybaseSingle((float)x.ByteValue);
- }
-
- public static explicit operator SybaseSingle (SybaseDouble x)
- {
- return new SybaseSingle((float)x.Value);
- }
-
- public static explicit operator float (SybaseSingle x)
- {
- return x.Value;
- }
-
- public static explicit operator SybaseSingle (SybaseString x)
- {
- return SybaseSingle.Parse (x.Value);
- }
-
- public static implicit operator SybaseSingle (float x)
- {
- return new SybaseSingle (x);
- }
-
- public static implicit operator SybaseSingle (SybaseByte x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseSingle((float)x.Value);
- }
-
- public static implicit operator SybaseSingle (SybaseDecimal x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseSingle((float)x.Value);
- }
-
- public static implicit operator SybaseSingle (SybaseInt16 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseSingle((float)x.Value);
- }
-
- public static implicit operator SybaseSingle (SybaseInt32 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseSingle((float)x.Value);
- }
-
- public static implicit operator SybaseSingle (SybaseInt64 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseSingle((float)x.Value);
- }
-
- public static implicit operator SybaseSingle (SybaseMoney x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseSingle((float)x.Value);
- }
-
- #endregion
- }
-}
-
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseString.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseString.cs
deleted file mode 100644
index 4af7c32cef1..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseString.cs
+++ /dev/null
@@ -1,514 +0,0 @@
-//
-// Mono.Data.SybaseTypes.SybaseString
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Based on System.Data.SqlTypes.SqlString
-//
-// (C) Ximian, Inc. 2002-2003
-// (C) Copyright Tim Coleman, 2002-2003
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.SybaseClient;
-using System;
-using System.Data.SqlTypes;
-using System.Globalization;
-using System.Text;
-
-namespace Mono.Data.SybaseTypes {
- public struct SybaseString : INullable, IComparable
- {
- #region Fields
-
- string value;
-
- private bool notNull;
-
- private CultureInfo cultureInfo;
- private SybaseCompareOptions compareOptions;
-
- public static readonly int BinarySort = 0x8000;
- public static readonly int IgnoreCase = 0x1;
- public static readonly int IgnoreKanaType = 0x8;
- public static readonly int IgnoreNonSpace = 0x2;
- public static readonly int IgnoreWidth = 0x10;
- public static readonly SybaseString Null;
-
- #endregion // Fields
-
- #region Constructors
-
- // init with a string data
- public SybaseString (string data)
- {
- this.value = data;
- this.cultureInfo = CultureInfo.CurrentCulture;
- this.compareOptions = SybaseCompareOptions.None;
- this.notNull = true;
- }
-
- // init with a string data and locale id values.
- public SybaseString (string data, int lcid)
- : this (data, lcid, SybaseCompareOptions.None)
- {
- }
-
- // init with locale id, compare options,
- // and an array of bytes data
- public SybaseString (int lcid, SybaseCompareOptions compareOptions, byte[] data)
- : this (lcid, compareOptions, data, true)
- {
- }
-
- // init with string data, locale id, and compare options
- public SybaseString (string data, int lcid, SybaseCompareOptions compareOptions)
- {
- this.value = data;
- this.cultureInfo = new CultureInfo (lcid);
- this.compareOptions = compareOptions;
- this.notNull = true;
- }
-
- // init with locale id, compare options, array of bytes data,
- // and whether unicode is encoded or not
- public SybaseString (int lcid, SybaseCompareOptions compareOptions, byte[] data, bool fUnicode)
- {
- Encoding encoding;
- if (fUnicode)
- encoding = new UnicodeEncoding ();
- else
- encoding = new ASCIIEncoding ();
-
- this.value = encoding.GetString (data);
- this.cultureInfo = new CultureInfo (lcid);
- this.compareOptions = compareOptions;
- this.notNull = true;
- }
-
- // init with locale id, compare options, array of bytes data,
- // starting index in the byte array,
- // and number of bytes to copy
- public SybaseString (int lcid, SybaseCompareOptions compareOptions, byte[] data, int index, int count)
- : this (lcid, compareOptions, data, index, count, true)
- {
- }
-
- // init with locale id, compare options, array of bytes data,
- // starting index in the byte array, number of byte to copy,
- // and whether unicode is encoded or not
- public SybaseString (int lcid, SybaseCompareOptions compareOptions, byte[] data, int index, int count, bool fUnicode)
- {
- Encoding encoding;
- if (fUnicode)
- encoding = new UnicodeEncoding ();
- else
- encoding = new ASCIIEncoding ();
-
- this.value = encoding.GetString (data, index, count);
- this.cultureInfo = new CultureInfo (lcid);
- this.compareOptions = compareOptions;
- this.notNull = true;
- }
-
- #endregion // Constructors
-
-
- #region Public Properties
-
- public CompareInfo CompareInfo {
- get { return cultureInfo.CompareInfo; }
- }
-
- public CultureInfo CultureInfo {
- get { return cultureInfo; }
- }
-
- public bool IsNull {
- get { return !notNull; }
- }
-
- // geographics location and language (locale id)
- public int LCID {
- get { return cultureInfo.LCID; }
- }
-
- public SybaseCompareOptions SybaseCompareOptions {
- get { return compareOptions; }
- }
-
- public string Value {
- get {
- if (this.IsNull)
- throw new SybaseNullValueException ("The property contains Null.");
- else
- return value;
- }
- }
-
- #endregion // Public Properties
-
- #region Public Methods
-
- public SybaseString Clone()
- {
- return new SybaseString (value, LCID, SybaseCompareOptions);
- }
-
- public static CompareOptions CompareOptionsFromSybaseCompareOptions (SybaseCompareOptions compareOptions)
- {
- CompareOptions options = CompareOptions.None;
- if ((compareOptions & SybaseCompareOptions.IgnoreCase) != 0)
- options |= CompareOptions.IgnoreCase;
- if ((compareOptions & SybaseCompareOptions.IgnoreKanaType) != 0)
- options |= CompareOptions.IgnoreKanaType;
- if ((compareOptions & SybaseCompareOptions.IgnoreNonSpace) != 0)
- options |= CompareOptions.IgnoreNonSpace;
- if ((compareOptions & SybaseCompareOptions.IgnoreWidth) != 0)
- options |= CompareOptions.IgnoreWidth;
- if ((compareOptions & SybaseCompareOptions.BinarySort) != 0)
- throw new ArgumentOutOfRangeException ();
- return options;
- }
-
- // **********************************
- // Comparison Methods
- // **********************************
-
- public int CompareTo(object value)
- {
- if (value == null)
- return 1;
- else if (!(value is SybaseString))
- throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseString"));
- else if (((SybaseString)value).IsNull)
- return 1;
- else
- return this.value.CompareTo (((SybaseString)value).Value);
- }
-
- public static SybaseString Concat(SybaseString x, SybaseString y)
- {
- return (x + y);
- }
-
- public override bool Equals(object value)
- {
- if (!(value is SybaseString))
- return false;
- else
- return (bool) (this == (SybaseString)value);
- }
-
- public static SybaseBoolean Equals(SybaseString x, SybaseString y)
- {
- return (x == y);
- }
-
- public override int GetHashCode()
- {
- int result = 10;
- for (int i = 0; i < value.Length; i += 1)
- result = 91 * result + (int) (value [i] ^ (value [i] >> 32));
- result = 91 * result + LCID.GetHashCode ();
- result = 91 * result + (int) compareOptions;
- return result;
- }
-
- public byte[] GetNonUnicodeBytes()
- {
- return GetBytes (new ASCIIEncoding ());
- }
-
- public byte[] GetUnicodeBytes()
- {
- return GetBytes (new UnicodeEncoding ());
- }
-
- private byte[] GetBytes (Encoding encoding)
- {
- int blen = encoding.GetByteCount (value);
- int clen = value.Length;
- byte[] bytes = new byte [blen];
- encoding.GetBytes (value, 0, clen, bytes, 0);
- return bytes;
- }
-
- public static SybaseBoolean GreaterThan(SybaseString x, SybaseString y)
- {
- return (x > y);
- }
-
- public static SybaseBoolean GreaterThanOrEqual(SybaseString x, SybaseString y)
- {
- return (x >= y);
- }
-
- public static SybaseBoolean LessThan(SybaseString x, SybaseString y)
- {
- return (x < y);
- }
-
- public static SybaseBoolean LessThanOrEqual(SybaseString x, SybaseString y)
- {
- return (x <= y);
- }
-
- public static SybaseBoolean NotEquals(SybaseString x, SybaseString y)
- {
- return (x != y);
- }
-
- // ****************************************
- // Type Conversions From SybaseString To ...
- // ****************************************
-
- public SybaseBoolean ToSybaseBoolean()
- {
- return ((SybaseBoolean)this);
- }
-
- public SybaseByte ToSybaseByte()
- {
- return ((SybaseByte)this);
- }
-
- public SybaseDateTime ToSybaseDateTime()
- {
- return ((SybaseDateTime)this);
- }
-
- public SybaseDecimal ToSybaseDecimal()
- {
- return ((SybaseDecimal)this);
- }
-
- public SybaseDouble ToSybaseDouble()
- {
- return ((SybaseDouble)this);
- }
-
- public SybaseGuid ToSybaseGuid()
- {
- return ((SybaseGuid)this);
- }
-
- public SybaseInt16 ToSybaseInt16()
- {
- return ((SybaseInt16)this);
- }
-
- public SybaseInt32 ToSybaseInt32()
- {
- return ((SybaseInt32)this);
- }
-
- public SybaseInt64 ToSybaseInt64()
- {
- return ((SybaseInt64)this);
- }
-
- public SybaseMoney ToSybaseMoney()
- {
- return ((SybaseMoney)this);
- }
-
- public SybaseSingle ToSybaseSingle()
- {
- return ((SybaseSingle)this);
- }
-
- public override string ToString()
- {
- return ((string)this);
- }
-
- // ***********************************
- // Operators
- // ***********************************
-
- // Concatenates
- public static SybaseString operator + (SybaseString x, SybaseString y)
- {
- return new SybaseString (x.Value + y.Value);
- }
-
- // Equality
- public static SybaseBoolean operator == (SybaseString x, SybaseString y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value == y.Value);
- }
-
- // Greater Than
- public static SybaseBoolean operator > (SybaseString x, SybaseString y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- throw new NotImplementedException ();
- }
-
- // Greater Than Or Equal
- public static SybaseBoolean operator >= (SybaseString x, SybaseString y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- throw new NotImplementedException ();
- }
-
- public static SybaseBoolean operator != (SybaseString x, SybaseString y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- return new SybaseBoolean (x.Value != y.Value);
- }
-
- // Less Than
- public static SybaseBoolean operator < (SybaseString x, SybaseString y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- throw new NotImplementedException ();
- }
-
- // Less Than Or Equal
- public static SybaseBoolean operator <= (SybaseString x, SybaseString y)
- {
- if (x.IsNull || y.IsNull)
- return SybaseBoolean.Null;
- else
- throw new NotImplementedException ();
- }
-
- // **************************************
- // Type Conversions
- // **************************************
-
- public static explicit operator SybaseString (SybaseBoolean x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseString (x.ByteValue.ToString ());
- }
-
- public static explicit operator SybaseString (SybaseByte x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseString (x.Value.ToString ());
- }
-
- public static explicit operator SybaseString (SybaseDateTime x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseString (x.Value.ToString ());
- }
-
- public static explicit operator SybaseString (SybaseDecimal x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseString (x.Value.ToString ());
- }
-
- public static explicit operator SybaseString (SybaseDouble x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseString (x.Value.ToString ());
- }
-
- public static explicit operator SybaseString (SybaseGuid x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseString (x.Value.ToString ());
- }
-
- public static explicit operator SybaseString (SybaseInt16 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseString (x.Value.ToString ());
- }
-
- public static explicit operator SybaseString (SybaseInt32 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseString (x.Value.ToString ());
- }
-
- public static explicit operator SybaseString (SybaseInt64 x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseString (x.Value.ToString ());
- }
-
- public static explicit operator SybaseString (SybaseMoney x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseString (x.Value.ToString ());
- }
-
- public static explicit operator SybaseString (SybaseSingle x)
- {
- if (x.IsNull)
- return Null;
- else
- return new SybaseString (x.Value.ToString ());
- }
-
- public static explicit operator string (SybaseString x)
- {
- return x.Value;
- }
-
- public static implicit operator SybaseString (string x)
- {
- return new SybaseString (x);
- }
-
- #endregion // Public Methods
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseTruncateException.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseTruncateException.cs
deleted file mode 100644
index d4024567380..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseTruncateException.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// Mono.Data.SybaseTypes.SybaseTruncateException.cs
-//
-// Authors:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Copyright (C) Tim Coleman, 2002
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.SybaseClient;
-using System;
-using System.Globalization;
-using System.Runtime.Serialization;
-
-namespace Mono.Data.SybaseTypes {
- [Serializable]
- public class SybaseTruncateException : SybaseTypeException
- {
- #region Constructors
-
- public SybaseTruncateException ()
- : base (Locale.GetText ("This value is being truncated"))
- {
- }
-
- public SybaseTruncateException (string message)
- : base (message)
- {
- }
-
- #endregion // Constructors
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseTypeException.cs b/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseTypeException.cs
deleted file mode 100644
index aa458a0a1db..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/Mono.Data.SybaseTypes/SybaseTypeException.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// Mono.Data.SybaseTypes.SybaseTypeException.cs
-//
-// Authors:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Copyright (C) Tim Coleman, 2002
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Data.SybaseClient;
-using System;
-using System.Globalization;
-using System.Runtime.Serialization;
-
-namespace Mono.Data.SybaseTypes {
- [Serializable]
- public class SybaseTypeException : SystemException
- {
- #region Constructors
-
- public SybaseTypeException (string message)
- : base (message)
- {
- }
-
- protected SybaseTypeException (SerializationInfo info, StreamingContext context)
- : base (info, context)
- {
- }
-
- #endregion // Constructors
- }
-}
diff --git a/mcs/class/Mono.Data.SybaseClient/test/ChangeLog b/mcs/class/Mono.Data.SybaseClient/test/ChangeLog
deleted file mode 100644
index 5f16e966073..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/test/ChangeLog
+++ /dev/null
@@ -1,8 +0,0 @@
-2005-01-16 Daniel Morgan <danielmorgan@verizon.net>
-
- * test: added this directory
-
- * SybaseTest.cs: added tests for Mono.Data.SybaseClient
- based on the SqlTest.cs at System.Data/Test
-
- * ChangeLog: added file \ No newline at end of file
diff --git a/mcs/class/Mono.Data.SybaseClient/test/SybaseTest.cs b/mcs/class/Mono.Data.SybaseClient/test/SybaseTest.cs
deleted file mode 100644
index a3bb709db7b..00000000000
--- a/mcs/class/Mono.Data.SybaseClient/test/SybaseTest.cs
+++ /dev/null
@@ -1,660 +0,0 @@
-/* SybaseTest.cs - Tests for Sybase ASE
- * based on SqlTest.cs
- * which is based on the PostgresTest.cs
- *
- * Copyright (C) 2002 Gonzalo Paniagua Javier
- * Copyright (C) 2002,2005 Daniel Morgan
- * Copyright (C) 2002 Tim Coleman
- *
- * ORIGINAL AUTHOR:
- * Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
- * PORTING FROM C TO C# AUTHOR:
- * Daniel Morgan <danmorg@sc.rr.com>
- * PORTING TO SQL SERVER AUTHOR:
- * Tim Coleman <tim@timcoleman.com>
- *
- * Permission was given from the original author, Gonzalo Paniagua Javier,
- * to port and include his original work in Mono.
- *
- * The original work falls under the LGPL, but the port to C# falls
- * under the X11 license.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; see the file COPYING. If not,
- * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-using System;
-using System.Data;
-using System.Text;
-using Mono.Data.SybaseClient;
-
-namespace Test.Mono.Data.SybaseClient
-{
- class SybaseTest
- {
- // execute SQL CREATE TABLE Command using ExecuteNonQuery()
- static void CreateTable (IDbConnection cnc)
- {
- IDbCommand createCommand = cnc.CreateCommand();
-
- createCommand.CommandText =
- "CREATE TABLE mono_sybase_test (" +
- " bit_value bit not null, " +
- " binary_value binary(8) not null, " +
- " char_value char(50) not null, " +
- " datetime_value datetime not null, " +
- " decimal_value decimal(15,3) not null, " +
- " float_value float not null, " +
- " int_value int not null, " +
- " money_value money not null, " +
- " nchar_value nchar(50) not null, " +
- " nvarchar_value nvarchar(20) not null, " +
- " real_value real not null, " +
- " smalldatetime_value smalldatetime not null, " +
- " smallint_value smallint not null, " +
- " smallmoney_value smallmoney not null, " +
- " timestamp_value timestamp not null, " +
- " tinyint_value tinyint not null, " +
- " varbinary_value varbinary (8) not null, " +
- " varchar_value varchar(20) not null, " +
- " null_binary_value binary(8) null, " +
- " null_char_value char(50) null, " +
- " null_datetime_value datetime null, " +
- " null_decimal_value decimal(15,3) null, " +
- " null_float_value float null, " +
- " null_int_value int null, " +
- " null_money_value int null, " +
- " null_nchar_value nchar(50) null, " +
- " null_nvarchar_value nvarchar(20) null, " +
- " null_real_value real null, " +
- " null_smalldatetime_value smalldatetime null, " +
- " null_smallint_value smallint null, " +
- " null_smallmoney_value int null, " +
- " null_tinyint_value tinyint null, " +
- " null_varbinary_value varbinary (8) null, " +
- " null_varchar_value varchar(20) null " +
- " )";
-
- createCommand.ExecuteNonQuery ();
- }
-
- // execute SQL DROP TABLE Command using ExecuteNonQuery
- static void DropTable (IDbConnection cnc)
- {
- IDbCommand dropCommand = cnc.CreateCommand ();
-
- dropCommand.CommandText =
- "drop table mono_sybase_test";
-
- try {
- dropCommand.ExecuteNonQuery ();
- } catch (SybaseException e) {
- Console.WriteLine ("SybaseException caught: " + e.Message);
- }
- }
-
- // execute stored procedure using ExecuteScalar()
- static object CallStoredProcedure (IDbConnection cnc)
- {
- IDbCommand callStoredProcCommand = cnc.CreateCommand ();
- object data;
-
- callStoredProcCommand.CommandType =
- CommandType.StoredProcedure;
- callStoredProcCommand.CommandText =
- "sp_server_info";
-
- data = callStoredProcCommand.ExecuteScalar ();
-
- return data;
- }
-
- // execute SQL INSERT Command using ExecuteNonQuery()
- static void InsertData (IDbConnection cnc)
- {
- IDbCommand insertCommand = cnc.CreateCommand();
-
- insertCommand.CommandText =
- "INSERT INTO mono_sybase_test (" +
- " bit_value, " +
- " binary_value, " +
- " char_value, " +
- " datetime_value, " +
- " decimal_value, " +
- " float_value, " +
- " int_value, " +
- " money_value, " +
- " nchar_value, " +
- " nvarchar_value, " +
- " real_value, " +
- " smalldatetime_value, " +
- " smallint_value, " +
- " smallmoney_value, " +
- " tinyint_value, " +
- " varbinary_value, " +
- " varchar_value " +
- ") values (" +
- "@p1, " +
- "@p2, " +
- "@p3, " +
- "@p4, " +
- "@p5, " +
- "@p6, " +
- "@p7, " +
- "@p8, " +
- "@p9, " +
- "@p10, " +
- "@p11, " +
- "@p12, " +
- "@p13, " +
- "@p14, " +
- "@p15, " +
- "@p16, " +
- "@p17 " +
- ")";
-
- SybaseParameterCollection parameters = ((SybaseCommand) insertCommand).Parameters;
-
- parameters.Add ("@p1", SybaseType.Bit);
- parameters.Add ("@p2", SybaseType.Binary, 8);
- parameters.Add ("@p3", SybaseType.Char, 14);
- parameters.Add ("@p4", SybaseType.DateTime);
- parameters.Add ("@p5", SybaseType.Decimal);
- parameters.Add ("@p6", SybaseType.Float);
- parameters.Add ("@p7", SybaseType.Int);
- parameters.Add ("@p8", SybaseType.Money);
- parameters.Add ("@p9", SybaseType.NChar, 16);
- parameters.Add ("@p10", SybaseType.NVarChar, 19);
- parameters.Add ("@p11", SybaseType.Real);
- parameters.Add ("@p12", SybaseType.SmallDateTime);
- parameters.Add ("@p13", SybaseType.SmallInt);
- parameters.Add ("@p14", SybaseType.SmallMoney);
- parameters.Add ("@p15", SybaseType.TinyInt);
- parameters.Add ("@p16", SybaseType.VarBinary, 8);
- parameters.Add ("@p17", SybaseType.VarChar, 17);
-
- parameters ["@p1"].Value = true;
- parameters ["@p2"].Value = new byte[2] {0x12,0x34};
- parameters ["@p3"].Value = "This is a char";
- parameters ["@p4"].Value = new DateTime (1959, 7, 17); // My mom's birthday!
-
- parameters ["@p5"].Value = 123456789012.345;
- parameters ["@p5"].Precision = 15;
- parameters ["@p5"].Scale = 3;
-
- parameters ["@p6"].Value = 3.1415926969696;
- parameters ["@p7"].Value = 1048000;
- parameters ["@p8"].Value = 31337.456;
- parameters ["@p9"].Value = "This is an nchar";
- parameters ["@p10"].Value = "This is an nvarchar";
- parameters ["@p11"].Value = 3.141592;
- parameters ["@p12"].Value = new DateTime (1976, 10, 31); // My birthday!
- parameters ["@p13"].Value = -22;
- parameters ["@p14"].Value = 31337.456;
- parameters ["@p15"].Value = 15;
- parameters ["@p16"].Value = new byte[2] {0x56,0x78};
- parameters ["@p17"].Value = "This is a varchar";
-
- insertCommand.ExecuteNonQuery ();
- }
-
- // execute a SQL SELECT Query using ExecuteReader() to retrieve
- // a IDataReader so we retrieve data
- static IDataReader SelectData (IDbConnection cnc)
- {
- IDbCommand selectCommand = cnc.CreateCommand();
- IDataReader reader;
-
- selectCommand.CommandText =
- "SELECT " +
- " bit_value, " +
- " binary_value, " +
- " char_value, " +
- " datetime_value, " +
- " decimal_value, " +
- " float_value, " +
- " int_value, " +
- " money_value, " +
- " nchar_value, " +
- " nvarchar_value, " +
- " real_value, " +
- " smalldatetime_value, " +
- " smallint_value, " +
- " smallmoney_value, " +
- " timestamp_value, " +
- " tinyint_value, " +
- " varbinary_value, " +
- " varchar_value, " +
- " null_binary_value, " +
- " null_char_value, " +
- " null_datetime_value, " +
- " null_decimal_value, " +
- " null_float_value, " +
- " null_int_value, " +
- " null_money_value, " +
- " null_nchar_value, " +
- " null_nvarchar_value, " +
- " null_real_value, " +
- " null_smalldatetime_value, " +
- " null_smallint_value, " +
- " null_smallmoney_value, " +
- " null_tinyint_value, " +
- " null_varbinary_value, " +
- " null_varchar_value " +
- "FROM mono_sybase_test";
-
-
- reader = selectCommand.ExecuteReader ();
-
- return reader;
- }
-
- // Tests a SQL Command (INSERT, UPDATE, DELETE)
- // executed via ExecuteReader
- static IDataReader SelectDataUsingInsertCommand (IDbConnection cnc)
- {
- IDbCommand selectCommand = cnc.CreateCommand();
- IDataReader reader;
-
- // This is a SQL INSERT Command, not a Query
- selectCommand.CommandText =
- "INSERT INTO mono_sybase_test (" +
- " bit_value, " +
- " binary_value, " +
- " char_value, " +
- " datetime_value, " +
- " decimal_value, " +
- " float_value, " +
- " int_value, " +
- " money_value, " +
- " nchar_value, " +
- " nvarchar_value, " +
- " real_value, " +
- " smalldatetime_value, " +
- " smallint_value, " +
- " smallmoney_value, " +
- " tinyint_value, " +
- " varbinary_value, " +
- " varchar_value " +
- ") values (" +
- "@p1, " +
- "@p2, " +
- "@p3, " +
- "@p4, " +
- "@p5, " +
- "@p6, " +
- "@p7, " +
- "@p8, " +
- "@p9, " +
- "@p10, " +
- "@p11, " +
- "@p12, " +
- "@p13, " +
- "@p14, " +
- "@p15, " +
- "@p16, " +
- "@p17 " +
- ")";
-
- SybaseParameterCollection parameters = ((SybaseCommand) selectCommand).Parameters;
-
- parameters.Add ("@p1", SybaseType.Bit);
- parameters.Add ("@p2", SybaseType.Binary, 8);
- parameters.Add ("@p3", SybaseType.Char, 14);
- parameters.Add ("@p4", SybaseType.DateTime);
- parameters.Add ("@p5", SybaseType.Decimal);
- parameters.Add ("@p6", SybaseType.Float);
- parameters.Add ("@p7", SybaseType.Int);
- parameters.Add ("@p8", SybaseType.Money);
- parameters.Add ("@p9", SybaseType.NChar, 16);
- parameters.Add ("@p10", SybaseType.NVarChar, 19);
- parameters.Add ("@p11", SybaseType.Real);
- parameters.Add ("@p12", SybaseType.SmallDateTime);
- parameters.Add ("@p13", SybaseType.SmallInt);
- parameters.Add ("@p14", SybaseType.SmallMoney);
- parameters.Add ("@p15", SybaseType.TinyInt);
- parameters.Add ("@p16", SybaseType.VarBinary, 8);
- parameters.Add ("@p17", SybaseType.VarChar, 17);
-
- parameters ["@p1"].Value = true;
- parameters ["@p2"].Value = new byte[2] {0x9a,0xbc};
- parameters ["@p3"].Value = "This is a char";
- parameters ["@p4"].Value = DateTime.Now;
-
- parameters ["@p5"].Value = 123456789012.345;
- parameters ["@p5"].Precision = 15;
- parameters ["@p5"].Scale = 3;
-
- parameters ["@p6"].Value = 3.1415926969696;
- parameters ["@p7"].Value = 1048000;
- parameters ["@p8"].Value = 31337.456;
- parameters ["@p9"].Value = "This is an nchar";
- parameters ["@p10"].Value = "This is an nvarchar";
- parameters ["@p11"].Value = 3.141592;
- parameters ["@p12"].Value = new DateTime (2001, 7, 9);
- parameters ["@p13"].Value = -22;
- parameters ["@p14"].Value = 31337.456;
- parameters ["@p15"].Value = 15;
- parameters ["@p16"].Value = new byte[2] {0xde, 0xef};
- parameters ["@p17"].Value = "This is a varchar";
-
- reader = selectCommand.ExecuteReader ();
-
- return reader;
- }
-
- // Tests a SQL Command not (INSERT, UPDATE, DELETE)
- // executed via ExecuteReader
- static IDataReader SelectDataUsingCommand (IDbConnection cnc)
- {
- IDbCommand selectCommand = cnc.CreateCommand();
- IDataReader reader;
-
- // This is a SQL Command, not a Query
- selectCommand.CommandText =
- "SET FMTONLY OFF";
-
- reader = selectCommand.ExecuteReader ();
-
- return reader;
- }
-
-
- // execute an SQL UPDATE Command using ExecuteNonQuery()
- static void UpdateData (IDbConnection cnc)
- {
- IDbCommand updateCommand = cnc.CreateCommand();
-
- updateCommand.CommandText =
- "update mono_sybase_test " +
- "set " +
- "bit_value = @p1, " +
- "tinyint_value = @p2, " +
- "smallint_value = @p3, " +
- "int_value = @p4, " +
- "char_value = @p5, " +
- "nchar_value = @p6, " +
- "varchar_value = @p7, " +
- "nvarchar_value = @p8, " +
- "binary_value = @p9, " +
- "varbinary_value = @p10 " +
- "where smallint_value = @p11";
-
- SybaseParameterCollection parameters = ((SybaseCommand) updateCommand).Parameters;
-
- parameters.Add ("@p1", SybaseType.Bit);
- parameters.Add ("@p2", SybaseType.TinyInt);
- parameters.Add ("@p3", SybaseType.SmallInt);
- parameters.Add ("@p4", SybaseType.Int);
- parameters.Add ("@p5", SybaseType.Char, 10);
- parameters.Add ("@p6", SybaseType.NChar, 10);
- parameters.Add ("@p7", SybaseType.VarChar, 14);
- parameters.Add ("@p8", SybaseType.NVarChar, 14);
- parameters.Add ("@p9", SybaseType.Binary, 8);
- parameters.Add ("@p10", SybaseType.VarBinary, 8);
- parameters.Add ("@p11", SybaseType.SmallInt);
-
- parameters ["@p1"].Value = false;
- parameters ["@p2"].Value = 2;
- parameters ["@p3"].Value = 5;
- parameters ["@p4"].Value = 3;
- parameters ["@p5"].Value = "Mono.Data!";
- parameters ["@p6"].Value = "Mono.Data!";
- parameters ["@p7"].Value = "It was not me!";
- parameters ["@p8"].Value = "It was not me!";
- parameters ["@p9"].Value = new byte[2] {0x57,0x3e};
- parameters ["@p10"].Value = new byte[2] {0xa2,0xf7};
- parameters ["@p11"].Value = -22;
-
- updateCommand.ExecuteNonQuery ();
- }
-
- // used to do a min(), max(), count(), sum(), or avg()
- // execute SQL SELECT Query using ExecuteScalar
- static object SelectAggregate (IDbConnection cnc, String agg)
- {
- IDbCommand selectCommand = cnc.CreateCommand();
- object data;
-
- Console.WriteLine("Aggregate: " + agg);
-
- selectCommand.CommandType = CommandType.Text;
- selectCommand.CommandText =
- "select " + agg +
- "from mono_sybase_test";
-
- data = selectCommand.ExecuteScalar ();
-
- Console.WriteLine("Agg Result: " + data);
-
- return data;
- }
-
- // used internally by ReadData() to read each result set
- static void ReadResult(IDataReader rdr, DataTable dt)
- {
- // number of columns in the table
- Console.WriteLine(" Total Columns: " +
- dt.Rows.Count);
-
- // display the schema
- foreach (DataRow schemaRow in dt.Rows) {
- foreach (DataColumn schemaCol in dt.Columns)
- Console.WriteLine(schemaCol.ColumnName +
- " = " +
- schemaRow[schemaCol]);
- Console.WriteLine();
- }
-
- int nRows = 0;
- int c = 0;
- string output, metadataValue, dataValue;
- // Read and display the rows
- Console.WriteLine("Gonna do a Read() now...");
- while(rdr.Read()) {
- Console.WriteLine(" Row " + nRows + ": ");
-
- for(c = 0; c < rdr.FieldCount; c++) {
- // column meta data
- DataRow dr = dt.Rows[c];
- metadataValue =
- " Col " +
- c + ": " +
- dr["ColumnName"];
-
- // column data
- if (rdr.IsDBNull(c) == true)
- dataValue = " is NULL";
- else if ((Type) dr["DataType"] == typeof (byte[]))
- dataValue =
- ": 0x" +
- BitConverter.ToString ((byte[]) rdr.GetValue (c)).Replace ("-", "").ToLower ();
- else
- dataValue =
- ": " +
- rdr.GetValue(c);
-
- // display column meta data and data
- output = metadataValue + dataValue;
- Console.WriteLine(output);
- }
- nRows++;
- }
- Console.WriteLine(" Total Rows Retrieved: " +
- nRows);
- }
-
- // Used to read data from IDataReader after calling IDbCommand:ExecuteReader()
- static void ReadData(IDataReader rdr) {
-
- int results = 0;
- if(rdr == null) {
-
- Console.WriteLine("IDataReader has a Null Reference.");
- }
- else {
- do {
- DataTable dt = rdr.GetSchemaTable();
- if(rdr.RecordsAffected != -1) {
- // Results for
- // SQL INSERT, UPDATE, DELETE Commands
- // have RecordsAffected >= 0
- Console.WriteLine("Result is from a SQL Command (INSERT,UPDATE,DELETE). Records Affected: " + rdr.RecordsAffected);
- }
- else if(dt == null)
- // Results for
- // SQL Commands not INSERT, UPDATE, nor DELETE
- // have RecordsAffected == -1
- // and GetSchemaTable() returns a null reference
- Console.WriteLine("Result is from a SQL Command not (INSERT,UPDATE,DELETE). Records Affected: " + rdr.RecordsAffected);
- else {
- // Results for
- // SQL SELECT Queries
- // have RecordsAffected = -1
- // and GetSchemaTable() returns a reference to a DataTable
- Console.WriteLine("Result is from a SELECT SQL Query. Records Affected: " + rdr.RecordsAffected);
-
- results++;
- Console.WriteLine("Result Set " + results + "...");
-
- ReadResult(rdr, dt);
- }
-
- } while(rdr.NextResult());
- Console.WriteLine("Total Result sets: " + results);
-
- rdr.Close();
- }
- }
-
- /* Sybase provider tests */
- static void DoSybaseTest (IDbConnection cnc)
- {
- IDataReader reader;
- Object oDataValue;
-
- Console.WriteLine ("\tSybase provider specific tests...\n");
-
- /* Drops the mono_sybase_test table. */
- Console.WriteLine ("\t\tDrop table: ");
- try {
- DropTable (cnc);
- Console.WriteLine ("OK");
- }
- catch (SybaseException e) {
- Console.WriteLine("Error (don't worry about this one)" + e);
- }
-
- try {
- /* Creates a table with all supported data types */
- Console.WriteLine ("\t\tCreate table with all supported types: ");
- CreateTable (cnc);
- Console.WriteLine ("OK");
-
- /* Inserts values */
- Console.WriteLine ("\t\tInsert values for all known types: ");
- InsertData (cnc);
- Console.WriteLine ("OK");
-
- /* Update values */
- Console.WriteLine ("\t\tUpdate values: ");
- UpdateData (cnc);
- Console.WriteLine ("OK");
-
- /* Inserts values */
- Console.WriteLine ("\t\tInsert values for all known types: ");
- InsertData (cnc);
- Console.WriteLine ("OK");
-
- /* Select aggregates */
- SelectAggregate (cnc, "count(*)");
- SelectAggregate (cnc, "avg(int_value)");
- SelectAggregate (cnc, "min(varchar_value)");
- SelectAggregate (cnc, "max(int_value)");
- SelectAggregate (cnc, "sum(int_value)");
-
- /* Select values */
- Console.WriteLine ("\t\tSelect values from the database: ");
- reader = SelectData (cnc);
- ReadData(reader);
-
- /* SQL Command via ExecuteReader/SqlDataReader */
- /* Command is not INSERT, UPDATE, or DELETE */
- Console.WriteLine("\t\tCall ExecuteReader with a SQL Command. (Not INSERT,UPDATE,DELETE).");
- reader = SelectDataUsingCommand(cnc);
- ReadData(reader);
-
- /* SQL Command via ExecuteReader/SqlDataReader */
- /* Command is INSERT, UPDATE, or DELETE */
- Console.WriteLine("\t\tCall ExecuteReader with a SQL Command. (Is INSERT,UPDATE,DELETE).");
- reader = SelectDataUsingInsertCommand(cnc);
- ReadData(reader);
-
- // Call a Stored Procedure named Version()
- Console.WriteLine("\t\tCalling stored procedure sp_server_info()");
- object obj = CallStoredProcedure(cnc);
- Console.WriteLine("Result: " + obj);
-
- Console.WriteLine("Database Server Version: " +
- ((SybaseConnection)cnc).ServerVersion);
-
- /* Clean up */
- Console.WriteLine ("Clean up...");
- Console.WriteLine ("\t\tDrop table...");
-
- Console.WriteLine("OK");
- }
- catch(Exception e) {
- Console.WriteLine("Exception caught: " + e);
- }
- }
-
- [STAThread]
- static void Main(string[] args)
- {
- string connectionString = "";
-
- if(args.Length == 3 || args.Length == 4) {
- if(args.Length == 3) {
- connectionString = String.Format(
- "Server={0};" +
- "Database={1};" +
- "User ID={2};",
- args[0], args[1], args[2]);
- }
- else if(args.Length == 4) {
- connectionString = String.Format(
- "Server={0};" +
- "Database={1};" +
- "User ID={2};" +
- "Password={3}",
- args[0], args[1], args[2], args[3]);
- }
- }
- else {
- Console.WriteLine("Usage: mono SybaseTest.exe sql_server database user_id password");
- return;
- }
-
- SybaseConnection cnc = new SybaseConnection ();
- cnc.ConnectionString = connectionString;
-
- cnc.Open();
- DoSybaseTest(cnc);
- cnc.Close();
- }
- }
-}
-