diff options
author | Egor Bogatov <egorbo@gmail.com> | 2017-10-25 12:34:22 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2017-10-25 12:34:22 +0300 |
commit | 0f045b1ded3cfab2f8fc013001ba6c5446afbf45 (patch) | |
tree | a0f11584970a245e6fd07372f12db892ff9ca9d2 /mcs | |
parent | 00af82567c7c0a2c73927bb585ee55ad2ccd05fc (diff) |
[System.Data] Cleanup after #4893 (PR) (#5841)
* [System.Data] cleanup
* Remove DataProviderTests
Diffstat (limited to 'mcs')
118 files changed, 9 insertions, 26705 deletions
diff --git a/mcs/class/System.Data.DataSetExtensions/ReferenceSources/Strings.cs b/mcs/class/System.Data.DataSetExtensions/ReferenceSources/Strings.cs deleted file mode 100644 index f271148c06c..00000000000 --- a/mcs/class/System.Data.DataSetExtensions/ReferenceSources/Strings.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace System.Data.DataSetExtensions -{ - static partial class Strings - { - const string DataSetLinq_InvalidEnumerationValue_ = "The {0} enumeration value, {1}, is not valid."; - public const string DataSetLinq_EmptyDataRowSource = "The source contains no DataRows."; - public const string DataSetLinq_NullDataRow = "The source contains a DataRow reference that is null."; - public const string DataSetLinq_CannotLoadDeletedRow = "The source contains a deleted DataRow that cannot be copied to the DataTable."; - public const string DataSetLinq_CannotLoadDetachedRow = "The source contains a detached DataRow that cannot be copied to the DataTable."; - public const string DataSetLinq_CannotCompareDeletedRow = "The DataRowComparer does not work with DataRows that have been deleted since it only compares current values."; - const string DataSetLinq_NonNullableCast_ = "Cannot cast DBNull.Value to type '{0}'. Please use a nullable type."; - public const string ToLDVUnsupported = "Can not create DataView after using projection"; - const string LDV_InvalidNumOfKeys_ = "Must provide '{0}' keys to find"; - - public static string DataSetLinq_InvalidEnumerationValue (params object[] args) - { - return SR.GetString (DataSetLinq_InvalidEnumerationValue_, args); - } - - public static string DataSetLinq_NonNullableCast (object arg) - { - return SR.GetString (DataSetLinq_NonNullableCast_, arg); - } - - public static string LDV_InvalidNumOfKeys (params object[] args) - { - return SR.GetString (LDV_InvalidNumOfKeys_, args); - } - - // Missing - public const string LDVRowStateError = "LDVRowStateError"; - } -}
\ No newline at end of file diff --git a/mcs/class/System.Data/.gitignore b/mcs/class/System.Data/.gitignore index 11934cb3457..9aeb32bee48 100644 --- a/mcs/class/System.Data/.gitignore +++ b/mcs/class/System.Data/.gitignore @@ -1,11 +1 @@ -y.output -gen_OleDbConnection.cs -gen_OleDbParameter.cs -gen_OleDbParameterCollection.cs -gen_OdbcConnection.cs -gen_OdbcParameter.cs -gen_OdbcParameterCollection.cs -gen_SqlConnection.cs -gen_SqlParameter.cs -gen_SqlParameterCollection.cs - +y.output
\ No newline at end of file diff --git a/mcs/class/System.Data/Mainsoft.Data.Configuration.jvm/IKeyMapper.cs b/mcs/class/System.Data/Mainsoft.Data.Configuration.jvm/IKeyMapper.cs deleted file mode 100644 index ec6fdbd98e8..00000000000 --- a/mcs/class/System.Data/Mainsoft.Data.Configuration.jvm/IKeyMapper.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -// System.Data.OleDb.OleDbConnection -// -// Authors: -// Konstantin Triger <kostat@mainsoft.com> -// Boris Kirzner <borisk@mainsoft.com> -// -// (C) 2006 Mainsoft Corporation (http://www.mainsoft.com) -// - -// -// 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; - -namespace Mainsoft.Data.Configuration -{ - public interface IConnectionStringDictionary : IDictionary - { - string GetConnectionStringKey (string key); - object GetValue (string key); - } -} diff --git a/mcs/class/System.Data/Mainsoft.Data.Configuration.jvm/KeyMapperBase.cs b/mcs/class/System.Data/Mainsoft.Data.Configuration.jvm/KeyMapperBase.cs deleted file mode 100644 index a6aa1a63771..00000000000 --- a/mcs/class/System.Data/Mainsoft.Data.Configuration.jvm/KeyMapperBase.cs +++ /dev/null @@ -1,319 +0,0 @@ -// -// System.Data.OleDb.OleDbConnection -// -// Authors: -// Konstantin Triger <kostat@mainsoft.com> -// Boris Kirzner <borisk@mainsoft.com> -// -// (C) 2006 Mainsoft Corporation (http://www.mainsoft.com) -// - -// -// 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.Collections.Specialized; -using System.Text; -using System.Globalization; -using System.IO; - -namespace Mainsoft.Data.Configuration -{ - public class ConnectionStringDictionary: IConnectionStringDictionary - { - #region Fields - - private readonly IDictionary _dictionary; - private readonly NameValueCollection _mapping; - private readonly NameValueCollection _actualKeys; - const string DataDirectoryPlaceholder = "|DataDirectory|"; - - #endregion // Fields - - #region Constructors - - public ConnectionStringDictionary(string connectionString, NameValueCollection defaultMapping) - { - _actualKeys = new NameValueCollection(StringComparer.OrdinalIgnoreCase); - _dictionary = Parse (connectionString); - _mapping = defaultMapping; - } - - #endregion // Constructors - - #region Methods - - public string GetConnectionStringKey (string key) - { - string cached = _actualKeys [key]; - if (cached != null) - return cached; - - if (_mapping != null) - for(int i = 0, c = _mapping.Keys.Count; i < c; i++) { - if (string.Compare(key, _mapping.Keys[i], StringComparison.OrdinalIgnoreCase) == 0) { - string[] values = _mapping.GetValues(i); - for(int j = 0; j < values.Length; j++) { - string actualKey = values[j]; - if (_dictionary.Contains (actualKey)) { - _actualKeys.Add (key, actualKey); - return actualKey; - } - } - } - } - - if (_dictionary.Contains(key)) - return key; - - return null; - } - - public object GetValue (string key) - { - return _dictionary [key]; - } - - public static IDictionary Parse (string connectionString) - { - IDictionary userParameters = new Hashtable (StringComparer.OrdinalIgnoreCase); - - if (connectionString == null || connectionString.Length == 0) { - return userParameters; - } - //connectionString += ";"; - - if (connectionString.IndexOf (DataDirectoryPlaceholder, StringComparison.Ordinal) >= 0) { - string dataDirectory = (string) AppDomain.CurrentDomain.GetData ("DataDirectory"); - if (dataDirectory != null && dataDirectory.Length > 0) { - char lastChar = dataDirectory [dataDirectory.Length - 1]; - if (lastChar != Path.DirectorySeparatorChar && - lastChar != Path.AltDirectorySeparatorChar) - dataDirectory += '/'; - } - connectionString = connectionString.Replace (DataDirectoryPlaceholder, dataDirectory); - } - - bool inQuote = false; - bool inDQuote = false; - bool inName = true; - - string name = String.Empty; - string value = String.Empty; - StringBuilder sb = new StringBuilder (connectionString.Length); - - for (int i = 0; i < connectionString.Length; i ++) { - char c = connectionString [i]; - char peek; - if (i == connectionString.Length - 1) - peek = '\0'; - else - peek = connectionString [i + 1]; - - switch (c) { - case '\'': - if (inDQuote) - sb.Append (c); - else if (peek == c) { - sb.Append(c); - i ++; - } - else - inQuote = !inQuote; - break; - case '"': - if (inQuote) - sb.Append(c); - else if (peek == c) { - sb.Append(c); - i ++; - } - else - inDQuote = !inDQuote; - break; - case ';': - if (inDQuote || inQuote) - sb.Append(c); - else { - if (name != null && name.Length > 0) { - value = sb.ToString(); - userParameters [name.Trim()] = value.Trim(); - } - inName = true; - name = String.Empty; - value = String.Empty; - sb.Length = 0; - } - break; - case '=': - if (inDQuote || inQuote || !inName) - sb.Append (c); - else if (peek == c) { - sb.Append (c); - i += 1; - } - else { - name = sb.ToString(); - sb.Length = 0; - inName = false; - } - break; - case ' ': - if (inQuote || inDQuote) - sb.Append(c); - else if (sb.Length > 0 && peek != ';') - sb.Append(c); - break; - default: - sb.Append(c); - break; - } - } - - if (inDQuote || inQuote) - throw new ArgumentException("connectionString"); - - if (name != null && name.Length > 0) { - value = sb.ToString(); - userParameters [name.Trim()] = value.Trim(); - } - - return userParameters; - } - - - #endregion // Methods - - #region IDictionary Members - - public virtual bool IsFixedSize - { - get { return _dictionary.IsFixedSize; } - } - - public virtual bool IsReadOnly - { - get { return _dictionary.IsReadOnly; } - } - - public virtual ICollection Keys - { - get { - return _dictionary.Keys; - } - } - - public virtual object this [object key] { - get { - - if (!(key is String)) - throw new ArgumentException("key is not string"); - - string skey = (string)key; - - skey = GetConnectionStringKey(skey); - if (skey == null) - return null; - - return _dictionary[skey]; - } - - set { - if (!(key is String)) - throw new ArgumentException("key is not string"); - - string skey = (string)key; - - skey = GetConnectionStringKey(skey); - if (skey == null) - skey = (string)key; - - _dictionary[skey] = value; - } - } - - public virtual ICollection Values - { - get { return _dictionary.Values; } - } - - public virtual void Add (object key, object value) - { - _dictionary.Add ((string)key, (string)value); - } - - public virtual void Clear () - { - _dictionary.Clear (); - } - - public virtual bool Contains (object key) - { - return _dictionary.Contains (key); - } - - public virtual IDictionaryEnumerator GetEnumerator () - { - return _dictionary.GetEnumerator (); - } - - public virtual void Remove (object key) - { - _dictionary.Remove ((string)key); - } - - #endregion // IDictionary Members - - #region IEnumerable Members - - IEnumerator IEnumerable.GetEnumerator () - { - return this.GetEnumerator(); - } - - #endregion // IEnumerable Members - - #region ICollection Members - - public virtual bool IsSynchronized - { - get { return ((ICollection)_dictionary).IsSynchronized; } - } - - public virtual int Count - { - get { return _dictionary.Count; } - } - - public virtual void CopyTo (Array array, int index) - { - _dictionary.CopyTo (array, index); - } - - public virtual object SyncRoot - { - get {return ((ICollection)_dictionary).SyncRoot; } - } - - #endregion // ICollection Members - } -} diff --git a/mcs/class/System.Data/Mainsoft.Data.Configuration.jvm/ProvidersSectionHandler.cs b/mcs/class/System.Data/Mainsoft.Data.Configuration.jvm/ProvidersSectionHandler.cs deleted file mode 100644 index 5ac952a9b57..00000000000 --- a/mcs/class/System.Data/Mainsoft.Data.Configuration.jvm/ProvidersSectionHandler.cs +++ /dev/null @@ -1,113 +0,0 @@ -// -// System.Data.OleDb.OleDbConnection -// -// Authors: -// Konstantin Triger <kostat@mainsoft.com> -// Boris Kirzner <borisk@mainsoft.com> -// -// (C) 2006 Mainsoft Corporation (http://www.mainsoft.com) -// - -// -// 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.Configuration; -using System.Xml; -using System.Collections; -using System.Collections.Specialized; - -namespace Mainsoft.Data.Configuration -{ - class ProvidersSectionHandler : IConfigurationSectionHandler - { - public virtual object Create (object parent, object configContext, XmlNode section) { - if (section.Attributes != null && section.Attributes.Count != 0) - ThrowException ("Unrecognized attribute", section); - - ArrayList providers = new ArrayList(); - - XmlNodeList providerElements = section.SelectNodes ("provider"); - foreach (XmlNode child in providerElements) { - XmlNodeType ntype = child.NodeType; - if (ntype == XmlNodeType.Whitespace || ntype == XmlNodeType.Comment) - continue; - - if (ntype != XmlNodeType.Element) - ThrowException ("Only elements allowed", child); - - object parentProvider = null; - XmlAttribute extends = child.Attributes["parent"]; - if (extends != null) { - string super = extends.Value; - string sectionName = super.Substring(0, super.IndexOf('#')); - string id = super.Substring(sectionName.Length+1); - IList supers = (IList) ConfigurationSettings.GetConfig(sectionName); - for (int i = 0; i < supers.Count; i++) { - Hashtable ht = (Hashtable)supers[i]; - string curId = (string)ht["id"]; - if (String.CompareOrdinal(id,curId) == 0) { - parentProvider = ht; - break; - } - } - child.Attributes.Remove(extends); - } - - DictionarySectionHandler handler = new DictionarySectionHandler(); - Hashtable col = (Hashtable) handler.Create (parentProvider, null, child); - providers.Add(col); - } - if (parent != null && parent is IList) { - IList parentList = (IList)parent; - for (int i = 0; i < parentList.Count; i++) { - Hashtable htParent = (Hashtable)parentList[i]; - string parentId = (string)htParent["id"]; - bool overriden = false; - for (int y = 0; y < providers.Count; y++) { - Hashtable htMe = (Hashtable)providers[y]; - string myId = (string)htMe["id"]; - if (String.CompareOrdinal(parentId,myId) == 0) { - overriden = true; - foreach (object key in htParent.Keys) - if (!htMe.ContainsKey(key)) - htMe[key] = htParent[key]; - break; - } - } - - if (!overriden) - providers.Add(htParent); - } - } - - return providers; - } - - static internal void ThrowException (string msg, XmlNode node) - { - if (node != null && node.Name != String.Empty) - msg = msg + " (node name: " + node.Name + ") "; - throw new ConfigurationException (msg, node); - } - } -} diff --git a/mcs/class/System.Data/Mainsoft.Data.Jdbc.Providers.jvm/.gitattributes b/mcs/class/System.Data/Mainsoft.Data.Jdbc.Providers.jvm/.gitattributes deleted file mode 100644 index 57f4ce4c6a0..00000000000 --- a/mcs/class/System.Data/Mainsoft.Data.Jdbc.Providers.jvm/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -/wrappers.cs -crlf diff --git a/mcs/class/System.Data/Mainsoft.Data.Jdbc.Providers.jvm/OleDbDB2Provider.cs b/mcs/class/System.Data/Mainsoft.Data.Jdbc.Providers.jvm/OleDbDB2Provider.cs deleted file mode 100644 index 93089a58c85..00000000000 --- a/mcs/class/System.Data/Mainsoft.Data.Jdbc.Providers.jvm/OleDbDB2Provider.cs +++ /dev/null @@ -1,99 +0,0 @@ -// -// System.Data.OleDb.OleDbConnection -// -// Authors: -// Konstantin Triger <kostat@mainsoft.com> -// Boris Kirzner <borisk@mainsoft.com> -// -// (C) 2006 Mainsoft Corporation (http://www.mainsoft.com) -// - -// -// 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 Mainsoft.Data.Configuration; - -namespace Mainsoft.Data.Jdbc.Providers { - public class OleDbDB2Provider : GenericProvider { - #region Consts - - private const string Port = "port"; - private const string Hostname = "hostname"; - private const string Location = "location"; - - #endregion //Consts - - #region Fields - - #endregion // Fields - - #region Constructors - - public OleDbDB2Provider (IDictionary providerInfo) : base (providerInfo) { - } - - #endregion // Constructors - - #region Properties - - #endregion // Properties - - #region Methods - - public override IConnectionStringDictionary GetConnectionStringBuilder (string connectionString) { - IConnectionStringDictionary connectionStringBuilder = base.GetConnectionStringBuilder (connectionString); - - string hostname = (string)connectionStringBuilder[Hostname]; - string port = null; - if (hostname == null || hostname.Length == 0) { - string location = (string)connectionStringBuilder[Location]; - if (location != null) { - int semicolumnIndex = location.IndexOf(':'); - if (semicolumnIndex != -1) { - hostname = location.Substring(0,semicolumnIndex); - port = location.Substring(semicolumnIndex + 1); - } - else - hostname = location; - - if (hostname != null) - connectionStringBuilder.Add(Hostname, hostname); - - if (port != null) - connectionStringBuilder[Port] = port; - } - } - - port = (string) connectionStringBuilder [Port]; - if (port == null || port.Length == 0) { - port = (string) ProviderInfo [Port]; - connectionStringBuilder.Add (Port, port); - } - - return connectionStringBuilder; - } - - #endregion //Methods - } -} diff --git a/mcs/class/System.Data/Mainsoft.Data.Jdbc.Providers.jvm/OleDbOracleProvider.cs b/mcs/class/System.Data/Mainsoft.Data.Jdbc.Providers.jvm/OleDbOracleProvider.cs deleted file mode 100644 index db359cc32d8..00000000000 --- a/mcs/class/System.Data/Mainsoft.Data.Jdbc.Providers.jvm/OleDbOracleProvider.cs +++ /dev/null @@ -1,321 +0,0 @@ -// -// Mainsoft.Data.Jdbc.Providers.OleDbOracleProvider -// -// Authors: -// Konstantin Triger <kostat@mainsoft.com> -// Boris Kirzner <borisk@mainsoft.com> -// -// (C) 2006 Mainsoft Corporation (http://www.mainsoft.com) -// - -// -// 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 Mainsoft.Data.Configuration; -using System.Reflection; - -namespace Mainsoft.Data.Jdbc.Providers -{ - public class OleDbOracleProvider : GenericProvider - { - #region Consts - - private const string Port = "Port"; - private const string ROWID = "ROWID"; - private const string DBTYPE_CHAR = "DBTYPE_CHAR"; - - #endregion //Consts - - #region oracle.sql.Types constants - - private enum JavaSqlTypes { - ARRAY = 2003 , - BIGINT = -5, - BINARY = -2 , - BIT = -7 , - BLOB = 2004, - BOOLEAN = 16, - CHAR = 1, - CLOB = 2005, - DATALINK = 70, - DATE = 91, - DECIMAL = 3, - DISTINCT = 2001, - DOUBLE = 8, - FLOAT = 6, - INTEGER = 4, - JAVA_OBJECT = 2000, - LONGVARBINARY = -4, - LONGVARCHAR = -1, - NULL = 0, - NUMERIC = 2 , - OTHER = 1111 , - REAL = 7 , - REF = 2006 , - SMALLINT = 5, - STRUCT = 2002, - TIME = 92, - TIMESTAMP = 93, - TINYINT = -6, - VARBINARY = -3, - VARCHAR = 12, - - //ORACLE types, see oracle.jdbc.OracleTypes - BINARY_FLOAT = 100, - BINARY_DOUBLE = 101, - ROWID = -8, - CURSOR = -10, - TIMESTAMPNS = -100, - TIMESTAMPTZ = -101, - TIMESTAMPLTZ = -102, - INTERVALYM = -103, - INTERVALDS = -104, - } - - #endregion - - #region Fields - - #endregion // Fields - - #region Constructors - - public OleDbOracleProvider (IDictionary providerInfo) : base (providerInfo) - { - } - - #endregion // Constructors - - #region Properties - - #endregion // Properties - - #region Methods - - public override IConnectionStringDictionary GetConnectionStringBuilder (string connectionString) - { - IConnectionStringDictionary conectionStringBuilder = base.GetConnectionStringBuilder (connectionString); - - string port = (string) conectionStringBuilder [Port]; - if (port == null || port.Length == 0) { - port = (string) ProviderInfo [Port]; - conectionStringBuilder.Add (Port, port); - } - - return conectionStringBuilder; - } - - public override java.sql.Connection GetConnection(IConnectionStringDictionary conectionStringBuilder) { - return new OracleConnection(base.GetConnection (conectionStringBuilder)); - } - - - #endregion //Methods - - #region OracleConnection - - sealed class OracleConnection : Connection { - - public OracleConnection(java.sql.Connection connection) - : base(connection) {} - - public override java.sql.Statement createStatement() { - return new OracleStatement (base.createStatement()); - } - - public override java.sql.Statement createStatement(int arg_0, int arg_1) { - return new OracleStatement (base.createStatement(arg_0, arg_1)); - } - - public override java.sql.Statement createStatement(int arg_0, int arg_1, int arg_2) { - return new OracleStatement (base.createStatement(arg_0, arg_1, arg_2)); - } - - public override java.sql.CallableStatement prepareCall(string arg_0) { - return new OracleCallableStatement(base.prepareCall (arg_0)); - } - - public override java.sql.CallableStatement prepareCall(string arg_0, int arg_1, int arg_2) { - return new OracleCallableStatement(base.prepareCall (arg_0, arg_1, arg_2)); - } - - public override java.sql.CallableStatement prepareCall(string arg_0, int arg_1, int arg_2, int arg_3) { - return new OracleCallableStatement(base.prepareCall (arg_0, arg_1, arg_2, arg_3)); - } - - public override java.sql.PreparedStatement prepareStatement(string arg_0) { - return new OraclePreparedStatement(base.prepareStatement (arg_0)); - } - - public override java.sql.PreparedStatement prepareStatement(string arg_0, int arg_1) { - return new OraclePreparedStatement(base.prepareStatement (arg_0, arg_1)); - } - - public override java.sql.PreparedStatement prepareStatement(string arg_0, int arg_1, int arg_2) { - return new OraclePreparedStatement(base.prepareStatement (arg_0, arg_1, arg_2)); - } - - public override java.sql.PreparedStatement prepareStatement(string arg_0, int arg_1, int arg_2, int arg_3) { - return new OraclePreparedStatement(base.prepareStatement (arg_0, arg_1, arg_2, arg_3)); - } - - public override java.sql.PreparedStatement prepareStatement(string arg_0, int[] arg_1) { - return new OraclePreparedStatement(base.prepareStatement (arg_0, arg_1)); - } - - public override java.sql.PreparedStatement prepareStatement(string arg_0, string[] arg_1) { - return new OraclePreparedStatement(base.prepareStatement (arg_0, arg_1)); - } - } - - #endregion - - sealed class OracleStatement : Statement { - - public OracleStatement (java.sql.Statement statement) - : base (statement) { - } - - public override java.sql.ResultSet executeQuery(string arg_0) { - return new OracleResultSet (base.executeQuery(arg_0)); - } - - public override java.sql.ResultSet getResultSet() { - return new OracleResultSet (base.getResultSet()); - } - } - - sealed class OraclePreparedStatement : PreparedStatement, IPreparedStatement { - readonly MethodInfo _info; - - public OraclePreparedStatement(java.sql.PreparedStatement statement) - : base(statement) { - _info = Wrapped.GetType().GetMethod("setFixedCHAR"); - } - - public override java.sql.ResultSet executeQuery(string arg_0) { - return new OracleResultSet (base.executeQuery(arg_0)); - } - - #region IPreparedStatement Members - - public void setBit(int parameterIndex, int value) { - base.setInt(parameterIndex, value); - } - - public void setChar(int parameterIndex, string value) { - if (_info == null) { - base.setString(parameterIndex, value); - return; - } - - _info.Invoke(Wrapped, new object[] { - new java.lang.Integer(parameterIndex), - value}); - } - - public void setNumeric(int parameterIndex, java.math.BigDecimal value) { - base.setBigDecimal(parameterIndex, value); - } - - public void setReal(int parameterIndex, double value) { - base.setDouble(parameterIndex, value); - } - - #endregion - } - - sealed class OracleCallableStatement : CallableStatement, IPreparedStatement { - readonly MethodInfo _info; - - public OracleCallableStatement(java.sql.CallableStatement statement) - : base(statement) { - _info = Wrapped.GetType().GetMethod("setFixedCHAR"); - } - - public override java.sql.ResultSet executeQuery(string arg_0) { - return new OracleResultSet (base.executeQuery(arg_0)); - } - - #region IPreparedStatement Members - - public void setBit(int parameterIndex, int value) { - base.setInt(parameterIndex, value); - } - - public void setChar(int parameterIndex, string value) { - if (_info == null) { - base.setString(parameterIndex, value); - return; - } - - _info.Invoke(Wrapped, new object[] { - new java.lang.Integer(parameterIndex), - value}); - } - - public void setNumeric(int parameterIndex, java.math.BigDecimal value) { - base.setBigDecimal(parameterIndex, value); - } - - public void setReal(int parameterIndex, double value) { - base.setDouble(parameterIndex, value); - } - - #endregion - - } - - sealed class OracleResultSet : ResultSet { - public OracleResultSet (java.sql.ResultSet resultSet) : base (resultSet) { - } - - public override java.sql.ResultSetMetaData getMetaData() { - return new OracleResultSetMetaData (base.getMetaData ()); - } - } - - sealed class OracleResultSetMetaData: ResultSetMetaData { - public OracleResultSetMetaData (java.sql.ResultSetMetaData resultSetMetaData) - : base (resultSetMetaData) { - } - - public override int getColumnType(int arg_0) { - int jdbcType = base.getColumnType (arg_0); - if ((JavaSqlTypes)jdbcType == JavaSqlTypes.ROWID) - return (int)JavaSqlTypes.VARCHAR; - - return jdbcType; - } - - public override string getColumnTypeName(int arg_0) { - string columnTypeName = base.getColumnTypeName (arg_0); - if (ROWID == columnTypeName) - return DBTYPE_CHAR; - - return columnTypeName; - } - } - - } -} diff --git a/mcs/class/System.Data/Mainsoft.Data.Jdbc.Providers.jvm/wrappers.cs b/mcs/class/System.Data/Mainsoft.Data.Jdbc.Providers.jvm/wrappers.cs deleted file mode 100644 index 5488f736b40..00000000000 --- a/mcs/class/System.Data/Mainsoft.Data.Jdbc.Providers.jvm/wrappers.cs +++ /dev/null @@ -1,2373 +0,0 @@ -// -// Mainsoft.Data.Jdbc.Providers -// -// Authors: -// Konstantin Triger <kostat@mainsoft.com> -// Boris Kirzner <borisk@mainsoft.com> -// -// (C) 2006 Mainsoft Corporation (http://www.mainsoft.com) -// - -// -// 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. -// - -namespace Mainsoft.Data.Jdbc.Providers { - public class Connection : java.sql.Connection { - - readonly java.sql.Connection _connection; - - public Connection(java.sql.Connection connection) { - _connection = connection; - } - - protected java.sql.Connection Wrapped { - get { return _connection; } - } - - #region Connection Members - - public virtual bool isClosed() { - return Wrapped.isClosed(); - } - - public virtual bool isReadOnly() { - return Wrapped.isReadOnly(); - } - - public virtual void setTransactionIsolation(int arg_0) { - Wrapped.setTransactionIsolation(arg_0); - } - - public virtual void releaseSavepoint(java.sql.Savepoint arg_0) { - Wrapped.releaseSavepoint(arg_0); - } - - public virtual void setTypeMap(java.util.Map arg_0) { - Wrapped.setTypeMap(arg_0); - } - - public virtual string getCatalog() { - return Wrapped.getCatalog(); - } - - public virtual int getHoldability() { - return Wrapped.getHoldability(); - } - - public virtual void rollback() { - Wrapped.rollback(); - } - - public virtual void rollback(java.sql.Savepoint arg_0) { - Wrapped.rollback(arg_0); - } - - public virtual java.sql.CallableStatement prepareCall(string arg_0) { - return Wrapped.prepareCall(arg_0); - } - - public virtual java.sql.CallableStatement prepareCall(string arg_0, int arg_1, int arg_2) { - return Wrapped.prepareCall(arg_0, arg_1, arg_2); - } - - public virtual java.sql.CallableStatement prepareCall(string arg_0, int arg_1, int arg_2, int arg_3) { - return Wrapped.prepareCall(arg_0, arg_1, arg_2, arg_3); - } - - public virtual void setAutoCommit(bool arg_0) { - Wrapped.setAutoCommit(arg_0); - } - - public virtual java.sql.Savepoint setSavepoint() { - return Wrapped.setSavepoint(); - } - - public virtual java.sql.Savepoint setSavepoint(string arg_0) { - return Wrapped.setSavepoint(arg_0); - } - - public virtual java.sql.Statement createStatement() { - return Wrapped.createStatement(); - } - - public virtual java.sql.Statement createStatement(int arg_0, int arg_1) { - return Wrapped.createStatement(arg_0, arg_1); - } - - public virtual java.sql.Statement createStatement(int arg_0, int arg_1, int arg_2) { - return Wrapped.createStatement(arg_0, arg_1, arg_2); - } - - public virtual void setCatalog(string arg_0) { - Wrapped.setCatalog(arg_0); - } - - public virtual java.sql.PreparedStatement prepareStatement(string arg_0) { - return Wrapped.prepareStatement(arg_0); - } - - public virtual java.sql.PreparedStatement prepareStatement(string arg_0, int arg_1, int arg_2) { - return Wrapped.prepareStatement(arg_0, arg_1, arg_2); - } - - public virtual java.sql.PreparedStatement prepareStatement(string arg_0, int arg_1, int arg_2, int arg_3) { - return Wrapped.prepareStatement(arg_0, arg_1, arg_2, arg_3); - } - - public virtual java.sql.PreparedStatement prepareStatement(string arg_0, int arg_1) { - return Wrapped.prepareStatement(arg_0, arg_1); - } - - public virtual java.sql.PreparedStatement prepareStatement(string arg_0, int[] arg_1) { - return Wrapped.prepareStatement(arg_0, arg_1); - } - - public virtual java.sql.PreparedStatement prepareStatement(string arg_0, string[] arg_1) { - return Wrapped.prepareStatement(arg_0, arg_1); - } - - public virtual void setHoldability(int arg_0) { - Wrapped.setHoldability(arg_0); - } - - public virtual void commit() { - Wrapped.commit(); - } - - public virtual java.sql.DatabaseMetaData getMetaData() { - return Wrapped.getMetaData(); - } - - public virtual int getTransactionIsolation() { - return Wrapped.getTransactionIsolation(); - } - - public virtual bool getAutoCommit() { - return Wrapped.getAutoCommit(); - } - - public virtual java.sql.SQLWarning getWarnings() { - return Wrapped.getWarnings(); - } - - public virtual java.util.Map getTypeMap() { - return Wrapped.getTypeMap(); - } - - public virtual void close() { - Wrapped.close(); - } - - public virtual string nativeSQL(string arg_0) { - return Wrapped.nativeSQL(arg_0);; - } - - public virtual void setReadOnly(bool arg_0) { - Wrapped.setReadOnly(arg_0); - } - - public virtual void clearWarnings() { - Wrapped.clearWarnings(); - } - - #endregion - - } - - public class Statement : java.sql.Statement { - - readonly java.sql.Statement _statement; - - public Statement(java.sql.Statement statement) { - _statement = statement; - } - - protected java.sql.Statement Wrapped { - get { return _statement; } - } - - #region Statement Members - - public virtual java.sql.Connection getConnection() { - return Wrapped.getConnection(); - } - - public virtual void setEscapeProcessing(bool arg_0) { - Wrapped.setEscapeProcessing(arg_0); - } - - public virtual void setMaxFieldSize(int arg_0) { - Wrapped.setMaxFieldSize(arg_0); - } - - public virtual void cancel() { - Wrapped.cancel(); - } - - public virtual bool getMoreResults() { - return Wrapped.getMoreResults(); - } - - public virtual bool getMoreResults(int arg_0) { - return Wrapped.getMoreResults(arg_0); - } - - public virtual int executeUpdate(string arg_0) { - return Wrapped.executeUpdate(arg_0); - } - - public virtual int executeUpdate(string arg_0, int arg_1) { - return Wrapped.executeUpdate(arg_0, arg_1); - } - - public virtual int executeUpdate(string arg_0, int[] arg_1) { - return Wrapped.executeUpdate(arg_0, arg_1); - } - - public virtual int executeUpdate(string arg_0, string[] arg_1) { - return Wrapped.executeUpdate(arg_0, arg_1); - } - - public virtual java.sql.ResultSet getResultSet() { - return Wrapped.getResultSet(); - } - - public virtual int getResultSetConcurrency() { - return Wrapped.getResultSetConcurrency(); - } - - public virtual void setQueryTimeout(int arg_0) { - Wrapped.setQueryTimeout(arg_0); - } - - public virtual int getUpdateCount() { - return Wrapped.getUpdateCount(); - } - - public virtual int getResultSetType() { - return Wrapped.getResultSetType(); - } - - public virtual int[] executeBatch() { - return Wrapped.executeBatch(); - } - - public virtual void setFetchDirection(int arg_0) { - Wrapped.setFetchDirection(arg_0); - } - - public virtual void setMaxRows(int arg_0) { - Wrapped.setMaxRows(arg_0); - } - - public virtual void addBatch(string arg_0) { - Wrapped.addBatch(arg_0); - } - - public virtual bool execute(string arg_0) { - return Wrapped.execute(arg_0); - } - - public virtual bool execute(string arg_0, int arg_1) { - return Wrapped.execute(arg_0, arg_1); - } - - public virtual bool execute(string arg_0, int[] arg_1) { - return Wrapped.execute(arg_0, arg_1); - } - - public virtual bool execute(string arg_0, string[] arg_1) { - return Wrapped.execute(arg_0, arg_1); - } - - public virtual int getResultSetHoldability() { - return Wrapped.getResultSetHoldability(); - } - - public virtual java.sql.ResultSet executeQuery(string arg_0) { - return Wrapped.executeQuery(arg_0); - } - - public virtual void setCursorName(string arg_0) { - Wrapped.setCursorName(arg_0); - } - - public virtual java.sql.SQLWarning getWarnings() { - return Wrapped.getWarnings(); - } - - public virtual int getMaxRows() { - return Wrapped.getMaxRows(); - } - - public virtual int getFetchSize() { - return Wrapped.getFetchSize(); - } - - public virtual void clearBatch() { - Wrapped.clearBatch(); - } - - public virtual int getQueryTimeout() { - return Wrapped.getQueryTimeout(); - } - - public virtual java.sql.ResultSet getGeneratedKeys() { - return Wrapped.getGeneratedKeys(); - } - - public virtual int getFetchDirection() { - return Wrapped.getFetchDirection(); - } - - public virtual void close() { - Wrapped.close(); - } - - public virtual int getMaxFieldSize() { - return Wrapped.getMaxFieldSize(); - } - - public virtual void clearWarnings() { - Wrapped.clearWarnings(); - } - - public virtual void setFetchSize(int arg_0) { - Wrapped.setFetchSize(arg_0); - } - - #endregion - - } - - public class PreparedStatement : Statement, java.sql.PreparedStatement { - - public PreparedStatement(java.sql.PreparedStatement statement) : base(statement) { - } - - protected new java.sql.PreparedStatement Wrapped { - get { return (java.sql.PreparedStatement)base.Wrapped; } - } - - #region PreparedStatement Members - - public virtual void setBlob(int arg_0, java.sql.Blob arg_1) { - Wrapped.setBlob(arg_0, arg_1); - } - - public virtual java.sql.ParameterMetaData getParameterMetaData() { - return Wrapped.getParameterMetaData(); - } - - public virtual void setInt(int arg_0, int arg_1) { - Wrapped.setInt(arg_0, arg_1); - } - - public virtual void setFloat(int arg_0, float arg_1) { - Wrapped.setFloat(arg_0, arg_1); - } - - public virtual int executeUpdate() { - return Wrapped.executeUpdate(); - } - - public virtual void setLong(int arg_0, long arg_1) { - Wrapped.setLong(arg_0, arg_1); - } - - public virtual void setNull(int arg_0, int arg_1) { - Wrapped.setNull(arg_0, arg_1); - } - - public virtual void setNull(int arg_0, int arg_1, string arg_2) { - Wrapped.setNull(arg_0, arg_1, arg_2); - } - - public virtual void setUnicodeStream(int arg_0, java.io.InputStream arg_1, int arg_2) { - Wrapped.setUnicodeStream(arg_0, arg_1, arg_2); - } - - public virtual void setShort(int arg_0, short arg_1) { - Wrapped.setShort(arg_0, arg_1); - } - - public virtual void setByte(int arg_0, sbyte arg_1) { - Wrapped.setByte(arg_0, arg_1); - } - - public virtual bool execute() { - return Wrapped.execute(); - } - - public virtual void addBatch() { - Wrapped.addBatch(); - } - - public virtual void setURL(int arg_0, java.net.URL arg_1) { - Wrapped.setURL(arg_0, arg_1); - } - - public virtual void setBigDecimal(int arg_0, java.math.BigDecimal arg_1) { - Wrapped.setBigDecimal(arg_0, arg_1); - } - - public virtual void setBytes(int arg_0, sbyte[] arg_1) { - Wrapped.setBytes(arg_0, arg_1); - } - - public virtual void setDouble(int arg_0, double arg_1) { - Wrapped.setDouble(arg_0, arg_1); - } - - public virtual void setRef(int arg_0, java.sql.Ref arg_1) { - Wrapped.setRef(arg_0, arg_1); - } - - public virtual java.sql.ResultSetMetaData getMetaData() { - return Wrapped.getMetaData(); - } - - public virtual void setTimestamp(int arg_0, java.sql.Timestamp arg_1) { - Wrapped.setTimestamp(arg_0, arg_1); - } - - public virtual void setTimestamp(int arg_0, java.sql.Timestamp arg_1, java.util.Calendar arg_2) { - Wrapped.setTimestamp(arg_0, arg_1, arg_2); - } - - public virtual java.sql.ResultSet executeQuery() { - return Wrapped.executeQuery(); - } - - public virtual void setCharacterStream(int arg_0, java.io.Reader arg_1, int arg_2) { - Wrapped.setCharacterStream(arg_0, arg_1, arg_2); - } - - public virtual void setTime(int arg_0, java.sql.Time arg_1) { - Wrapped.setTime(arg_0, arg_1); - } - - public virtual void setTime(int arg_0, java.sql.Time arg_1, java.util.Calendar arg_2) { - Wrapped.setTime(arg_0, arg_1, arg_2); - } - - public virtual void setBoolean(int arg_0, bool arg_1) { - Wrapped.setBoolean(arg_0, arg_1); - } - - public virtual void setString(int arg_0, string arg_1) { - Wrapped.setString(arg_0, arg_1); - } - - public virtual void setBinaryStream(int arg_0, java.io.InputStream arg_1, int arg_2) { - Wrapped.setBinaryStream(arg_0, arg_1, arg_2); - } - - public virtual void clearParameters() { - Wrapped.clearParameters(); - } - - public virtual void setObject(int arg_0, object arg_1, int arg_2, int arg_3) { - Wrapped.setObject(arg_0, arg_1, arg_2, arg_3); - } - - public virtual void setObject(int arg_0, object arg_1, int arg_2) { - Wrapped.setObject(arg_0, arg_1, arg_2); - } - - public virtual void setObject(int arg_0, object arg_1) { - Wrapped.setObject(arg_0, arg_1); - } - - public virtual void setArray(int arg_0, java.sql.Array arg_1) { - Wrapped.setArray(arg_0, arg_1); - } - - public virtual void setDate(int arg_0, java.sql.Date arg_1) { - Wrapped.setDate(arg_0, arg_1); - } - - public virtual void setDate(int arg_0, java.sql.Date arg_1, java.util.Calendar arg_2) { - Wrapped.setDate(arg_0, arg_1, arg_2); - } - - public virtual void setAsciiStream(int arg_0, java.io.InputStream arg_1, int arg_2) { - Wrapped.setAsciiStream(arg_0, arg_1, arg_2); - } - - public virtual void setClob(int arg_0, java.sql.Clob arg_1) { - Wrapped.setClob(arg_0, arg_1); - } - - #endregion - - } - - public class CallableStatement : PreparedStatement, java.sql.CallableStatement { - - public CallableStatement(java.sql.CallableStatement statement) : base(statement) { - } - - protected new java.sql.CallableStatement Wrapped { - get { return (java.sql.CallableStatement)base.Wrapped; } - } - - #region CallableStatement Members - - public virtual java.sql.Clob getClob(int arg_0) { - return Wrapped.getClob(arg_0); - } - - public virtual java.sql.Clob getClob(string arg_0) { - return Wrapped.getClob(arg_0); - } - - public virtual int getInt(int arg_0) { - return Wrapped.getInt(arg_0); - } - - public virtual int getInt(string arg_0) { - return Wrapped.getInt(arg_0); - } - - public virtual java.sql.Array getArray(int arg_0) { - return Wrapped.getArray(arg_0); - } - - public virtual java.sql.Array getArray(string arg_0) { - return Wrapped.getArray(arg_0); - } - - public virtual void setInt(string arg_0, int arg_1) { - Wrapped.setInt(arg_0, arg_1); - } - - public virtual void setFloat(string arg_0, float arg_1) { - Wrapped.setFloat(arg_0, arg_1); - } - - public virtual java.net.URL getURL(int arg_0) { - return Wrapped.getURL(arg_0); - } - - public virtual java.net.URL getURL(string arg_0) { - return Wrapped.getURL(arg_0); - } - - public virtual void registerOutParameter(int arg_0, int arg_1) { - Wrapped.registerOutParameter(arg_0, arg_1); - } - - public virtual void registerOutParameter(int arg_0, int arg_1, int arg_2) { - Wrapped.registerOutParameter(arg_0, arg_1, arg_2); - } - - public virtual void registerOutParameter(int arg_0, int arg_1, string arg_2) { - Wrapped.registerOutParameter(arg_0, arg_1, arg_2); - } - - public virtual void registerOutParameter(string arg_0, int arg_1) { - Wrapped.registerOutParameter(arg_0, arg_1); - } - - public virtual void registerOutParameter(string arg_0, int arg_1, int arg_2) { - Wrapped.registerOutParameter(arg_0, arg_1, arg_2); - } - - public virtual void registerOutParameter(string arg_0, int arg_1, string arg_2) { - Wrapped.registerOutParameter(arg_0, arg_1, arg_2); - } - - public virtual long getLong(int arg_0) { - return Wrapped.getLong(arg_0); - } - - public virtual long getLong(string arg_0) { - return Wrapped.getLong(arg_0); - } - - public virtual void setLong(string arg_0, long arg_1) { - Wrapped.setLong(arg_0, arg_1); - } - - public virtual void setNull(string arg_0, int arg_1) { - Wrapped.setNull(arg_0, arg_1); - } - - public virtual void setNull(string arg_0, int arg_1, string arg_2) { - Wrapped.setNull(arg_0, arg_1, arg_2); - } - - public virtual object getObject(int arg_0) { - return Wrapped.getObject(arg_0); - } - - public virtual object getObject(int arg_0, java.util.Map arg_1) { - return Wrapped.getObject(arg_0, arg_1); - } - - public virtual object getObject(string arg_0) { - return Wrapped.getObject(arg_0); - } - - public virtual object getObject(string arg_0, java.util.Map arg_1) { - return Wrapped.getObject(arg_0, arg_1); - } - - public virtual bool wasNull() { - return Wrapped.wasNull(); - } - - public virtual sbyte[] getBytes(int arg_0) { - return Wrapped.getBytes(arg_0); - } - - public virtual sbyte[] getBytes(string arg_0) { - return Wrapped.getBytes(arg_0); - } - - public virtual void setShort(string arg_0, short arg_1) { - Wrapped.setShort(arg_0, arg_1); - } - - public virtual void setByte(string arg_0, sbyte arg_1) { - Wrapped.setByte(arg_0, arg_1); - } - - public virtual sbyte getByte(int arg_0) { - return Wrapped.getByte(arg_0); - } - - public virtual sbyte getByte(string arg_0) { - return Wrapped.getByte(arg_0); - } - - public virtual void setURL(string arg_0, java.net.URL arg_1) { - Wrapped.setURL(arg_0, arg_1); - } - - public virtual double getDouble(int arg_0) { - return Wrapped.getDouble(arg_0); - } - - public virtual double getDouble(string arg_0) { - return Wrapped.getDouble(arg_0); - } - - public virtual void setBigDecimal(string arg_0, java.math.BigDecimal arg_1) { - Wrapped.setBigDecimal(arg_0, arg_1); - } - - public virtual float getFloat(int arg_0) { - return Wrapped.getFloat(arg_0); - } - - public virtual float getFloat(string arg_0) { - return Wrapped.getFloat(arg_0); - } - - public virtual void setBytes(string arg_0, sbyte[] arg_1) { - Wrapped.setBytes(arg_0, arg_1); - } - - public virtual short getShort(int arg_0) { - return Wrapped.getShort(arg_0); - } - - public virtual short getShort(string arg_0) { - return Wrapped.getShort(arg_0); - } - - public virtual java.sql.Timestamp getTimestamp(int arg_0) { - return Wrapped.getTimestamp(arg_0); - } - - public virtual java.sql.Timestamp getTimestamp(int arg_0, java.util.Calendar arg_1) { - return Wrapped.getTimestamp(arg_0, arg_1); - } - - public virtual java.sql.Timestamp getTimestamp(string arg_0) { - return Wrapped.getTimestamp(arg_0); - } - - public virtual java.sql.Timestamp getTimestamp(string arg_0, java.util.Calendar arg_1) { - return Wrapped.getTimestamp(arg_0, arg_1); - } - - public virtual void setDouble(string arg_0, double arg_1) { - Wrapped.setDouble(arg_0, arg_1); - } - - public virtual void setTimestamp(string arg_0, java.sql.Timestamp arg_1) { - Wrapped.setTimestamp(arg_0, arg_1); - } - - public virtual void setTimestamp(string arg_0, java.sql.Timestamp arg_1, java.util.Calendar arg_2) { - Wrapped.setTimestamp(arg_0, arg_1, arg_2); - } - - public virtual bool getBoolean(int arg_0) { - return Wrapped.getBoolean(arg_0); - } - - public virtual bool getBoolean(string arg_0) { - return Wrapped.getBoolean(arg_0); - } - - public virtual void setCharacterStream(string arg_0, java.io.Reader arg_1, int arg_2) { - Wrapped.setCharacterStream(arg_0, arg_1, arg_2); - } - - public virtual void setTime(string arg_0, java.sql.Time arg_1) { - Wrapped.setTime(arg_0, arg_1); - } - - public virtual void setTime(string arg_0, java.sql.Time arg_1, java.util.Calendar arg_2) { - Wrapped.setTime(arg_0, arg_1, arg_2); - } - - public virtual void setBoolean(string arg_0, bool arg_1) { - Wrapped.setBoolean(arg_0, arg_1); - } - - public virtual java.math.BigDecimal getBigDecimal(int arg_0, int arg_1) { - return Wrapped.getBigDecimal(arg_0, arg_1); - } - - public virtual java.math.BigDecimal getBigDecimal(int arg_0) { - return Wrapped.getBigDecimal(arg_0); - } - - public virtual java.math.BigDecimal getBigDecimal(string arg_0) { - return Wrapped.getBigDecimal(arg_0); - } - - public virtual java.sql.Ref getRef(int arg_0) { - return Wrapped.getRef(arg_0); - } - - public virtual java.sql.Ref getRef(string arg_0) { - return Wrapped.getRef(arg_0); - } - - public virtual string getString(int arg_0) { - return Wrapped.getString(arg_0); - } - - public virtual string getString(string arg_0) { - return Wrapped.getString(arg_0); - } - - public virtual void setString(string arg_0, string arg_1) { - Wrapped.setString(arg_0, arg_1); - } - - public virtual java.sql.Blob getBlob(int arg_0) { - return Wrapped.getBlob(arg_0); - } - - public virtual java.sql.Blob getBlob(string arg_0) { - return Wrapped.getBlob(arg_0); - } - - public virtual void setBinaryStream(string arg_0, java.io.InputStream arg_1, int arg_2) { - Wrapped.setBinaryStream(arg_0, arg_1, arg_2); - } - - public virtual java.sql.Time getTime(int arg_0) { - return Wrapped.getTime(arg_0); - } - - public virtual java.sql.Time getTime(int arg_0, java.util.Calendar arg_1) { - return Wrapped.getTime(arg_0, arg_1);; - } - - public virtual java.sql.Time getTime(string arg_0) { - return Wrapped.getTime(arg_0); - } - - public virtual java.sql.Time getTime(string arg_0, java.util.Calendar arg_1) { - return Wrapped.getTime(arg_0, arg_1); - } - - public virtual void setObject(string arg_0, object arg_1, int arg_2, int arg_3) { - Wrapped.setObject(arg_0, arg_1, arg_2, arg_3); - } - - public virtual void setObject(string arg_0, object arg_1, int arg_2) { - Wrapped.setObject(arg_0, arg_1, arg_2); - } - - public virtual void setObject(string arg_0, object arg_1) { - Wrapped.setObject(arg_0, arg_1); - } - - public virtual void setDate(string arg_0, java.sql.Date arg_1) { - Wrapped.setDate(arg_0, arg_1); - } - - public virtual void setDate(string arg_0, java.sql.Date arg_1, java.util.Calendar arg_2) { - Wrapped.setDate(arg_0, arg_1, arg_2); - } - - public virtual void setAsciiStream(string arg_0, java.io.InputStream arg_1, int arg_2) { - Wrapped.setAsciiStream(arg_0, arg_1, arg_2); - } - - public virtual java.sql.Date getDate(int arg_0) { - return Wrapped.getDate(arg_0); - } - - public virtual java.sql.Date getDate(int arg_0, java.util.Calendar arg_1) { - return Wrapped.getDate(arg_0, arg_1); - } - - public virtual java.sql.Date getDate(string arg_0) { - return Wrapped.getDate(arg_0); - } - - public virtual java.sql.Date getDate(string arg_0, java.util.Calendar arg_1) { - return Wrapped.getDate(arg_0, arg_1); - } - - #endregion - - } - - public class ResultSet : java.sql.ResultSet { - readonly java.sql.ResultSet _resultSet; - - public ResultSet (java.sql.ResultSet resultSet) { - _resultSet = resultSet; - } - - protected java.sql.ResultSet Wrapped { - get { return _resultSet; } - } - - #region ResultSet Members
-
- public virtual java.io.InputStream getBinaryStream(int arg_0) {
- return Wrapped.getBinaryStream (arg_0);
- }
-
- public virtual java.io.InputStream getBinaryStream(string arg_0) {
- return Wrapped.getBinaryStream (arg_0);
- }
-
- public virtual void updateTime(int arg_0, java.sql.Time arg_1) {
- Wrapped.updateTime (arg_0, arg_1);
- }
-
- public virtual void updateTime(string arg_0, java.sql.Time arg_1) {
- Wrapped.updateTime (arg_0, arg_1);
- }
-
- public virtual bool next() {
- return Wrapped.next ();
- }
-
- public virtual int getInt(int arg_0) {
- return Wrapped.getInt (arg_0);
- }
-
- public virtual int getInt(string arg_0) {
- return Wrapped.getInt (arg_0);
- }
-
- public virtual java.io.InputStream getUnicodeStream(int arg_0) {
- return Wrapped.getUnicodeStream (arg_0);
- }
-
- public virtual java.io.InputStream getUnicodeStream(string arg_0) {
- return Wrapped.getUnicodeStream (arg_0);
- }
-
- public virtual bool isAfterLast() {
- return Wrapped.isAfterLast ();
- }
-
- public virtual bool isLast() {
- return Wrapped.isLast ();
- }
-
- public virtual bool isFirst() {
- return Wrapped.isFirst ();
- }
-
- public virtual void updateRow() {
- Wrapped.updateRow ();
- }
-
- public virtual java.net.URL getURL(int arg_0) {
- return Wrapped.getURL (arg_0);
- }
-
- public virtual java.net.URL getURL(string arg_0) {
- return Wrapped.getURL (arg_0);
- }
-
- public virtual bool rowDeleted() {
- return Wrapped.rowDeleted ();
- }
-
- public virtual void updateFloat(int arg_0, float arg_1) {
- Wrapped.updateFloat (arg_0, arg_1);
- }
-
- public virtual void updateFloat(string arg_0, float arg_1) {
- Wrapped.updateFloat (arg_0, arg_1);
- }
-
- public virtual object getObject(int arg_0) {
- return Wrapped.getObject (arg_0);
- }
-
- public virtual object getObject(string arg_0) {
- return Wrapped.getObject (arg_0);
- }
-
- public virtual object getObject(int arg_0, java.util.Map arg_1) {
- return Wrapped.getObject (arg_0, arg_1);
- }
-
- public virtual object getObject(string arg_0, java.util.Map arg_1) {
- return Wrapped.getObject (arg_0, arg_1);
- }
-
- public virtual sbyte[] getBytes(int arg_0) {
- return Wrapped.getBytes (arg_0);
- }
-
- public virtual sbyte[] getBytes(string arg_0) {
- return Wrapped.getBytes (arg_0);
- }
-
- public virtual void moveToCurrentRow() {
- Wrapped.moveToCurrentRow ();
- }
-
- public virtual sbyte getByte(int arg_0) {
- return Wrapped.getByte (arg_0);
- }
-
- public virtual sbyte getByte(string arg_0) {
- return Wrapped.getByte (arg_0);
- }
-
- public virtual void updateCharacterStream(int arg_0, java.io.Reader arg_1, int arg_2) {
- Wrapped.updateCharacterStream (arg_0, arg_1, arg_2);
- }
-
- public virtual void updateCharacterStream(string arg_0, java.io.Reader arg_1, int arg_2) {
- Wrapped.updateCharacterStream (arg_0, arg_1, arg_2);
- }
-
- public virtual void insertRow() {
- Wrapped.insertRow ();
- }
-
- public virtual void updateBoolean(int arg_0, bool arg_1) {
- Wrapped.updateBoolean (arg_0, arg_1);
- }
-
- public virtual void updateBoolean(string arg_0, bool arg_1) {
- Wrapped.updateBoolean (arg_0, arg_1);
- }
-
- public virtual bool relative(int arg_0) {
- return Wrapped.relative (arg_0);
- }
-
- public virtual java.sql.Timestamp getTimestamp(int arg_0) {
- return Wrapped.getTimestamp (arg_0);
- }
-
- public virtual java.sql.Timestamp getTimestamp(string arg_0) {
- return Wrapped.getTimestamp (arg_0);
- }
-
- public virtual java.sql.Timestamp getTimestamp(int arg_0, java.util.Calendar arg_1) {
- return Wrapped.getTimestamp (arg_0, arg_1);
- }
-
- public virtual java.sql.Timestamp getTimestamp(string arg_0, java.util.Calendar arg_1) {
- return Wrapped.getTimestamp (arg_0, arg_1);
- }
-
- public virtual void updateBigDecimal(int arg_0, java.math.BigDecimal arg_1) {
- Wrapped.updateBigDecimal (arg_0, arg_1);
- }
-
- public virtual void updateBigDecimal(string arg_0, java.math.BigDecimal arg_1) {
- Wrapped.updateBigDecimal (arg_0, arg_1);
- }
-
- public virtual void updateBinaryStream(int arg_0, java.io.InputStream arg_1, int arg_2) {
- Wrapped.updateBinaryStream (arg_0, arg_1, arg_2);
- }
-
- public virtual void updateBinaryStream(string arg_0, java.io.InputStream arg_1, int arg_2) {
- Wrapped.updateBinaryStream (arg_0, arg_1, arg_2);
- }
-
- public virtual void updateByte(int arg_0, sbyte arg_1) {
- Wrapped.updateByte (arg_0, arg_1);
- }
-
- public virtual void updateByte(string arg_0, sbyte arg_1) {
- Wrapped.updateByte (arg_0, arg_1);
- }
-
- public virtual bool isBeforeFirst() {
- return Wrapped.isBeforeFirst ();
- }
-
- public virtual bool first() {
- return Wrapped.first ();
- }
-
- public virtual java.math.BigDecimal getBigDecimal(int arg_0, int arg_1) {
- return Wrapped.getBigDecimal (arg_0, arg_1);
- }
-
- public virtual java.math.BigDecimal getBigDecimal(string arg_0, int arg_1) {
- return Wrapped.getBigDecimal (arg_0, arg_1);
- }
-
- public virtual java.math.BigDecimal getBigDecimal(int arg_0) {
- return Wrapped.getBigDecimal (arg_0);
- }
-
- public virtual java.math.BigDecimal getBigDecimal(string arg_0) {
- return Wrapped.getBigDecimal (arg_0);
- }
-
- public virtual int getFetchSize() {
- return Wrapped.getFetchSize ();
- }
-
- public virtual string getString(int arg_0) {
- return Wrapped.getString (arg_0);
- }
-
- public virtual string getString(string arg_0) {
- return Wrapped.getString (arg_0);
- }
-
- public virtual bool absolute(int arg_0) {
- return Wrapped.absolute (arg_0);
- }
-
- public virtual bool last() {
- return Wrapped.last ();
- }
-
- public virtual int getFetchDirection() {
- return Wrapped.getFetchDirection ();
- }
-
- public virtual java.sql.Time getTime(int arg_0) {
- return Wrapped.getTime (arg_0);
- }
-
- public virtual java.sql.Time getTime(string arg_0) {
- return Wrapped.getTime (arg_0);
- }
-
- public virtual java.sql.Time getTime(int arg_0, java.util.Calendar arg_1) {
- return Wrapped.getTime (arg_0, arg_1);
- }
-
- public virtual java.sql.Time getTime(string arg_0, java.util.Calendar arg_1) {
- return Wrapped.getTime (arg_0, arg_1);
- }
-
- public virtual void close() {
- Wrapped.close ();
- }
-
- public virtual void deleteRow() {
- Wrapped.deleteRow ();
- }
-
- public virtual void updateObject(int arg_0, object arg_1, int arg_2) {
- Wrapped.updateObject (arg_0, arg_1, arg_2);
- }
-
- public virtual void updateObject(int arg_0, object arg_1) {
- Wrapped.updateObject (arg_0, arg_1);
- }
-
- public virtual void updateObject(string arg_0, object arg_1, int arg_2) {
- Wrapped.updateObject (arg_0, arg_1, arg_2);
- }
-
- public virtual void updateObject(string arg_0, object arg_1) {
- Wrapped.updateObject (arg_0, arg_1);
- }
-
- public virtual void updateString(int arg_0, string arg_1) {
- Wrapped.updateString (arg_0, arg_1);
- }
-
- public virtual void updateString(string arg_0, string arg_1) {
- Wrapped.updateString (arg_0, arg_1);
- }
-
- public virtual java.sql.Date getDate(int arg_0) {
- return Wrapped.getDate (arg_0);
- }
-
- public virtual java.sql.Date getDate(string arg_0) {
- return Wrapped.getDate (arg_0);
- }
-
- public virtual java.sql.Date getDate(int arg_0, java.util.Calendar arg_1) {
- return Wrapped.getDate (arg_0, arg_1);
- }
-
- public virtual java.sql.Date getDate(string arg_0, java.util.Calendar arg_1) {
- return Wrapped.getDate (arg_0, arg_1);
- }
-
- public virtual java.sql.Clob getClob(int arg_0) {
- return Wrapped.getClob (arg_0);
- }
-
- public virtual java.sql.Clob getClob(string arg_0) {
- return Wrapped.getClob (arg_0);
- }
-
- public virtual void moveToInsertRow() {
- Wrapped.moveToInsertRow ();
- }
-
- public virtual void updateAsciiStream(int arg_0, java.io.InputStream arg_1, int arg_2) {
- Wrapped.updateAsciiStream (arg_0, arg_1, arg_2);
- }
-
- public virtual void updateAsciiStream(string arg_0, java.io.InputStream arg_1, int arg_2) {
- Wrapped.updateAsciiStream (arg_0, arg_1, arg_2);
- }
-
- public virtual void updateRef(int arg_0, java.sql.Ref arg_1) {
- Wrapped.updateRef (arg_0, arg_1);
- }
-
- public virtual void updateRef(string arg_0, java.sql.Ref arg_1) {
- Wrapped.updateRef (arg_0, arg_1);
- }
-
- public virtual int findColumn(string arg_0) {
- return Wrapped.findColumn (arg_0);
- }
-
- public virtual bool rowInserted() {
- return Wrapped.rowInserted ();
- }
-
- public virtual void updateBlob(int arg_0, java.sql.Blob arg_1) {
- Wrapped.updateBlob (arg_0, arg_1);
- }
-
- public virtual void updateBlob(string arg_0, java.sql.Blob arg_1) {
- Wrapped.updateBlob (arg_0, arg_1);
- }
-
- public virtual java.sql.Array getArray(int arg_0) {
- return Wrapped.getArray (arg_0);
- }
-
- public virtual java.sql.Array getArray(string arg_0) {
- return Wrapped.getArray (arg_0);
- }
-
- public virtual void updateDouble(int arg_0, double arg_1) {
- Wrapped.updateDouble (arg_0, arg_1);
- }
-
- public virtual void updateDouble(string arg_0, double arg_1)
- {
- Wrapped.updateDouble (arg_0, arg_1);
- }
-
- public virtual void updateInt(int arg_0, int arg_1) {
- Wrapped.updateInt (arg_0, arg_1);
- }
-
- public virtual void updateInt(string arg_0, int arg_1) {
- Wrapped.updateInt (arg_0, arg_1);
- }
-
- public virtual long getLong(int arg_0) {
- return Wrapped.getLong (arg_0);
- }
-
- public virtual long getLong(string arg_0) {
- return Wrapped.getLong (arg_0);
- }
-
- public virtual void updateDate(int arg_0, java.sql.Date arg_1) {
- Wrapped.updateDate (arg_0, arg_1);
- }
-
- public virtual void updateDate(string arg_0, java.sql.Date arg_1) {
- Wrapped.updateDate (arg_0, arg_1);
- }
-
- public virtual void beforeFirst() {
- Wrapped.beforeFirst ();
- }
-
- public virtual bool wasNull() {
- return Wrapped.wasNull ();
- }
-
- public virtual void updateClob(int arg_0, java.sql.Clob arg_1) {
- Wrapped.updateClob (arg_0, arg_1);
- }
-
- public virtual void updateClob(string arg_0, java.sql.Clob arg_1) {
- Wrapped.updateClob (arg_0, arg_1);
- }
-
- public virtual java.sql.Statement getStatement() {
- return Wrapped.getStatement ();
- }
-
- public virtual void setFetchDirection(int arg_0) {
- Wrapped.setFetchDirection (arg_0);
- }
-
- public virtual void cancelRowUpdates() {
- Wrapped.cancelRowUpdates ();
- }
-
- public virtual double getDouble(int arg_0) {
- return Wrapped.getDouble (arg_0);
- }
-
- public virtual double getDouble(string arg_0) {
- return Wrapped.getDouble (arg_0);
- }
-
- public virtual void updateBytes(int arg_0, sbyte[] arg_1) {
- Wrapped.updateBytes (arg_0, arg_1);
- }
-
- public virtual void updateBytes(string arg_0, sbyte[] arg_1) {
- Wrapped.updateBytes (arg_0, arg_1);
- }
-
- public virtual bool previous() {
- return Wrapped.previous ();
- }
-
- public virtual float getFloat(int arg_0) {
- return Wrapped.getFloat (arg_0);
- }
-
- public virtual float getFloat(string arg_0) {
- return Wrapped.getFloat (arg_0);
- }
-
- public virtual java.io.InputStream getAsciiStream(int arg_0) {
- return Wrapped.getAsciiStream (arg_0);
- }
-
- public virtual java.io.InputStream getAsciiStream(string arg_0) {
- return Wrapped.getAsciiStream (arg_0);
- }
-
- public virtual short getShort(int arg_0) {
- return Wrapped.getShort (arg_0);
- }
-
- public virtual short getShort(string arg_0) {
- return Wrapped.getShort (arg_0);
- }
-
- public virtual java.io.Reader getCharacterStream(int arg_0) {
- return Wrapped.getCharacterStream (arg_0);
- }
-
- public virtual java.io.Reader getCharacterStream(string arg_0) {
- return Wrapped.getCharacterStream (arg_0);
- }
-
- public virtual int getConcurrency() {
- return Wrapped.getConcurrency ();
- }
-
- public virtual java.sql.ResultSetMetaData getMetaData() {
- return Wrapped.getMetaData ();
- }
-
- public virtual bool getBoolean(int arg_0) {
- return Wrapped.getBoolean (arg_0);
- }
-
- public virtual bool getBoolean(string arg_0) {
- return Wrapped.getBoolean (arg_0);
- }
-
- public virtual void updateNull(int arg_0) {
- Wrapped.updateNull (arg_0);
- }
-
- public virtual void updateNull(string arg_0) {
- Wrapped.updateNull (arg_0);
- }
-
- public void updateArray(int arg_0, java.sql.Array arg_1) {
- Wrapped.updateArray (arg_0, arg_1);
- }
-
- public void updateArray(string arg_0, java.sql.Array arg_1) {
- Wrapped.updateArray (arg_0, arg_1);
- }
-
- public virtual void updateLong(int arg_0, long arg_1) {
- Wrapped.updateLong (arg_0, arg_1);
- }
-
- public virtual void updateLong(string arg_0, long arg_1) {
- Wrapped.updateLong (arg_0, arg_1);
- }
-
- public virtual java.sql.SQLWarning getWarnings() {
- return Wrapped.getWarnings ();
-
- }
-
- public virtual java.sql.Ref getRef(int arg_0) {
- return Wrapped.getRef (arg_0);
- }
-
- public virtual java.sql.Ref getRef(string arg_0) {
- return Wrapped.getRef (arg_0);
- }
-
- public virtual void updateTimestamp(int arg_0, java.sql.Timestamp arg_1) {
- Wrapped.updateTimestamp (arg_0, arg_1);
- }
-
- public virtual void updateTimestamp(string arg_0, java.sql.Timestamp arg_1) {
- Wrapped.updateTimestamp (arg_0, arg_1);
- }
-
- public virtual bool rowUpdated() {
- return Wrapped.rowUpdated ();
- }
-
- public virtual string getCursorName() {
- return Wrapped.getCursorName ();
- }
-
- public virtual java.sql.Blob getBlob(int arg_0) {
- return Wrapped.getBlob (arg_0);
- }
-
- public virtual java.sql.Blob getBlob(string arg_0) {
- return Wrapped.getBlob (arg_0);
- }
-
- public virtual void afterLast() {
- Wrapped.afterLast ();
- }
-
- public virtual int getRow() {
- return Wrapped.getRow ();
- }
-
- public virtual void refreshRow() {
- Wrapped.refreshRow ();
- }
-
- public virtual void updateShort(int arg_0, short arg_1) {
- Wrapped.updateShort (arg_0, arg_1);
- }
-
- public virtual void updateShort(string arg_0, short arg_1) {
- Wrapped.updateShort (arg_0, arg_1);
- }
-
- public virtual int getType() {
- return Wrapped.getType ();
- }
-
- public virtual void clearWarnings() {
- Wrapped.clearWarnings ();
- }
-
- public virtual void setFetchSize(int arg_0) {
- Wrapped.setFetchSize (arg_0);
- }
-
- #endregion - } - - public class ResultSetMetaData : java.sql.ResultSetMetaData
- {
- readonly java.sql.ResultSetMetaData _resultSetMetaData;
-
- public ResultSetMetaData (java.sql.ResultSetMetaData resultSetMetaData) {
- _resultSetMetaData = resultSetMetaData;
- }
-
- protected java.sql.ResultSetMetaData Wrapped {
- get { return _resultSetMetaData; }
- }
-
- #region ResultSetMetaData Members
-
- public virtual int getColumnCount() {
- return Wrapped.getColumnCount ();
- }
-
- public virtual bool isReadOnly(int arg_0) {
- return Wrapped.isReadOnly (arg_0);
- }
-
- public virtual string getSchemaName(int arg_0) {
- return Wrapped.getSchemaName (arg_0);
- }
-
- public virtual int getColumnDisplaySize(int arg_0) {
- return Wrapped.getColumnDisplaySize (arg_0);
- }
-
- public virtual int getColumnType(int arg_0) {
- return Wrapped.getColumnType (arg_0);
- }
-
- public virtual bool isSigned(int arg_0) {
- return Wrapped.isSigned (arg_0);
- }
-
- public virtual int getScale(int arg_0) {
- return Wrapped.getScale (arg_0);
- }
-
- public virtual int getPrecision(int arg_0) {
- return Wrapped.getPrecision (arg_0);
- }
-
- public virtual bool isCaseSensitive(int arg_0) {
- return Wrapped.isCaseSensitive (arg_0);
- }
-
- public virtual string getTableName(int arg_0) {
- return Wrapped.getTableName (arg_0);
- }
-
- public virtual string getColumnName(int arg_0) {
- return Wrapped.getColumnName (arg_0);
- }
-
- public virtual bool isDefinitelyWritable(int arg_0) {
- return Wrapped.isDefinitelyWritable (arg_0);
- }
-
- public virtual bool isSearchable(int arg_0) {
- return Wrapped.isSearchable (arg_0);
- }
-
- public virtual string getCatalogName(int arg_0) {
- return Wrapped.getCatalogName (arg_0);
- }
-
- public virtual string getColumnTypeName(int arg_0) {
- return Wrapped.getColumnTypeName (arg_0);
- }
-
- public virtual int isNullable(int arg_0) {
- return Wrapped.isNullable (arg_0);
- }
-
- public virtual string getColumnClassName(int arg_0) {
- return Wrapped.getColumnClassName (arg_0);
- }
-
- public virtual string getColumnLabel(int arg_0) {
- return Wrapped.getColumnLabel (arg_0);
- }
-
- public virtual bool isAutoIncrement(int arg_0) {
- return Wrapped.isAutoIncrement (arg_0);
- }
-
- public virtual bool isCurrency(int arg_0) {
- return Wrapped.isCurrency (arg_0);
- }
-
- public virtual bool isWritable(int arg_0) {
- return Wrapped.isWritable (arg_0);
- } - - #endregion - } - - public class DatabaseMetaData : java.sql.DatabaseMetaData - { - readonly java.sql.DatabaseMetaData _databaseMetaData; - - public DatabaseMetaData (java.sql.DatabaseMetaData databaseMetaData) { - _databaseMetaData = databaseMetaData; - } - - protected java.sql.DatabaseMetaData Wrapped { - get { return _databaseMetaData; } - } - - #region DatabaseMetaData Members - - public virtual bool nullsAreSortedLow() - { - return Wrapped.nullsAreSortedLow (); - } - - public virtual bool supportsSchemasInPrivilegeDefinitions() - { - return Wrapped.supportsSchemasInPrivilegeDefinitions (); - } - - public virtual string getSearchStringEscape() - { - return Wrapped.getSearchStringEscape (); - } - - public virtual bool supportsGroupByUnrelated() - { - return Wrapped.supportsGroupByUnrelated (); - } - - public virtual bool supportsSchemasInDataManipulation() - { - return Wrapped.supportsSchemasInDataManipulation (); - } - - public virtual bool supportsTransactions() - { - return Wrapped.supportsTransactions (); - } - - public virtual bool supportsSchemasInProcedureCalls() - { - return Wrapped.supportsSchemasInProcedureCalls (); - } - - public virtual java.sql.ResultSet getImportedKeys(string arg_0, string arg_1, string arg_2) - { - return Wrapped.getImportedKeys (arg_0, arg_1, arg_2); - } - - public virtual bool supportsTransactionIsolationLevel(int arg_0) - { - return Wrapped.supportsTransactionIsolationLevel (arg_0); - } - - public virtual bool supportsResultSetConcurrency(int arg_0, int arg_1) - { - return Wrapped.supportsResultSetConcurrency (arg_0, arg_1); - } - - public virtual bool supportsSubqueriesInQuantifieds() - { - return Wrapped.supportsSubqueriesInQuantifieds (); - } - - public virtual bool othersInsertsAreVisible(int arg_0) - { - return Wrapped.othersInsertsAreVisible (arg_0); - } - - public virtual bool supportsSchemasInTableDefinitions() - { - return Wrapped.supportsSchemasInTableDefinitions (); - } - - public virtual bool supportsGetGeneratedKeys() - { - return Wrapped.supportsGetGeneratedKeys (); - } - - public virtual bool supportsConvert() - { - return Wrapped.supportsConvert (); - } - - bool java.sql.DatabaseMetaData.supportsConvert(int arg_0, int arg_1) - { - return Wrapped.supportsConvert (arg_0, arg_1); - } - - public virtual bool deletesAreDetected(int arg_0) - { - return Wrapped.deletesAreDetected (arg_0); - } - - public virtual bool supportsExtendedSQLGrammar() - { - return Wrapped.supportsExtendedSQLGrammar (); - } - - public virtual string getStringFunctions() - { - return Wrapped.getStringFunctions (); - } - - public virtual java.sql.ResultSet getExportedKeys(string arg_0, string arg_1, string arg_2) - { - return Wrapped.getExportedKeys (arg_0, arg_1, arg_2); - } - - public virtual bool supportsDataDefinitionAndDataManipulationTransactions() - { - return Wrapped.supportsDataDefinitionAndDataManipulationTransactions (); - } - - public virtual bool supportsOrderByUnrelated() - { - return Wrapped.supportsOrderByUnrelated (); - } - - public virtual bool supportsGroupByBeyondSelect() - { - return Wrapped.supportsGroupByBeyondSelect (); - } - - public virtual string getDatabaseProductName() - { - return Wrapped.getDatabaseProductName (); - } - - public virtual int getMaxStatementLength() - { - return Wrapped.getMaxStatementLength (); - } - - public virtual java.sql.ResultSet getTypeInfo() - { - return Wrapped.getTypeInfo (); - } - - public virtual bool supportsSubqueriesInIns() - { - return Wrapped.supportsSubqueriesInIns (); - } - - public virtual string getSystemFunctions() - { - return Wrapped.getSystemFunctions (); - } - - public virtual bool nullPlusNonNullIsNull() - { - return Wrapped.nullPlusNonNullIsNull (); - } - - public virtual bool usesLocalFilePerTable() - { - return Wrapped.usesLocalFilePerTable (); - } - - public virtual int getDatabaseMinorVersion() - { - return Wrapped.getDatabaseMinorVersion (); - } - - public virtual bool supportsLikeEscapeClause() - { - return Wrapped.supportsLikeEscapeClause (); - } - - public virtual int getMaxColumnNameLength() - { - return Wrapped.getMaxColumnNameLength (); - } - - public virtual bool supportsSubqueriesInComparisons() - { - return Wrapped.supportsSubqueriesInComparisons (); - } - - public virtual bool isReadOnly() - { - return Wrapped.isReadOnly (); - } - - public virtual java.sql.Connection getConnection() - { - return Wrapped.getConnection (); - } - - public virtual bool supportsPositionedDelete() - { - return Wrapped.supportsPositionedDelete (); - } - - public virtual bool doesMaxRowSizeIncludeBlobs() - { - return Wrapped.doesMaxRowSizeIncludeBlobs (); - } - - public virtual bool supportsAlterTableWithDropColumn() - { - return Wrapped.supportsAlterTableWithDropColumn (); - } - - public virtual bool supportsFullOuterJoins() - { - return Wrapped.supportsFullOuterJoins (); - } - - public virtual int getDatabaseMajorVersion() - { - return Wrapped.getDatabaseMajorVersion (); - } - - public virtual bool supportsCorrelatedSubqueries() - { - return Wrapped.supportsCorrelatedSubqueries (); - } - - public virtual bool supportsOpenStatementsAcrossCommit() - { - return Wrapped.supportsOpenStatementsAcrossCommit (); - } - - public virtual bool supportsMixedCaseIdentifiers() - { - return Wrapped.supportsMixedCaseIdentifiers (); - } - - public virtual string getDatabaseProductVersion() - { - return Wrapped.getDatabaseProductVersion (); - } - - public virtual bool supportsUnion() - { - return Wrapped.supportsUnion (); - } - - public virtual bool supportsResultSetHoldability(int arg_0) - { - return Wrapped.supportsResultSetHoldability (arg_0); - } - - public virtual string getSQLKeywords() - { - return Wrapped.getSQLKeywords (); - } - - public virtual bool nullsAreSortedAtEnd() - { - return Wrapped.nullsAreSortedAtEnd (); - } - - public virtual bool locatorsUpdateCopy() - { - return Wrapped.locatorsUpdateCopy (); - } - - public virtual bool supportsColumnAliasing() - { - return Wrapped.supportsColumnAliasing (); - } - - public virtual bool supportsCatalogsInPrivilegeDefinitions() - { - return Wrapped.supportsCatalogsInPrivilegeDefinitions (); - } - - public virtual bool supportsSchemasInIndexDefinitions() - { - return Wrapped.supportsSchemasInIndexDefinitions (); - } - - public virtual string getDriverVersion() - { - return Wrapped.getDriverVersion (); - } - - public virtual int getDriverMajorVersion() - { - return Wrapped.getDriverMajorVersion (); - } - - public virtual java.sql.ResultSet getSchemas() - { - return Wrapped.getSchemas (); - } - - public virtual bool supportsSelectForUpdate() - { - return Wrapped.supportsSelectForUpdate (); - } - - public virtual int getResultSetHoldability() - { - return Wrapped.getResultSetHoldability (); - } - - public virtual java.sql.ResultSet getAttributes(string arg_0, string arg_1, string arg_2, string arg_3) - { - return Wrapped.getAttributes (arg_0, arg_1, arg_2, arg_3); - } - - public virtual bool supportsSavepoints() - { - return Wrapped.supportsSavepoints (); - } - - public virtual string getUserName() - { - return Wrapped.getUserName (); - } - - public virtual string getExtraNameCharacters() - { - return Wrapped.getExtraNameCharacters (); - } - - public virtual bool insertsAreDetected(int arg_0) - { - return Wrapped.insertsAreDetected (arg_0); - } - - public virtual java.sql.ResultSet getCatalogs() - { - return Wrapped.getCatalogs (); - } - - public virtual bool nullsAreSortedAtStart() - { - return Wrapped.nullsAreSortedAtStart (); - } - - public virtual bool supportsOpenCursorsAcrossRollback() - { - return Wrapped.supportsOpenCursorsAcrossRollback (); - } - - public virtual int getMaxColumnsInIndex() - { - return Wrapped.getMaxColumnsInIndex (); - } - - public virtual int getMaxColumnsInGroupBy() - { - return Wrapped.getMaxColumnsInGroupBy (); - } - - public virtual bool supportsBatchUpdates() - { - return Wrapped.supportsBatchUpdates (); - } - - public virtual java.sql.ResultSet getCrossReference(string arg_0, string arg_1, string arg_2, string arg_3, string arg_4, string arg_5) - { - return Wrapped.getCrossReference (arg_0, arg_1, arg_2, arg_3, arg_4, arg_5); - } - - public virtual string getCatalogTerm() - { - return Wrapped.getCatalogTerm (); - } - - public virtual int getMaxStatements() - { - return Wrapped.getMaxStatements (); - } - - public virtual string getCatalogSeparator() - { - return Wrapped.getCatalogSeparator (); - } - - public virtual int getMaxBinaryLiteralLength() - { - return Wrapped.getMaxBinaryLiteralLength (); - } - - public virtual bool supportsOuterJoins() - { - return Wrapped.supportsOuterJoins (); - } - - public virtual int getSQLStateType() - { - return Wrapped.getSQLStateType (); - } - - public virtual bool dataDefinitionIgnoredInTransactions() - { - return Wrapped.dataDefinitionIgnoredInTransactions (); - } - - public virtual int getMaxColumnsInSelect() - { - return Wrapped.getMaxColumnsInSelect (); - } - - public virtual bool supportsIntegrityEnhancementFacility() - { - return Wrapped.supportsIntegrityEnhancementFacility (); - } - - public virtual string getTimeDateFunctions() - { - return Wrapped.getTimeDateFunctions (); - } - - public virtual bool ownDeletesAreVisible(int arg_0) - { - return Wrapped.ownDeletesAreVisible (arg_0); - } - - public virtual java.sql.ResultSet getProcedures(string arg_0, string arg_1, string arg_2) - { - return Wrapped.getProcedures (arg_0, arg_1, arg_2); - } - - public virtual string getURL() - { - return Wrapped.getURL (); - } - - public virtual bool supportsStoredProcedures() - { - return Wrapped.supportsStoredProcedures (); - } - - public virtual bool usesLocalFiles() - { - return Wrapped.usesLocalFiles (); - } - - public virtual java.sql.ResultSet getTableTypes() - { - return Wrapped.getTableTypes (); - - } - - public virtual bool dataDefinitionCausesTransactionCommit() - { - return Wrapped.dataDefinitionCausesTransactionCommit (); - } - - public virtual bool supportsGroupBy() - { - return Wrapped.supportsGroupBy (); - } - - public virtual bool supportsExpressionsInOrderBy() - { - return Wrapped.supportsExpressionsInOrderBy (); - } - - public virtual bool isCatalogAtStart() - { - return Wrapped.isCatalogAtStart (); - } - - public virtual bool storesUpperCaseQuotedIdentifiers() - { - return Wrapped.storesUpperCaseQuotedIdentifiers (); - } - - public virtual int getMaxRowSize() - { - return Wrapped.getMaxRowSize (); - } - - public virtual bool supportsSubqueriesInExists() - { - return Wrapped.supportsSubqueriesInExists (); - } - - public virtual bool supportsCatalogsInIndexDefinitions() - { - return Wrapped.supportsCatalogsInIndexDefinitions (); - } - - public virtual bool supportsANSI92EntryLevelSQL() - { - return Wrapped.supportsANSI92EntryLevelSQL (); - } - - public virtual bool storesMixedCaseQuotedIdentifiers() - { - return Wrapped.storesMixedCaseQuotedIdentifiers (); - } - - public virtual bool supportsMultipleTransactions() - { - return Wrapped.supportsMultipleTransactions (); - } - - public virtual bool othersUpdatesAreVisible(int arg_0) - { - return Wrapped.othersUpdatesAreVisible (arg_0); - } - - public virtual java.sql.ResultSet getProcedureColumns(string arg_0, string arg_1, string arg_2, string arg_3) - { - return Wrapped.getProcedureColumns (arg_0, arg_1, arg_2, arg_3); - } - - public virtual int getMaxProcedureNameLength() - { - return Wrapped.getMaxProcedureNameLength (); - } - - public virtual java.sql.ResultSet getSuperTables(string arg_0, string arg_1, string arg_2) - { - return Wrapped.getSuperTables (arg_0, arg_1, arg_2); - } - - public virtual int getJDBCMajorVersion() - { - return Wrapped.getJDBCMajorVersion (); - } - - public virtual bool supportsPositionedUpdate() - { - return Wrapped.supportsPositionedUpdate (); - } - - public virtual bool supportsLimitedOuterJoins() - { - return Wrapped.supportsLimitedOuterJoins (); - } - - public virtual bool allTablesAreSelectable() - { - return Wrapped.allTablesAreSelectable (); - } - - public virtual java.sql.ResultSet getSuperTypes(string arg_0, string arg_1, string arg_2) - { - return Wrapped.getSuperTypes (arg_0, arg_1, arg_2); - } - - public virtual int getMaxTablesInSelect() - { - return Wrapped.getMaxTablesInSelect (); - } - - public virtual string getNumericFunctions() - { - return Wrapped.getNumericFunctions (); - } - - public virtual bool ownInsertsAreVisible(int arg_0) - { - return Wrapped.ownInsertsAreVisible (arg_0); - } - - public virtual bool supportsResultSetType(int arg_0) - { - return Wrapped.supportsResultSetType (arg_0); - } - - public virtual java.sql.ResultSet getPrimaryKeys(string arg_0, string arg_1, string arg_2) - { - return Wrapped.getPrimaryKeys (arg_0, arg_1, arg_2); - } - - public virtual bool nullsAreSortedHigh() - { - return Wrapped.nullsAreSortedHigh (); - } - - public virtual bool supportsAlterTableWithAddColumn() - { - return Wrapped.supportsAlterTableWithAddColumn (); - } - - public virtual bool supportsDataManipulationTransactionsOnly() - { - return Wrapped.supportsDataManipulationTransactionsOnly (); - } - - public virtual java.sql.ResultSet getUDTs(string arg_0, string arg_1, string arg_2, int[] arg_3) - { - return Wrapped.getUDTs (arg_0, arg_1, arg_2, arg_3); - } - - public virtual int getMaxConnections() - { - return Wrapped.getMaxConnections (); - } - - public virtual bool supportsNonNullableColumns() - { - return Wrapped.supportsNonNullableColumns (); - } - - public virtual bool supportsTableCorrelationNames() - { - return Wrapped.supportsTableCorrelationNames (); - } - - public virtual java.sql.ResultSet getVersionColumns(string arg_0, string arg_1, string arg_2) - { - return Wrapped.getVersionColumns (arg_0, arg_1, arg_2); - } - - public virtual bool supportsOpenStatementsAcrossRollback() - { - return Wrapped.supportsOpenStatementsAcrossRollback (); - } - - public virtual bool supportsMultipleResultSets() - { - return Wrapped.supportsMultipleResultSets (); - } - - public virtual string getDriverName() - { - return Wrapped.getDriverName (); - } - - public virtual bool storesLowerCaseQuotedIdentifiers() - { - return Wrapped.storesLowerCaseQuotedIdentifiers (); - } - - public virtual java.sql.ResultSet getBestRowIdentifier(string arg_0, string arg_1, string arg_2, int arg_3, bool arg_4) - { - return Wrapped.getBestRowIdentifier (arg_0, arg_1, arg_2, arg_3, arg_4); - } - - public virtual bool supportsOpenCursorsAcrossCommit() - { - return Wrapped.supportsOpenCursorsAcrossCommit (); - } - - public virtual int getMaxCursorNameLength() - { - return Wrapped.getMaxCursorNameLength (); - } - - public virtual int getMaxColumnsInOrderBy() - { - return Wrapped.getMaxColumnsInOrderBy (); - } - - public virtual java.sql.ResultSet getColumns(string arg_0, string arg_1, string arg_2, string arg_3) - { - return Wrapped.getColumns (arg_0, arg_1, arg_2, arg_3); - } - - public virtual bool supportsStatementPooling() - { - return Wrapped.supportsStatementPooling (); - } - - public virtual bool storesMixedCaseIdentifiers() - { - return Wrapped.storesMixedCaseIdentifiers (); - } - - public virtual int getMaxCharLiteralLength() - { - return Wrapped.getMaxCharLiteralLength (); - } - - public virtual bool supportsUnionAll() - { - return Wrapped.supportsUnionAll (); - } - - public virtual string getProcedureTerm() - { - return Wrapped.getProcedureTerm (); - } - - public virtual bool storesLowerCaseIdentifiers() - { - return Wrapped.storesLowerCaseIdentifiers (); - } - - public virtual bool supportsMixedCaseQuotedIdentifiers() - { - return Wrapped.supportsMixedCaseQuotedIdentifiers (); - } - - public virtual int getDefaultTransactionIsolation() - { - return Wrapped.getDefaultTransactionIsolation (); - } - - public virtual bool ownUpdatesAreVisible(int arg_0) - { - return Wrapped.ownUpdatesAreVisible (arg_0); - } - - public virtual bool supportsNamedParameters() - { - return Wrapped.supportsNamedParameters (); - } - - public virtual int getMaxColumnsInTable() - { - return Wrapped.getMaxColumnsInTable (); - } - - public virtual bool supportsMinimumSQLGrammar() - { - return Wrapped.supportsMinimumSQLGrammar (); - } - - public virtual bool supportsDifferentTableCorrelationNames() - { - return Wrapped.supportsDifferentTableCorrelationNames (); - } - - public virtual java.sql.ResultSet getTables(string arg_0, string arg_1, string arg_2, string[] arg_3) - { - return Wrapped.getTables (arg_0, arg_1, arg_2, arg_3); - } - - public virtual int getMaxIndexLength() - { - return Wrapped.getMaxIndexLength (); - } - - public virtual int getMaxSchemaNameLength() - { - return Wrapped.getMaxSchemaNameLength (); - } - - public virtual int getMaxCatalogNameLength() - { - return Wrapped.getMaxCatalogNameLength (); - } - - public virtual int getMaxTableNameLength() - { - return Wrapped.getMaxTableNameLength (); - } - - public virtual bool supportsCoreSQLGrammar() - { - return Wrapped.supportsCoreSQLGrammar (); - } - - public virtual bool othersDeletesAreVisible(int arg_0) - { - return Wrapped.othersDeletesAreVisible (arg_0); - } - - public virtual bool allProceduresAreCallable() - { - return Wrapped.allProceduresAreCallable (); - } - - public virtual int getDriverMinorVersion() - { - return Wrapped.getDriverMinorVersion (); - } - - public virtual java.sql.ResultSet getColumnPrivileges(string arg_0, string arg_1, string arg_2, string arg_3) - { - return Wrapped.getColumnPrivileges (arg_0, arg_1, arg_2, arg_3); - } - - public virtual bool updatesAreDetected(int arg_0) - { - return Wrapped.updatesAreDetected (arg_0); - } - - public virtual string getSchemaTerm() - { - return Wrapped.getSchemaTerm (); - } - - public virtual bool supportsANSI92FullSQL() - { - return Wrapped.supportsANSI92FullSQL (); - } - - public virtual java.sql.ResultSet getTablePrivileges(string arg_0, string arg_1, string arg_2) - { - return Wrapped.getTablePrivileges (arg_0, arg_1, arg_2); - } - - public virtual bool supportsANSI92IntermediateSQL() - { - return Wrapped.supportsANSI92IntermediateSQL (); - } - - public virtual string getIdentifierQuoteString() - { - return Wrapped.getIdentifierQuoteString (); - } - - public virtual int getMaxUserNameLength() - { - return Wrapped.getMaxUserNameLength (); - } - - public virtual bool supportsCatalogsInProcedureCalls() - { - return Wrapped.supportsCatalogsInProcedureCalls (); - } - - public virtual bool supportsCatalogsInDataManipulation() - { - return Wrapped.supportsCatalogsInDataManipulation (); - } - - public virtual bool storesUpperCaseIdentifiers() - { - return Wrapped.storesUpperCaseIdentifiers (); - } - - public virtual int getJDBCMinorVersion() - { - return Wrapped.getJDBCMinorVersion (); - } - - public virtual java.sql.ResultSet getIndexInfo(string arg_0, string arg_1, string arg_2, bool arg_3, bool arg_4) - { - return Wrapped.getIndexInfo (arg_0, arg_1, arg_2, arg_3, arg_4); - } - - public virtual bool supportsMultipleOpenResults() - { - return Wrapped.supportsMultipleOpenResults (); - } - - public virtual bool supportsCatalogsInTableDefinitions() - { - return Wrapped.supportsCatalogsInTableDefinitions (); - } - - #endregion - } - -}
\ No newline at end of file diff --git a/mcs/class/System.Data/Microsoft.SqlServer.Server/SqlDataRecord.cs b/mcs/class/System.Data/Microsoft.SqlServer.Server/SqlDataRecord.cs deleted file mode 100644 index f1bd8de25c7..00000000000 --- a/mcs/class/System.Data/Microsoft.SqlServer.Server/SqlDataRecord.cs +++ /dev/null @@ -1,455 +0,0 @@ -// -// SqlDataRecord.cs -// -// Authors: -// Marek Safar (marek.safar@gmail.com) -// -// Copyright (C) 2015 Novell, Inc (http://www.xamarin.com) -// -// 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.SqlTypes; - -namespace Microsoft.SqlServer.Server -{ - public class SqlDataRecord : IDataRecord - { - public SqlDataRecord (params SqlMetaData[] metaData) - { - } - - public virtual bool GetBoolean (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual byte GetByte (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual long GetBytes (int ordinal, long fieldOffset, byte[] buffer, int bufferOffset, int length) - { - throw new NotImplementedException (); - } - - public virtual char GetChar (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual long GetChars (int ordinal, long fieldOffset, char[] buffer, int bufferOffset, int length) - { - throw new NotImplementedException (); - } - - public virtual IDataReader GetData (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual string GetDataTypeName (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual DateTime GetDateTime (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual DateTimeOffset GetDateTimeOffset (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual decimal GetDecimal (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual double GetDouble (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual Type GetFieldType (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual float GetFloat (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual Guid GetGuid (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual short GetInt16 (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual int GetInt32 (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual long GetInt64 (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual string GetName (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual int GetOrdinal (string name) - { - throw new NotImplementedException (); - } - - public virtual SqlBinary GetSqlBinary (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual SqlBoolean GetSqlBoolean (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual SqlByte GetSqlByte (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual SqlBytes GetSqlBytes (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual SqlChars GetSqlChars (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual SqlDateTime GetSqlDateTime (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual SqlDecimal GetSqlDecimal (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual SqlDouble GetSqlDouble (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual Type GetSqlFieldType (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual SqlGuid GetSqlGuid (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual SqlInt16 GetSqlInt16 (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual SqlInt32 GetSqlInt32 (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual SqlInt64 GetSqlInt64 (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual SqlMetaData GetSqlMetaData (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual SqlMoney GetSqlMoney (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual SqlSingle GetSqlSingle (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual SqlString GetSqlString (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual object GetSqlValue (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual int GetSqlValues (object[] values) - { - throw new NotImplementedException (); - } - - public virtual SqlXml GetSqlXml (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual string GetString (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual TimeSpan GetTimeSpan (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual object GetValue (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual int GetValues (object[] values) - { - throw new NotImplementedException (); - } - - public virtual void SetBoolean (int ordinal, bool value) - { - throw new NotImplementedException (); - } - - public virtual void SetByte (int ordinal, byte value) - { - throw new NotImplementedException (); - } - - public virtual void SetBytes (int ordinal, long fieldOffset, byte[] buffer, int bufferOffset, int length) - { - throw new NotImplementedException (); - } - - public virtual void SetChar (int ordinal, char value) - { - throw new NotImplementedException (); - } - - public virtual void SetChars (int ordinal, long fieldOffset, char[] buffer, int bufferOffset, int length) - { - throw new NotImplementedException (); - } - - public virtual void SetDateTime (int ordinal, DateTime value) - { - throw new NotImplementedException (); - } - - public virtual void SetDateTimeOffset (int ordinal, DateTimeOffset value) - { - throw new NotImplementedException (); - } - - public virtual void SetDBNull (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual void SetDecimal (int ordinal, decimal value) - { - throw new NotImplementedException (); - } - - public virtual void SetDouble (int ordinal, double value) - { - throw new NotImplementedException (); - } - - public virtual void SetFloat (int ordinal, float value) - { - throw new NotImplementedException (); - } - - public virtual void SetGuid (int ordinal, Guid value) - { - throw new NotImplementedException (); - } - - public virtual void SetInt16 (int ordinal, short value) - { - throw new NotImplementedException (); - } - - public virtual void SetInt32 (int ordinal, int value) - { - throw new NotImplementedException (); - } - - public virtual void SetInt64 (int ordinal, long value) - { - throw new NotImplementedException (); - } - - public virtual void SetSqlBinary (int ordinal, SqlBinary value) - { - throw new NotImplementedException (); - } - - public virtual void SetSqlBoolean (int ordinal, SqlBoolean value) - { - throw new NotImplementedException (); - } - - public virtual void SetSqlByte (int ordinal, SqlByte value) - { - throw new NotImplementedException (); - } - - public virtual void SetSqlBytes (int ordinal, SqlBytes value) - { - throw new NotImplementedException (); - } - - public virtual void SetSqlChars (int ordinal, SqlChars value) - { - throw new NotImplementedException (); - } - - public virtual void SetSqlDateTime (int ordinal, SqlDateTime value) - { - throw new NotImplementedException (); - } - - public virtual void SetSqlDecimal (int ordinal, SqlDecimal value) - { - throw new NotImplementedException (); - } - - public virtual void SetSqlDouble (int ordinal, SqlDouble value) - { - throw new NotImplementedException (); - } - - public virtual void SetSqlGuid (int ordinal, SqlGuid value) - { - throw new NotImplementedException (); - } - - public virtual void SetSqlInt16 (int ordinal, SqlInt16 value) - { - throw new NotImplementedException (); - } - - public virtual void SetSqlInt32 (int ordinal, SqlInt32 value) - { - throw new NotImplementedException (); - } - - public virtual void SetSqlInt64 (int ordinal, SqlInt64 value) - { - throw new NotImplementedException (); - } - - public virtual void SetSqlMoney (int ordinal, SqlMoney value) - { - throw new NotImplementedException (); - } - - public virtual void SetSqlSingle (int ordinal, SqlSingle value) - { - throw new NotImplementedException (); - } - - public virtual void SetSqlString (int ordinal, SqlString value) - { - throw new NotImplementedException (); - } - - public virtual void SetSqlXml (int ordinal, SqlXml value) - { - throw new NotImplementedException (); - } - - public virtual void SetString (int ordinal, string value) - { - throw new NotImplementedException (); - } - - public virtual void SetTimeSpan (int ordinal, TimeSpan value) - { - throw new NotImplementedException (); - } - - public virtual void SetValue (int ordinal, object value) - { - throw new NotImplementedException (); - } - - public virtual int SetValues (params object[] values) - { - throw new NotImplementedException (); - } - - public virtual bool IsDBNull (int ordinal) - { - throw new NotImplementedException (); - } - - public virtual int FieldCount { - get { - throw new NotImplementedException (); - } - } - - public virtual object this [string name] { - get { - throw new NotImplementedException (); - } - } - - public virtual object this [int ordinal] { - get { - throw new NotImplementedException (); - } - } - } -}
\ No newline at end of file diff --git a/mcs/class/System.Data/Microsoft.SqlServer.Server/SqlMetaData.cs b/mcs/class/System.Data/Microsoft.SqlServer.Server/SqlMetaData.cs deleted file mode 100644 index b428f22577d..00000000000 --- a/mcs/class/System.Data/Microsoft.SqlServer.Server/SqlMetaData.cs +++ /dev/null @@ -1,1013 +0,0 @@ -// -// Microsoft.SqlServer.Server.SqlMetaData -// -// Author: -// Tim Coleman (tim@timcoleman.com) -// -// Copyright (C) Tim Coleman, 2003 -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.SqlClient; -using System.Threading; -using System.Data.SqlTypes; - -namespace Microsoft.SqlServer.Server { - public sealed class SqlMetaData - { - #region Fields - - SqlCompareOptions compareOptions = SqlCompareOptions.None; - string databaseName = null; - long _localeId = 0L; - long maxLength = 0L; - string name; - byte precision = 10; - byte scale = 0; - string owningSchema = null; - string objectName = null; - SqlDbType _sqlDbType = SqlDbType.NVarChar; - DbType _dbType = DbType.String; - Type type = typeof (string); - - #endregion // Fields - - #region Constructors - - public SqlMetaData (string name, SqlDbType dbType) - { - if (name == null) - throw new ArgumentNullException ("name can not be null"); - switch (dbType) { - case SqlDbType.Bit: - maxLength = 1; - precision = 1; - scale = 0; - _localeId = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Boolean; - type = typeof (bool); - break; - case SqlDbType.BigInt: - maxLength = 8; - precision = 19; - scale = 0; - _localeId = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Int64; - type = typeof (long); - break; - case SqlDbType.DateTime: - maxLength = 8; - precision = 23; - scale = 3; - _localeId = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.DateTime; - type = typeof (DateTime); - break; - case SqlDbType.Decimal: - maxLength = 9; - precision = 18; - scale = 0; - _localeId = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Decimal; - type = typeof (decimal); - break; - case SqlDbType.Float: - maxLength = 8; - precision = 53; - scale = 0; - _localeId = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Double; - type = typeof (float); - break; - case SqlDbType.Int: - maxLength = 4; - precision = 10; - scale = 0; - _localeId = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Int32; - type = typeof (int); - break; - case SqlDbType.Money: - maxLength = 8; - precision = 19; - scale = 4; - _localeId = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Currency; - type = typeof (double); - break; - /* - case SqlDbType.Numeric: - maxLength = ; - precision = ; - scale = ; - localeId = 0; - compareOptions = SqlCompareOptions.None; - break; - */ - case SqlDbType.SmallDateTime: - maxLength = 4; - precision = 16; - scale = 0; - _localeId = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.DateTime; - type = typeof (DateTime); - break; - case SqlDbType.SmallInt: - maxLength = 2; - precision = 5; - scale = 0; - _localeId = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Int16; - type = typeof (short); - break; - case SqlDbType.SmallMoney: - maxLength = 4; - precision = 10; - scale = 4; - _localeId = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Currency; - type = typeof (double); - break; - case SqlDbType.Timestamp: - maxLength = 8; - precision = 0; - scale = 0; - _localeId = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.DateTime; - type = typeof (DateTime); - break; - case SqlDbType.TinyInt: - maxLength = 1; - precision = 3; - scale = 0; - _localeId = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Int16; - type = typeof (short); - break; - case SqlDbType.UniqueIdentifier: - maxLength = 16; - precision = 0; - scale = 0; - _localeId = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Guid; - type = typeof (Guid); - break; - case SqlDbType.Xml: - maxLength = -1; - precision = 0; - scale = 0; - _localeId = 0; - compareOptions = SqlCompareOptions.IgnoreCase | SqlCompareOptions.IgnoreKanaType | SqlCompareOptions.IgnoreWidth; - _dbType = DbType.Xml; - type = typeof (string); - break; - default: - throw new ArgumentException ("SqlDbType not supported"); - } - this.name = name; - this._sqlDbType = dbType; - } - - [MonoTODO] - public SqlMetaData (string name, SqlDbType dbType, bool useServerDefault, bool isUniqueKey, SortOrder columnSortOrder, int sortOrdinal) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public SqlMetaData (string name, SqlDbType dbType, long maxLength, bool useServerDefault, bool isUniqueKey, SortOrder columnSortOrder, int sortOrdinal) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public SqlMetaData (string name, SqlDbType dbType, byte precision, byte scale, bool useServerDefault, bool isUniqueKey, SortOrder columnSortOrder, int sortOrdinal) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public SqlMetaData (string name, SqlDbType dbType, long maxLength, long locale, SqlCompareOptions compareOptions, bool useServerDefault, bool isUniqueKey, SortOrder columnSortOrder, int sortOrdinal) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public SqlMetaData (string name, SqlDbType dbType, string database, string owningSchema, string objectName, bool useServerDefault, bool isUniqueKey, SortOrder columnSortOrder, int sortOrdinal) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public SqlMetaData (string name, SqlDbType dbType, long maxLength, byte precision, byte scale, long localeId, SqlCompareOptions compareOptions, System.Type userDefinedType, bool useServerDefault, bool isUniqueKey, SortOrder columnSortOrder, int sortOrdinal) - { - throw new NotImplementedException (); - } - - public SqlMetaData (string name, SqlDbType dbType, long maxLength) - { - if (name == null) - throw new ArgumentNullException ("name can not be null"); - switch (dbType) { - case SqlDbType.Binary: - compareOptions = SqlCompareOptions.IgnoreCase | SqlCompareOptions.IgnoreKanaType | SqlCompareOptions.IgnoreWidth; - _dbType = DbType.Binary; - type = typeof (byte []); - break; - case SqlDbType.Char: - _localeId = Thread.CurrentThread.CurrentCulture.LCID; - compareOptions = SqlCompareOptions.IgnoreCase | SqlCompareOptions.IgnoreKanaType | SqlCompareOptions.IgnoreWidth; - _dbType = DbType.AnsiStringFixedLength; - type = typeof (string); - break; - case SqlDbType.Image: - maxLength = -1; - precision = 0; - scale = 0; - _localeId = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Binary; - type = typeof (byte []); - break; - case SqlDbType.NChar: - _localeId = Thread.CurrentThread.CurrentCulture.LCID; - compareOptions = SqlCompareOptions.IgnoreCase | SqlCompareOptions.IgnoreKanaType | SqlCompareOptions.IgnoreWidth; - _dbType = DbType.String; - type = typeof (string); - break; - case SqlDbType.NText: - maxLength = -1; - precision = 0; - scale = 0; - _localeId = Thread.CurrentThread.CurrentCulture.LCID; - compareOptions = SqlCompareOptions.IgnoreCase | SqlCompareOptions.IgnoreKanaType | SqlCompareOptions.IgnoreWidth; - _dbType = DbType.String; - type = typeof (string); - break; - case SqlDbType.NVarChar: - maxLength = -1; - _localeId = Thread.CurrentThread.CurrentCulture.LCID; - compareOptions = SqlCompareOptions.IgnoreCase | SqlCompareOptions.IgnoreKanaType | SqlCompareOptions.IgnoreWidth; - _dbType = DbType.String; - type = typeof (string); - break; - case SqlDbType.Text: - maxLength = -1; - precision = 0; - scale = 0; - _localeId = Thread.CurrentThread.CurrentCulture.LCID; - compareOptions = SqlCompareOptions.IgnoreCase | SqlCompareOptions.IgnoreKanaType | SqlCompareOptions.IgnoreWidth; - _dbType = DbType.String; - type = typeof (char []); - break; - case SqlDbType.VarBinary: - maxLength = -1; - compareOptions = SqlCompareOptions.IgnoreCase | SqlCompareOptions.IgnoreKanaType | SqlCompareOptions.IgnoreWidth; - _dbType = DbType.Binary; - type = typeof (byte []); - break; - case SqlDbType.VarChar: - maxLength = -1; - _localeId = Thread.CurrentThread.CurrentCulture.LCID; - compareOptions = SqlCompareOptions.IgnoreCase | SqlCompareOptions.IgnoreKanaType | SqlCompareOptions.IgnoreWidth; - _dbType = DbType.String; - type = typeof (char []); - break; - default: - throw new ArgumentException ("SqlDbType not supported"); - } - this.maxLength = maxLength; - this.name = name; - this._sqlDbType = dbType; - } - - [MonoTODO] - public SqlMetaData (string name, SqlDbType dbType, Type userDefinedType) - { - if (name == null) - throw new ArgumentNullException ("name can not be null"); - switch (dbType) { - case SqlDbType.Udt: - maxLength = -1; - precision = 0; - scale = 0; - _localeId = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Guid; - type = typeof (Guid); - break; - default: - throw new ArgumentException ("SqlDbType not supported"); - } - this.name = name; - // FIXME: - //this.sqlDbType = userDefinedType; - throw new NotImplementedException (); - } - - public SqlMetaData (string name, SqlDbType dbType, byte precision, byte scale) - { - if (name == null) - throw new ArgumentNullException ("name can not be null"); - switch (dbType) { - case SqlDbType.Decimal: - maxLength = 9; - this.precision = precision; - this.scale = scale; - _localeId = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Decimal; - type = typeof (decimal); - break; - default: - throw new ArgumentException ("SqlDbType not supported"); - } - this.name = name; - this._sqlDbType = dbType; - } - - public SqlMetaData (string name, SqlDbType dbType, long maxLength, long locale, SqlCompareOptions compareOptions) - { - if (name == null) - throw new ArgumentNullException ("name can not be null"); - switch (dbType) { - case SqlDbType.Char: - _dbType = DbType.AnsiStringFixedLength; - type = typeof (char []); - break; - case SqlDbType.NChar: - _dbType = DbType.StringFixedLength; - type = typeof (char []); - break; - case SqlDbType.NText: - case SqlDbType.NVarChar: - _dbType = DbType.String; - type = typeof (string); - break; - case SqlDbType.Text: - case SqlDbType.VarChar: - _dbType = DbType.AnsiString; - type = typeof (char []); - break; - default: - throw new ArgumentException ("SqlDbType not supported"); - } - this.compareOptions = compareOptions; - this._localeId = locale; - this.maxLength = maxLength; - this.name = name; - this._sqlDbType = dbType; - } - - public SqlMetaData (string name, SqlDbType dbType, string database, string owningSchema, string objectName) - { - if ((name == null || objectName == null) && database != null && owningSchema != null) - throw new ArgumentNullException ("name can not be null"); - switch (dbType) { - case SqlDbType.Xml: - maxLength = -1; - precision = 0; - scale = 0; - _localeId = 0; - compareOptions = SqlCompareOptions.IgnoreCase | SqlCompareOptions.IgnoreKanaType | SqlCompareOptions.IgnoreWidth; - _dbType = DbType.String; - type = typeof (string); - break; - default: - throw new ArgumentException ("SqlDbType not supported"); - } - this.name = name; - this._sqlDbType = dbType; - databaseName = database; - this.owningSchema = owningSchema; - this.objectName = objectName; - } - - public SqlMetaData (string name, SqlDbType dbType, long maxLength, byte precision, - byte scale, long locale, SqlCompareOptions compareOptions, - Type userDefinedType) - { - if (name == null) - throw new ArgumentNullException ("name can not be null"); - this.compareOptions = compareOptions; - this._localeId = locale; - this.maxLength = maxLength; - this.precision = precision; - this.scale = scale; - switch (dbType) { - case SqlDbType.Bit: - maxLength = 1; - precision = 1; - scale = 0; - locale = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Boolean; - type = typeof (bool); - break; - case SqlDbType.BigInt: - maxLength = 8; - precision = 19; - scale = 0; - locale = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Int64; - type = typeof (long); - break; - case SqlDbType.DateTime: - maxLength = 8; - precision = 23; - scale = 3; - locale = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.DateTime; - type = typeof (DateTime); - break; - case SqlDbType.Decimal: - maxLength = 9; - precision = 18; - scale = 0; - locale = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Decimal; - type = typeof (decimal); - break; - case SqlDbType.Float: - maxLength = 8; - precision = 53; - scale = 0; - locale = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Decimal; - type = typeof (float); - break; - case SqlDbType.Image: - maxLength = -1; - precision = 0; - scale = 0; - locale = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Binary; - type = typeof (byte []); - break; - case SqlDbType.Int: - maxLength = 4; - precision = 10; - scale = 0; - locale = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Int32; - type = typeof (int); - break; - case SqlDbType.Money: - maxLength = 8; - precision = 19; - scale = 4; - locale = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Currency; - type = typeof (decimal); - break; - case SqlDbType.NText: - maxLength = -1; - precision = 0; - scale = 0; - locale = Thread.CurrentThread.CurrentCulture.LCID; - compareOptions = SqlCompareOptions.IgnoreCase | SqlCompareOptions.IgnoreKanaType | SqlCompareOptions.IgnoreWidth; - _dbType = DbType.String; - type = typeof (string); - break; - /* - case SqlDbType.Numeric: - maxLength = ; - precision = ; - scale = ; - localeId = 0; - compareOptions = SqlCompareOptions.None; - break; - */ - case SqlDbType.Real: - maxLength = 4; - precision = 24; - scale = 0; - locale = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Single; - type = typeof (Single); - break; - case SqlDbType.SmallDateTime: - maxLength = 4; - precision = 16; - scale = 0; - locale = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.DateTime; - type = typeof (DateTime); - break; - case SqlDbType.SmallInt: - maxLength = 2; - precision = 5; - scale = 0; - locale = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Int16; - type = typeof (short); - break; - case SqlDbType.SmallMoney: - maxLength = 4; - precision = 10; - scale = 4; - locale = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Currency; - type = typeof (decimal); - break; - case SqlDbType.Text: - maxLength = -1; - precision = 0; - scale = 0; - locale = Thread.CurrentThread.CurrentCulture.LCID; - compareOptions = SqlCompareOptions.IgnoreCase | SqlCompareOptions.IgnoreKanaType | SqlCompareOptions.IgnoreWidth; - _dbType = DbType.AnsiString; - type = typeof (char []); - break; - case SqlDbType.Timestamp: - maxLength = 8; - precision = 0; - scale = 0; - locale = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Byte; - type = typeof (byte []); - break; - case SqlDbType.TinyInt: - maxLength = 1; - precision = 3; - scale = 0; - locale = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Int16; - type = typeof (short); - break; - case SqlDbType.UniqueIdentifier: - maxLength = 16; - precision = 0; - scale = 0; - locale = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Guid; - type = typeof (Guid); - break; - case SqlDbType.Udt: - maxLength = -1; - precision = 0; - scale = 0; - locale = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Object; - type = typeof (object); - break; - case SqlDbType.Variant: - maxLength = 8016; - precision = 0; - scale = 0; - locale = 0; - compareOptions = SqlCompareOptions.None; - _dbType = DbType.Object; - type = typeof (object); - break; - case SqlDbType.Xml: - maxLength = -1; - precision = 0; - scale = 0; - locale = 0; - compareOptions = SqlCompareOptions.IgnoreCase | SqlCompareOptions.IgnoreKanaType | SqlCompareOptions.IgnoreWidth; - _dbType = DbType.Xml; - type = typeof (string); - break; - default: - /* - if (typeof (DbType.Row) == typeof (userDefinedType)) { - // FIXME: - // maxLength = Number of columns; - precision = 0; - scale = 0; - localeId = 0; - compareOptions = SqlCompareOptions.None; - } else - */ - throw new ArgumentException ("SqlDbType not supported"); - } - this.name = name; - this._sqlDbType = dbType; - } - - #endregion // Constructors - - #region Properties - - public SqlCompareOptions CompareOptions { - get { return compareOptions; } - } - - public DbType DbType { - get { return _dbType; } - } - - public long LocaleId { - get { return _localeId; } - } - - public static long Max { - get { return -1; } - } - - public long MaxLength { - get { return maxLength; } - } - - public string Name { - get { return name; } - } - - public byte Precision { - get { return precision; } - } - - public byte Scale { - get { return scale; } - } - - public SqlDbType SqlDbType { - get { return _sqlDbType; } - } - - public string XmlSchemaCollectionDatabase { - get { return databaseName; } - } - - public string XmlSchemaCollectionName { - get { return objectName; } - } - - public string XmlSchemaCollectionOwningSchema { - get { return owningSchema; } - } - - [MonoTODO] - public string TypeName { - get { throw new NotImplementedException (); } - } - - [MonoTODO] - public bool IsUniqueKey { - get { throw new NotImplementedException (); } - } - - [MonoTODO] - public SortOrder SortOrder { - get { throw new NotImplementedException (); } - } - - [MonoTODO] - public int SortOrdinal { - get { throw new NotImplementedException (); } - } - - [MonoTODO] - public bool UseServerDefault { - get { throw new NotImplementedException (); } - } - #endregion // Properties - - #region Methods - - public bool Adjust (bool value) - { - if (type != typeof (bool)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public byte Adjust (byte value) - { - if (type != typeof (byte)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public byte[] Adjust (byte[] value) - { - if (type != typeof (byte [])) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public char Adjust (char value) - { - if (type != typeof (char)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public char[] Adjust (char[] value) - { - if (type != typeof (char [])) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public DateTime Adjust (DateTime value) - { - if (type != typeof (DateTime)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public DateTimeOffset Adjust (DateTimeOffset value) - { - if (type != typeof (DateTimeOffset)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public TimeSpan Adjust (TimeSpan value) - { - if (type != typeof (TimeSpan)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public decimal Adjust (decimal value) - { - if (type != typeof (decimal)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public double Adjust (double value) - { - if (type != typeof (double)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public Guid Adjust (Guid value) - { - if (type != typeof (Guid)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public short Adjust (short value) - { - if (type != typeof (short)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public int Adjust (int value) - { - if (type != typeof (int)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public long Adjust (long value) - { - if (type != typeof (long)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public object Adjust (object value) - { - if (type != typeof (object)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public float Adjust (float value) - { - if (type != typeof (float)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public SqlBinary Adjust (SqlBinary value) - { - if (type != typeof (byte [])) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public SqlBoolean Adjust (SqlBoolean value) - { - if (type != typeof (bool)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public SqlByte Adjust (SqlByte value) - { - if (type != typeof (byte)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public SqlBytes Adjust (SqlBytes value) - { - if (type != typeof (byte [])) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public SqlChars Adjust (SqlChars value) - { - if (type != typeof (char [])) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public SqlDateTime Adjust (SqlDateTime value) - { - if (type != typeof (DateTime)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public SqlDecimal Adjust (SqlDecimal value) - { - if (type != typeof (decimal)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public SqlDouble Adjust (SqlDouble value) - { - if (type != typeof (double)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public SqlGuid Adjust (SqlGuid value) - { - if (type != typeof (Guid)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public SqlInt16 Adjust (SqlInt16 value) - { - if (type != typeof (short)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public SqlInt32 Adjust (SqlInt32 value) - { - if (type != typeof (int)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public SqlInt64 Adjust (SqlInt64 value) - { - if (type != typeof (long)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public SqlMoney Adjust (SqlMoney value) - { - if (type != typeof (decimal)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public SqlSingle Adjust (SqlSingle value) - { - if (type != typeof (Single)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public SqlString Adjust (SqlString value) - { - if (type != typeof (string)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - [MonoTODO] - public SqlXml Adjust (SqlXml value) - { - throw new NotImplementedException (); - } - - public string Adjust (string value) - { - if (type != typeof (string)) - throw new ArgumentException ("Value does not match the SqlMetaData type"); - return value; - } - - public static SqlMetaData InferFromValue (object value, string name) - { - if (name == null) - throw new ArgumentNullException ("name can not be null"); - if (value == null) - throw new ArgumentException ("value can not be null"); - SqlMetaData sqlMetaData = null; - switch (value.GetType ().ToString ()) { - case "System.Boolean": - sqlMetaData = new SqlMetaData (name, SqlDbType.Bit); - break; - case "System.Byte": - sqlMetaData = new SqlMetaData (name, SqlDbType.Binary); - break; - case "System.Byte[]": - sqlMetaData = new SqlMetaData (name, SqlDbType.VarBinary); - break; - case "System.Char": - sqlMetaData = new SqlMetaData (name, SqlDbType.Char); - break; - case "System.Char[]": - sqlMetaData = new SqlMetaData (name, SqlDbType.VarChar); - break; - case "System.DateTime": - sqlMetaData = new SqlMetaData (name, SqlDbType.DateTime); - break; - case "System.Decimal": - sqlMetaData = new SqlMetaData (name, SqlDbType.Decimal); - break; - case "System.Double": - sqlMetaData = new SqlMetaData (name, SqlDbType.Float); - break; - case "System.Guid": - sqlMetaData = new SqlMetaData (name, SqlDbType.UniqueIdentifier); - break; - case "System.Int16": - sqlMetaData = new SqlMetaData (name, SqlDbType.SmallInt); - break; - case "System.Int32": - sqlMetaData = new SqlMetaData (name, SqlDbType.Int); - break; - case "System.Int64": - sqlMetaData = new SqlMetaData (name, SqlDbType.BigInt); - break; - case "System.Single": - sqlMetaData = new SqlMetaData (name, SqlDbType.Real); - break; - case "System.String": - sqlMetaData = new SqlMetaData (name, SqlDbType.NVarChar); - break; - case "System.Object": - default: - sqlMetaData = new SqlMetaData (name, SqlDbType.Variant); - break; - } - return sqlMetaData; - } - - #endregion // Methods - } -} - diff --git a/mcs/class/System.Data/ReferenceSources/Bid.cs b/mcs/class/System.Data/ReferenceSources/Bid.cs deleted file mode 100644 index 72b53042355..00000000000 --- a/mcs/class/System.Data/ReferenceSources/Bid.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; - -static class Bid -{ - static IntPtr NoData = (IntPtr)(-1); - - internal static void Trace(string fmtPrintfW, params object[] args) - { - } - - internal static void TraceEx(uint flags, string fmtPrintfW, params object[] args) - { - } -#if !MOBILE - internal static void TraceSqlReturn(string fmtPrintfW, System.Data.Odbc.ODBC32.RetCode a1, string a2) - { - } -#endif - internal static void ScopeEnter(out IntPtr hScp, string fmt, params object[] args) { - hScp = NoData; - } - - internal static void ScopeLeave(ref IntPtr hScp) { - hScp = NoData; - } -}
\ No newline at end of file diff --git a/mcs/class/System.Data/ReferenceSources/BidArgumentTypeAttribute.cs b/mcs/class/System.Data/ReferenceSources/BidArgumentTypeAttribute.cs deleted file mode 100644 index e61f89dae39..00000000000 --- a/mcs/class/System.Data/ReferenceSources/BidArgumentTypeAttribute.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; - -/// <summary> -/// This attribute is used by FxCopBid rule to tell FXCOP the 'real' type sent to the native trace call for this argument. For -/// example, if Bid.Trace accepts enumeration value, but marshals it as string to the native trace method, set this attribute -/// on the argument and set ArgumentType = typeof(string) -/// -/// It can be applied on a parameter, to let FxCopBid rule know the format spec type used for the argument, or it can be applied on a method, -/// to insert additional format spec arguments at specific location. -/// -/// If you need to rename/remove the attribute or change its properties, make sure to update the FxCopBid rule! -/// </summary> -[System.Diagnostics.ConditionalAttribute("CODE_ANALYSIS")] -[System.AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method, AllowMultiple=true)] -internal sealed class BidArgumentTypeAttribute : Attribute -{ - // this overload can be used on the argument itself - internal BidArgumentTypeAttribute(Type bidArgumentType) - { - this.ArgumentType = bidArgumentType; - this.Index = -1; // if this c-tor is used on methods, default index value is 'last' - } - - // this overload can be used on the method to add hidden spec arguments - // set index to -1 to add an argument to the end - internal BidArgumentTypeAttribute(Type bidArgumentType, int index) - { - this.ArgumentType = bidArgumentType; - this.Index = index; - } - - public readonly Type ArgumentType; - // should be used only if attribute is applied on the method - public readonly int Index; -}
\ No newline at end of file diff --git a/mcs/class/System.Data/ReferenceSources/BidMethodAttribute.cs b/mcs/class/System.Data/ReferenceSources/BidMethodAttribute.cs deleted file mode 100644 index d79edb0285f..00000000000 --- a/mcs/class/System.Data/ReferenceSources/BidMethodAttribute.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; - -/// <summary> -/// This attribute is used by FxCopBid rule to mark methods that accept format string and list of arguments that match it -/// FxCopBid rule uses this attribute to check if the method needs to be included in checks and to read type mappings -/// between the argument type to printf Type spec. -/// -/// If you need to rename/remove the attribute or change its properties, make sure to update the FxCopBid rule! -/// </summary> -[System.Diagnostics.ConditionalAttribute("CODE_ANALYSIS")] -[System.AttributeUsage(AttributeTargets.Method)] -internal sealed class BidMethodAttribute : Attribute -{ - private bool m_enabled; - - /// <summary> - /// enabled by default - /// </summary> - internal BidMethodAttribute() - { - m_enabled = true; - } - - /// <summary> - /// if Enabled is true, FxCopBid rule will validate all calls to this method and require that it will have string argument; - /// otherwise, this method is ignored. - /// </summary> - public bool Enabled { - get - { - return m_enabled; - } - set - { - m_enabled = value; - } - } -}
\ No newline at end of file diff --git a/mcs/class/System.Data/ReferenceSources/DataStorage.cs b/mcs/class/System.Data/ReferenceSources/DataStorage.cs deleted file mode 100644 index 8529f810e74..00000000000 --- a/mcs/class/System.Data/ReferenceSources/DataStorage.cs +++ /dev/null @@ -1,9 +0,0 @@ -// Remove when fully integrated - -namespace System.Data.Common { - abstract internal class DataStorage { - internal static bool IsSqlType(object storageType) { - throw new NotImplementedException (); - } - } -}
\ No newline at end of file diff --git a/mcs/class/System.Data/ReferenceSources/InOutOfProcHelper.cs b/mcs/class/System.Data/ReferenceSources/InOutOfProcHelper.cs deleted file mode 100644 index 9796590fcd8..00000000000 --- a/mcs/class/System.Data/ReferenceSources/InOutOfProcHelper.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace System.Data.SqlClient { - - static class InOutOfProcHelper { - - internal static bool InProc { - get { - return false; - } - } - } -}
\ No newline at end of file diff --git a/mcs/class/System.Data/ReferenceSources/NativeOledbWrapper.cs b/mcs/class/System.Data/ReferenceSources/NativeOledbWrapper.cs deleted file mode 100644 index 391a08f7904..00000000000 --- a/mcs/class/System.Data/ReferenceSources/NativeOledbWrapper.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; - -class NativeOledbWrapper -{ - const string msg = "It is native method used by Microsoft System.Data.OleDb implementation that Mono or non-Windows platform does not support."; - -#if !MOBILE - public static int SizeOfPROPVARIANT { - get { throw new NotSupportedException (msg); } - } - - public static int ITransactionAbort (IntPtr handle) - { - throw new NotSupportedException (msg); - } - - public static int ITransactionCommit (IntPtr handle) - { - throw new NotSupportedException (msg); - } - - public static bool MemoryCompare (IntPtr dst, IntPtr src, int bytes) - { - throw new NotSupportedException (msg); - } - - public static IntPtr IChapteredRowsetReleaseChapter (IntPtr handle, IntPtr chapter) - { - throw new NotSupportedException (msg); - } -#endif - - - public static int MemoryCopy (IntPtr dst, IntPtr src, int bytes) - { - throw new NotSupportedException (msg); - } - -} diff --git a/mcs/class/System.Data/ReferenceSources/ODB.cs b/mcs/class/System.Data/ReferenceSources/ODB.cs deleted file mode 100644 index 70d2833a312..00000000000 --- a/mcs/class/System.Data/ReferenceSources/ODB.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Data.Common; - -namespace System.Data.OleDb { - - internal static class ODB { - - // used by OleDbConnection to create and verify OLE DB Services - internal const string DataLinks_CLSID = "CLSID\\{2206CDB2-19C1-11D1-89E0-00C04FD7A829}\\InprocServer32"; - - static internal InvalidOperationException MDACNotAvailable(Exception inner) { - return ADP.DataAdapter(Res.GetString(Res.OleDb_MDACNotAvailable), inner); - } - } -}
\ No newline at end of file diff --git a/mcs/class/System.Data/ReferenceSources/OdbcHandle.cs b/mcs/class/System.Data/ReferenceSources/OdbcHandle.cs deleted file mode 100644 index 213d8dab63f..00000000000 --- a/mcs/class/System.Data/ReferenceSources/OdbcHandle.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Text; -using System.Runtime.InteropServices; - -namespace System.Data.Odbc { - - internal abstract class OdbcHandle : SafeHandle { - - protected OdbcHandle(ODBC32.SQL_HANDLE handleType, OdbcHandle parentHandle) : base(IntPtr.Zero, true) { - throw new NotImplementedException (); - } - - internal ODBC32.RetCode GetDiagnosticRecord(short record, out string sqlState, StringBuilder message, out int nativeError, out short cchActual) { - throw new NotImplementedException (); - } - } -}
\ No newline at end of file diff --git a/mcs/class/System.Data/ReferenceSources/PoolBlockingPeriod.cs b/mcs/class/System.Data/ReferenceSources/PoolBlockingPeriod.cs deleted file mode 100644 index 82231f413b5..00000000000 --- a/mcs/class/System.Data/ReferenceSources/PoolBlockingPeriod.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace System.Data.SqlClient -{ - public enum PoolBlockingPeriod - { - Auto, - AlwaysBlock, - NeverBlock - } -}
\ No newline at end of file diff --git a/mcs/class/System.Data/ReferenceSources/Res.cs b/mcs/class/System.Data/ReferenceSources/Res.cs deleted file mode 100644 index c103d0d1e3b..00000000000 --- a/mcs/class/System.Data/ReferenceSources/Res.cs +++ /dev/null @@ -1,1289 +0,0 @@ -// -// This file was generated by txt2sr tool -// - -namespace System.Data { - static partial class Res - { - public const string ADP_Ascending = "Ascending"; - public const string ADP_CollectionIndexInt32 = "Invalid index {0} for this {1} with Count={2}."; - public const string ADP_CollectionIndexString = "An {0} with {1} '{2}' is not contained by this {3}."; - public const string ADP_CollectionInvalidType = "The {0} only accepts non-null {1} type objects, not {2} objects."; - public const string ADP_CollectionIsNotParent = "The {0} is already contained by another {1}."; - public const string ADP_CollectionIsParent = "The {0} with is already contained by this {1}."; - public const string ADP_CollectionNullValue = "The {0} only accepts non-null {1} type objects."; - public const string ADP_CollectionRemoveInvalidObject = "Attempted to remove an {0} that is not contained by this {1}."; - public const string ADP_CollectionUniqueValue = "The {0}.{1} is required to be unique, '{2}' already exists in the collection."; - public const string ADP_ConnectionAlreadyOpen = "The connection was not closed. {0}"; - public const string ADP_ConnectionStateMsg_Closed = "The connection's current state is closed."; - public const string ADP_ConnectionStateMsg_Connecting = "The connection's current state is connecting."; - public const string ADP_ConnectionStateMsg_Open = "The connection's current state is open."; - public const string ADP_ConnectionStateMsg_OpenExecuting = "The connection's current state is executing."; - public const string ADP_ConnectionStateMsg_OpenFetching = "The connection's current state is fetching."; - public const string ADP_ConnectionStateMsg = "The connection's current state: {0}."; - public const string ADP_ConnectionStringSyntax = "Format of the initialization string does not conform to specification starting at index {0}."; - public const string ADP_DataReaderClosed = "Invalid attempt to call {0} when reader is closed."; - public const string ADP_DelegatedTransactionPresent = "Cannot enlist in the transaction because the connection is the primary connection for a delegated or promoted transaction."; - public const string ADP_Descending = "Descending"; - public const string ADP_EmptyString = "Expecting non-empty string for '{0}' parameter."; - public const string ADP_InternalConnectionError = "Internal DbConnection Error: {0}"; - public const string ADP_InvalidDataDirectory = "The DataDirectory substitute is not a string."; - public const string ADP_InvalidEnumerationValue = "The {0} enumeration value, {1}, is invalid."; - public const string ADP_InvalidKey = "Invalid keyword, contain one or more of 'no characters', 'control characters', 'leading or trailing whitespace' or 'leading semicolons'."; - public const string ADP_InvalidOffsetValue = "Invalid parameter Offset value '{0}'. The value must be greater than or equal to 0."; - public const string ADP_InvalidValue = "The value contains embedded nulls (\\u0000)."; - public const string ADP_InvalidXMLBadVersion = "Invalid Xml; can only parse elements of version one."; - public const string ADP_NoConnectionString = "The ConnectionString property has not been initialized."; - public const string ADP_NonCLSException = "A Non CLS Exception was caught."; - public const string ADP_NotAPermissionElement = "Given security element is not a permission element."; - public const string ADP_OpenConnectionPropertySet = "Not allowed to change the '{0}' property. {1}"; - public const string ADP_PendingAsyncOperation = "Can not start another operation while there is an asynchronous operation pending."; - public const string ADP_PermissionTypeMismatch = "Type mismatch."; - public const string ADP_PooledOpenTimeout = "Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached."; - public const string ADP_NonPooledOpenTimeout = "Timeout attempting to open the connection. The time period elapsed prior to attempting to open the connection has been exceeded. This may have occurred because of too many simultaneous non-pooled connection attempts."; - public const string ADP_InvalidMixedUsageOfSecureAndClearCredential = "Cannot use Credential with UserID, UID, Password, or PWD connection string keywords."; - public const string ADP_InvalidMixedUsageOfSecureCredentialAndIntegratedSecurity = "Cannot use Credential with Integrated Security connection string keyword."; - public const string ADP_InvalidMixedUsageOfSecureCredentialAndContextConnection = "Cannot use Credential with Context Connection keyword."; - public const string ADP_MustBeReadOnly = "{0} must be marked as read only."; - public const string DataCategory_Data = "Data"; - public const string DataCategory_StateChange = "StateChange"; - public const string DataCategory_Update = "Update"; - public const string DbCommand_CommandTimeout = "Time to wait for command to execute."; - public const string DbConnection_State = "The ConnectionState indicating whether the connection is open or closed."; - public const string DbConnection_StateChange = "Event triggered when the connection changes state."; - public const string DbParameter_DbType = "The parameter generic type."; - public const string DbParameter_Direction = "Input, output, or bidirectional parameter."; - public const string DbParameter_IsNullable = "a design-time property used for strongly typed code-generation."; - public const string DbParameter_Offset = "Offset in variable length data types."; - public const string DbParameter_ParameterName = "Name of the parameter."; - public const string DbParameter_Size = "Size of variable length data types (string & arrays)."; - public const string DbParameter_SourceColumn = "When used by a DataAdapter.Update, the source column name that is used to find the DataSetColumn name in the ColumnMappings. This is to copy a value between the parameter and a data row."; - public const string DbParameter_SourceVersion = "When used by a DataAdapter.Update (UpdateCommand only), the version of the DataRow value that is used to update the data source."; - public const string DbParameter_SourceColumnNullMapping = "When used by DataAdapter.Update, the parameter value is changed from DBNull.Value into (Int32)1 or (Int32)0 if non-null."; - public const string DbParameter_Value = "Value of the parameter."; - public const string MDF_QueryFailed = "Unable to build the '{0}' collection because execution of the SQL query failed. See the inner exception for details."; - public const string MDF_TooManyRestrictions = "More restrictions were provided than the requested schema ('{0}') supports."; - public const string MDF_InvalidRestrictionValue = "'{2}' is not a valid value for the '{1}' restriction of the '{0}' schema collection."; - public const string MDF_UndefinedCollection = "The requested collection ({0}) is not defined."; - public const string MDF_UndefinedPopulationMechanism = "The population mechanism '{0}' is not defined."; - public const string MDF_UnsupportedVersion = "The requested collection ({0}) is not supported by this version of the provider."; - public const string MDF_MissingDataSourceInformationColumn = "One of the required DataSourceInformation tables columns is missing."; - public const string MDF_IncorrectNumberOfDataSourceInformationRows = "The DataSourceInformation table must contain exactly one row."; - public const string MDF_MissingRestrictionColumn = "One or more of the required columns of the restrictions collection is missing."; - public const string MDF_MissingRestrictionRow = "A restriction exists for which there is no matching row in the restrictions collection."; - public const string MDF_NoColumns = "The schema table contains no columns."; - public const string MDF_UnableToBuildCollection = "Unable to build schema collection '{0}';"; - public const string MDF_AmbigousCollectionName = "The collection name '{0}' matches at least two collections with the same name but with different case, but does not match any of them exactly."; - public const string MDF_CollectionNameISNotUnique = "There are multiple collections named '{0}'."; - public const string MDF_DataTableDoesNotExist = "The collection '{0}' is missing from the metadata XML."; - public const string MDF_InvalidXml = "The metadata XML is invalid."; - public const string MDF_InvalidXmlMissingColumn = "The metadata XML is invalid. The {0} collection must contain a {1} column and it must be a string column."; - public const string MDF_InvalidXmlInvalidValue = "The metadata XML is invalid. The {1} column of the {0} collection must contain a non-empty string."; - public const string DataCategory_Action = "Action"; - public const string DataCategory_Behavior = "Behavior"; - public const string DataCategory_Fill = "Fill"; - public const string DataCategory_InfoMessage = "InfoMessage"; - public const string DataCategory_Mapping = "Mapping"; - public const string DataCategory_StatementCompleted = "StatementCompleted"; - public const string DataCategory_Udt = "UDT"; - public const string DataCategory_Notification = "Notification"; - public const string DataCategory_Schema = "Schema"; - public const string DataCategory_Xml = "XML"; - public const string DataCategory_Advanced = "Advanced"; - public const string DataCategory_Context = "Context"; - public const string DataCategory_Initialization = "Initialization"; - public const string DataCategory_Pooling = "Pooling"; - public const string DataCategory_NamedConnectionString = "Named ConnectionString"; - public const string DataCategory_Security = "Security"; - public const string DataCategory_Source = "Source"; - public const string DataCategory_Replication = "Replication"; - public const string DataCategory_ConnectionResilency = "Connection Resiliency"; - public const string ExtendedPropertiesDescr = "The collection that holds custom user information."; - public const string DataSetCaseSensitiveDescr = "Indicates whether comparing strings within the DataSet is case sensitive."; - public const string DataSetDataSetNameDescr = "The name of this DataSet."; - public const string DataSetDefaultViewDescr = "Indicates a custom \"view\" of the data contained by the DataSet. This view allows filtering, searching, and navigating through the custom data view."; - public const string DataSetEnforceConstraintsDescr = "Indicates whether constraint rules are to be followed."; - public const string DataSetHasErrorsDescr = "Indicates that the DataSet has errors."; - public const string DataSetLocaleDescr = "Indicates a locale under which to compare strings within the DataSet."; - public const string DataSetNamespaceDescr = "Indicates the XML uri namespace for the root element pointed at by this DataSet."; - public const string DataSetPrefixDescr = "Indicates the prefix of the namespace used for this DataSet."; - public const string DataSetRelationsDescr = "The collection that holds the relations for this DataSet."; - public const string DataSetTablesDescr = "The collection that holds the tables for this DataSet."; - public const string DataSetMergeFailedDescr = "Occurs when it is not possible to merge schemas for two tables with the same name."; - public const string DataSetInitializedDescr = "Occurs after Initialization is finished."; - public const string DataSetDescr = "Represents an in-memory cache of data."; - public const string DataTableCaseSensitiveDescr = "Indicates whether comparing strings within the table is case sensitive."; - public const string DataTableChildRelationsDescr = "Returns the child relations for this table."; - public const string DataTableColumnsDescr = "The collection that holds the columns for this table."; - public const string DataTableConstraintsDescr = "The collection that holds the constraints for this table."; - public const string DataTableDataSetDescr = "Indicates the DataSet to which this table belongs."; - public const string DataTableDefaultViewDescr = "This is the default DataView for the table."; - public const string DataTableDisplayExpressionDescr = "The expression used to compute the data-bound value of this row."; - public const string DataTableHasErrorsDescr = "Returns whether the table has errors."; - public const string DataTableLocaleDescr = "Indicates a locale under which to compare strings within the table."; - public const string DataTableMinimumCapacityDescr = "Indicates an initial starting size for this table."; - public const string DataTableNamespaceDescr = "Indicates the XML uri namespace for the elements contained in this table."; - public const string DataTablePrefixDescr = "Indicates the Prefix of the namespace used for this table in XML representation."; - public const string DataTableParentRelationsDescr = "Returns the parent relations for this table."; - public const string DataTablePrimaryKeyDescr = "Indicates the column(s) that represent the primary key for this table."; - public const string DataTableRowsDescr = "Indicates the collection that holds the rows of data for this table."; - public const string DataTableTableNameDescr = "Indicates the name used to look up this table in the Tables collection of a DataSet."; - public const string DataTableRowChangedDescr = "Occurs after a row in the table has been successfully edited."; - public const string DataTableRowChangingDescr = "Occurs when the row is being changed so that the event handler can modify or cancel the change. The user can modify values in the row and should throw an exception to cancel the edit."; - public const string DataTableRowDeletedDescr = "Occurs after a row in the table has been successfully deleted."; - public const string DataTableRowDeletingDescr = "Occurs when a row in the table marked for deletion. Throw an exception to cancel the deletion."; - public const string DataTableColumnChangingDescr = "Occurs when a value has been submitted for this column. The user can modify the proposed value and should throw an exception to cancel the edit."; - public const string DataTableColumnChangedDescr = "Occurs when a value has been changed for this column."; - public const string DataTableRowsClearingDescr = "Occurs prior to clearing all rows from the table."; - public const string DataTableRowsClearedDescr = "Occurs after all rows in the table has been successfully cleared."; - public const string DataTableRowsNewRowDescr = "Occurs after a new DataRow has been instantiated."; - public const string DataRelationRelationNameDescr = "The name used to look up this relation in the Relations collection of a DataSet."; - public const string DataRelationChildColumnsDescr = "Indicates the child columns of this relation."; - public const string DataRelationParentColumnsDescr = "Indicates the parent columns of this relation."; - public const string DataRelationNested = "Indicates whether relations are nested."; - public const string ForeignKeyConstraintDeleteRuleDescr = "For deletions, indicates what kind of cascading should take place across this relation."; - public const string ForeignKeyConstraintUpdateRuleDescr = "For updates, indicates what kind of cascading should take place across this relation."; - public const string ForeignKeyConstraintAcceptRejectRuleDescr = "For accept and reject changes, indicates what kind of cascading should take place across this relation."; - public const string ForeignKeyConstraintChildColumnsDescr = "Indicates the child columns of this constraint."; - public const string ForeignKeyConstraintParentColumnsDescr = "Indicates the parent columns of this constraint."; - public const string ForeignKeyRelatedTableDescr = "Indicates the child table of this constraint."; - public const string KeyConstraintColumnsDescr = "Indicates the columns of this constraint."; - public const string KeyConstraintIsPrimaryKeyDescr = "Indicates if this constraint is a primary key."; - public const string ConstraintNameDescr = "Indicates the name of this constraint."; - public const string ConstraintTableDescr = "Indicates the table of this constraint."; - public const string DataColumnAllowNullDescr = "Indicates whether null values are allowed in this column."; - public const string DataColumnAutoIncrementDescr = "Indicates whether the column automatically increments itself for new rows added to the table. The type of this column must be Int16, Int32, or Int64."; - public const string DataColumnAutoIncrementSeedDescr = "Indicates the starting value for an AutoIncrement column."; - public const string DataColumnAutoIncrementStepDescr = "Indicates the increment used by an AutoIncrement column."; - public const string DataColumnCaptionDescr = "Indicates the default user-interface caption for this column."; - public const string DataColumnColumnNameDescr = "Indicates the name used to look up this column in the Columns collection of a DataTable."; - public const string DataColumnDataTableDescr = "Returns the DataTable to which this column belongs."; - public const string DataColumnDataTypeDescr = "Indicates the type of data stored in this column."; - public const string DataColumnDefaultValueDescr = "Indicates the default column value used when adding new rows to the table."; - public const string DataColumnExpressionDescr = "Indicates the value that this column computes for each row based on other columns instead of taking user input."; - public const string DataColumnMappingDescr = "Indicates how this column persists in XML: as an attribute, element, simple content node, or nothing."; - public const string DataColumnNamespaceDescr = "Indicates the XML uri for elements or attributes stored in this column."; - public const string DataColumnPrefixDescr = "Indicates the Prefix used for this DataColumn in xml representation."; - public const string DataColumnOrdinalDescr = "Indicates the index of this column in the Columns collection."; - public const string DataColumnReadOnlyDescr = "Indicates whether this column allows changes once a row has been added to the table."; - public const string DataColumnUniqueDescr = "Indicates whether this column should restrict its values in the rows of the table to be unique."; - public const string DataColumnMaxLengthDescr = "Indicates the maximum length of the value this column allows."; - public const string DataColumnDateTimeModeDescr = "Indicates DateTimeMode of this DataColumn."; - public const string DataViewAllowDeleteDescr = "Indicates whether this DataView and the user interface associated with it allows deletes."; - public const string DataViewAllowEditDescr = "Indicates whether this DataView and the user interface associated with it allows edits."; - public const string DataViewAllowNewDescr = "Indicates whether this DataView and the user interface associated with it allows new rows to be added."; - public const string DataViewCountDescr = "Returns the number of items currently in this view."; - public const string DataViewDataViewManagerDescr = "This returns a pointer to back to the DataViewManager that owns this DataSet (if any)."; - public const string DataViewIsOpenDescr = "Indicates whether the view is open."; - public const string DataViewRowFilterDescr = "Indicates an expression used to filter the data returned by this DataView."; - public const string DataViewRowStateFilterDescr = "Indicates the versions of data returned by this DataView."; - public const string DataViewSortDescr = "Indicates the names of the column and the order in which data is returned by this DataView."; - public const string DataViewApplyDefaultSortDescr = "Indicates whether to use the default sort if the Sort property is not set."; - public const string DataViewTableDescr = "Indicates the table this DataView uses to get data."; - public const string DataViewListChangedDescr = "Indicates that the data returned by this DataView has somehow changed."; - public const string DataViewManagerDataSetDescr = "Indicates the source of data for this DataViewManager."; - public const string DataViewManagerTableSettingsDescr = "Indicates the sorting/filtering/state settings for any table in the corresponding DataSet."; - public const string Xml_SimpleTypeNotSupported = "DataSet doesn't support 'union' or 'list' as simpleType."; - public const string Xml_MissingAttribute = "Invalid {0} syntax: missing required '{1}' attribute."; - public const string Xml_ValueOutOfRange = "Value '{1}' is invalid for attribute '{0}'."; - public const string Xml_AttributeValues = "The value of attribute '{0}' should be '{1}' or '{2}'."; - public const string Xml_ElementTypeNotFound = "Cannot find ElementType name='{0}'."; - public const string Xml_RelationParentNameMissing = "Parent table name is missing in relation '{0}'."; - public const string Xml_RelationChildNameMissing = "Child table name is missing in relation '{0}'."; - public const string Xml_RelationTableKeyMissing = "Parent table key is missing in relation '{0}'."; - public const string Xml_RelationChildKeyMissing = "Child table key is missing in relation '{0}'."; - public const string Xml_UndefinedDatatype = "Undefined data type: '{0}'."; - public const string Xml_DatatypeNotDefined = "Data type not defined."; - public const string Xml_InvalidField = "Invalid XPath selection inside field node. Cannot find: {0}."; - public const string Xml_InvalidSelector = "Invalid XPath selection inside selector node: {0}."; - public const string Xml_InvalidKey = "Invalid 'Key' node inside constraint named: {0}."; - public const string Xml_DuplicateConstraint = "The constraint name {0} is already used in the schema."; - public const string Xml_CannotConvert = "Cannot convert '{0}' to type '{1}'."; - public const string Xml_MissingRefer = "Missing '{0}' part in '{1}' constraint named '{2}'."; - public const string Xml_MismatchKeyLength = "Invalid Relation definition: different length keys."; - public const string Xml_CircularComplexType = "DataSet doesn't allow the circular reference in the ComplexType named '{0}'."; - public const string Xml_CannotInstantiateAbstract = "DataSet cannot instantiate an abstract ComplexType for the node {0}."; - public const string Xml_MultipleTargetConverterError = "An error occurred with the multiple target converter while writing an Xml Schema. See the inner exception for details."; - public const string Xml_MultipleTargetConverterEmpty = "An error occurred with the multiple target converter while writing an Xml Schema. A null or empty string was returned."; - public const string Xml_MergeDuplicateDeclaration = "Duplicated declaration '{0}'."; - public const string Xml_MissingTable = "Cannot load diffGram. Table '{0}' is missing in the destination dataset."; - public const string Xml_MissingSQL = "Cannot load diffGram. The 'sql' node is missing."; - public const string Xml_ColumnConflict = "Column name '{0}' is defined for different mapping types."; - public const string Xml_InvalidPrefix = "Prefix '{0}' is not valid, because it contains special characters."; - public const string Xml_NestedCircular = "Circular reference in self-nested table '{0}'."; - public const string Xml_FoundEntity = "DataSet cannot expand entities. Use XmlValidatingReader and set the EntityHandling property accordingly."; - public const string Xml_PolymorphismNotSupported = "Type '{0}' does not implement IXmlSerializable interface therefore can not proceed with serialization."; - public const string Xml_CanNotDeserializeObjectType = "Unable to proceed with deserialization. Data does not implement IXMLSerializable, therefore polymorphism is not supported."; - public const string Xml_DataTableInferenceNotSupported = "DataTable does not support schema inference from Xml."; - public const string Xml_MultipleParentRows = "Cannot proceed with serializing DataTable '{0}'. It contains a DataRow which has multiple parent rows on the same Foreign Key."; - public const string Xml_IsDataSetAttributeMissingInSchema = "IsDataSet attribute is missing in input Schema."; - public const string Xml_TooManyIsDataSetAtributeInSchema = "Cannot determine the DataSet Element. IsDataSet attribute exist more than once."; - public const string Xml_DynamicWithoutXmlSerializable = "DataSet will not serialize types that implement IDynamicMetaObjectProvider but do not also implement IXmlSerializable."; - public const string Expr_NYI = "The feature not implemented. {0}."; - public const string Expr_MissingOperand = "Syntax error: Missing operand after '{0}' operator."; - public const string Expr_TypeMismatch = "Type mismatch in expression '{0}'."; - public const string Expr_ExpressionTooComplex = "Expression is too complex."; - public const string Expr_UnboundName = "Cannot find column [{0}]."; - public const string Expr_InvalidString = "The expression contains an invalid string constant: {0}."; - public const string Expr_UndefinedFunction = "The expression contains undefined function call {0}()."; - public const string Expr_Syntax = "Syntax error in the expression."; - public const string Expr_FunctionArgumentCount = "Invalid number of arguments: function {0}()."; - public const string Expr_MissingRightParen = "The expression is missing the closing parenthesis."; - public const string Expr_UnknownToken = "Cannot interpret token '{0}' at position {1}."; - public const string Expr_UnknownToken1 = "Expected {0}, but actual token at the position {2} is {1}."; - public const string Expr_DatatypeConvertion = "Cannot convert from {0} to {1}."; - public const string Expr_DatavalueConvertion = "Cannot convert value '{0}' to Type: {1}."; - public const string Expr_InvalidName = "Invalid column name [{0}]."; - public const string Expr_InvalidDate = "The expression contains invalid date constant '{0}'."; - public const string Expr_NonConstantArgument = "Only constant expressions are allowed in the expression list for the IN operator."; - public const string Expr_InvalidPattern = "Error in Like operator: the string pattern '{0}' is invalid."; - public const string Expr_InWithoutParentheses = "Syntax error: The items following the IN keyword must be separated by commas and be enclosed in parentheses."; - public const string Expr_ArgumentType = "Type mismatch in function argument: {0}(), argument {1}, expected {2}."; - public const string Expr_ArgumentTypeInteger = "Type mismatch in function argument: {0}(), argument {1}, expected one of the Integer types."; - public const string Expr_TypeMismatchInBinop = "Cannot perform '{0}' operation on {1} and {2}."; - public const string Expr_AmbiguousBinop = "Operator '{0}' is ambiguous on operands of type '{1}' and '{2}'. Cannot mix signed and unsigned types. Please use explicit Convert() function."; - public const string Expr_InWithoutList = "Syntax error: The IN keyword must be followed by a non-empty list of expressions separated by commas, and also must be enclosed in parentheses."; - public const string Expr_UnsupportedOperator = "The expression contains unsupported operator '{0}'."; - public const string Expr_InvalidNameBracketing = "The expression contains invalid name: '{0}'."; - public const string Expr_MissingOperandBefore = "Syntax error: Missing operand before '{0}' operator."; - public const string Expr_TooManyRightParentheses = "The expression has too many closing parentheses."; - public const string Expr_UnresolvedRelation = "The table [{0}] involved in more than one relation. You must explicitly mention a relation name in the expression '{1}'."; - public const string Expr_AggregateArgument = "Syntax error in aggregate argument: Expecting a single column argument with possible 'Child' qualifier."; - public const string Expr_AggregateUnbound = "Unbound reference in the aggregate expression '{0}'."; - public const string Expr_EvalNoContext = "Cannot evaluate non-constant expression without current row."; - public const string Expr_ExpressionUnbound = "Unbound reference in the expression '{0}'."; - public const string Expr_ComputeNotAggregate = "Cannot evaluate. Expression '{0}' is not an aggregate."; - public const string Expr_FilterConvertion = "Filter expression '{0}' does not evaluate to a Boolean term."; - public const string Expr_InvalidType = "Invalid type name '{0}'."; - public const string Expr_LookupArgument = "Syntax error in Lookup expression: Expecting keyword 'Parent' followed by a single column argument with possible relation qualifier: Parent[(<relation_name>)].<column_name>."; - public const string Expr_InvokeArgument = "Need a row or a table to Invoke DataFilter."; - public const string Expr_ArgumentOutofRange = "{0}() argument is out of range."; - public const string Expr_IsSyntax = "Syntax error: Invalid usage of 'Is' operator. Correct syntax: <expression> Is [Not] Null."; - public const string Expr_Overflow = "Value is either too large or too small for Type '{0}'."; - public const string Expr_DivideByZero = "Divide by zero error encountered."; - public const string Expr_BindFailure = "Cannot find the parent relation '{0}'."; - public const string Expr_InvalidHoursArgument = "'hours' argument is out of range. Value must be between -14 and +14."; - public const string Expr_InvalidMinutesArgument = "'minutes' argument is out of range. Value must be between -59 and +59."; - public const string Expr_InvalidTimeZoneRange = "Provided range for time one exceeds total of 14 hours."; - public const string Expr_MismatchKindandTimeSpan = "Kind property of provided DateTime argument, does not match 'hours' and 'minutes' arguments."; - public const string Expr_UnsupportedType = "A DataColumn of type '{0}' does not support expression."; - public const string Data_EnforceConstraints = "Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints."; - public const string Data_CannotModifyCollection = "Collection itself is not modifiable."; - public const string Data_CaseInsensitiveNameConflict = "The given name '{0}' matches at least two names in the collection object with different cases, but does not match either of them with the same case."; - public const string Data_NamespaceNameConflict = "The given name '{0}' matches at least two names in the collection object with different namespaces."; - public const string Data_InvalidOffsetLength = "Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection."; - public const string Data_ArgumentOutOfRange = "'{0}' argument is out of range."; - public const string Data_ArgumentNull = "'{0}' argument cannot be null."; - public const string Data_ArgumentContainsNull = "'{0}' argument contains null value."; - public const string DataColumns_OutOfRange = "Cannot find column {0}."; - public const string DataColumns_Add1 = "Column '{0}' already belongs to this DataTable."; - public const string DataColumns_Add2 = "Column '{0}' already belongs to another DataTable."; - public const string DataColumns_Add3 = "Cannot have more than one SimpleContent columns in a DataTable."; - public const string DataColumns_Add4 = "Cannot add a SimpleContent column to a table containing element columns or nested relations."; - public const string DataColumns_AddDuplicate = "A column named '{0}' already belongs to this DataTable."; - public const string DataColumns_AddDuplicate2 = "Cannot add a column named '{0}': a nested table with the same name already belongs to this DataTable."; - public const string DataColumns_AddDuplicate3 = "A column named '{0}' already belongs to this DataTable: cannot set a nested table name to the same name."; - public const string DataColumns_Remove = "Cannot remove a column that doesn't belong to this table."; - public const string DataColumns_RemovePrimaryKey = "Cannot remove this column, because it's part of the primary key."; - public const string DataColumns_RemoveChildKey = "Cannot remove this column, because it is part of the parent key for relationship {0}."; - public const string DataColumns_RemoveConstraint = "Cannot remove this column, because it is a part of the constraint {0} on the table {1}."; - public const string DataColumns_RemoveExpression = "Cannot remove this column, because it is part of an expression: {0} = {1}."; - public const string DataColumn_AutoIncrementAndExpression = "Cannot set AutoIncrement property for a computed column."; - public const string DataColumn_AutoIncrementAndDefaultValue = "Cannot set AutoIncrement property for a column with DefaultValue set."; - public const string DataColumn_DefaultValueAndAutoIncrement = "Cannot set a DefaultValue on an AutoIncrement column."; - public const string DataColumn_AutoIncrementSeed = "AutoIncrementStep must be a non-zero value."; - public const string DataColumn_NameRequired = "ColumnName is required when it is part of a DataTable."; - public const string DataColumn_ChangeDataType = "Cannot change DataType of a column once it has data."; - public const string DataColumn_NullDataType = "Column requires a valid DataType."; - public const string DataColumn_DefaultValueDataType = "The DefaultValue for column {0} is of type {1} and cannot be converted to {2}."; - public const string DataColumn_DefaultValueDataType1 = "The DefaultValue for the column is of type {0} and cannot be converted to {1}."; - public const string DataColumn_DefaultValueColumnDataType = "The DefaultValue for column {0} is of type {1}, but the column is of type {2}."; - public const string DataColumn_ReadOnlyAndExpression = "Cannot change ReadOnly property for the expression column."; - public const string DataColumn_UniqueAndExpression = "Cannot change Unique property for the expression column."; - public const string DataColumn_ExpressionAndUnique = "Cannot create an expression on a column that has AutoIncrement or Unique."; - public const string DataColumn_ExpressionAndReadOnly = "Cannot set expression because column cannot be made ReadOnly."; - public const string DataColumn_ExpressionAndConstraint = "Cannot set Expression property on column {0}, because it is a part of a constraint."; - public const string DataColumn_ExpressionInConstraint = "Cannot create a constraint based on Expression column {0}."; - public const string DataColumn_ExpressionCircular = "Cannot set Expression property due to circular reference in the expression."; - public const string DataColumn_NullKeyValues = "Column '{0}' has null values in it."; - public const string DataColumn_NullValues = "Column '{0}' does not allow nulls."; - public const string DataColumn_ReadOnly = "Column '{0}' is read only."; - public const string DataColumn_NonUniqueValues = "Column '{0}' contains non-unique values."; - public const string DataColumn_NotInTheTable = "Column '{0}' does not belong to table {1}."; - public const string DataColumn_NotInAnyTable = "Column must belong to a table."; - public const string DataColumn_SetFailed = "Couldn't store <{0}> in {1} Column. Expected type is {2}."; - public const string DataColumn_CannotSetToNull = "Cannot set Column '{0}' to be null. Please use DBNull instead."; - public const string DataColumn_LongerThanMaxLength = "Cannot set column '{0}'. The value violates the MaxLength limit of this column."; - public const string DataColumn_HasToBeStringType = "MaxLength applies to string data type only. You cannot set Column '{0}' property MaxLength to be non-negative number."; - public const string DataColumn_CannotSetMaxLength = "Cannot set Column '{0}' property MaxLength to '{1}'. There is at least one string in the table longer than the new limit."; - public const string DataColumn_CannotSetMaxLength2 = "Cannot set Column '{0}' property MaxLength. The Column is SimpleContent."; - public const string DataColumn_CannotSimpleContentType = "Cannot set Column '{0}' property DataType to {1}. The Column is SimpleContent."; - public const string DataColumn_CannotSimpleContent = "Cannot set Column '{0}' property MappingType to SimpleContent. The Column DataType is {1}."; - public const string DataColumn_ExceedMaxLength = "Column '{0}' exceeds the MaxLength limit."; - public const string DataColumn_NotAllowDBNull = "Column '{0}' does not allow DBNull.Value."; - public const string DataColumn_CannotChangeNamespace = "Cannot change the Column '{0}' property Namespace. The Column is SimpleContent."; - public const string DataColumn_AutoIncrementCannotSetIfHasData = "Cannot change AutoIncrement of a DataColumn with type '{0}' once it has data."; - public const string DataColumn_NotInTheUnderlyingTable = "Column '{0}' does not belong to underlying table '{1}'."; - public const string DataColumn_InvalidDataColumnMapping = "DataColumn with type '{0}' is a complexType. Can not serialize value of a complex type as Attribute"; - public const string DataColumn_CannotSetDateTimeModeForNonDateTimeColumns = "The DateTimeMode can be set only on DataColumns of type DateTime."; - public const string DataColumn_InvalidDateTimeMode = "'{0}' is Invalid DataSetDateTime value."; - public const string DataColumn_DateTimeMode = "Cannot change DateTimeMode from '{0}' to '{1}' once the table has data."; - public const string DataColumn_INullableUDTwithoutStaticNull = "Type '{0}' does not contain static Null property or field."; - public const string DataColumn_UDTImplementsIChangeTrackingButnotIRevertible = "Type '{0}' does not implement IRevertibleChangeTracking; therefore can not proceed with RejectChanges()."; - public const string DataColumn_SetAddedAndModifiedCalledOnNonUnchanged = "SetAdded and SetModified can only be called on DataRows with Unchanged DataRowState."; - public const string DataColumn_OrdinalExceedMaximun = "Ordinal '{0}' exceeds the maximum number."; - public const string DataColumn_NullableTypesNotSupported = "DataSet does not support System.Nullable<>."; - public const string DataConstraint_NoName = "Cannot change the name of a constraint to empty string when it is in the ConstraintCollection."; - public const string DataConstraint_Violation = "Cannot enforce constraints on constraint {0}."; - public const string DataConstraint_ViolationValue = "Column '{0}' is constrained to be unique. Value '{1}' is already present."; - public const string DataConstraint_NotInTheTable = "Constraint '{0}' does not belong to this DataTable."; - public const string DataConstraint_OutOfRange = "Cannot find constraint {0}."; - public const string DataConstraint_Duplicate = "Constraint matches constraint named {0} already in collection."; - public const string DataConstraint_DuplicateName = "A Constraint named '{0}' already belongs to this DataTable."; - public const string DataConstraint_UniqueViolation = "These columns don't currently have unique values."; - public const string DataConstraint_ForeignTable = "These columns don't point to this table."; - public const string DataConstraint_ParentValues = "This constraint cannot be enabled as not all values have corresponding parent values."; - public const string DataConstraint_AddFailed = "This constraint cannot be added since ForeignKey doesn't belong to table {0}."; - public const string DataConstraint_RemoveFailed = "Cannot remove a constraint that doesn't belong to this table."; - public const string DataConstraint_NeededForForeignKeyConstraint = "Cannot remove unique constraint '{0}'. Remove foreign key constraint '{1}' first."; - public const string DataConstraint_CascadeDelete = "Cannot delete this row because constraints are enforced on relation {0}, and deleting this row will strand child rows."; - public const string DataConstraint_CascadeUpdate = "Cannot make this change because constraints are enforced on relation {0}, and changing this value will strand child rows."; - public const string DataConstraint_ClearParentTable = "Cannot clear table {0} because ForeignKeyConstraint {1} enforces constraints and there are child rows in {2}."; - public const string DataConstraint_ForeignKeyViolation = "ForeignKeyConstraint {0} requires the child key values ({1}) to exist in the parent table."; - public const string DataConstraint_BadObjectPropertyAccess = "Property not accessible because '{0}'."; - public const string DataConstraint_RemoveParentRow = "Cannot remove this row because it has child rows, and constraints on relation {0} are enforced."; - public const string DataConstraint_AddPrimaryKeyConstraint = "Cannot add primary key constraint since primary key is already set for the table."; - public const string DataConstraint_CantAddConstraintToMultipleNestedTable = "Cannot add constraint to DataTable '{0}' which is a child table in two nested relations."; - public const string DataKey_TableMismatch = "Cannot create a Key from Columns that belong to different tables."; - public const string DataKey_NoColumns = "Cannot have 0 columns."; - public const string DataKey_TooManyColumns = "Cannot have more than {0} columns."; - public const string DataKey_DuplicateColumns = "Cannot create a Key when the same column is listed more than once: '{0}'"; - public const string DataKey_RemovePrimaryKey = "Cannot remove unique constraint since it's the primary key of a table."; - public const string DataKey_RemovePrimaryKey1 = "Cannot remove unique constraint since it's the primary key of table {0}."; - public const string DataRelation_ColumnsTypeMismatch = "Parent Columns and Child Columns don't have type-matching columns."; - public const string DataRelation_KeyColumnsIdentical = "ParentKey and ChildKey are identical."; - public const string DataRelation_KeyLengthMismatch = "ParentColumns and ChildColumns should be the same length."; - public const string DataRelation_KeyZeroLength = "ParentColumns and ChildColumns must not be zero length."; - public const string DataRelation_ForeignRow = "The row doesn't belong to the same DataSet as this relation."; - public const string DataRelation_NoName = "RelationName is required when it is part of a DataSet."; - public const string DataRelation_ForeignTable = "GetChildRows requires a row whose Table is {0}, but the specified row's Table is {1}."; - public const string DataRelation_ForeignDataSet = "This relation should connect two tables in this DataSet to be added to this DataSet."; - public const string DataRelation_GetParentRowTableMismatch = "GetParentRow requires a row whose Table is {0}, but the specified row's Table is {1}."; - public const string DataRelation_SetParentRowTableMismatch = "SetParentRow requires a child row whose Table is {0}, but the specified row's Table is {1}."; - public const string DataRelation_DataSetMismatch = "Cannot have a relationship between tables in different DataSets."; - public const string DataRelation_TablesInDifferentSets = "Cannot create a relation between tables in different DataSets."; - public const string DataRelation_AlreadyExists = "A relation already exists for these child columns."; - public const string DataRelation_DoesNotExist = "This relation doesn't belong to this relation collection."; - public const string DataRelation_AlreadyInOtherDataSet = "This relation already belongs to another DataSet."; - public const string DataRelation_AlreadyInTheDataSet = "This relation already belongs to this DataSet."; - public const string DataRelation_DuplicateName = "A Relation named '{0}' already belongs to this DataSet."; - public const string DataRelation_NotInTheDataSet = "Relation {0} does not belong to this DataSet."; - public const string DataRelation_OutOfRange = "Cannot find relation {0}."; - public const string DataRelation_TableNull = "Cannot create a collection on a null table."; - public const string DataRelation_TableWasRemoved = "The table this collection displays relations for has been removed from its DataSet."; - public const string DataRelation_ChildTableMismatch = "Cannot add a relation to this table's ParentRelation collection where this table isn't the child table."; - public const string DataRelation_ParentTableMismatch = "Cannot add a relation to this table's ChildRelation collection where this table isn't the parent table."; - public const string DataRelation_RelationNestedReadOnly = "Cannot set the 'Nested' property to false for this relation."; - public const string DataRelation_TableCantBeNestedInTwoTables = "The same table '{0}' cannot be the child table in two nested relations."; - public const string DataRelation_LoopInNestedRelations = "The table ({0}) cannot be the child table to itself in nested relations."; - public const string DataRelation_CaseLocaleMismatch = "Cannot add a DataRelation or Constraint that has different Locale or CaseSensitive settings between its parent and child tables."; - public const string DataRelation_ParentOrChildColumnsDoNotHaveDataSet = "Cannot create a DataRelation if Parent or Child Columns are not in a DataSet."; - public const string DataRelation_InValidNestedRelation = "Nested table '{0}' which inherits its namespace cannot have multiple parent tables in different namespaces."; - public const string DataRelation_InValidNamespaceInNestedRelation = "Nested table '{0}' with empty namespace cannot have multiple parent tables in different namespaces."; - public const string DataRow_NotInTheDataSet = "The row doesn't belong to the same DataSet as this relation."; - public const string DataRow_NotInTheTable = "Cannot perform this operation on a row not in the table."; - public const string DataRow_ParentRowNotInTheDataSet = "This relation and child row don't belong to same DataSet."; - public const string DataRow_EditInRowChanging = "Cannot change a proposed value in the RowChanging event."; - public const string DataRow_EndEditInRowChanging = "Cannot call EndEdit() inside an OnRowChanging event."; - public const string DataRow_BeginEditInRowChanging = "Cannot call BeginEdit() inside the RowChanging event."; - public const string DataRow_CancelEditInRowChanging = "Cannot call CancelEdit() inside an OnRowChanging event. Throw an exception to cancel this update."; - public const string DataRow_DeleteInRowDeleting = "Cannot call Delete inside an OnRowDeleting event. Throw an exception to cancel this delete."; - public const string DataRow_ValuesArrayLength = "Input array is longer than the number of columns in this table."; - public const string DataRow_NoCurrentData = "There is no Current data to access."; - public const string DataRow_NoOriginalData = "There is no Original data to access."; - public const string DataRow_NoProposedData = "There is no Proposed data to access."; - public const string DataRow_RemovedFromTheTable = "This row has been removed from a table and does not have any data. BeginEdit() will allow creation of new data in this row."; - public const string DataRow_DeletedRowInaccessible = "Deleted row information cannot be accessed through the row."; - public const string DataRow_InvalidVersion = "Version must be Original, Current, or Proposed."; - public const string DataRow_OutOfRange = "There is no row at position {0}."; - public const string DataRow_RowInsertOutOfRange = "The row insert position {0} is invalid."; - public const string DataRow_RowInsertTwice = "The rowOrder value={0} has been found twice for table named '{1}'."; - public const string DataRow_RowInsertMissing = "Values are missing in the rowOrder sequence for table '{0}'."; - public const string DataRow_RowOutOfRange = "The given DataRow is not in the current DataRowCollection."; - public const string DataRow_AlreadyInOtherCollection = "This row already belongs to another table."; - public const string DataRow_AlreadyInTheCollection = "This row already belongs to this table."; - public const string DataRow_AlreadyDeleted = "Cannot delete this row since it's already deleted."; - public const string DataRow_Empty = "This row is empty."; - public const string DataRow_AlreadyRemoved = "Cannot remove a row that's already been removed."; - public const string DataRow_MultipleParents = "A child row has multiple parents."; - public const string DataRow_InvalidRowBitPattern = "Unrecognized row state bit pattern."; - public const string DataSet_SetNameToEmpty = "Cannot change the name of the DataSet to an empty string."; - public const string DataSet_SetDataSetNameConflicting = "The name '{0}' is invalid. A DataSet cannot have the same name of the DataTable."; - public const string DataSet_UnsupportedSchema = "The schema namespace is invalid. Please use this one instead: {0}."; - public const string DataSet_CannotChangeCaseLocale = "Cannot change CaseSensitive or Locale property. This change would lead to at least one DataRelation or Constraint to have different Locale or CaseSensitive settings between its related tables."; - public const string DataSet_CannotChangeSchemaSerializationMode = "SchemaSerializationMode property can be set only if it is overridden by derived DataSet."; - public const string DataTable_ForeignPrimaryKey = "PrimaryKey columns do not belong to this table."; - public const string DataTable_CannotAddToSimpleContent = "Cannot add a nested relation or an element column to a table containing a SimpleContent column."; - public const string DataTable_NoName = "TableName is required when it is part of a DataSet."; - public const string DataTable_MultipleSimpleContentColumns = "DataTable already has a simple content column."; - public const string DataTable_MissingPrimaryKey = "Table doesn't have a primary key."; - public const string DataTable_InvalidSortString = "{0} isn't a valid Sort string entry."; - public const string DataTable_CanNotSerializeDataTableHierarchy = "Cannot serialize the DataTable. A DataTable being used in one or more DataColumn expressions is not a descendant of current DataTable."; - public const string DataTable_CanNotRemoteDataTable = "This DataTable can only be remoted as part of DataSet. One or more Expression Columns has reference to other DataTable(s)."; - public const string DataTable_CanNotSetRemotingFormat = "Cannot have different remoting format property value for DataSet and DataTable."; - public const string DataTable_CanNotSerializeDataTableWithEmptyName = "Cannot serialize the DataTable. DataTable name is not set."; - public const string DataTable_DuplicateName = "A DataTable named '{0}' already belongs to this DataSet."; - public const string DataTable_DuplicateName2 = "A DataTable named '{0}' with the same Namespace '{1}' already belongs to this DataSet."; - public const string DataTable_SelfnestedDatasetConflictingName = "The table ({0}) cannot be the child table to itself in a nested relation: the DataSet name conflicts with the table name."; - public const string DataTable_DatasetConflictingName = "The name '{0}' is invalid. A DataTable cannot have the same name of the DataSet."; - public const string DataTable_AlreadyInOtherDataSet = "DataTable already belongs to another DataSet."; - public const string DataTable_AlreadyInTheDataSet = "DataTable already belongs to this DataSet."; - public const string DataTable_NotInTheDataSet = "Table {0} does not belong to this DataSet."; - public const string DataTable_OutOfRange = "Cannot find table {0}."; - public const string DataTable_InRelation = "Cannot remove a table that has existing relations. Remove relations first."; - public const string DataTable_InConstraint = "Cannot remove table {0}, because it referenced in ForeignKeyConstraint {1}. Remove the constraint first."; - public const string DataTable_TableNotFound = "DataTable '{0}' does not match to any DataTable in source."; - public const string DataMerge_MissingDefinition = "Target DataSet missing definition for {0}."; - public const string DataMerge_MissingConstraint = "Target DataSet missing {0} {1}."; - public const string DataMerge_DataTypeMismatch = "<target>.{0} and <source>.{0} have conflicting properties: DataType property mismatch."; - public const string DataMerge_PrimaryKeyMismatch = "<target>.PrimaryKey and <source>.PrimaryKey have different Length."; - public const string DataMerge_PrimaryKeyColumnsMismatch = "Mismatch columns in the PrimaryKey : <target>.{0} versus <source>.{1}."; - public const string DataMerge_ReltionKeyColumnsMismatch = "Relation {0} cannot be merged, because keys have mismatch columns."; - public const string DataMerge_MissingColumnDefinition = "Target table {0} missing definition for column {1}."; - public const string DataMerge_MissingPrimaryKeyColumnInSource = "PrimaryKey column {0} does not exist in source Table."; - public const string DataIndex_RecordStateRange = "The RowStates parameter must be set to a valid combination of values from the DataViewRowState enumeration."; - public const string DataIndex_FindWithoutSortOrder = "Find finds a row based on a Sort order, and no Sort order is specified."; - public const string DataIndex_KeyLength = "Expecting {0} value(s) for the key being indexed, but received {1} value(s)."; - public const string DataStorage_AggregateException = "Invalid usage of aggregate function {0}() and Type: {1}."; - public const string DataStorage_InvalidStorageType = "Invalid storage type: {0}."; - public const string DataStorage_ProblematicChars = "The DataSet Xml persistency does not support the value '{0}' as Char value, please use Byte storage instead."; - public const string DataStorage_SetInvalidDataType = "Type of value has a mismatch with column type"; - public const string DataStorage_IComparableNotDefined = "Type '{0}' does not implement IComparable interface. Comparison cannot be done."; - public const string DataView_SetFailed = "Cannot set {0}."; - public const string DataView_SetDataSetFailed = "Cannot change DataSet on a DataViewManager that's already the default view for a DataSet."; - public const string DataView_SetRowStateFilter = "RowStateFilter cannot show ModifiedOriginals and ModifiedCurrents at the same time."; - public const string DataView_SetTable = "Cannot change Table property on a DefaultView or a DataView coming from a DataViewManager."; - public const string DataView_CanNotSetDataSet = "Cannot change DataSet property once it is set."; - public const string DataView_CanNotUseDataViewManager = "DataSet must be set prior to using DataViewManager."; - public const string DataView_CanNotSetTable = "Cannot change Table property once it is set."; - public const string DataView_CanNotUse = "DataTable must be set prior to using DataView."; - public const string DataView_CanNotBindTable = "Cannot bind to DataTable with no name."; - public const string DataView_SetIListObject = "Cannot set an object into this list."; - public const string DataView_AddNewNotAllowNull = "Cannot call AddNew on a DataView where AllowNew is false."; - public const string DataView_NotOpen = "DataView is not open."; - public const string DataView_CreateChildView = "The relation is not parented to the table to which this DataView points."; - public const string DataView_CanNotDelete = "Cannot delete on a DataSource where AllowDelete is false."; - public const string DataView_CanNotEdit = "Cannot edit on a DataSource where AllowEdit is false."; - public const string DataView_GetElementIndex = "Index {0} is either negative or above rows count."; - public const string DataView_AddExternalObject = "Cannot add external objects to this list."; - public const string DataView_CanNotClear = "Cannot clear this list."; - public const string DataView_InsertExternalObject = "Cannot insert external objects to this list."; - public const string DataView_RemoveExternalObject = "Cannot remove objects not in the list."; - public const string DataROWView_PropertyNotFound = "{0} is neither a DataColumn nor a DataRelation for table {1}."; - public const string Range_Argument = "Min ({0}) must be less than or equal to max ({1}) in a Range object."; - public const string Range_NullRange = "This is a null range."; - public const string RecordManager_MinimumCapacity = "MinimumCapacity must be non-negative."; - public const string CodeGen_InvalidIdentifier = "Cannot generate identifier for name '{0}'."; - public const string CodeGen_DuplicateTableName = "There is more than one table with the same name '{0}' (even if namespace is different)."; - public const string CodeGen_TypeCantBeNull = "Column '{0}': Type '{1}' cannot be null."; - public const string CodeGen_NoCtor0 = "Column '{0}': Type '{1}' does not have parameterless constructor."; - public const string CodeGen_NoCtor1 = "Column '{0}': Type '{1}' does not have constructor with string argument."; - public const string SqlConvert_ConvertFailed = "Cannot convert object of type '{0}' to object of type '{1}'."; - public const string DataSet_DefaultDataException = "Data Exception."; - public const string DataSet_DefaultConstraintException = "Constraint Exception."; - public const string DataSet_DefaultDeletedRowInaccessibleException = "Deleted rows inaccessible."; - public const string DataSet_DefaultDuplicateNameException = "Duplicate name not allowed."; - public const string DataSet_DefaultInRowChangingEventException = "Operation not supported in the RowChanging event."; - public const string DataSet_DefaultInvalidConstraintException = "Invalid constraint."; - public const string DataSet_DefaultMissingPrimaryKeyException = "Missing primary key."; - public const string DataSet_DefaultNoNullAllowedException = "Null not allowed."; - public const string DataSet_DefaultReadOnlyException = "Column is marked read only."; - public const string DataSet_DefaultRowNotInTableException = "Row not found in table."; - public const string DataSet_DefaultVersionNotFoundException = "Version not found."; - public const string Load_ReadOnlyDataModified = "ReadOnly Data is Modified."; - public const string DataTableReader_InvalidDataTableReader = "DataTableReader is invalid for current DataTable '{0}'."; - public const string DataTableReader_SchemaInvalidDataTableReader = "Schema of current DataTable '{0}' in DataTableReader has changed, DataTableReader is invalid."; - public const string DataTableReader_CannotCreateDataReaderOnEmptyDataSet = "DataTableReader Cannot be created. There is no DataTable in DataSet."; - public const string DataTableReader_DataTableReaderArgumentIsEmpty = "Cannot create DataTableReader. Argument is Empty."; - public const string DataTableReader_ArgumentContainsNullValue = "Cannot create DataTableReader. Arguments contain null value."; - public const string DataTableReader_InvalidRowInDataTableReader = "Current DataRow is either in Deleted or Detached state."; - public const string DataTableReader_DataTableCleared = "Current DataTable '{0}' is empty. There is no DataRow in DataTable."; - public const string RbTree_InvalidState = "DataTable internal index is corrupted: '{0}'."; - public const string RbTree_EnumerationBroken = "Collection was modified; enumeration operation might not execute."; - public const string NamedSimpleType_InvalidDuplicateNamedSimpleTypeDelaration = "Simple type '{0}' has already be declared with different '{1}'."; - public const string DataDom_Foliation = "Invalid foliation."; - public const string DataDom_TableNameChange = "Cannot change the table name once the associated DataSet is mapped to a loaded XML document."; - public const string DataDom_TableNamespaceChange = "Cannot change the table namespace once the associated DataSet is mapped to a loaded XML document."; - public const string DataDom_ColumnNameChange = "Cannot change the column name once the associated DataSet is mapped to a loaded XML document."; - public const string DataDom_ColumnNamespaceChange = "Cannot change the column namespace once the associated DataSet is mapped to a loaded XML document."; - public const string DataDom_ColumnMappingChange = "Cannot change the ColumnMapping property once the associated DataSet is mapped to a loaded XML document."; - public const string DataDom_TableColumnsChange = "Cannot add or remove columns from the table once the DataSet is mapped to a loaded XML document."; - public const string DataDom_DataSetTablesChange = "Cannot add or remove tables from the DataSet once the DataSet is mapped to a loaded XML document."; - public const string DataDom_DataSetNestedRelationsChange = "Cannot add, remove, or change Nested relations from the DataSet once the DataSet is mapped to a loaded XML document."; - public const string DataDom_DataSetNull = "The DataSet parameter is invalid. It cannot be null."; - public const string DataDom_DataSetNameChange = "Cannot change the DataSet name once the DataSet is mapped to a loaded XML document."; - public const string DataDom_CloneNode = "This type of node cannot be cloned: {0}."; - public const string DataDom_MultipleLoad = "Cannot load XmlDataDocument if it already contains data. Please use a new XmlDataDocument."; - public const string DataDom_MultipleDataSet = "DataSet can be associated with at most one XmlDataDocument. Cannot associate the DataSet with the current XmlDataDocument because the DataSet is already associated with another XmlDataDocument."; - public const string DataDom_EnforceConstraintsShouldBeOff = "Please set DataSet.EnforceConstraints == false before trying to edit XmlDataDocument using XML operations."; - public const string DataDom_NotSupport_GetElementById = "GetElementById() is not supported on DataDocument."; - public const string DataDom_NotSupport_EntRef = "Cannot create entity references on DataDocument."; - public const string DataDom_NotSupport_Clear = "Clear function on DateSet and DataTable is not supported on XmlDataDocument."; - public const string StrongTyping_CannotRemoveColumn = "Cannot remove column since it is built in to this dataSet."; - public const string StrongTyping_CananotRemoveRelation = "Cannot remove relation since it is built in to this dataSet."; - public const string propertyChangedEventDescr = "Occurs whenever a property for this control changes."; - public const string collectionChangedEventDescr = "Occurs whenever this collection's membership changes."; - public const string StrongTyping_CananotAccessDBNull = "Cannot get value because it is DBNull."; - public const string ADP_PropertyNotSupported = "The '{0}' property requires Microsoft WindowsNT or a WindowsNT based operating system."; - public const string ConfigProviderNotFound = "Unable to find the requested .Net Framework Data Provider. It may not be installed."; - public const string ConfigProviderInvalid = "The requested .Net Framework Data Provider's implementation does not have an Instance field of a System.Data.Common.DbProviderFactory derived type."; - public const string ConfigProviderNotInstalled = "Failed to find or load the registered .Net Framework Data Provider."; - public const string ConfigProviderMissing = "The missing .Net Framework Data Provider's assembly qualified name is required."; - public const string ConfigBaseElementsOnly = "Only elements allowed."; - public const string ConfigBaseNoChildNodes = "Child nodes not allowed."; - public const string ConfigUnrecognizedAttributes = "Unrecognized attribute '{0}'."; - public const string ConfigUnrecognizedElement = "Unrecognized element."; - public const string ConfigSectionsUnique = "The '{0}' section can only appear once per config file."; - public const string ConfigRequiredAttributeMissing = "Required attribute '{0}' not found."; - public const string ConfigRequiredAttributeEmpty = "Required attribute '{0}' cannot be empty."; - public const string ADP_EmptyArray = "Expecting non-empty array for '{0}' parameter."; - public const string ADP_SingleValuedProperty = "The only acceptable value for the property '{0}' is '{1}'."; - public const string ADP_DoubleValuedProperty = "The acceptable values for the property '{0}' are '{1}' or '{2}'."; - public const string ADP_InvalidPrefixSuffix = "Specified QuotePrefix and QuoteSuffix values do not match."; - public const string ADP_InvalidArgumentLength = "The length of argument '{0}' exceeds it's limit of '{1}'."; - public const string SQL_WrongType = "Expecting argument of type {1}, but received type {0}."; - public const string ADP_InvalidConnectionOptionValue = "Invalid value for key '{0}'."; - public const string ADP_MissingConnectionOptionValue = "Use of key '{0}' requires the key '{1}' to be present."; - public const string ADP_InvalidConnectionOptionValueLength = "The value's length for key '{0}' exceeds it's limit of '{1}'."; - public const string ADP_KeywordNotSupported = "Keyword not supported: '{0}'."; - public const string ADP_UdlFileError = "Unable to load the UDL file."; - public const string ADP_InvalidUDL = "Invalid UDL file."; - public const string ADP_InternalProviderError = "Internal .Net Framework Data Provider error {0}."; - public const string ADP_NoQuoteChange = "The QuotePrefix and QuoteSuffix properties cannot be changed once an Insert, Update, or Delete command has been generated."; - public const string ADP_MissingSourceCommand = "The DataAdapter.SelectCommand property needs to be initialized."; - public const string ADP_MissingSourceCommandConnection = "The DataAdapter.SelectCommand.Connection property needs to be initialized;"; - public const string ADP_InvalidMultipartName = "{0} \"{1}\"."; - public const string ADP_InvalidMultipartNameQuoteUsage = "{0} \"{1}\", incorrect usage of quotes."; - public const string ADP_InvalidMultipartNameToManyParts = "{0} \"{1}\", the current limit of \"{2}\" is insufficient."; - public const string SQL_BulkCopyDestinationTableName = "SqlBulkCopy.WriteToServer failed because the SqlBulkCopy.DestinationTableName is an invalid multipart name"; - public const string SQL_TDSParserTableName = "Processing of results from SQL Server failed because of an invalid multipart name"; - public const string SQL_UDTTypeName = "SqlParameter.UdtTypeName is an invalid multipart name"; - public const string SQL_TypeName = "SqlParameter.TypeName is an invalid multipart name"; - public const string SQL_SqlCommandCommandText = "SqlCommand.DeriveParameters failed because the SqlCommand.CommandText property value is an invalid multipart name"; - public const string ODBC_ODBCCommandText = "OdbcCommandBuilder.DeriveParameters failed because the OdbcCommand.CommandText property value is an invalid multipart name"; - public const string OLEDB_OLEDBCommandText = "OleDbCommandBuilder.DeriveParameters failed because the OleDbCommandBuilder.CommandText property value is an invalid multipart name"; - public const string SQLMSF_FailoverPartnerNotSupported = "Connecting to a mirrored SQL Server instance using the MultiSubnetFailover connection option is not supported."; - public const string ADP_ColumnSchemaExpression = "The column mapping from SourceColumn '{0}' failed because the DataColumn '{1}' is a computed column."; - public const string ADP_ColumnSchemaMismatch = "Inconvertible type mismatch between SourceColumn '{0}' of {1} and the DataColumn '{2}' of {3}."; - public const string ADP_ColumnSchemaMissing1 = "Missing the DataColumn '{0}' for the SourceColumn '{2}'."; - public const string ADP_ColumnSchemaMissing2 = "Missing the DataColumn '{0}' in the DataTable '{1}' for the SourceColumn '{2}'."; - public const string ADP_InvalidSourceColumn = "SourceColumn is required to be a non-empty string."; - public const string ADP_MissingColumnMapping = "Missing SourceColumn mapping for '{0}'."; - public const string ADP_NotSupportedEnumerationValue = "The {0} enumeration value, {1}, is not supported by the {2} method."; - public const string ODBC_NotSupportedEnumerationValue = "The {0} enumeration value, {1}, is not supported by the .Net Framework Odbc Data Provider."; - public const string OLEDB_NotSupportedEnumerationValue = "The {0} enumeration value, {1}, is not supported by the .Net Framework OleDb Data Provider."; - public const string SQL_NotSupportedEnumerationValue = "The {0} enumeration value, {1}, is not supported by the .Net Framework SqlClient Data Provider."; - public const string ADP_ComputerNameEx = "Unable to retrieve the ComputerNameDnsFullyQualified, {0}."; - public const string ADP_MissingTableSchema = "Missing the '{0}' DataTable for the '{1}' SourceTable."; - public const string ADP_InvalidSourceTable = "SourceTable is required to be a non-empty string"; - public const string ADP_MissingTableMapping = "Missing SourceTable mapping: '{0}'"; - public const string ADP_CommandTextRequired = "{0}: CommandText property has not been initialized"; - public const string ADP_ConnectionRequired = "{0}: Connection property has not been initialized."; - public const string ADP_OpenConnectionRequired = "{0} requires an open and available Connection. {1}"; - public const string ADP_ConnectionRequired_Fill = "Fill: SelectCommand.Connection property has not been initialized."; - public const string ADP_ConnectionRequired_FillPage = "FillPage: SelectCommand.Connection property has not been initialized."; - public const string ADP_ConnectionRequired_FillSchema = "FillSchema: SelectCommand.Connection property has not been initialized."; - public const string ADP_ConnectionRequired_Insert = "Update requires the InsertCommand to have a connection object. The Connection property of the InsertCommand has not been initialized."; - public const string ADP_ConnectionRequired_Update = "Update requires the UpdateCommand to have a connection object. The Connection property of the UpdateCommand has not been initialized."; - public const string ADP_ConnectionRequired_Delete = "Update requires the DeleteCommand to have a connection object. The Connection property of the DeleteCommand has not been initialized."; - public const string ADP_ConnectionRequired_Batch = "Update requires a connection object. The Connection property has not been initialized."; - public const string ADP_ConnectionRequired_Clone = "Update requires the command clone to have a connection object. The Connection property of the command clone has not been initialized."; - public const string ADP_ConnecitonRequired_UpdateRows = "Update requires a connection."; - public const string ADP_OpenConnectionRequired_Insert = "Update requires the {0}Command to have an open connection object. {1}"; - public const string ADP_OpenConnectionRequired_Update = "Update requires the {0}Command to have an open connection object. {1}"; - public const string ADP_OpenConnectionRequired_Delete = "Update requires the {0}Command to have an open connection object. {1}"; - public const string ADP_OpenConnectionRequired_Clone = "Update requires the updating command to have an open connection object. {1}"; - public const string ADP_NoStoredProcedureExists = "The stored procedure '{0}' doesn't exist."; - public const string ADP_TransactionCompleted = "The transaction assigned to this command must be the most nested pending local transaction."; - public const string ADP_TransactionConnectionMismatch = "The transaction is either not associated with the current connection or has been completed."; - public const string ADP_TransactionCompletedButNotDisposed = "The transaction associated with the current connection has completed but has not been disposed. The transaction must be disposed before the connection can be used to execute SQL statements."; - public const string ADP_TransactionRequired = "{0} requires the command to have a transaction when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized."; - public const string ADP_OpenResultSetExists = "There is already an open SqlResultSet associated with this command which must be closed first."; - public const string ADP_OpenReaderExists = "There is already an open DataReader associated with this Command which must be closed first."; - public const string ADP_DeriveParametersNotSupported = "{0} DeriveParameters only supports CommandType.StoredProcedure, not CommandType.{1}."; - public const string ADP_CalledTwice = "The method '{0}' cannot be called more than once for the same execution."; - public const string ADP_IncorrectAsyncResult = "Incorrect async result."; - public const string ADP_MissingSelectCommand = "The SelectCommand property has not been initialized before calling '{0}'."; - public const string ADP_UnwantedStatementType = "The StatementType {0} is not expected here."; - public const string ADP_FillSchemaRequiresSourceTableName = "FillSchema: expected a non-empty string for the SourceTable name."; - public const string ADP_InvalidMaxRecords = "The MaxRecords value of {0} is invalid; the value must be >= 0."; - public const string ADP_InvalidStartRecord = "The StartRecord value of {0} is invalid; the value must be >= 0."; - public const string ADP_FillRequiresSourceTableName = "Fill: expected a non-empty string for the SourceTable name."; - public const string ADP_FillChapterAutoIncrement = "Hierarchical chapter columns must map to an AutoIncrement DataColumn."; - public const string ADP_MissingDataReaderFieldType = "DataReader.GetFieldType({0}) returned null."; - public const string ADP_OnlyOneTableForStartRecordOrMaxRecords = "Only specify one item in the dataTables array when using non-zero values for startRecords or maxRecords."; - public const string ADP_UpdateRequiresSourceTable = "Update unable to find TableMapping['{0}'] or DataTable '{0}'."; - public const string ADP_UpdateRequiresSourceTableName = "Update: expected a non-empty SourceTable name."; - public const string ADP_MissingTableMappingDestination = "Missing TableMapping when TableMapping.DataSetTable='{0}'."; - public const string ADP_UpdateRequiresCommandClone = "Update requires the command clone to be valid."; - public const string ADP_UpdateRequiresCommandSelect = "Auto SQL generation during Update requires a valid SelectCommand."; - public const string ADP_UpdateRequiresCommandInsert = "Update requires a valid InsertCommand when passed DataRow collection with new rows."; - public const string ADP_UpdateRequiresCommandUpdate = "Update requires a valid UpdateCommand when passed DataRow collection with modified rows."; - public const string ADP_UpdateRequiresCommandDelete = "Update requires a valid DeleteCommand when passed DataRow collection with deleted rows."; - public const string ADP_UpdateMismatchRowTable = "DataRow[{0}] is from a different DataTable than DataRow[0]."; - public const string ADP_RowUpdatedErrors = "RowUpdatedEvent: Errors occurred; no additional is information available."; - public const string ADP_RowUpdatingErrors = "RowUpdatingEvent: Errors occurred; no additional is information available."; - public const string ADP_ResultsNotAllowedDuringBatch = "When batching, the command's UpdatedRowSource property value of UpdateRowSource.FirstReturnedRecord or UpdateRowSource.Both is invalid."; - public const string ADP_UpdateConcurrencyViolation_Update = "Concurrency violation: the UpdateCommand affected {0} of the expected {1} records."; - public const string ADP_UpdateConcurrencyViolation_Delete = "Concurrency violation: the DeleteCommand affected {0} of the expected {1} records."; - public const string ADP_UpdateConcurrencyViolation_Batch = "Concurrency violation: the batched command affected {0} of the expected {1} records."; - public const string ADP_InvalidCommandTimeout = "Invalid CommandTimeout value {0}; the value must be >= 0."; - public const string ADP_UninitializedParameterSize = "{1}[{0}]: the Size property has an invalid size of 0."; - public const string ADP_PrepareParameterType = "{0}.Prepare method requires all parameters to have an explicitly set type."; - public const string ADP_PrepareParameterSize = "{0}.Prepare method requires all variable length parameters to have an explicitly set non-zero Size."; - public const string ADP_PrepareParameterScale = "{0}.Prepare method requires parameters of type '{1}' have an explicitly set Precision and Scale."; - public const string ADP_MismatchedAsyncResult = "Mismatched end method call for asyncResult. Expected call to {0} but {1} was called instead."; - public const string ADP_ClosedConnectionError = "Invalid operation. The connection is closed."; - public const string ADP_ConnectionIsDisabled = "The connection has been disabled."; - public const string ADP_LocalTransactionPresent = "Cannot enlist in the transaction because a local transaction is in progress on the connection. Finish local transaction and retry."; - public const string ADP_TransactionPresent = "Connection currently has transaction enlisted. Finish current transaction and retry."; - public const string ADP_EmptyDatabaseName = "Database cannot be null, the empty string, or string of only whitespace."; - public const string ADP_DatabaseNameTooLong = "The argument is too long."; - public const string ADP_InvalidConnectTimeoutValue = "Invalid 'Connect Timeout' value which must be an integer >= 0."; - public const string ADP_InvalidSourceBufferIndex = "Invalid source buffer (size of {0}) offset: {1}"; - public const string ADP_InvalidDestinationBufferIndex = "Invalid destination buffer (size of {0}) offset: {1}"; - public const string ADP_DataReaderNoData = "No data exists for the row/column."; - public const string ADP_NumericToDecimalOverflow = "The numerical value is too large to fit into a 96 bit decimal."; - public const string ADP_StreamClosed = "Invalid attempt to {0} when stream is closed."; - public const string ADP_InvalidSeekOrigin = "Specified SeekOrigin value is invalid."; - public const string ADP_DynamicSQLJoinUnsupported = "Dynamic SQL generation is not supported against multiple base tables."; - public const string ADP_DynamicSQLNoTableInfo = "Dynamic SQL generation is not supported against a SelectCommand that does not return any base table information."; - public const string ADP_DynamicSQLNoKeyInfoDelete = "Dynamic SQL generation for the DeleteCommand is not supported against a SelectCommand that does not return any key column information."; - public const string ADP_DynamicSQLNoKeyInfoUpdate = "Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information."; - public const string ADP_DynamicSQLNoKeyInfoRowVersionDelete = "Dynamic SQL generation for the DeleteCommand is not supported against a SelectCommand that does not contain a row version column."; - public const string ADP_DynamicSQLNoKeyInfoRowVersionUpdate = "Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not contain a row version column."; - public const string ADP_DynamicSQLNestedQuote = "Dynamic SQL generation not supported against table names '{0}' that contain the QuotePrefix or QuoteSuffix character '{1}'."; - public const string ADP_NonSequentialColumnAccess = "Invalid attempt to read from column ordinal '{0}'. With CommandBehavior.SequentialAccess, you may only read from column ordinal '{1}' or greater."; - public const string ADP_InvalidDateTimeDigits = "Data type '{0}' can not be formatted as a literal because it has an invalid date time digits."; - public const string ADP_InvalidFormatValue = "The value can not be formatted as a literal of the requested type."; - public const string ADP_InvalidMaximumScale = "Data type '{0}' can not be formatted as a literal because it has an invalid maximum scale."; - public const string ADP_LiteralValueIsInvalid = "The literal value provided is not a valid literal for the data type '{0}'."; - public const string ADP_EvenLengthLiteralValue = "'{0}':The length of the literal value must be even."; - public const string ADP_HexDigitLiteralValue = "'{0}':The literal value must be a string with hexadecimal digits"; - public const string ADP_QuotePrefixNotSet = "{0} requires open connection when the quote prefix has not been set."; - public const string ADP_UnableToCreateBooleanLiteral = "Can not determine the correct boolean literal values. Boolean literals can not be created."; - public const string ADP_UnsupportedNativeDataTypeOleDb = "Literals of the native data type associated with data type '{0}' are not supported."; - public const string ADP_InvalidDataType = "The parameter data type of {0} is invalid."; - public const string ADP_UnknownDataType = "No mapping exists from object type {0} to a known managed provider native type."; - public const string ADP_UnknownDataTypeCode = "Unable to handle an unknown TypeCode {0} returned by Type {1}."; - public const string ADP_DbTypeNotSupported = "No mapping exists from DbType {0} to a known {1}."; - public const string ADP_VersionDoesNotSupportDataType = "The version of SQL Server in use does not support datatype '{0}'."; - public const string ADP_ParameterValueOutOfRange = "Parameter value '{0}' is out of range."; - public const string ADP_BadParameterName = "Specified parameter name '{0}' is not valid."; - public const string ADP_MultipleReturnValue = "Multiple return value parameters are not supported."; - public const string ADP_InvalidSizeValue = "Invalid parameter Size value '{0}'. The value must be greater than or equal to 0."; - public const string ADP_NegativeParameter = "Invalid value for argument '{0}'. The value must be greater than or equal to 0."; - public const string ADP_InvalidMetaDataValue = "Invalid value for this metadata."; - public const string ADP_NotRowType = "Metadata must be SqlDbType.Row"; - public const string ADP_ParameterConversionFailed = "Failed to convert parameter value from a {0} to a {1}."; - public const string ADP_ParallelTransactionsNotSupported = "{0} does not support parallel transactions."; - public const string ADP_TransactionZombied = "This {0} has completed; it is no longer usable."; - public const string ADP_DbRecordReadOnly = "'{0}' cannot be called when the record is read only."; - public const string ADP_DbDataUpdatableRecordReadOnly = "'{0}' cannot be called when the DbDataRecord is read only."; - public const string ADP_InvalidImplicitConversion = "Implicit conversion of object type '{0}' to data type '{1}' is not supported."; - public const string ADP_InvalidBufferSizeOrIndex = "Buffer offset '{1}' plus the bytes available '{0}' is greater than the length of the passed in buffer."; - public const string ADP_InvalidDataLength = "Data length '{0}' is less than 0."; - public const string ADP_InvalidDataLength2 = "Specified length '{0}' is out of range."; - public const string ADP_NonSeqByteAccess = "Invalid {2} attempt at dataIndex '{0}'. With CommandBehavior.SequentialAccess, you may only read from dataIndex '{1}' or greater."; - public const string ADP_OffsetOutOfRangeException = "Offset must refer to a location within the value."; - public const string ODBC_GetSchemaRestrictionRequired = "The ODBC managed provider requires that the TABLE_NAME restriction be specified and non-null for the GetSchema indexes collection."; - public const string ADP_InvalidArgumentValue = "Invalid argument value for method '{0}'."; - public const string ADP_OdbcNoTypesFromProvider = "The ODBC provider did not return results from SQLGETTYPEINFO."; - public const string ADP_NullDataTable = "Unexpected null DataTable argument"; - public const string ADP_NullDataSet = "Unexpected null DataSet argument."; - public const string OdbcConnection_ConnectionStringTooLong = "Connection string exceeds maximum allowed length of {0}."; - public const string Odbc_GetTypeMapping_UnknownType = "{0} - unable to map type."; - public const string Odbc_UnknownSQLType = "Unknown SQL type - {0}."; - public const string Odbc_UnknownURTType = "Unknown URT type - {0}."; - public const string Odbc_NegativeArgument = "Invalid negative argument!"; - public const string Odbc_CantSetPropertyOnOpenConnection = "Can't set property on an open connection."; - public const string Odbc_NoMappingForSqlTransactionLevel = "No valid mapping for a SQL_TRANSACTION '{0}' to a System.Data.IsolationLevel enumeration value."; - public const string Odbc_CantEnableConnectionpooling = "{0} - unable to enable connection pooling..."; - public const string Odbc_CantAllocateEnvironmentHandle = "{0} - unable to allocate an environment handle."; - public const string Odbc_FailedToGetDescriptorHandle = "{0} - unable to get descriptor handle."; - public const string Odbc_NotInTransaction = "Not in a transaction"; - public const string Odbc_UnknownOdbcType = "Invalid OdbcType enumeration value={0}."; - public const string Odbc_NullData = "Use IsDBNull when DBNull.Value data is expected."; - public const string Odbc_ExceptionMessage = "{0} [{1}] {2}"; - public const string Odbc_ExceptionNoInfoMsg = "{0} - no error information available"; - public const string Odbc_ConnectionClosed = "The connection is closed."; - public const string Odbc_OpenConnectionNoOwner = "An internal connection does not have an owner."; - public const string Odbc_MDACWrongVersion = "The .Net Framework Odbc Data Provider requires Microsoft Data Access Components(MDAC) version 2.6 or later. Version {0} was found currently installed."; - public const string OleDb_MDACWrongVersion = "The .Net Framework OleDb Data Provider requires Microsoft Data Access Components(MDAC) version 2.6 or later. Version {0} was found currently installed."; - public const string OleDb_SchemaRowsetsNotSupported = "'{0}' interface is not supported by the '{1}' provider. GetOleDbSchemaTable is unavailable with the current provider."; - public const string OleDb_NoErrorInformation2 = "'{0}' failed with no error message available, result code: {1}."; - public const string OleDb_NoErrorInformation = "No error message available, result code: {0}."; - public const string OleDb_MDACNotAvailable = "The .Net Framework Data Providers require Microsoft Data Access Components(MDAC). Please install Microsoft Data Access Components(MDAC) version 2.6 or later."; - public const string OleDb_MSDASQLNotSupported = "The .Net Framework Data Provider for OLEDB (System.Data.OleDb) does not support the Microsoft OLE DB Provider for ODBC Drivers (MSDASQL). Use the .Net Framework Data Provider for ODBC (System.Data.Odbc)."; - public const string OleDb_PossiblePromptNotUserInteractive = "The .Net Framework Data Provider for OLEDB will not allow the OLE DB Provider to prompt the user in a non-interactive environment."; - public const string OleDb_ProviderUnavailable = "The '{0}' provider is not registered on the local machine."; - public const string OleDb_CommandTextNotSupported = "The ICommandText interface is not supported by the '{0}' provider. Use CommandType.TableDirect instead."; - public const string OleDb_TransactionsNotSupported = "The ITransactionLocal interface is not supported by the '{0}' provider. Local transactions are unavailable with the current provider."; - public const string OleDb_ConnectionStringSyntax = "Format of the initialization string does not conform to the OLE DB specification. Starting around char[{0}] in the connection string."; - public const string OleDb_AsynchronousNotSupported = "'Asynchronous Processing' is not a supported feature of the .Net Framework Data OLE DB Provider(System.Data.OleDb)."; - public const string OleDb_NoProviderSpecified = "An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'."; - public const string OleDb_InvalidProviderSpecified = "The OLE DB Provider specified in the ConnectionString is too long."; - public const string OleDb_InvalidRestrictionsDbInfoKeywords = "No restrictions are expected for the DbInfoKeywords OleDbSchemaGuid."; - public const string OleDb_InvalidRestrictionsDbInfoLiteral = "No restrictions are expected for the DbInfoLiterals OleDbSchemaGuid."; - public const string OleDb_InvalidRestrictionsSchemaGuids = "No restrictions are expected for the schema guid OleDbSchemaGuid."; - public const string OleDb_NotSupportedSchemaTable = "The {0} OleDbSchemaGuid is not a supported schema by the '{1}' provider."; - public const string OleDb_ConfigWrongNumberOfValues = "The '{0}' configuration setting has the wrong number of values."; - public const string OleDb_ConfigUnableToLoadXmlMetaDataFile = "Unable to load the XML file specified in configuration setting '{0}'."; - public const string OleDb_CommandParameterBadAccessor = "Command parameter[{0}] '{1}' is invalid."; - public const string OleDb_CommandParameterCantConvertValue = "Command parameter[{0}] '{1}' data value could not be converted for reasons other than sign mismatch or data overflow."; - public const string OleDb_CommandParameterSignMismatch = "Conversion failed for command parameter[{0}] '{1}' because the data value was signed and the type used by the provider was unsigned."; - public const string OleDb_CommandParameterDataOverflow = "Conversion failed for command parameter[{0}] '{1}' because the data value overflowed the type used by the provider."; - public const string OleDb_CommandParameterUnavailable = "Provider encountered an error while sending command parameter[{0}] '{1}' value and stopped processing."; - public const string OleDb_CommandParameterDefault = "Parameter[{0}] '{1}' has no default value."; - public const string OleDb_CommandParameterError = "Error occurred with parameter[{0}]: {1}."; - public const string OleDb_BadStatus_ParamAcc = "System.Data.OleDb.OleDbDataAdapter internal error: invalid parameter accessor: {0} {1}."; - public const string OleDb_UninitializedParameters = "Parameter[{0}]: the OleDbType property is uninitialized: OleDbType.{1}."; - public const string OleDb_NoProviderSupportForParameters = "The ICommandWithParameters interface is not supported by the '{0}' provider. Command parameters are unsupported with the current provider."; - public const string OleDb_NoProviderSupportForSProcResetParameters = "Retrieving procedure parameter information is not supported by the '{0}' provider."; - public const string OleDb_CanNotDetermineDecimalSeparator = "Can not determine the server's decimal separator. Non-integer numeric literals can not be created."; - public const string OleDb_Fill_NotADODB = "Object is not an ADODB.RecordSet or an ADODB.Record."; - public const string OleDb_Fill_EmptyRecordSet = "Unable to retrieve the '{0}' interface from the ADODB.RecordSet object."; - public const string OleDb_Fill_EmptyRecord = "Unable to retrieve the IRow interface from the ADODB.Record object."; - public const string OleDb_ISourcesRowsetNotSupported = "Type does not support the OLE DB interface ISourcesRowset"; - public const string OleDb_IDBInfoNotSupported = "Cannot construct the ReservedWords schema collection because the provider does not support IDBInfo."; - public const string OleDb_PropertyNotSupported = "The property's value was not set because the provider did not support the '{0}' property, or the consumer attempted to get or set values of properties not in the Initialization property group and the data source object is uninitialized."; - public const string OleDb_PropertyBadValue = "Failed to initialize the '{0}' property for one of the following reasons:\r\n\tThe value data type was not the data type of the property or was not null. For example, the property was DBPROP_MEMORYUSAGE, which has a data type of Int32, and the data type was Int64.\r\n\tThe value was not a valid value. For example, the property was DBPROP_MEMORYUSAGE and the value was negative.\r\n\tThe value was a valid value for the property and the provider supports the property as a settable property, but the provider does not support the value specified. This includes the case where the value was added to the property in OLE DB after the provider was written."; - public const string OleDb_PropertyBadOption = "The value of Options was invalid."; - public const string OleDb_PropertyBadColumn = "The ColumnID element was invalid."; - public const string OleDb_PropertyNotAllSettable = "A '{0}' property was specified to be applied to all columns but could not be applied to one or more of them."; - public const string OleDb_PropertyNotSettable = "The '{0}' property was read-only, or the consumer attempted to set values of properties in the Initialization property group after the data source object was initialized. Consumers can set the value of a read-only property to its current value. This status is also returned if a settable column property could not be set for the particular column."; - public const string OleDb_PropertyNotSet = "The optional '{0}' property's value was not set to the specified value and setting the property to the specified value was not possible."; - public const string OleDb_PropertyConflicting = "The '{0}'property's value was not set because doing so would have conflicted with an existing property."; - public const string OleDb_PropertyNotAvailable = "(Reserved)."; - public const string OleDb_PropertyStatusUnknown = "The provider returned an unknown DBPROPSTATUS_ value '{0}'."; - public const string OleDb_BadAccessor = "Accessor validation was deferred and was performed while the method returned data. The binding was invalid for this column or parameter."; - public const string OleDb_BadStatusRowAccessor = "OleDbDataAdapter internal error: invalid row set accessor: Ordinal={0} Status={1}."; - public const string OleDb_CantConvertValue = "The data value could not be converted for reasons other than sign mismatch or data overflow. For example, the data was corrupted in the data store but the row was still retrievable."; - public const string OleDb_CantCreate = "The provider could not allocate memory in which to return {0} data."; - public const string OleDb_DataOverflow = "Conversion failed because the {0} data value overflowed the type specified for the {0} value part in the consumer's buffer."; - public const string OleDb_GVtUnknown = "OleDbDataAdapter internal error: [get] Unknown OLE DB data type: 0x{0} ({1})."; - public const string OleDb_SignMismatch = "Conversion failed because the {0} data value was signed and the type specified for the {0} value part in the consumer's buffer was unsigned."; - public const string OleDb_SVtUnknown = "OleDbDataAdapter internal error: [set] Unknown OLE DB data type: 0x{0} ({1})."; - public const string OleDb_Unavailable = "The provider could not determine the {0} value. For example, the row was just created, the default for the {0} column was not available, and the consumer had not yet set a new {0} value."; - public const string OleDb_UnexpectedStatusValue = "OLE DB Provider returned an unexpected status value of {0}."; - public const string OleDb_ThreadApartmentState = "The OleDbDataReader.Read must be used from the same thread on which is was created if that thread's ApartmentState was not ApartmentState.MTA."; - public const string OleDb_NoErrorMessage = "Unspecified error: {0}"; - public const string OleDb_FailedGetDescription = "IErrorInfo.GetDescription failed with {0}."; - public const string OleDb_FailedGetSource = "IErrorInfo.GetSource failed with {0}."; - public const string OleDb_DBBindingGetVector = "DBTYPE_VECTOR data is not supported by the .Net Framework Data OLE DB Provider(System.Data.OleDb)."; - public const string ADP_InvalidMinMaxPoolSizeValues = "Invalid min or max pool size values, min pool size cannot be greater than the max pool size."; - public const string ADP_ObsoleteKeyword = "The '{0}' keyword is obsolete. Use '{1}' instead."; - public const string SQL_CannotGetDTCAddress = "Unable to get the address of the distributed transaction coordinator for the server, from the server. Is DTC enabled on the server?"; - public const string SQL_InvalidOptionLength = "The length of the value for the connection parameter <{0}> exceeds the maximum allowed 65535 characters."; - public const string SQL_InvalidPacketSizeValue = "Invalid 'Packet Size'. The value must be an integer >= 512 and <= 32768."; - public const string SQL_NullEmptyTransactionName = "Invalid transaction or invalid name for a point at which to save within the transaction."; - public const string SQL_SnapshotNotSupported = "The {0} enumeration value, {1}, is not supported by SQL Server 7.0 or SQL Server 2000."; - public const string SQL_UserInstanceFailoverNotCompatible = "User Instance and Failover are not compatible options. Please choose only one of the two in the connection string."; - public const string SQL_EncryptionNotSupportedByClient = "The instance of SQL Server you attempted to connect to requires encryption but this machine does not support it."; - public const string SQL_EncryptionNotSupportedByServer = "The instance of SQL Server you attempted to connect to does not support encryption."; - public const string SQL_InvalidSQLServerVersionUnknown = "Unsupported SQL Server version. The .Net Framework SqlClient Data Provider can only be used with SQL Server versions 7.0 and later."; - public const string SQL_CannotModifyPropertyAsyncOperationInProgress = "{0} cannot be changed while async operation is in progress."; - public const string SQL_AsyncConnectionRequired = "This command requires an asynchronous connection. Set \"Asynchronous Processing=true\" in the connection string."; - public const string SQL_FatalTimeout = "Timeout expired. The connection has been broken as a result."; - public const string SQL_InstanceFailure = "Instance failure."; - public const string SQL_ChangePasswordArgumentMissing = "The '{0}' argument must not be null or empty."; - public const string SQL_ChangePasswordConflictsWithSSPI = "ChangePassword can only be used with SQL authentication, not with integrated security."; - public const string SQL_ChangePasswordUseOfUnallowedKey = "The keyword '{0}' must not be specified in the connectionString argument to ChangePassword."; - public const string SQL_UnknownSysTxIsolationLevel = "Unrecognized System.Transactions.IsolationLevel enumeration value: {0}."; - public const string SQL_InvalidPartnerConfiguration = "Server {0}, database {1} is not configured for database mirroring."; - public const string SQL_MarsUnsupportedOnConnection = "The connection does not support MultipleActiveResultSets."; - public const string SQL_ChangePasswordRequiresYukon = "ChangePassword requires SQL Server 9.0 or later."; - public const string SQL_NonLocalSSEInstance = "SSE Instance re-direction is not supported for non-local user instances."; - public const string SQL_AsyncOperationCompleted = "The asynchronous operation has already completed."; - public const string SQL_PendingBeginXXXExists = "The command execution cannot proceed due to a pending asynchronous operation already in progress."; - public const string SQL_NonXmlResult = "Invalid command sent to ExecuteXmlReader. The command must return an Xml result."; - public const string SQL_NotificationsRequireYukon = "Notifications require SQL Server 9.0 or later."; - public const string SQL_InvalidUdt3PartNameFormat = "Invalid 3 part name format for UdtTypeName."; - public const string SQL_InvalidParameterTypeNameFormat = "Invalid 3 part name format for TypeName."; - public const string SQL_InvalidParameterNameLength = "The length of the parameter '{0}' exceeds the limit of 128 characters."; - public const string SQL_PrecisionValueOutOfRange = "Precision value '{0}' is either less than 0 or greater than the maximum allowed precision of 38."; - public const string SQL_ScaleValueOutOfRange = "Scale value '{0}' is either less than 0 or greater than the maximum allowed scale of 38."; - public const string SQL_TimeScaleValueOutOfRange = "Scale value '{0}' is either less than 0 or greater than the maximum allowed scale of 7."; - public const string SQL_ParameterInvalidVariant = "Parameter '{0}' exceeds the size limit for the sql_variant datatype."; - public const string SQL_ParameterTypeNameRequired = "The {0} type parameter '{1}' must have a valid type name."; - public const string SQL_InvalidInternalPacketSize = "Invalid internal packet size:"; - public const string SQL_InvalidTDSVersion = "The SQL Server instance returned an invalid or unsupported protocol version during login negotiation."; - public const string SQL_InvalidTDSPacketSize = "Invalid Packet Size."; - public const string SQL_ParsingError = "Internal connection fatal error."; - public const string SQL_ConnectionLockedForBcpEvent = "The connection cannot be used because there is an ongoing operation that must be finished."; - public const string SQL_SNIPacketAllocationFailure = "Memory allocation for internal connection failed."; - public const string SQL_SmallDateTimeOverflow = "SqlDbType.SmallDateTime overflow. Value '{0}' is out of range. Must be between 1/1/1900 12:00:00 AM and 6/6/2079 11:59:59 PM."; - public const string SQL_TimeOverflow = "SqlDbType.Time overflow. Value '{0}' is out of range. Must be between 00:00:00.0000000 and 23:59:59.9999999."; - public const string SQL_MoneyOverflow = "SqlDbType.SmallMoney overflow. Value '{0}' is out of range. Must be between -214,748.3648 and 214,748.3647."; - public const string SQL_CultureIdError = "The Collation specified by SQL Server is not supported."; - public const string SQL_OperationCancelled = "Operation cancelled by user."; - public const string SQL_SevereError = "A severe error occurred on the current command. The results, if any, should be discarded."; - public const string SQL_SSPIGenerateError = "The target principal name is incorrect. Cannot generate SSPI context."; - public const string SQL_InvalidSSPIPacketSize = "Invalid SSPI packet size."; - public const string SQL_SSPIInitializeError = "Cannot initialize SSPI package."; - public const string SQL_Timeout = "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."; - public const string SQL_Timeout_PreLogin_Begin = "Connection Timeout Expired. The timeout period elapsed at the start of the pre-login phase. This could be because of insufficient time provided for connection timeout."; - public const string SQL_Timeout_PreLogin_InitializeConnection = "Connection Timeout Expired. The timeout period elapsed while attempting to create and initialize a socket to the server. This could be either because the server was unreachable or unable to respond back in time."; - public const string SQL_Timeout_PreLogin_SendHandshake = "Connection Timeout Expired. The timeout period elapsed while making a pre-login handshake request. This could be because the server was unable to respond back in time."; - public const string SQL_Timeout_PreLogin_ConsumeHandshake = "Connection Timeout Expired. The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement. This could be because the pre-login handshake failed or the server was unable to respond back in time."; - public const string SQL_Timeout_Login_Begin = "Connection Timeout Expired. The timeout period elapsed at the start of the login phase. This could be because of insufficient time provided for connection timeout."; - public const string SQL_Timeout_Login_ProcessConnectionAuth = "Connection Timeout Expired. The timeout period elapsed while attempting to authenticate the login. This could be because the server failed to authenticate the user or the server was unable to respond back in time."; - public const string SQL_Timeout_PostLogin = "Connection Timeout Expired. The timeout period elapsed during the post-login phase. The connection could have timed out while waiting for server to complete the login process and respond; Or it could have timed out while attempting to create multiple active connections."; - public const string SQL_Timeout_FailoverInfo = "This failure occured while attempting to connect to the {0} server."; - public const string SQL_Timeout_RoutingDestinationInfo = "This failure occurred while attempting to connect to the routing destination. The duration spent while attempting to connect to the original server was - [Pre-Login] initialization={0}; handshake={1}; [Login] initialization={2}; authentication={3}; [Post-Login] complete={4};"; - public const string SQL_Duration_PreLogin_Begin = "The duration spent while attempting to connect to this server was - [Pre-Login] initialization={0};"; - public const string SQL_Duration_PreLoginHandshake = "The duration spent while attempting to connect to this server was - [Pre-Login] initialization={0}; handshake={1};"; - public const string SQL_Duration_Login_Begin = "The duration spent while attempting to connect to this server was - [Pre-Login] initialization={0}; handshake={1}; [Login] initialization={2};"; - public const string SQL_Duration_Login_ProcessConnectionAuth = "The duration spent while attempting to connect to this server was - [Pre-Login] initialization={0}; handshake={1}; [Login] initialization={2}; authentication={3};"; - public const string SQL_Duration_PostLogin = "The duration spent while attempting to connect to this server was - [Pre-Login] initialization={0}; handshake={1}; [Login] initialization={2}; authentication={3}; [Post-Login] complete={4};"; - public const string SQL_UserInstanceFailure = "A user instance was requested in the connection string but the server specified does not support this option."; - public const string SQL_ExceedsMaxDataLength = "Specified data length {0} exceeds the allowed maximum length of {1}."; - public const string SQL_InvalidRead = "Invalid attempt to read when no data is present."; - public const string SQL_NonBlobColumn = "Invalid attempt to GetBytes on column '{0}'. The GetBytes function can only be used on columns of type Text, NText, or Image."; - public const string SQL_NonCharColumn = "Invalid attempt to GetChars on column '{0}'. The GetChars function can only be used on columns of type Text, NText, Xml, VarChar or NVarChar."; - public const string SQL_StreamNotSupportOnColumnType = "Invalid attempt to GetStream on column '{0}'. The GetStream function can only be used on columns of type Binary, Image, Udt or VarBinary."; - public const string SQL_TextReaderNotSupportOnColumnType = "Invalid attempt to GetTextReader on column '{0}'. The GetTextReader function can only be used on columns of type Char, NChar, NText, NVarChar, Text or VarChar."; - public const string SQL_XmlReaderNotSupportOnColumnType = "Invalid attempt to GetXmlReader on column '{0}'. The GetXmlReader function can only be used on columns of type Xml."; - public const string SQL_InvalidBufferSizeOrIndex = "Buffer offset '{1}' plus the bytes available '{0}' is greater than the length of the passed in buffer."; - public const string SQL_InvalidDataLength = "Data length '{0}' is less than 0."; - public const string SQL_SqlResultSetClosed = "Invalid attempt to call method {0} when SqlResultSet is closed."; - public const string SQL_SqlResultSetClosed2 = "Operation cannot be completed because the SqlResultSet is closed."; - public const string SQL_SqlRecordReadOnly = "'{0}' cannot be called when the record is read only."; - public const string SQL_SqlRecordReadOnly2 = "Operation cannot be completed because the record is read only."; - public const string SQL_SqlResultSetRowDeleted = "Invalid attempt to call method {0} when the current row is deleted"; - public const string SQL_SqlResultSetRowDeleted2 = "Operation cannot be completed because the current row is deleted"; - public const string SQL_SqlResultSetCommandNotInSameConnection = "Operation cannot be completed because the command that created the SqlResultSet has been dissociated from the original connection. SqlResultSet is closed."; - public const string SQL_SqlResultSetNoAcceptableCursor = "SqlResultSet could not be created for the given query with the desired options."; - public const string SQL_SqlUpdatableRecordReadOnly = "'{0}' cannot be called when the SqlDataRecord is read only."; - public const string SQL_BulkLoadMappingInaccessible = "The mapped collection is in use and cannot be accessed at this time;"; - public const string SQL_BulkLoadMappingsNamesOrOrdinalsOnly = "Mappings must be either all name or all ordinal based."; - public const string SQL_BulkLoadCannotConvertValue = "The given value of type {0} from the data source cannot be converted to type {1} of the specified target column."; - public const string SQL_BulkLoadNonMatchingColumnMapping = "The given ColumnMapping does not match up with any column in the source or destination."; - public const string SQL_BulkLoadNonMatchingColumnName = "The given ColumnName '{0}' does not match up with any column in data source."; - public const string SQL_BulkLoadStringTooLong = "String or binary data would be truncated."; - public const string SQL_BulkLoadInvalidTimeout = "Timeout Value '{0}' is less than 0."; - public const string SQL_BulkLoadInvalidVariantValue = "Value cannot be converted to SqlVariant."; - public const string SQL_BulkLoadExistingTransaction = "Unexpected existing transaction."; - public const string SQL_BulkLoadNoCollation = "Failed to obtain column collation information for the destination table. If the table is not in the current database the name must be qualified using the database name (e.g. [mydb]..[mytable](e.g. [mydb]..[mytable]); this also applies to temporary-tables (e.g. #mytable would be specified as tempdb..#mytable)."; - public const string SQL_BulkLoadConflictingTransactionOption = "Must not specify SqlBulkCopyOption.UseInternalTransaction and pass an external Transaction at the same time."; - public const string SQL_BulkLoadInvalidOperationInsideEvent = "Function must not be called during event."; - public const string SQL_BulkLoadMissingDestinationTable = "The DestinationTableName property must be set before calling this method."; - public const string SQL_BulkLoadInvalidDestinationTable = "Cannot access destination table '{0}'."; - public const string SQL_BulkLoadNotAllowDBNull = "Column '{0}' does not allow DBNull.Value."; - public const string Sql_BulkLoadLcidMismatch = "The locale id '{0}' of the source column '{1}' and the locale id '{2}' of the destination column '{3}' do not match."; - public const string SQL_BulkLoadPendingOperation = "Attempt to invoke bulk copy on an object that has a pending operation."; - public const string SQL_ConnectionDoomed = "The requested operation cannot be completed because the connection has been broken."; - public const string SQL_OpenResultCountExceeded = "Open result count exceeded."; - public const string SQL_BatchedUpdatesNotAvailableOnContextConnection = "Batching updates is not supported on the context connection."; - public const string SQL_ContextAllowsLimitedKeywords = "The only additional connection string keyword that may be used when requesting the context connection is the Type System Version keyword."; - public const string SQL_ContextAllowsOnlyTypeSystem2005 = "The context connection does not support Type System Version=SQL Server 2000."; - public const string SQL_ContextConnectionIsInUse = "The context connection is already in use."; - public const string SQL_ContextUnavailableOutOfProc = "The requested operation requires a SqlClr context, which is only available when running in the Sql Server process."; - public const string SQL_ContextUnavailableWhileInProc = "The requested operation requires a Sql Server execution thread. The current thread was started by user code or other non-Sql Server engine code."; - public const string SQL_NestedTransactionScopesNotSupported = "Nested TransactionScopes are not supported."; - public const string SQL_NotAvailableOnContextConnection = "The requested operation is not available on the context connection."; - public const string SQL_NotificationsNotAvailableOnContextConnection = "Notifications are not available on the context connection."; - public const string SQL_UnexpectedSmiEvent = "Unexpected server event: {0}."; - public const string SQL_UserInstanceNotAvailableInProc = "User instances are not allowed when running in the Sql Server process."; - public const string SQL_ArgumentLengthMismatch = "The length of '{0}' must match the length of '{1}'."; - public const string SQL_InvalidSqlDbTypeWithOneAllowedType = "The SqlDbType '{0}' is invalid for {1}. Only {2} is supported."; - public const string SQL_PipeErrorRequiresSendEnd = "An error occurred with a prior row sent to the SqlPipe. SendResultsEnd must be called before anything else con be sent."; - public const string SQL_TooManyValues = "Too many values."; - public const string SQL_StreamWriteNotSupported = "The Stream does not support writing."; - public const string SQL_StreamReadNotSupported = "The Stream does not support reading."; - public const string SQL_StreamSeekNotSupported = "The Stream does not support seeking."; - public const string SQL_ExClientConnectionId = "ClientConnectionId:{0}"; - public const string SQL_ExErrorNumberStateClass = "Error Number:{0},State:{1},Class:{2}"; - public const string SQL_ExOriginalClientConnectionId = "ClientConnectionId before routing:{0}"; - public const string SQL_ExRoutingDestination = "Routing Destination:{0}"; - public const string SqlMisc_NullString = "Null"; - public const string SqlMisc_MessageString = "Message"; - public const string SqlMisc_ArithOverflowMessage = "Arithmetic Overflow."; - public const string SqlMisc_DivideByZeroMessage = "Divide by zero error encountered."; - public const string SqlMisc_NullValueMessage = "Data is Null. This method or property cannot be called on Null values."; - public const string SqlMisc_TruncationMessage = "Numeric arithmetic causes truncation."; - public const string SqlMisc_DateTimeOverflowMessage = "SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM."; - public const string SqlMisc_ConcatDiffCollationMessage = "Two strings to be concatenated have different collation."; - public const string SqlMisc_CompareDiffCollationMessage = "Two strings to be compared have different collation."; - public const string SqlMisc_InvalidFlagMessage = "Invalid flag value."; - public const string SqlMisc_NumeToDecOverflowMessage = "Conversion from SqlDecimal to Decimal overflows."; - public const string SqlMisc_ConversionOverflowMessage = "Conversion overflows."; - public const string SqlMisc_InvalidDateTimeMessage = "Invalid SqlDateTime."; - public const string SqlMisc_TimeZoneSpecifiedMessage = "A time zone was specified. SqlDateTime does not support time zones."; - public const string SqlMisc_InvalidArraySizeMessage = "Invalid array size."; - public const string SqlMisc_InvalidPrecScaleMessage = "Invalid numeric precision/scale."; - public const string SqlMisc_FormatMessage = "The input wasn't in a correct format."; - public const string SqlMisc_SqlTypeMessage = "SqlType error."; - public const string SqlMisc_LenTooLargeMessage = "The SqlBytes and SqlChars don't support length of more than 2GB in this version."; - public const string SqlMisc_StreamErrorMessage = "An error occurred while reading."; - public const string SqlMisc_StreamClosedMessage = "Stream has been closed or disposed."; - public const string SqlMisc_NoBufferMessage = "There is no buffer. Read or write operation failed."; - public const string SqlMisc_SetNonZeroLenOnNullMessage = "Cannot set to non-zero length, because current value is Null."; - public const string SqlMisc_BufferInsufficientMessage = "The buffer is insufficient. Read or write operation failed."; - public const string SqlMisc_WriteNonZeroOffsetOnNullMessage = "Cannot write to non-zero offset, because current value is Null."; - public const string SqlMisc_WriteOffsetLargerThanLenMessage = "Cannot write from an offset that is larger than current length. It would leave uninitialized data in the buffer."; - public const string SqlMisc_TruncationMaxDataMessage = "Data returned is larger than 2Gb in size. Use SequentialAccess command behavior in order to get all of the data."; - public const string SqlMisc_InvalidFirstDayMessage = "Argument to GetDayOfWeek must be integer between 1 and 7."; - public const string SqlMisc_NotFilledMessage = "SQL Type has not been loaded with data."; - public const string SqlMisc_AlreadyFilledMessage = "SQL Type has already been loaded with data."; - public const string SqlMisc_ClosedXmlReaderMessage = "Invalid attempt to access a closed XmlReader."; - public const string SqlMisc_InvalidOpStreamClosed = "Invalid attempt to call {0} when the stream is closed."; - public const string SqlMisc_InvalidOpStreamNonWritable = "Invalid attempt to call {0} when the stream non-writable."; - public const string SqlMisc_InvalidOpStreamNonReadable = "Invalid attempt to call {0} when the stream non-readable."; - public const string SqlMisc_InvalidOpStreamNonSeekable = "Invalid attempt to call {0} when the stream is non-seekable."; - public const string SqlMisc_SubclassMustOverride = "Subclass did not override a required method."; - public const string Sql_CanotCreateNormalizer = "Cannot create normalizer for '{0}'."; - public const string Sql_InternalError = "Internal Error"; - public const string Sql_NullCommandText = "Command parameter must have a non null and non empty command text."; - public const string Sql_MismatchedMetaDataDirectionArrayLengths = "MetaData parameter array must have length equivalent to ParameterDirection array argument."; - public const string ADP_AdapterMappingExceptionMessage = "Data adapter mapping error."; - public const string ADP_DataAdapterExceptionMessage = "Data adapter error."; - public const string ADP_DBConcurrencyExceptionMessage = "DB concurrency violation."; - public const string ADP_OperationAborted = "Operation aborted."; - public const string ADP_OperationAbortedExceptionMessage = "Operation aborted due to an exception (see InnerException for details)."; - public const string DataAdapter_AcceptChangesDuringFill = "Whether or not Fill will call DataRow.AcceptChanges."; - public const string DataAdapter_AcceptChangesDuringUpdate = "Whether or not Update will call DataRow.AcceptChanges."; - public const string DataAdapter_ContinueUpdateOnError = "Whether or not to continue to the next DataRow when the Update events, RowUpdating and RowUpdated, Status is UpdateStatus.ErrorsOccurred."; - public const string DataAdapter_FillLoadOption = "How the adapter fills the DataTable from the DataReader."; - public const string DataAdapter_MissingMappingAction = "The action taken when a table or column in the TableMappings is missing."; - public const string DataAdapter_MissingSchemaAction = "The action taken when a table or column in the DataSet is missing."; - public const string DataAdapter_TableMappings = "How to map source table to DataSet table."; - public const string DataAdapter_FillError = "Event triggered when a recoverable error occurs during Fill."; - public const string DataAdapter_ReturnProviderSpecificTypes = "Should Fill return provider specific values or common CLSCompliant values."; - public const string DataColumnMapping_DataSetColumn = "DataColumn.ColumnName"; - public const string DataColumnMapping_SourceColumn = "Source column name - case sensitive."; - public const string DataColumnMappings_Count = "The number of items in the collection"; - public const string DataColumnMappings_Item = "The specified DataColumnMapping object."; - public const string DataTableMapping_ColumnMappings = "Individual columns mappings when this table mapping is matched."; - public const string DataTableMapping_DataSetTable = "DataTable.TableName"; - public const string DataTableMapping_SourceTable = "The DataTableMapping source table name. This name is case sensitive."; - public const string DataTableMappings_Count = "The number of items in the collection"; - public const string DataTableMappings_Item = "The specified DataTableMapping object"; - public const string DbDataAdapter_DeleteCommand = "Used during Update for deleted rows in DataSet."; - public const string DbDataAdapter_InsertCommand = "Used during Update for new rows in DataSet."; - public const string DbDataAdapter_SelectCommand = "Used during Fill/FillSchema."; - public const string DbDataAdapter_UpdateCommand = "Used during Update for modified rows in DataSet."; - public const string DbDataAdapter_RowUpdated = "Event triggered before every DataRow during Update."; - public const string DbDataAdapter_RowUpdating = "Event triggered after every DataRow during Update."; - public const string DbDataAdapter_UpdateBatchSize = "Number of rows to batch together before executing against the data source."; - public const string DbTable_Connection = "Connection used if the the Select/Insert/Update/DeleteCommands do not already have a connection."; - public const string DbTable_DeleteCommand = "Used during Update for deleted rows in the DataTable."; - public const string DbTable_InsertCommand = "Used during Update for new rows in the DataTable."; - public const string DbTable_SelectCommand = "Used during Fill."; - public const string DbTable_UpdateCommand = "Used during Update for modified rows in the DataTable."; - public const string DbTable_ReturnProviderSpecificTypes = "Should Fill return provider specific values or common CLSCompliant values."; - public const string DbTable_TableMapping = "How to map source table to DataTable."; - public const string DbTable_ConflictDetection = "How are the Insert/Update/DeleteCommands generated when not set by the user."; - public const string DbTable_UpdateBatchSize = "Number of rows to batch together before executing against the data source."; - public const string DbConnectionString_ConnectionString = "The connection string used to connect to the Data Source."; - public const string DbConnectionString_Driver = "The name of the ODBC Driver to use when connecting to the Data Source."; - public const string DbConnectionString_DSN = "The DSN to use when connecting to the Data Source."; - public const string DbConnectionString_AdoNetPooler = "When true, indicates that managed connection pooling should be used."; - public const string DbConnectionString_FileName = "The UDL file to use when connecting to the Data Source."; - public const string DbConnectionString_OleDbServices = "Specifies which OLE DB Services to enable or disable with the OleDb Provider."; - public const string DbConnectionString_Provider = "The name of the OLE DB Provider to use when connecting to the Data Source."; - public const string DbConnectionString_ApplicationName = "The name of the application."; - public const string DbConnectionString_AsynchronousProcessing = "When true, enables usage of the Asynchronous functionality in the .Net Framework Data Provider."; - public const string DbConnectionString_AttachDBFilename = "The name of the primary file, including the full path name, of an attachable database."; - public const string DbConnectionString_ConnectTimeout = "The length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error."; - public const string DbConnectionString_ConnectionReset = "When true, indicates the connection state is reset when removed from the pool."; - public const string DbConnectionString_ContextConnection = "When true, indicates the connection should be from the Sql Server context. Available only when running in the Sql Server process."; - public const string DbConnectionString_CurrentLanguage = "The SQL Server Language record name."; - public const string DbConnectionString_DataSource = "Indicates the name of the data source to connect to."; - public const string DbConnectionString_Encrypt = "When true, SQL Server uses SSL encryption for all data sent between the client and server if the server has a certificate installed."; - public const string DbConnectionString_Enlist = "Sessions in a Component Services (or MTS, if you are using Microsoft Windows NT) environment should automatically be enlisted in a global transaction where required."; - public const string DbConnectionString_InitialCatalog = "The name of the initial catalog or database in the data source."; - public const string DbConnectionString_FailoverPartner = "The name or network address of the instance of SQL Server that acts as a failover partner."; - public const string DbConnectionString_IntegratedSecurity = "Whether the connection is to be a secure connection or not."; - public const string DbConnectionString_LoadBalanceTimeout = "The minimum amount of time (in seconds) for this connection to live in the pool before being destroyed."; - public const string DbConnectionString_MaxPoolSize = "The maximum number of connections allowed in the pool."; - public const string DbConnectionString_MinPoolSize = "The minimum number of connections allowed in the pool."; - public const string DbConnectionString_MultipleActiveResultSets = "When true, multiple result sets can be returned and read from one connection."; - public const string DbConnectionString_MultiSubnetFailover = "If your application is connecting to a high-availability, disaster recovery (AlwaysOn) availability group (AG) on different subnets, MultiSubnetFailover=Yes configures SqlConnection to provide faster detection of and connection to the (currently) active server."; - public const string DbConnectionString_NetworkLibrary = "The network library used to establish a connection to an instance of SQL Server."; - public const string DbConnectionString_PacketSize = "Size in bytes of the network packets used to communicate with an instance of SQL Server."; - public const string DbConnectionString_Password = "Indicates the password to be used when connecting to the data source."; - public const string DbConnectionString_PersistSecurityInfo = "When false, security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open state."; - public const string DbConnectionString_Pooling = "When true, the connection object is drawn from the appropriate pool, or if necessary, is created and added to the appropriate pool."; - public const string DbConnectionString_Replication = "Used by SQL Server in Replication."; - public const string DbConnectionString_TransactionBinding = "Indicates binding behavior of connection to a System.Transactions Transaction when enlisted."; - public const string DbConnectionString_TrustServerCertificate = "When true (and encrypt=true), SQL Server uses SSL encryption for all data sent between the client and server without validating the server certificate."; - public const string DbConnectionString_TypeSystemVersion = "Indicates which server type system the provider will expose through the DataReader."; - public const string DbConnectionString_UserID = "Indicates the user ID to be used when connecting to the data source."; - public const string DbConnectionString_UserInstance = "Indicates whether the connection will be re-directed to connect to an instance of SQL Server running under the user's account."; - public const string DbConnectionString_WorkstationID = "The name of the workstation connecting to SQL Server."; - public const string DbConnectionString_ApplicationIntent = "Declares the application workload type when connecting to a server."; - public const string DbConnectionString_ConnectRetryCount = "Number of attempts to restore connection."; - public const string DbConnectionString_ConnectRetryInterval = "Delay between attempts to restore connection."; - public const string OdbcConnection_ConnectionString = "Information used to connect to a Data Source."; - public const string OdbcConnection_ConnectionTimeout = "Current connection timeout value, not settable in the ConnectionString."; - public const string OdbcConnection_Database = "Current data source catalog value, 'Database=X' in the connection string."; - public const string OdbcConnection_DataSource = "Current data source, 'Server=X' in the connection string."; - public const string OdbcConnection_Driver = "Current ODBC driver."; - public const string OdbcConnection_ServerVersion = "Version of the product accessed by the ODBC Driver."; - public const string OleDbConnection_ConnectionString = "Information used to connect to a Data Source."; - public const string OleDbConnection_ConnectionTimeout = "Current connection timeout value, 'Connect Timeout=X' in the ConnectionString."; - public const string OleDbConnection_Database = "Current data source catalog value, 'Initial Catalog=X' in the connection string."; - public const string OleDbConnection_DataSource = "Current data source, 'Data Source=X' in the connection string."; - public const string OleDbConnection_Provider = "Current OLE DB provider ProgID, 'Provider=X' in the connection string."; - public const string OleDbConnection_ServerVersion = "Version of the product accessed by the OLE DB Provider."; - public const string SqlConnection_Asynchronous = "State of connection, synchronous or asynchronous. 'Asynchronous Processing=x' in the connection string."; - public const string SqlConnection_Replication = "Information used to connect for replication."; - public const string SqlConnection_ConnectionString = "Information used to connect to a DataSource, such as 'Data Source=x;Initial Catalog=x;Integrated Security=SSPI'."; - public const string SqlConnection_ConnectionTimeout = "Current connection timeout value, 'Connect Timeout=X' in the ConnectionString."; - public const string SqlConnection_Database = "Current SQL Server database, 'Initial Catalog=X' in the connection string."; - public const string SqlConnection_DataSource = "Current SqlServer that the connection is opened to, 'Data Source=X' in the connection string."; - public const string SqlConnection_PacketSize = "Network packet size, 'Packet Size=x' in the connection string."; - public const string SqlConnection_ServerVersion = "Version of the SQL Server accessed by the SqlConnection."; - public const string SqlConnection_WorkstationId = "Workstation Id, 'Workstation ID=x' in the connection string."; - public const string SqlConnection_StatisticsEnabled = "Collect statistics for this connection."; - public const string SqlConnection_ClientConnectionId = "A guid to represent the physical connection."; - public const string SqlConnection_Credential = "User Id and secure password to use for authentication."; - public const string DbConnection_InfoMessage = "Event triggered when messages arrive from the DataSource."; - public const string DbCommand_CommandText = "Command text to execute."; - public const string DbCommand_CommandType = "How to interpret the CommandText."; - public const string DbCommand_Connection = "Connection used by the command."; - public const string DbCommand_Parameters = "The parameters collection."; - public const string DbCommand_Transaction = "The transaction used by the command."; - public const string DbCommand_UpdatedRowSource = "When used by a DataAdapter.Update, how command results are applied to the current DataRow."; - public const string DbCommand_StatementCompleted = "When records are affected by a given statement by the execution of the command."; - public const string SqlCommand_Notification = "Notification values used by Microsoft SQL Server."; - public const string SqlCommand_NotificationAutoEnlist = "Automatic enlistment in notifications used by Microsoft SQL Server."; - public const string DbCommandBuilder_ConflictOption = "How the where clause is auto-generated for the Update and Delete commands when not specified by the user."; - public const string DbCommandBuilder_CatalogLocation = "Indicates the position of the catalog name in a qualified table name in a text command."; - public const string DbCommandBuilder_CatalogSeparator = "The character that separates the catalog name from the rest of the identifier in a text command."; - public const string DbCommandBuilder_SchemaSeparator = "The character that separates the schema name from the rest of the identifier in a text command."; - public const string DbCommandBuilder_QuotePrefix = "The prefix string wrapped around sql objects."; - public const string DbCommandBuilder_QuoteSuffix = "The suffix string wrapped around sql objects."; - public const string DbCommandBuilder_DataAdapter = "The DataAdapter for which to automatically generate Commands."; - public const string DbCommandBuilder_SchemaLocation = "Use schema from DataTable or the SelectCommand."; - public const string DbCommandBuilder_SetAllValues = "How the set clause is auto-generated for the Update command when not specified by the user."; - public const string OdbcCommandBuilder_DataAdapter = "The DataAdapter for which to automatically generate OdbcCommands"; - public const string OdbcCommandBuilder_QuotePrefix = "The character used in a text command as the opening quote for quoting identifiers that contain special characters."; - public const string OdbcCommandBuilder_QuoteSuffix = "The character used in a text command as the closing quote for quoting identifiers that contain special characters."; - public const string OleDbCommandBuilder_DataAdapter = "The DataAdapter for which to automatically generate OleDbCommands"; - public const string OleDbCommandBuilder_DecimalSeparator = "The decimal separator used in numeric literals."; - public const string OleDbCommandBuilder_QuotePrefix = "The prefix string wrapped around sql objects"; - public const string OleDbCommandBuilder_QuoteSuffix = "The suffix string wrapped around sql objects"; - public const string SqlCommandBuilder_DataAdapter = "The DataAdapter for which to automatically generate SqlCommands"; - public const string SqlCommandBuilder_DecimalSeparator = "The decimal separator used in numeric literals."; - public const string SqlCommandBuilder_QuotePrefix = "The character used in a text command as the opening quote for quoting identifiers that contain special characters."; - public const string SqlCommandBuilder_QuoteSuffix = "The character used in a text command as the closing quote for quoting identifiers that contain special characters."; - public const string DbDataParameter_Precision = "Only necessary to set for decimal and numeric parameters when using with Prepare, FillSchema and CommandBuilder scenarios."; - public const string DbDataParameter_Scale = "Only necessary to set for decimal and numeric parameters when using with Prepare, FillSchema and CommandBuilder scenarios."; - public const string OdbcParameter_OdbcType = "The parameter native type."; - public const string OleDbParameter_OleDbType = "The parameter native type."; - public const string SqlParameter_ParameterName = "Name of the parameter, like '@p1'"; - public const string SqlParameter_SqlDbType = "The parameter native type."; - public const string SqlParameter_TypeName = "The server's name for the type."; - public const string SqlParameter_Offset = "Offset in variable length data types."; - public const string SqlParameter_XmlSchemaCollectionDatabase = "XmlSchemaCollectionDatabase"; - public const string SqlParameter_XmlSchemaCollectionOwningSchema = "XmlSchemaCollectionOwningSchema"; - public const string SqlParameter_XmlSchemaCollectionName = "XmlSchemaCollectionName"; - public const string SqlParameter_UnsupportedTVPOutputParameter = "ParameterDirection '{0}' specified for parameter '{1}' is not supported. Table-valued parameters only support ParameterDirection.Input."; - public const string SqlParameter_DBNullNotSupportedForTVP = "DBNull value for parameter '{0}' is not supported. Table-valued parameters cannot be DBNull."; - public const string SqlParameter_InvalidTableDerivedPrecisionForTvp = "Precision '{0}' required to send all values in column '{1}' exceeds the maximum supported precision '{2}'. The values must all fit in a single precision."; - public const string SqlParameter_UnexpectedTypeNameForNonStruct = "TypeName specified for parameter '{0}'. TypeName must only be set for Structured parameters."; - public const string MetaType_SingleValuedStructNotSupported = "SqlDbType.Structured type is only supported for multiple valued types."; - public const string NullSchemaTableDataTypeNotSupported = "DateType column for field '{0}' in schema table is null. DataType must be non-null."; - public const string InvalidSchemaTableOrdinals = "Invalid column ordinals in schema table. ColumnOrdinals, if present, must not have duplicates or gaps."; - public const string SQL_EnumeratedRecordMetaDataChanged = "Metadata for field '{0}' of record '{1}' did not match the original record's metadata."; - public const string SQL_EnumeratedRecordFieldCountChanged = "Number of fields in record '{0}' does not match the number in the original record."; - public const string SQLUDT_MaxByteSizeValue = "range: 0-8000"; - public const string SQLUDT_Unexpected = "unexpected error encountered in SqlClient data provider. {0}"; - public const string SQLUDT_InvalidDbId = "Unable to get Type Info for {0},{1}"; - public const string SQLUDT_CantLoadAssembly = "The provider has failed to load the following assembly: {0}"; - public const string SQLUDT_InvalidUdtTypeName = "UdtTypeName property must be set for UDT parameters."; - public const string SQLUDT_UnexpectedUdtTypeName = "UdtTypeName property must be set only for UDT parameters."; - public const string SQLUDT_InvalidSqlType = "Specified type is not registered on the target server.{0}."; - public const string SQLUDT_InWhereClause = "UDT parameters not permitted in the where clause unless part of the primary key."; - public const string SqlUdt_InvalidUdtMessage = "'{0}' is an invalid user defined type, reason: {1}."; - public const string SqlUdtReason_MultipleSerFormats = "supports both in-memory and user-defined formats"; - public const string SqlUdtReason_CannotSupportNative = "Native format can't be supported."; - public const string SqlUdtReason_CannotSupportUserDefined = "does not implement IBinarySerialize"; - public const string SqlUdtReason_NotSerializable = "not serializable"; - public const string SqlUdtReason_NoPublicConstructors = "no public constructors"; - public const string SqlUdtReason_NotNullable = "does not implement INullable"; - public const string SqlUdtReason_NoPublicConstructor = "does not have a public constructor"; - public const string SqlUdtReason_NoUdtAttribute = "no UDT attribute"; - public const string SqlUdtReason_MaplessNotYetSupported = "Serialization without mapping is not yet supported."; - public const string SqlUdtReason_ParseMethodMissing = "'public static x Parse(System.Data.SqlTypes.SqlString)' method is missing"; - public const string SqlUdtReason_ToStringMethodMissing = "'public override string ToString()' method is missing"; - public const string SqlUdtReason_NullPropertyMissing = "'public static x Null { get; }' method is missing"; - public const string SqlUdtReason_NativeFormatNoFieldSupport = "Native format does not support fields (directly or through another field) of type '{0}'"; - public const string SqlUdtReason_TypeNotPublic = "Type is not public"; - public const string SqlUdtReason_NativeUdtNotSequentialLayout = "Native UDT not sequential layout due to type '{0}'"; - public const string SqlUdtReason_NativeUdtMaxByteSize = "Native UDT specifies a max byte size"; - public const string SqlUdtReason_NonSerializableField = "field '{0}' is marked non-serialized"; - public const string SqlUdtReason_NativeFormatExplictLayoutNotAllowed = "The type of field '{0}' is marked as explicit layout which is not allowed in Native format"; - public const string SqlUdtReason_MultivaluedAssemblyId = "Multiple valued assembly references must have a nonzero Assembly Id."; - public const string SQLTVP_TableTypeCanOnlyBeParameter = "Structured, multiple-valued types can only be used for parameters, and cannot be nested within another type."; - public const string SqlFileStream_InvalidPath = "The path name is not valid."; - public const string SqlFileStream_InvalidParameter = "An invalid parameter was passed to the function."; - public const string SqlFileStream_FileAlreadyInTransaction = "The process cannot access the file specified because it has been opened in another transaction."; - public const string SqlFileStream_PathNotValidDiskResource = "The path name is invalid or does not point to a disk file."; - public const string SqlDelegatedTransaction_PromotionFailed = "Failure while attempting to promote transaction."; - public const string SqlDependency_SqlDependency = "Dependency object used to receive query notifications."; - public const string SqlDependency_HasChanges = "Property to indicate if this dependency is invalid."; - public const string SqlDependency_Id = "A string that uniquely identifies this dependency object."; - public const string SqlDependency_OnChange = "Event that can be used to subscribe for change notifications."; - public const string SqlDependency_AddCommandDependency = "To add a command to existing dependency object."; - public const string SqlDependency_Duplicate = "Command is already associated with another dependency object. Can not overwrite."; - public const string SQLNotify_AlreadyHasCommand = "This SqlCommand object is already associated with another SqlDependency object."; - public const string SqlNotify_SqlDepCannotBeCreatedInProc = "SqlDependency object cannot be created when running inside the SQL Server process."; - public const string SqlDependency_DatabaseBrokerDisabled = "The SQL Server Service Broker for the current database is not enabled, and as a result query notifications are not supported. Please enable the Service Broker for this database if you wish to use notifications."; - public const string SqlDependency_DefaultOptionsButNoStart = "When using SqlDependency without providing an options value, SqlDependency.Start() must be called prior to execution of a command added to the SqlDependency instance."; - public const string SqlDependency_EventNoDuplicate = "SqlDependency.OnChange does not support multiple event registrations for the same delegate."; - public const string SqlDependency_DuplicateStart = "SqlDependency does not support calling Start() with different connection strings having the same server, user, and database in the same app domain."; - public const string SqlDependency_IdMismatch = "No SqlDependency exists for the key."; - public const string SqlDependency_NoMatchingServerStart = "When using SqlDependency without providing an options value, SqlDependency.Start() must be called for each server that is being executed against."; - public const string SqlDependency_NoMatchingServerDatabaseStart = "SqlDependency.Start has been called for the server the command is executing against more than once, but there is no matching server/user/database Start() call for current command."; - public const string SqlDependency_InvalidTimeout = "Timeout specified is invalid. Timeout cannot be < 0."; - public const string SQLNotify_ErrorFormat = "Notification Error. Type={0}, Info={1}, Source={2}."; - public const string SqlMetaData_NoMetadata = "GetMetaData is not valid for this SqlDbType."; - public const string SqlMetaData_InvalidSqlDbTypeForConstructorFormat = "The dbType {0} is invalid for this constructor."; - public const string SqlMetaData_NameTooLong = "The name is too long."; - public const string SqlMetaData_SpecifyBothSortOrderAndOrdinal = "The sort order and ordinal must either both be specified, or neither should be specified (SortOrder.Unspecified and -1). The values given were: order = {0}, ordinal = {1}."; - public const string SqlProvider_InvalidDataColumnType = "The type of column '{0}' is not supported. The type is '{1}'"; - public const string SqlProvider_InvalidDataColumnMaxLength = "The size of column '{0}' is not supported. The size is {1}."; - public const string SqlProvider_NotEnoughColumnsInStructuredType = "There are not enough fields in the Structured type. Structured types must have at least one field."; - public const string SqlProvider_DuplicateSortOrdinal = "The sort ordinal {0} was specified twice."; - public const string SqlProvider_MissingSortOrdinal = "The sort ordinal {0} was not specified."; - public const string SqlProvider_SortOrdinalGreaterThanFieldCount = "The sort ordinal {0} on field {1} exceeds the total number of fields."; - public const string IEnumerableOfSqlDataRecordHasNoRows = "There are no records in the SqlDataRecord enumeration. To send a table-valued parameter with no rows, use a null reference for the value instead."; - public const string SqlPipe_CommandHookedUpToNonContextConnection = "SqlPipe does not support executing a command with a connection that is not a context connection."; - public const string SqlPipe_MessageTooLong = "Message length {0} exceeds maximum length supported of 4000."; - public const string SqlPipe_IsBusy = "Could not use the pipe while it is busy with another operation."; - public const string SqlPipe_AlreadyHasAnOpenResultSet = "A result set is currently being sent to the pipe. End the current result set before calling {0}."; - public const string SqlPipe_DoesNotHaveAnOpenResultSet = "Result set has not been initiated. Call SendResultSetStart before calling {0}."; - public const string SNI_PN0 = "HTTP Provider"; - public const string SNI_PN1 = "Named Pipes Provider"; - public const string SNI_PN2 = "Session Provider"; - public const string SNI_PN3 = "Sign Provider"; - public const string SNI_PN4 = "Shared Memory Provider"; - public const string SNI_PN5 = "SMux Provider"; - public const string SNI_PN6 = "SSL Provider"; - public const string SNI_PN7 = "TCP Provider"; - public const string SNI_PN8 = "VIA Provider"; - public const string SNI_PN9 = ""; - public const string SNI_PN10 = "SQL Network Interfaces"; - public const string SNI_ERROR_1 = "I/O Error detected in read/write operation"; - public const string SNI_ERROR_2 = "Connection was terminated"; - public const string SNI_ERROR_3 = "Asynchronous operations not supported"; - public const string SNI_ERROR_4 = ""; - public const string SNI_ERROR_5 = "Invalid parameter(s) found"; - public const string SNI_ERROR_6 = "Unsupported protocol specified"; - public const string SNI_ERROR_7 = "Invalid connection found when setting up new session protocol"; - public const string SNI_ERROR_8 = "Protocol not supported"; - public const string SNI_ERROR_9 = "Associating port with I/O completion mechanism failed"; - public const string SNI_ERROR_10 = ""; - public const string SNI_ERROR_11 = "Timeout error"; - public const string SNI_ERROR_12 = "No server name supplied"; - public const string SNI_ERROR_13 = "TerminateListener() has been called"; - public const string SNI_ERROR_14 = "Win9x not supported"; - public const string SNI_ERROR_15 = "Function not supported"; - public const string SNI_ERROR_16 = "Shared-Memory heap error"; - public const string SNI_ERROR_17 = "Cannot find an ip/ipv6 type address to connect"; - public const string SNI_ERROR_18 = "Connection has been closed by peer"; - public const string SNI_ERROR_19 = "Physical connection is not usable"; - public const string SNI_ERROR_20 = "Connection has been closed"; - public const string SNI_ERROR_21 = "Encryption is enforced but there is no valid certificate"; - public const string SNI_ERROR_22 = "Couldn't load library"; - public const string SNI_ERROR_23 = "Cannot open a new thread in server process"; - public const string SNI_ERROR_24 = "Cannot post event to completion port"; - public const string SNI_ERROR_25 = "Connection string is not valid"; - public const string SNI_ERROR_26 = "Error Locating Server/Instance Specified"; - public const string SNI_ERROR_27 = "Error getting enabled protocols list from registry"; - public const string SNI_ERROR_28 = "Server doesn't support requested protocol"; - public const string SNI_ERROR_29 = "Shared Memory is not supported for clustered server connectivity"; - public const string SNI_ERROR_30 = "Invalid attempt bind to shared memory segment"; - public const string SNI_ERROR_31 = "Encryption(ssl/tls) handshake failed"; - public const string SNI_ERROR_32 = "Packet size too large for SSL Encrypt/Decrypt operations"; - public const string SNI_ERROR_33 = "SSRP error"; - public const string SNI_ERROR_34 = "Could not connect to the Shared Memory pipe"; - public const string SNI_ERROR_35 = "An internal exception was caught"; - public const string SNI_ERROR_36 = "The Shared Memory dll used to connect to SQL Server 2000 was not found"; - public const string SNI_ERROR_37 = "The SQL Server 2000 Shared Memory client dll appears to be invalid/corrupted"; - public const string SNI_ERROR_38 = "Cannot open a Shared Memory connection to SQL Server 2000"; - public const string SNI_ERROR_39 = "Shared memory connectivity to SQL Server 2000 is either disabled or not available on this machine"; - public const string SNI_ERROR_40 = "Could not open a connection to SQL Server"; - public const string SNI_ERROR_41 = "Cannot open a Shared Memory connection to a remote SQL server"; - public const string SNI_ERROR_42 = "Could not establish dedicated administrator connection (DAC) on default port. Make sure that DAC is enabled"; - public const string SNI_ERROR_43 = "An error occurred while obtaining the dedicated administrator connection (DAC) port. Make sure that SQL Browser is running, or check the error log for the port number"; - public const string SNI_ERROR_44 = "Could not compose Service Principal Name (SPN) for Windows Integrated Authentication. Possible causes are server(s) incorrectly specified to connection API calls, Domain Name System (DNS) lookup failure or memory shortage"; - public const string SNI_ERROR_47 = "Connecting with the MultiSubnetFailover connection option to a SQL Server instance configured with more than 64 IP addresses is not supported."; - public const string SNI_ERROR_48 = "Connecting to a named SQL Server instance using the MultiSubnetFailover connection option is not supported."; - public const string SNI_ERROR_49 = "Connecting to a SQL Server instance using the MultiSubnetFailover connection option is only supported when using the TCP protocol."; - public const string SNI_ERROR_50 = "Local Database Runtime error occurred."; - public const string SNI_ERROR_51 = "An instance name was not specified while connecting to a Local Database Runtime. Specify an instance name in the format (localdb)\\instance_name."; - public const string SNI_ERROR_52 = "Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled."; - public const string SNI_ERROR_53 = "Invalid Local Database Runtime registry configuration found. Verify that SQL Server Express is properly installed."; - public const string SNI_ERROR_54 = "Unable to locate the registry entry for SQLUserInstance.dll file path. Verify that the Local Database Runtime feature of SQL Server Express is properly installed."; - public const string SNI_ERROR_55 = "Registry value contains an invalid SQLUserInstance.dll file path. Verify that the Local Database Runtime feature of SQL Server Express is properly installed."; - public const string SNI_ERROR_56 = "Unable to load the SQLUserInstance.dll from the location specified in the registry. Verify that the Local Database Runtime feature of SQL Server Express is properly installed."; - public const string SNI_ERROR_57 = "Invalid SQLUserInstance.dll found at the location specified in the registry. Verify that the Local Database Runtime feature of SQL Server Express is properly installed."; - public const string Snix_Connect = "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections."; - public const string Snix_PreLoginBeforeSuccessfullWrite = "The client was unable to establish a connection because of an error during connection initialization process before login. Possible causes include the following: the client tried to connect to an unsupported version of SQL Server; the server was too busy to accept new connections; or there was a resource limitation (insufficient memory or maximum allowed connections) on the server."; - public const string Snix_PreLogin = "A connection was successfully established with the server, but then an error occurred during the pre-login handshake."; - public const string Snix_LoginSspi = "A connection was successfully established with the server, but then an error occurred when obtaining the security/SSPI context information for integrated security login."; - public const string Snix_Login = "A connection was successfully established with the server, but then an error occurred during the login process."; - public const string Snix_EnableMars = "Connection open and login was successful, but then an error occurred while enabling MARS for this connection."; - public const string Snix_AutoEnlist = "Connection open and login was successful, but then an error occurred while enlisting the connection into the current distributed transaction."; - public const string Snix_GetMarsSession = "Failed to establish a MARS session in preparation to send the request to the server."; - public const string Snix_Execute = "A transport-level error has occurred when sending the request to the server."; - public const string Snix_Read = "A transport-level error has occurred when receiving results from the server."; - public const string Snix_Close = "A transport-level error has occurred during connection clean-up."; - public const string Snix_SendRows = "A transport-level error has occurred while sending information to the server."; - public const string Snix_ProcessSspi = "A transport-level error has occured during SSPI handshake."; - public const string LocalDB_CreateFailed = "Local Database Runtime: Cannot create named instance."; - public const string LocalDB_BadConfigSectionType = "Local Database Runtime: system.data.localdb configuration file section is of unknown type."; - public const string LocalDB_FailedGetDLLHandle = "Local Database Runtime: Cannot load SQLUserInstance.dll."; - public const string LocalDB_MethodNotFound = "Invalid SQLUserInstance.dll found at the location specified in the registry. Verify that the Local Database Runtime feature of SQL Server Express is properly installed."; - public const string LocalDB_UnobtainableMessage = "Cannot obtain Local Database Runtime error message"; - public const string LocalDB_InvalidVersion = "Local Database Runtime: Invalid instance version specification found in the configuration file."; - public const string SQLROR_RecursiveRoutingNotSupported = "Two or more redirections have occurred. Only one redirection per login is allowed."; - public const string SQLROR_FailoverNotSupported = "Connecting to a mirrored SQL Server instance using the ApplicationIntent ReadOnly connection option is not supported."; - public const string SQLROR_UnexpectedRoutingInfo = "Unexpected routing information received."; - public const string SQLROR_InvalidRoutingInfo = "Invalid routing information received."; - public const string SQLROR_TimeoutAfterRoutingInfo = "Server provided routing information, but timeout already expired."; - public const string SQLCR_InvalidConnectRetryCountValue = "Invalid ConnectRetryCount value (should be 0-255)."; - public const string SQLCR_InvalidConnectRetryIntervalValue = "Invalid ConnectRetryInterval value (should be 1-60)."; - public const string SQLCR_NextAttemptWillExceedQueryTimeout = "Next reconnection attempt will exceed query timeout. Reconnection was terminated."; - public const string SQLCR_EncryptionChanged = "The server did not preserve SSL encryption during a recovery attempt, connection recovery is not possible."; - public const string SQLCR_TDSVestionNotPreserved = "The server did not preserve the exact client TDS version requested during a recovery attempt, connection recovery is not possible."; - public const string SQLCR_AllAttemptsFailed = "The connection is broken and recovery is not possible. The client driver attempted to recover the connection one or more times and all attempts failed. Increase the value of ConnectRetryCount to increase the number of recovery attempts."; - public const string SQLCR_UnrecoverableServer = "The connection is broken and recovery is not possible. The connection is marked by the server as unrecoverable. No attempt was made to restore the connection."; - public const string SQLCR_UnrecoverableClient = "The connection is broken and recovery is not possible. The connection is marked by the client driver as unrecoverable. No attempt was made to restore the connection."; - public const string SQLCR_NoCRAckAtReconnection = "The server did not acknowledge a recovery attempt, connection recovery is not possible."; - - public const string AZURESQL_GenericEndpoint = ".database.windows.net"; - public const string AZURESQL_GermanEndpoint = ".database.cloudapi.de"; - public const string AZURESQL_UsGovEndpoint = ".database.usgovcloudapi.net"; - public const string AZURESQL_ChinaEndpoint = ".database.chinacloudapi.cn"; - public const string DbConnectionString_PoolBlockingPeriod = "Defines the blocking period behavior for a connection pool."; - public const string SQL_Timeout_Execution = "Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding."; - } - - - static partial class Res { - public static string GetString (string name) - { - return SR.GetString (name); - } - - public static string GetString (string name, params object[] args) - { - return SR.GetString (name, args); - } - } -} diff --git a/mcs/class/System.Data/ReferenceSources/Res.missing.cs b/mcs/class/System.Data/ReferenceSources/Res.missing.cs deleted file mode 100644 index 8bfe6584f5d..00000000000 --- a/mcs/class/System.Data/ReferenceSources/Res.missing.cs +++ /dev/null @@ -1,126 +0,0 @@ -namespace System.Data { - static partial class Res { - public const string ADP_InvalidMixedUsageOfAccessTokenAndAuthentication = "ADP_InvalidMixedUsageOfAccessTokenAndAuthentication"; - public const string ADP_InvalidMixedUsageOfAccessTokenAndContextConnection = "ADP_InvalidMixedUsageOfAccessTokenAndContextConnection"; - public const string ADP_InvalidMixedUsageOfAccessTokenAndCredential = "ADP_InvalidMixedUsageOfAccessTokenAndCredential"; - public const string ADP_InvalidMixedUsageOfAccessTokenAndIntegratedSecurity = "ADP_InvalidMixedUsageOfAccessTokenAndIntegratedSecurity"; - public const string ADP_InvalidMixedUsageOfAccessTokenAndUserIDPassword = "ADP_InvalidMixedUsageOfAccessTokenAndUserIDPassword"; - public const string ADP_InvalidMixedUsageOfCredentialAndAccessToken = "ADP_InvalidMixedUsageOfCredentialAndAccessToken"; - - public const string DbConnectionString_Authentication = "DbConnectionString_Authentication"; - - public const string SQL_AuthenticationAndIntegratedSecurity = "SQL_AuthenticationAndIntegratedSecurity"; - public const string SQL_CredentialsNotProvided = "SQL_CredentialsNotProvided"; - public const string SQL_IntegratedWithUserIDAndPassword = "SQL_IntegratedWithUserIDAndPassword"; - public const string SQL_ParsingErrorAuthLibraryType = "SQL_ParsingErrorAuthLibraryType"; - public const string SQL_ParsingErrorFeatureId = "SQL_ParsingErrorFeatureId"; - public const string SQL_ParsingErrorLength = "SQL_ParsingErrorLength"; - public const string SQL_ParsingErrorOffset = "SQL_ParsingErrorOffset"; - public const string SQL_ParsingErrorStatus = "SQL_ParsingErrorStatus"; - public const string SQL_ParsingErrorToken = "SQL_ParsingErrorToken"; - public const string SQL_ParsingErrorValue = "SQL_ParsingErrorValue"; - public const string SQL_ParsingErrorWithState = "SQL_ParsingErrorWithState"; - public const string SQL_SettingCredentialWithIntegrated = "SQL_SettingCredentialWithIntegrated"; - public const string SQL_SettingIntegratedWithCredential = "SQL_SettingIntegratedWithCredential"; - - public const string TCE_BatchedUpdateColumnEncryptionSettingMismatch = "TCE_BatchedUpdateColumnEncryptionSettingMismatch"; - public const string TCE_CanOnlyCallOnce = "TCE_CanOnlyCallOnce"; - public const string TCE_CertificateNotFound = "TCE_CertificateNotFound"; - public const string TCE_CertificateNotFoundSysErr = "TCE_CertificateNotFoundSysErr"; - public const string TCE_CertificateWithNoPrivateKey = "TCE_CertificateWithNoPrivateKey"; - public const string TCE_CertificateWithNoPrivateKeySysErr = "TCE_CertificateWithNoPrivateKeySysErr"; - public const string TCE_ColumnDecryptionFailed = "TCE_ColumnDecryptionFailed"; - public const string TCE_DbConnectionString_ColumnEncryptionSetting = "TCE_DbConnectionString_ColumnEncryptionSetting"; - public const string TCE_DecryptionFailed = "TCE_DecryptionFailed"; - public const string TCE_EmptyCertificateThumbprint = "TCE_EmptyCertificateThumbprint"; - public const string TCE_EmptyCertificateThumbprintSysErr = "TCE_EmptyCertificateThumbprintSysErr"; - public const string TCE_EmptyColumnEncryptionKey = "TCE_EmptyColumnEncryptionKey"; - public const string TCE_EmptyEncryptedColumnEncryptionKey = "TCE_EmptyEncryptedColumnEncryptionKey"; - public const string TCE_EmptyProviderName = "TCE_EmptyProviderName"; - public const string TCE_InvalidAlgorithmVersion = "TCE_InvalidAlgorithmVersion"; - public const string TCE_InvalidAlgorithmVersionInEncryptedCEK = "TCE_InvalidAlgorithmVersionInEncryptedCEK"; - public const string TCE_InvalidAuthenticationTag = "TCE_InvalidAuthenticationTag"; - public const string TCE_InvalidCertificateLocation = "TCE_InvalidCertificateLocation"; - public const string TCE_InvalidCertificateLocationSysErr = "TCE_InvalidCertificateLocationSysErr"; - public const string TCE_InvalidCertificatePath = "TCE_InvalidCertificatePath"; - public const string TCE_InvalidCertificatePathSysErr = "TCE_InvalidCertificatePathSysErr"; - public const string TCE_InvalidCertificateSignature = "TCE_InvalidCertificateSignature"; - public const string TCE_InvalidCertificateStore = "TCE_InvalidCertificateStore"; - public const string TCE_InvalidCertificateStoreSysErr = "TCE_InvalidCertificateStoreSysErr"; - public const string TCE_InvalidCipherTextSize = "TCE_InvalidCipherTextSize"; - public const string TCE_InvalidCiphertextLengthInEncryptedCEK = "TCE_InvalidCiphertextLengthInEncryptedCEK"; - public const string TCE_InvalidCustomKeyStoreProviderName = "TCE_InvalidCustomKeyStoreProviderName"; - public const string TCE_InvalidEncryptionKeyOrdinal = "TCE_InvalidEncryptionKeyOrdinal"; - public const string TCE_InvalidEncryptionType = "TCE_InvalidEncryptionType"; - public const string TCE_InvalidKeyEncryptionAlgorithm = "TCE_InvalidKeyEncryptionAlgorithm"; - public const string TCE_InvalidKeyEncryptionAlgorithmSysErr = "TCE_InvalidKeyEncryptionAlgorithmSysErr"; - public const string TCE_InvalidKeySize = "TCE_InvalidKeySize"; - public const string TCE_InvalidSignatureInEncryptedCEK = "TCE_InvalidSignatureInEncryptedCEK"; - public const string TCE_KeyDecryptionFailed = "TCE_KeyDecryptionFailed"; - public const string TCE_KeyDecryptionFailedCertStore = "TCE_KeyDecryptionFailedCertStore"; - public const string TCE_LargeCertificatePathLength = "TCE_LargeCertificatePathLength"; - public const string TCE_LargeCertificatePathLengthSysErr = "TCE_LargeCertificatePathLengthSysErr"; - public const string TCE_NotSupportedByServer = "TCE_NotSupportedByServer"; - public const string TCE_NullCertificatePath = "TCE_NullCertificatePath"; - public const string TCE_NullCertificatePathSysErr = "TCE_NullCertificatePathSysErr"; - public const string TCE_NullCipherText = "TCE_NullCipherText"; - public const string TCE_NullColumnEncryptionAlgorithm = "TCE_NullColumnEncryptionAlgorithm"; - public const string TCE_NullColumnEncryptionKey = "TCE_NullColumnEncryptionKey"; - public const string TCE_NullColumnEncryptionKeySysErr = "TCE_NullColumnEncryptionKeySysErr"; - public const string TCE_NullCustomKeyStoreProviderDictionary = "TCE_NullCustomKeyStoreProviderDictionary"; - public const string TCE_NullEncryptedColumnEncryptionKey = "TCE_NullEncryptedColumnEncryptionKey"; - public const string TCE_NullKeyEncryptionAlgorithm = "TCE_NullKeyEncryptionAlgorithm"; - public const string TCE_NullKeyEncryptionAlgorithmSysErr = "TCE_NullKeyEncryptionAlgorithmSysErr"; - public const string TCE_NullPlainText = "TCE_NullPlainText"; - public const string TCE_NullProviderValue = "TCE_NullProviderValue"; - public const string TCE_ParamDecryptionFailed = "TCE_ParamDecryptionFailed"; - public const string TCE_ParamEncryptionFailed = "TCE_ParamEncryptionFailed"; - public const string TCE_ParamEncryptionMetaDataMissing = "TCE_ParamEncryptionMetaDataMissing"; - public const string TCE_ParamInvalidForceColumnEncryptionSetting = "TCE_ParamInvalidForceColumnEncryptionSetting"; - public const string TCE_ParamUnExpectedEncryptionMetadata = "TCE_ParamUnExpectedEncryptionMetadata"; - public const string TCE_ProcEncryptionMetaDataMissing = "TCE_ProcEncryptionMetaDataMissing"; - public const string TCE_SequentialAccessNotSupportedOnEncryptedColumn = "TCE_SequentialAccessNotSupportedOnEncryptedColumn"; - public const string TCE_SqlCommand_ColumnEncryptionSetting = "TCE_SqlCommand_ColumnEncryptionSetting"; - public const string TCE_SqlConnection_TrustedColumnMasterKeyPaths = "TCE_SqlConnection_TrustedColumnMasterKeyPaths"; - public const string TCE_SqlParameter_ForceColumnEncryption = "TCE_SqlParameter_ForceColumnEncryption"; - public const string TCE_StreamNotSupportOnEncryptedColumn = "TCE_StreamNotSupportOnEncryptedColumn"; - public const string TCE_UnexpectedDescribeParamFormat = "TCE_UnexpectedDescribeParamFormat"; - public const string TCE_UnknownColumnEncryptionAlgorithm = "TCE_UnknownColumnEncryptionAlgorithm"; - public const string TCE_UnknownColumnEncryptionAlgorithmId = "TCE_UnknownColumnEncryptionAlgorithmId"; - public const string TCE_UnrecognizedKeyStoreProviderName = "TCE_UnrecognizedKeyStoreProviderName"; - public const string TCE_UnsupportedDatatype = "TCE_UnsupportedDatatype"; - public const string TCE_UnsupportedNormalizationVersion = "TCE_UnsupportedNormalizationVersion"; - public const string TCE_UntrustedKeyPath = "TCE_UntrustedKeyPath"; - public const string TCE_VeryLargeCiphertext = "TCE_VeryLargeCiphertext"; - public const string DbConnectionString_TransparentNetworkIPResolution = "DbConnectionString_TransparentNetworkIPResolution"; - public const string TCE_NullCspPathSysErr = "TCE_NullCspPathSysErr"; - public const string TCE_NullCspPath = "TCE_NullCspPath"; - public const string TCE_NullCngPathSysErr = "TCE_NullCngPathSysErr"; - public const string TCE_NullCngPath = "TCE_NullCngPath"; - public const string TCE_InvalidCspPathSysErr = "TCE_InvalidCspPathSysErr"; - public const string TCE_InvalidCspPath = "TCE_InvalidCspPath"; - public const string TCE_InvalidCngPathSysErr = "TCE_InvalidCngPathSysErr"; - public const string TCE_InvalidCngPath = "TCE_InvalidCngPath"; - public const string TCE_EmptyCspNameSysErr = "TCE_EmptyCspNameSysErr"; - public const string TCE_EmptyCspName = "TCE_EmptyCspName"; - public const string TCE_EmptyCngNameSysErr = "TCE_EmptyCngNameSysErr"; - public const string TCE_EmptyCngName = "TCE_EmptyCngName"; - public const string TCE_EmptyCspKeyIdSysErr = "TCE_EmptyCspKeyIdSysErr"; - public const string TCE_EmptyCspKeyId = "TCE_EmptyCspKeyId"; - public const string TCE_EmptyCngKeyIdSysErr = "TCE_EmptyCngKeyIdSysErr"; - public const string TCE_EmptyCngKeyId = "TCE_EmptyCngKeyId"; - public const string TCE_InvalidCspNameSysErr = "TCE_InvalidCspNameSysErr"; - public const string TCE_InvalidCspName = "TCE_InvalidCspName"; - public const string TCE_InvalidCspKeyIdSysErr = "TCE_InvalidCspKeyIdSysErr"; - public const string TCE_InvalidCspKeyId = "TCE_InvalidCspKeyId"; - public const string TCE_InvalidCngKeySysErr = "TCE_InvalidCngKeySysErr"; - public const string TCE_InvalidCngKey = "TCE_InvalidCngKey"; - public const string TCE_InvalidCiphertextLengthInEncryptedCEKCsp = "TCE_InvalidCiphertextLengthInEncryptedCEKCsp"; - public const string TCE_InvalidCiphertextLengthInEncryptedCEKCng = "TCE_InvalidCiphertextLengthInEncryptedCEKCng"; - public const string TCE_InvalidSignatureInEncryptedCEKCsp = "TCE_InvalidSignatureInEncryptedCEKCsp"; - public const string TCE_InvalidSignatureInEncryptedCEKCng = "TCE_InvalidSignatureInEncryptedCEKCng"; - public const string TCE_InvalidSignature = "TCE_InvalidSignature"; - public const string GT_Disabled = "GT_Disabled"; - public const string GT_UnsupportedSysTxVersion = "GT_UnsupportedSysTxVersion"; -} -}
\ No newline at end of file diff --git a/mcs/class/System.Data/ReferenceSources/ResCategoryAttribute.cs b/mcs/class/System.Data/ReferenceSources/ResCategoryAttribute.cs deleted file mode 100644 index d8086404a81..00000000000 --- a/mcs/class/System.Data/ReferenceSources/ResCategoryAttribute.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.ComponentModel; - -namespace System.Data -{ - sealed class ResCategoryAttribute : CategoryAttribute - { - public ResCategoryAttribute (string category) - : base (category) - { - } - } -}
\ No newline at end of file diff --git a/mcs/class/System.Data/ReferenceSources/ResDescriptionAttribute.cs b/mcs/class/System.Data/ReferenceSources/ResDescriptionAttribute.cs deleted file mode 100644 index ba86f7b52fd..00000000000 --- a/mcs/class/System.Data/ReferenceSources/ResDescriptionAttribute.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.ComponentModel; - -namespace System.Data -{ - sealed class ResDescriptionAttribute : DescriptionAttribute - { - public ResDescriptionAttribute (string description) - : base (description) - { - } - } -}
\ No newline at end of file diff --git a/mcs/class/System.Data/ReferenceSources/SNINativeMethodWrapper.cs b/mcs/class/System.Data/ReferenceSources/SNINativeMethodWrapper.cs deleted file mode 100644 index 8687f1ca990..00000000000 --- a/mcs/class/System.Data/ReferenceSources/SNINativeMethodWrapper.cs +++ /dev/null @@ -1,228 +0,0 @@ -using System; -using System.Security; -using System.Runtime.InteropServices; - -namespace System.Data.SqlClient -{ - - class SNINativeMethodWrapper - { - const string msg = "It is native method used by Microsoft System.Data implementation that Mono or non-Windows platform does not support."; - - public delegate void SqlAsyncCallbackDelegate (IntPtr h, IntPtr h2, uint i); - - public class ConsumerInfo - { - internal int defaultBufferSize; - internal IntPtr key; - internal SqlAsyncCallbackDelegate readDelegate; - internal SqlAsyncCallbackDelegate writeDelegate; - } - - public class SNI_Error - { - internal char [] errorMessage; - internal string function; - internal int lineNumber; - internal uint nativeError; - internal ProviderEnum provider; - internal int sniError; - } - - public enum IOType - { - WRITE - } - - public enum ConsumerNumber - { - SNI_Consumer_SNI - } - - public enum ProviderEnum - { - SMUX_PROV, - SSL_PROV, - } - - public enum QTypes - { - SNI_QUERY_LOCALDB_HMODULE, - SNI_QUERY_CONN_BUFSIZE, - SNI_QUERY_CLIENT_ENCRYPT_POSSIBLE, - } - - public enum SniSpecialErrors - { - LocalDBErrorCode, - MultiSubnetFailoverWithMoreThan64IPs, - MultiSubnetFailoverWithInstanceSpecified, - MultiSubnetFailoverWithNonTcpProtocol, - MaxErrorValue, - } - - public static int SniMaxComposedSpnLength { - get { throw new NotSupportedException (msg); } - } - - public static uint SNIInitialize () - { - throw new NotSupportedException (msg); - } - - public static uint SNITerminate () - { - throw new NotSupportedException (msg); - } - - public static uint SNISecInitPackage (ref uint maxLength) - { - throw new NotSupportedException (msg); - } - - public static uint SNIReadAsync (SafeHandle handle, ref IntPtr data) - { - throw new NotSupportedException (msg); - } - - public static uint SNIReadSyncOverAsync (SafeHandle handle, ref IntPtr data, int timeout) - { - throw new NotSupportedException (msg); - } - - public static uint SNIOpen (ConsumerInfo info, SafeHandle handle, out IntPtr result, bool b) - { - throw new NotSupportedException (msg); - } - - public static uint SNIOpenSyncEx (ConsumerInfo info, string serverName, ref IntPtr handle, byte [] spnBuffer, byte [] instanceName, bool flushCache, bool sync, int timeout, bool parallel) - { - throw new NotSupportedException (msg); - } - - public static uint SNICheckConnection (SNIHandle handle) - { - throw new NotSupportedException (msg); - } - - public static uint SNIClose (IntPtr result) - { - throw new NotSupportedException (msg); - } - - public static uint SNIAddProvider (SafeHandle handle, ProviderEnum e, ref uint result) - { - throw new NotSupportedException (msg); - } - - public static uint SNIRemoveProvider (SafeHandle handle, ProviderEnum e) - { - throw new NotSupportedException (msg); - } - - public static uint SNISetInfo (SafeHandle handle, QTypes q, ref uint result) - { - throw new NotSupportedException (msg); - } - - public static uint SniGetConnectionId (SafeHandle handle, ref System.Guid id) - { - throw new NotSupportedException (msg); - } - - public static IntPtr SNIServerEnumOpen () - { - throw new NotSupportedException (msg); - } - - public static void SNIServerEnumClose (IntPtr handle) - { - throw new NotSupportedException (msg); - } - - public static int SNIServerEnumRead (IntPtr handle, char [] buffer, int bufferSize, ref bool more) - { - throw new NotSupportedException (msg); - } - - public static byte [] GetData () - { - throw new NotSupportedException (msg); - } - - public static void SetData (byte [] buffer) - { - throw new NotSupportedException (msg); - } - - public static _AppDomain GetDefaultAppDomain () - { - throw new NotSupportedException (msg); - } - - public static void SNIPacketSetData (SafeHandle handle, byte[] data, int size) - { - throw new NotSupportedException (msg); - } - - public static void SNIPacketSetData (SafeHandle handle, byte[] data, int size, SecureString [] securePasswords, int [] securePasswordOffsets) - { - throw new NotSupportedException (msg); - } - - public static void SNIPacketReset (SafeHandle handle, IOType io, SafeHandle handle2, ConsumerNumber cn) - { - throw new NotSupportedException (msg); - } - - public static uint SNISecGenClientContext (SafeHandle handle, byte [] bytes, uint size, byte[] bytes2, ref uint size2, byte[] bytes3) - { - throw new NotSupportedException (msg); - } - - public static void SNIPacketAllocate (SafeHandle handle, IOType io, ref IntPtr result) - { - throw new NotSupportedException (msg); - } - - public static void SNIPacketRelease (IntPtr packet) - { - throw new NotSupportedException (msg); - } - - public static uint SNIPacketGetData (IntPtr packet, byte [] buffer, ref uint size) - { - throw new NotSupportedException (msg); - } - - public static uint SNIWritePacket (SafeHandle handle, SNIPacket packet, bool sync) - { - throw new NotSupportedException (msg); - } - - public static void SNIGetLastError (SNI_Error error) - { - throw new NotSupportedException (msg); - } - - public static uint SNIOpenMarsSession (ConsumerInfo info, SNIHandle parent, ref IntPtr handle, bool sync) - { - throw new NotSupportedException (msg); - } - - public static uint SNIWaitForSSLHandshakeToComplete (SafeHandle handle, int timeout) - { - throw new NotSupportedException (msg); - } - - public static uint SNIQueryInfo (QTypes q, ref uint value) - { - throw new NotSupportedException (msg); - } - - public static uint SNIQueryInfo (QTypes q, ref IntPtr value) - { - throw new NotSupportedException (msg); - } - } -} diff --git a/mcs/class/System.Data/ReferenceSources/SafeNativeMethods.cs b/mcs/class/System.Data/ReferenceSources/SafeNativeMethods.cs deleted file mode 100644 index dd383c10e06..00000000000 --- a/mcs/class/System.Data/ReferenceSources/SafeNativeMethods.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text; - -namespace System.Data.Common { - - internal static class SafeNativeMethods { - - static internal int GetComputerNameEx (int nameType, StringBuilder nameBuffer, ref int bufferSize) - { - throw new NotImplementedException (); - } - } -}
\ No newline at end of file diff --git a/mcs/class/System.Data/ReferenceSources/SqlInternalConnectionTds.cs b/mcs/class/System.Data/ReferenceSources/SqlInternalConnectionTds.cs deleted file mode 100644 index b82129cf64f..00000000000 --- a/mcs/class/System.Data/ReferenceSources/SqlInternalConnectionTds.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace System.Data.SqlClient -{ - class SqlInternalConnectionTds - { - - } -}
\ No newline at end of file diff --git a/mcs/class/System.Data/ReferenceSources/Win32NativeMethods.cs b/mcs/class/System.Data/ReferenceSources/Win32NativeMethods.cs deleted file mode 100644 index b8d3d44b563..00000000000 --- a/mcs/class/System.Data/ReferenceSources/Win32NativeMethods.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; - -class Win32NativeMethods -{ - public static bool IsTokenRestrictedWrapper (IntPtr token) - { - throw new NotSupportedException ("It is native method used by Microsoft System.Data implementation that Mono or non-Windows platform does not support."); - } -} - diff --git a/mcs/class/System.Data/ReferenceSources/mobile_DbConnectionPoolCounters.cs b/mcs/class/System.Data/ReferenceSources/mobile_DbConnectionPoolCounters.cs deleted file mode 100644 index 8bbd779c000..00000000000 --- a/mcs/class/System.Data/ReferenceSources/mobile_DbConnectionPoolCounters.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace System.Data.ProviderBase -{ - class DbConnectionPoolCounters - { - } - - class DbConnectionPoolCountersNoCounters : DbConnectionPoolCounters - { - public static DbConnectionPoolCounters SingletonInstance { get; set; } - } -} - diff --git a/mcs/class/System.Data/System.Data.Common/.gitattributes b/mcs/class/System.Data/System.Data.Common/.gitattributes deleted file mode 100644 index 9cf7c0a7544..00000000000 --- a/mcs/class/System.Data/System.Data.Common/.gitattributes +++ /dev/null @@ -1,5 +0,0 @@ -/DbMetaDataCache.cs -crlf -/DbTypes.cs -crlf -/ExceptionHelper.cs -crlf -/Index.cs -crlf -/Key.cs -crlf diff --git a/mcs/class/System.Data/System.Data.Common/DbConnectionStringBuilderHelper.cs b/mcs/class/System.Data/System.Data.Common/DbConnectionStringBuilderHelper.cs deleted file mode 100644 index 38df3d2b470..00000000000 --- a/mcs/class/System.Data/System.Data.Common/DbConnectionStringBuilderHelper.cs +++ /dev/null @@ -1,61 +0,0 @@ -// -// System.Data.Common.DbConnectionStringBuilderHelper.cs -// -// Author: -// Sureshkumar T (tsureshkumar@novell.com) -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.Globalization; - -namespace System.Data.Common -{ - internal sealed class DbConnectionStringBuilderHelper - { - #region Methods - public static int ConvertToInt32 (object value) - { - return Int32.Parse (value.ToString (), CultureInfo.InvariantCulture); - } - - public static 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 // Methods - } -} - diff --git a/mcs/class/System.Data/System.Data.Common/DbTypes.cs b/mcs/class/System.Data/System.Data.Common/DbTypes.cs deleted file mode 100644 index d3873aee4f9..00000000000 --- a/mcs/class/System.Data/System.Data.Common/DbTypes.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System;
-
-namespace System.Data.Common
-{
- internal class DbTypes
- {
- #region .Net types constants
-
- internal static readonly Type TypeOfBoolean = typeof(Boolean);
- internal static readonly Type TypeOfSByte = typeof(SByte);
- internal static readonly Type TypeOfChar = typeof(Char);
- internal static readonly Type TypeOfInt16 = typeof(Int16);
- internal static readonly Type TypeOfInt32 = typeof(Int32);
- internal static readonly Type TypeOfInt64 = typeof(Int64);
- internal static readonly Type TypeOfByte = typeof(Byte);
- internal static readonly Type TypeOfUInt16 = typeof(UInt16);
- internal static readonly Type TypeOfUInt32 = typeof(UInt32);
- internal static readonly Type TypeOfUInt64 = typeof(UInt64);
- internal static readonly Type TypeOfDouble = typeof(Double);
- internal static readonly Type TypeOfSingle = typeof(Single);
- internal static readonly Type TypeOfDecimal = typeof(Decimal);
- internal static readonly Type TypeOfString = typeof(String);
- internal static readonly Type TypeOfDateTime = typeof(DateTime);
- internal static readonly Type TypeOfObject = typeof(object);
- internal static readonly Type TypeOfGuid = typeof(Guid);
- internal static readonly Type TypeOfType = typeof(Type);
-
- // additional types
- internal static readonly Type TypeOfByteArray = typeof(Byte[]);
- internal static readonly Type TypeOfFloat = typeof (float);
- internal static readonly Type TypeOfTimespan = typeof (TimeSpan);
-
- #endregion // .Net types constants
- }
-}
diff --git a/mcs/class/System.Data/System.Data.Common/ExceptionHelper.cs b/mcs/class/System.Data/System.Data.Common/ExceptionHelper.cs deleted file mode 100644 index d4364aa2bc2..00000000000 --- a/mcs/class/System.Data/System.Data.Common/ExceptionHelper.cs +++ /dev/null @@ -1,234 +0,0 @@ -//
-// System.Data.Common.ExceptionHelper
-//
-// Author:
-// Boris Kirzner (borisk@mainsoft.com)
-//
-
-using System;
-using System.Globalization;
-
-namespace System.Data.Common
-{
- internal sealed class ExceptionHelper
- {
- internal static ArgumentException InvalidSizeValue (int value)
- {
- string [] args = new string [] {value.ToString ()};
- return new ArgumentException (GetExceptionMessage ("Invalid parameter Size value '{0}'. The value must be greater than or equal to 0.",args));
- }
-
- internal static void CheckEnumValue (Type enumType, object value)
- {
- if (!Enum.IsDefined (enumType, value))
- throw InvalidEnumValueException (enumType.Name, value);
- }
-
- internal static ArgumentException InvalidEnumValueException (String enumeration, object value)
- {
- string msg = string.Format (CultureInfo.InvariantCulture,
- "The {0} enumeration value, {1}, is invalid.",
- enumeration, value);
- return new ArgumentOutOfRangeException (enumeration, msg);
- }
-
- internal static ArgumentOutOfRangeException InvalidDataRowVersion (DataRowVersion value)
- {
- object [] args = new object [] { "DataRowVersion", value.ToString () } ;
- return new ArgumentOutOfRangeException (GetExceptionMessage ("{0}: Invalid DataRow Version enumeration value: {1}",args));
- }
-
- internal static ArgumentOutOfRangeException InvalidParameterDirection (ParameterDirection value)
- {
- object [] args = new object [] { "ParameterDirection", value.ToString () } ;
- return new ArgumentOutOfRangeException (GetExceptionMessage ("Invalid direction '{0}' for '{1}' parameter.",args));
- }
-
- internal static InvalidOperationException NoStoredProcedureExists (string procedureName) {
- object [] args = new object [1] { procedureName } ;
- return new InvalidOperationException (GetExceptionMessage ("The stored procedure '{0}' doesn't exist.", args));
- }
-
- internal static ArgumentNullException ArgumentNull (string parameter)
- {
- return new ArgumentNullException (parameter);
- }
-
- internal static InvalidOperationException TransactionRequired ()
- {
- return new InvalidOperationException (GetExceptionMessage ("Execute requires the command to have a transaction object when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized."));
- }
-
- internal static ArgumentOutOfRangeException InvalidOleDbType (int value)
- {
- string [] args = new string [] { value.ToString() };
- return new ArgumentOutOfRangeException (GetExceptionMessage ("Invalid OleDbType enumeration value: {0}",args));
- }
-
- internal static ArgumentException InvalidDbType(int value)
- {
- string [] args = new string [] { value.ToString () };
- return new ArgumentException (GetExceptionMessage ("No mapping exists from DbType {0} to a known {1}.",args));
- }
-
- internal static InvalidOperationException DeriveParametersNotSupported(Type type,CommandType commandType)
- {
- string [] args = new string [] { type.ToString(),commandType.ToString() };
- return new InvalidOperationException (GetExceptionMessage ("{0} DeriveParameters only supports CommandType.StoredProcedure, not CommandType.{1}.",args));
- }
-
- internal static InvalidOperationException ReaderClosed (string mehodName)
- {
- string [] args = new string [] { mehodName };
- return new InvalidOperationException (GetExceptionMessage ("Invalid attempt to {0} when reader is closed.",args));
- }
-
- internal static ArgumentOutOfRangeException InvalidSqlDbType (int value)
- {
- string [] args = new string [] { value.ToString () };
- return new ArgumentOutOfRangeException (GetExceptionMessage ("{0}: Invalid SqlDbType enumeration value: {1}.",args));
- }
-
- internal static ArgumentException UnknownDataType (string type1, string type2)
- {
- string [] args = new string [] { type1, type2 };
- return new ArgumentException (GetExceptionMessage ("No mapping exists from DbType {0} to a known {1}.",args));
- }
-
- internal static InvalidOperationException TransactionNotInitialized ()
- {
- return new InvalidOperationException (GetExceptionMessage ("Execute requires the command to have a transaction object when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized."));
- }
-
- internal static InvalidOperationException TransactionNotUsable (Type type)
- {
- return new InvalidOperationException (string.Format (
- CultureInfo.InvariantCulture,
- "This {0} has completed; it is no longer usable.",
- type.Name));
- }
-
- internal static InvalidOperationException ParametersNotInitialized (int parameterPosition,string parameterName,string parameterType)
- {
- object [] args = new object [] { parameterPosition, parameterName, parameterType };
- return new InvalidOperationException (GetExceptionMessage ("Parameter {0}: '{1}', the property DbType is uninitialized: OleDbType.{2}.",args));
- }
-
- internal static InvalidOperationException WrongParameterSize(string provider)
- {
- string [] args = new string [] { provider };
- return new InvalidOperationException (GetExceptionMessage ("{0}.Prepare method requires all variable length parameters to have an explicitly set non-zero Size.",args));
- }
-
- internal static InvalidOperationException ConnectionNotOpened (string operationName, string connectionState)
- {
- object [] args = new object [] { operationName, connectionState };
- return new InvalidOperationException (GetExceptionMessage ("{0} requires an open and available Connection. The connection's current state is {1}.",args));
- }
-
- internal static InvalidOperationException ConnectionNotInitialized (string methodName)
- {
- object [] args = new object [] { methodName };
- return new InvalidOperationException (GetExceptionMessage ("{0}: Connection property has not been initialized.",args));
- }
-
- internal static InvalidOperationException OpenConnectionRequired (string methodName, object connectionState)
- {
- object [] args = new object [] { methodName, connectionState };
- return new InvalidOperationException (GetExceptionMessage ("{0} requires an open and available Connection. The connection's current state is {1}.",args));
- }
-
- internal static InvalidOperationException OpenedReaderExists ()
- {
- return new InvalidOperationException (GetExceptionMessage ("There is already an open DataReader associated with this Connection which must be closed first."));
- }
-
- internal static InvalidOperationException ConnectionAlreadyOpen (object connectionState)
- {
- object [] args = new object [] { connectionState };
- return new InvalidOperationException (GetExceptionMessage ("The connection is already Open (state={0}).",args));
- }
-
- internal static InvalidOperationException ConnectionClosed ()
- {
- return new InvalidOperationException ("Invalid operation. The Connection is closed.");
- }
-
- internal static InvalidOperationException ConnectionStringNotInitialized ()
- {
- return new InvalidOperationException (GetExceptionMessage ("The ConnectionString property has not been initialized."));
- }
-
- internal static InvalidOperationException ConnectionIsBusy (object commandType,object connectionState)
- {
- object [] args = new object [] { commandType.ToString (), connectionState.ToString () };
- return new InvalidOperationException (GetExceptionMessage ("The {0} is currently busy {1}.",args));
- }
-
- internal static InvalidOperationException NotAllowedWhileConnectionOpen (string propertyName, object connectionState)
- {
- object [] args = new object [] { propertyName, connectionState };
- return new InvalidOperationException (GetExceptionMessage ("Not allowed to change the '{0}' property while the connection (state={1}).",args));
- }
-
- internal static ArgumentException OleDbNoProviderSpecified ()
- {
- return new ArgumentException (GetExceptionMessage ("An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'."));
- }
-
- internal static ArgumentException InvalidValueForKey (string key)
- {
- string [] args = new string [] { key };
- return new ArgumentException (String.Format ("Invalid value for key {0}",args));
- }
-
- internal static InvalidOperationException ParameterSizeNotInitialized( int parameterIndex, string parameterName,string parameterType,int parameterSize)
- {
- object [] args = new object [] { parameterIndex.ToString (), parameterName, parameterType, parameterSize.ToString () };
- return new InvalidOperationException (GetExceptionMessage ("Parameter {0}: '{1}' of type: {2}, the property Size has an invalid size: {3}",args));
- }
-
- internal static ArgumentException InvalidUpdateStatus (UpdateStatus status)
- {
- object [] args = new object [] { status };
- return new ArgumentException (GetExceptionMessage ("Invalid UpdateStatus: {0}",args));
- }
-
- internal static InvalidOperationException UpdateRequiresCommand (string command)
- {
- object [] args = new object [] { command };
- return new InvalidOperationException (GetExceptionMessage ("Auto SQL generation during {0} requires a valid SelectCommand.",args));
- }
-
- internal static DataException RowUpdatedError ()
- {
- return new DataException (GetExceptionMessage ("RowUpdatedEvent: Errors occurred; no additional is information available."));
- }
-
- internal static ArgumentNullException CollectionNoNullsAllowed (object collection, object objectsType)
- {
- object [] args = new object [] {collection.GetType ().ToString (), objectsType.ToString ()};
- return new ArgumentNullException (GetExceptionMessage ("The {0} only accepts non-null {1} type objects.", args));
- }
-
- internal static ArgumentException CollectionAlreadyContains(object objectType,string propertyName, object propertyValue, object collection)
- {
- object [] args = new object [] {objectType.ToString (), propertyName, propertyValue, collection.GetType ().ToString ()};
- return new ArgumentException (GetExceptionMessage ("The {0} with {1} '{2}' is already contained by this {3}.",args));
- }
-
- internal static string GetExceptionMessage (string exceptionMessage,object [] args)
- {
- if ((args == null) || (args.Length == 0)) {
- return exceptionMessage;
- } else {
- return String.Format (exceptionMessage,args);
- }
- }
-
- internal static string GetExceptionMessage (string exceptionMessage)
- {
- return GetExceptionMessage (exceptionMessage, null);
- }
- }
-}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/NetworkLibraryConverter.cs b/mcs/class/System.Data/System.Data.SqlClient/NetworkLibraryConverter.cs deleted file mode 100644 index 93737807be9..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/NetworkLibraryConverter.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -// System.Data.SqlClient.NetworkLibraryConverter.cs -// -// Author: -// Nagappan A (anagappan@novell.com) -// - -// -// Copyright (C) 2007 Novell, Inc (http://www.novell.com) -// -// 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.Globalization; - -namespace System.Data.SqlClient { - internal sealed class NetworkLibraryConverter : ExpandableObjectConverter - { - #region Constructors - - [MonoTODO] - public NetworkLibraryConverter () - { - throw new NotImplementedException (); - } - - #endregion // Constructors - - #region Methods - - [MonoTODO] - public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) - { - throw new NotImplementedException (); - } - - #endregion // Methods - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/OnChangeEventHandler.cs b/mcs/class/System.Data/System.Data.SqlClient/OnChangeEventHandler.cs deleted file mode 100644 index 8fbe7d20f0f..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/OnChangeEventHandler.cs +++ /dev/null @@ -1,36 +0,0 @@ -// -// System.Data.SqlClient.OnChangeEventHandler.cs -// -// Author: -// Umadevi S (sumadevi@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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 System.Data.SqlClient { - public delegate void OnChangeEventHandler(object sender, SqlNotificationEventArgs e); -} - diff --git a/mcs/class/System.Data/System.Data.SqlClient/SortOrder.cs b/mcs/class/System.Data/System.Data.SqlClient/SortOrder.cs deleted file mode 100644 index cb83ced5cae..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SortOrder.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -// System.Data.SqlClient.SortOrder.cs -// -// Author: -// Jonathan Pobst (monkey@jpobst.com) -// -// -// Copyright (C) 2009 Novell, Inc (http://www.novell.com) -// -// 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 System.Data.SqlClient -{ - public enum SortOrder - { - Ascending = 0, - Descending = 1, - Unspecified = -1 - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlAsyncResult.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlAsyncResult.cs deleted file mode 100644 index f574a310112..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlAsyncResult.cs +++ /dev/null @@ -1,137 +0,0 @@ -// -// System.Data.SqlClient.SqlAsyncResult.cs -// -// Author: -// T Sureshkumar <tsureshkumar@novell.com> -// Ankit Jain <radical@corewars.org> -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// -// 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.Threading; - -namespace System.Data.SqlClient -{ - internal class SqlAsyncResult : IAsyncResult - { - private SqlAsyncState _sqlState; - private WaitHandle _waitHandle; - private bool _completed = false; - private bool _completedSyncly = false; - private bool _ended = false; - private AsyncCallback _userCallback = null; - private object _retValue; - private string _endMethod; - private IAsyncResult _internal; - - public SqlAsyncResult (AsyncCallback userCallback, SqlAsyncState sqlState) - { - _sqlState = sqlState; - _userCallback = userCallback; - _waitHandle = new ManualResetEvent (false); - } - - public SqlAsyncResult (AsyncCallback userCallback, object state) - { - _sqlState = new SqlAsyncState (state); - _userCallback = userCallback; - _waitHandle = new ManualResetEvent (false); - } - - public object AsyncState - { - get { return _sqlState.UserState; } - } - - internal SqlAsyncState SqlAsyncState - { - get { return _sqlState; } - } - - public WaitHandle AsyncWaitHandle - { - get { return _waitHandle; } - - } - - public bool IsCompleted - { - get { return _completed; } - } - - public bool CompletedSynchronously - { - get { return _completedSyncly; } - } - - internal object ReturnValue - { - get { return _retValue; } - set { _retValue = value; } - } - - public string EndMethod - { - get { return _endMethod; } - set { _endMethod = value; } - } - - public bool Ended - { - get { return _ended; } - set { _ended = value; } - } - - - internal IAsyncResult InternalResult - { - get { return _internal; } - set { _internal = value; } - } - - public AsyncCallback BubbleCallback - { - get { return new AsyncCallback (Bubbleback); } - - } - - internal void MarkComplete () - { - _completed = true; - ((ManualResetEvent)_waitHandle).Set (); - - if (_userCallback != null) - _userCallback (this); - } - - public void Bubbleback (IAsyncResult ar) - { - this.MarkComplete (); - } - } -} - diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlAsyncState.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlAsyncState.cs deleted file mode 100644 index dcfd82c6c31..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlAsyncState.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -// System.Data.SqlClient.SqlAsyncState.cs -// -// Author: -// T Sureshkumar <tsureshkumar@novell.com> -// Ankit Jain <radical@corewars.org> -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// -// 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.Net.Sockets; - - -namespace System.Data.SqlClient -{ - internal class SqlAsyncState - { - object _userState; - - public SqlAsyncState (object userState) - { - _userState = userState; - } - - public object UserState - { - get {return _userState;} - set {_userState = value;} - } - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlBulkCopy.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlBulkCopy.cs deleted file mode 100644 index 87e740495b1..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlBulkCopy.cs +++ /dev/null @@ -1,702 +0,0 @@ -// -// System.Data.SqlClient.SqlBulkCopy.cs -// -// Author: -// Nagappan A (anagappan@novell.com) -// -// (C) Novell, Inc 2007 - -// -// Copyright (C) 2007 Novell, Inc (http://www.novell.com) -// -// 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.Threading; -using System.Threading.Tasks; -using Mono.Data.Tds; -using Mono.Data.Tds.Protocol; - -namespace System.Data.SqlClient { - /// <summary>Efficient way to bulk load SQL Server table with several data rows at once</summary> - public sealed class SqlBulkCopy : IDisposable - { - #region Constants - private const string transConflictMessage = "Must not specify SqlBulkCopyOptions.UseInternalTransaction " + - "and pass an external Transaction at the same time."; - - private const SqlBulkCopyOptions insertModifiers = - SqlBulkCopyOptions.CheckConstraints | SqlBulkCopyOptions.TableLock | - SqlBulkCopyOptions.KeepNulls | SqlBulkCopyOptions.FireTriggers; - #endregion - - #region Fields - - private int _batchSize = 0; - private int _notifyAfter = 0; - private int _bulkCopyTimeout = 0; - private SqlBulkCopyColumnMappingCollection _columnMappingCollection = new SqlBulkCopyColumnMappingCollection (); - private string _destinationTableName = null; - private bool ordinalMapping = false; - private bool sqlRowsCopied = false; - private bool isLocalConnection = false; - private SqlConnection connection; - private SqlTransaction externalTransaction; - private SqlBulkCopyOptions copyOptions = SqlBulkCopyOptions.Default; - - #endregion - - #region Constructors - public SqlBulkCopy (SqlConnection connection) - { - if (connection == null) { - throw new ArgumentNullException("connection"); - } - - this.connection = connection; - } - - public SqlBulkCopy (string connectionString) - { - if (connectionString == null) { - throw new ArgumentNullException("connectionString"); - } - - this.connection = new SqlConnection (connectionString); - isLocalConnection = true; - } - - [MonoTODO] - public SqlBulkCopy (string connectionString, SqlBulkCopyOptions copyOptions) - { - if (connectionString == null) { - throw new ArgumentNullException ("connectionString"); - } - - this.connection = new SqlConnection (connectionString); - isLocalConnection = true; - - if ((copyOptions & SqlBulkCopyOptions.UseInternalTransaction) == SqlBulkCopyOptions.UseInternalTransaction) - throw new NotImplementedException ("We don't know how to process UseInternalTransaction option."); - - this.copyOptions = copyOptions; - } - - [MonoTODO] - public SqlBulkCopy (SqlConnection connection, SqlBulkCopyOptions copyOptions, SqlTransaction externalTransaction) - { - if (connection == null) { - throw new ArgumentNullException ("connection"); - } - - this.connection = connection; - this.copyOptions = copyOptions; - - if ((copyOptions & SqlBulkCopyOptions.UseInternalTransaction) == SqlBulkCopyOptions.UseInternalTransaction) { - if (externalTransaction != null) - throw new ArgumentException (transConflictMessage); - } - else - this.externalTransaction = externalTransaction; - - if ((copyOptions & SqlBulkCopyOptions.UseInternalTransaction) == SqlBulkCopyOptions.UseInternalTransaction) - throw new NotImplementedException ("We don't know how to process UseInternalTransaction option."); - - this.copyOptions = copyOptions; - } - - #endregion - - #region Properties - - public int BatchSize { - get { return _batchSize; } - set { _batchSize = value; } - } - - public int BulkCopyTimeout { - get { return _bulkCopyTimeout; } - set { _bulkCopyTimeout = value; } - } - - public SqlBulkCopyColumnMappingCollection ColumnMappings { - get { return _columnMappingCollection; } - } - - public string DestinationTableName { - get { return _destinationTableName; } - set { _destinationTableName = value; } - } - - [MonoTODO] - public bool EnableStreaming { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } - } - - public int NotifyAfter { - get { return _notifyAfter; } - set { - if (value < 0) - throw new ArgumentOutOfRangeException ("NotifyAfter should be greater than or equal to 0"); - _notifyAfter = value; - } - } - - #endregion - - #region Methods - - public void Close () - { - if (sqlRowsCopied == true) { - throw new InvalidOperationException ("Close should not be called from SqlRowsCopied event"); - } - if (connection == null || connection.State == ConnectionState.Closed) { - return; - } - connection.Close (); - } - - private DataTable [] GetColumnMetaData () - { - DataTable [] columnMetaDataTables = new DataTable [2]; - SqlCommand cmd = new SqlCommand ("select @@trancount; " + - "set fmtonly on select * from " + - DestinationTableName + " set fmtonly off;" + - "exec sp_tablecollations_90 '" + - DestinationTableName + "'", - connection); - - if (externalTransaction != null) - cmd.Transaction = externalTransaction; - - SqlDataReader reader = cmd.ExecuteReader (); - int i = 0; // Skipping 1st result - do { - if (i == 1) { - columnMetaDataTables [i - 1] = reader.GetSchemaTable (); - } else if (i == 2) { - SqlDataAdapter adapter = new SqlDataAdapter (); - adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey; - columnMetaDataTables [i - 1] = new DataTable (DestinationTableName); - adapter.FillInternal (columnMetaDataTables [i - 1], reader); - } - i++; - } while (reader.IsClosed == false && reader.NextResult()); - reader.Close (); - return columnMetaDataTables; - } - - private string GenerateColumnMetaData (SqlCommand tmpCmd, DataTable colMetaData, DataTable tableCollations) - { - bool flag = false; - string statement = ""; - int i = 0; - foreach (DataRow row in colMetaData.Rows) { - flag = false; - foreach (DataColumn col in colMetaData.Columns) { // FIXME: This line not required, remove later - object value = null; - if (_columnMappingCollection.Count > 0) { - if (ordinalMapping) { - foreach (SqlBulkCopyColumnMapping mapping - in _columnMappingCollection) { - if (mapping.DestinationOrdinal == i) { - flag = true; - break; - } - } - } else { - foreach (SqlBulkCopyColumnMapping mapping - in _columnMappingCollection) { - if (mapping.DestinationColumn == (string) row ["ColumnName"]) { - flag = true; - break; - } - } - } - if (flag == false) - break; - } - if ((bool)row ["IsReadOnly"]) { - if (ordinalMapping) - value = false; - else - break; - } - SqlParameter param = new SqlParameter ((string) row ["ColumnName"], - ((SqlDbType) row ["ProviderType"])); - param.Value = value; - if ((int)row ["ColumnSize"] != -1) { - param.Size = (int) row ["ColumnSize"]; - } - - short numericPresision = (short)row ["NumericPrecision"]; - if (numericPresision != 255) { - param.Precision = (byte) numericPresision; - } - - short numericScale = (short)row ["NumericScale"]; - if (numericScale != 255) { - param.Scale = (byte) numericScale; - } - - param.IsNullable = (bool)row ["AllowDBNull"]; - tmpCmd.Parameters.Add (param); - break; - } - i++; - } - flag = false; - bool insertSt = false; - foreach (DataRow row in colMetaData.Rows) { - SqlDbType sqlType = (SqlDbType) row ["ProviderType"]; - if (_columnMappingCollection.Count > 0) { - i = 0; - insertSt = false; - foreach (SqlParameter param in tmpCmd.Parameters) { - if (ordinalMapping) { - foreach (SqlBulkCopyColumnMapping mapping - in _columnMappingCollection) { - if (mapping.DestinationOrdinal == i && param.Value == null) { - insertSt = true; - } - } - } else { - foreach (SqlBulkCopyColumnMapping mapping - in _columnMappingCollection) { - if (mapping.DestinationColumn == param.ParameterName && - (string)row ["ColumnName"] == param.ParameterName) { - insertSt = true; - param.Value = null; - } - } - } - i++; - if (insertSt == true) - break; - } - if (insertSt == false) - continue; - } - if ((bool)row ["IsReadOnly"]) { - continue; - } - - int columnSize = (int)row ["ColumnSize"]; - string columnInfo = ""; - - if (columnSize >= TdsMetaParameter.maxVarCharCharacters && sqlType == SqlDbType.Text) - columnInfo = "VarChar(max)"; - else if (columnSize >= TdsMetaParameter.maxNVarCharCharacters && sqlType == SqlDbType.NText) - columnInfo = "NVarChar(max)"; - else if (IsTextType(sqlType) && columnSize != -1) { - columnInfo = string.Format ("{0}({1})", - sqlType, - columnSize.ToString()); - } else { - columnInfo = string.Format ("{0}", sqlType); - } - - if ( sqlType == SqlDbType.Decimal) - columnInfo += String.Format("({0},{1})", row ["NumericPrecision"], row ["NumericScale"]); - - if (flag) - statement += ", "; - string columnName = (string) row ["ColumnName"]; - statement += string.Format ("[{0}] {1}", columnName, columnInfo); - if (flag == false) - flag = true; - if (IsTextType(sqlType) && tableCollations != null) { - foreach (DataRow collationRow in tableCollations.Rows) { - if ((string)collationRow ["name"] == columnName) { - statement += string.Format (" COLLATE {0}", collationRow ["collation"]); - break; - } - } - } - } - return statement; - } - - private void ValidateColumnMapping (DataTable table, DataTable tableCollations) - { - // So the problem here is that temp tables will not have any table collations. This prevents - // us from bulk inserting into temp tables. So for now we will skip the validation and - // let SqlServer tell us there is an issue rather than trying to do it here. - // So for now we will simply return and do nothing. - // TODO: At some point we should remove this function if we all agree its the right thing to do - return; - -// foreach (SqlBulkCopyColumnMapping _columnMapping in _columnMappingCollection) { -// if (ordinalMapping == false && -// (_columnMapping.DestinationColumn == String.Empty || -// _columnMapping.SourceColumn == String.Empty)) -// throw new InvalidOperationException ("Mappings must be either all null or ordinal"); -// if (ordinalMapping && -// (_columnMapping.DestinationOrdinal == -1 || -// _columnMapping.SourceOrdinal == -1)) -// throw new InvalidOperationException ("Mappings must be either all null or ordinal"); -// bool flag = false; -// if (ordinalMapping == false) { -// foreach (DataRow row in tableCollations.Rows) { -// if ((string)row ["name"] == _columnMapping.DestinationColumn) { -// flag = true; -// break; -// } -// } -// if (flag == false) -// throw new InvalidOperationException ("ColumnMapping does not match"); -// flag = false; -// foreach (DataColumn col in table.Columns) { -// if (col.ColumnName == _columnMapping.SourceColumn) { -// flag = true; -// break; -// } -// } -// if (flag == false) -// throw new InvalidOperationException ("ColumnName " + -// _columnMapping.SourceColumn + -// " does not match"); -// } else { -// if (_columnMapping.DestinationOrdinal >= tableCollations.Rows.Count) -// throw new InvalidOperationException ("ColumnMapping does not match"); -// } -// } - } - - private void BulkCopyToServer (DataTable table, DataRowState state) - { - if (connection == null || connection.State == ConnectionState.Closed) - throw new InvalidOperationException ("This method should not be called on a closed connection"); - if (_destinationTableName == null) - throw new ArgumentNullException ("DestinationTableName"); - if (isLocalConnection && connection.State != ConnectionState.Open) - connection.Open(); - - if ((copyOptions & SqlBulkCopyOptions.KeepIdentity) == SqlBulkCopyOptions.KeepIdentity) { - SqlCommand cmd = new SqlCommand ("set identity_insert " + - table.TableName + " on", - connection); - cmd.ExecuteScalar (); - } - DataTable [] columnMetaDataTables = GetColumnMetaData (); - DataTable colMetaData = columnMetaDataTables [0]; - DataTable tableCollations = columnMetaDataTables [1]; - - if (_columnMappingCollection.Count > 0) { - if (_columnMappingCollection [0].SourceOrdinal != -1) - ordinalMapping = true; - ValidateColumnMapping (table, tableCollations); - } - - SqlCommand tmpCmd = new SqlCommand (); - TdsBulkCopy blkCopy = new TdsBulkCopy ((Tds)connection.Tds); - if (((Tds)connection.Tds).TdsVersion >= TdsVersion.tds70) { - string statement = "insert bulk " + DestinationTableName + " ("; - statement += GenerateColumnMetaData (tmpCmd, colMetaData, tableCollations); - statement += ")"; - - #region Check requested options and add corresponding modifiers to the statement - if ((copyOptions & insertModifiers) != SqlBulkCopyOptions.Default) { - statement += " WITH ("; - bool commaRequired = false; - - if ((copyOptions & SqlBulkCopyOptions.CheckConstraints) == SqlBulkCopyOptions.CheckConstraints) { - if (commaRequired) - statement += ", "; - statement += "CHECK_CONSTRAINTS"; - commaRequired = true; - } - - if ((copyOptions & SqlBulkCopyOptions.TableLock) == SqlBulkCopyOptions.TableLock) { - if (commaRequired) - statement += ", "; - statement += "TABLOCK"; - commaRequired = true; - } - - if ((copyOptions & SqlBulkCopyOptions.KeepNulls) == SqlBulkCopyOptions.KeepNulls) { - if (commaRequired) - statement += ", "; - statement += "KEEP_NULLS"; - commaRequired = true; - } - - if ((copyOptions & SqlBulkCopyOptions.FireTriggers) == SqlBulkCopyOptions.FireTriggers) { - if (commaRequired) - statement += ", "; - statement += "FIRE_TRIGGERS"; - commaRequired = true; - } - - statement += ")"; - } - #endregion Check requested options and add corresponding modifiers to the statement - - blkCopy.SendColumnMetaData (statement); - } - blkCopy.BulkCopyStart (tmpCmd.Parameters.MetaParameters); - long noRowsCopied = 0; - foreach (DataRow row in table.Rows) { - if (row.RowState == DataRowState.Deleted) - continue; // Don't copy the row that's in deleted state - if (state != 0 && row.RowState != state) - continue; - bool isNewRow = true; - int i = 0; - foreach (SqlParameter param in tmpCmd.Parameters) { - int size = 0; - object rowToCopy = null; - if (_columnMappingCollection.Count > 0) { - if (ordinalMapping) { - foreach (SqlBulkCopyColumnMapping mapping - in _columnMappingCollection) { - if (mapping.DestinationOrdinal == i && param.Value == null) { - rowToCopy = row [mapping.SourceOrdinal]; - SqlParameter parameter = new SqlParameter (mapping.SourceOrdinal.ToString (), - rowToCopy); - if (param.MetaParameter.TypeName != parameter.MetaParameter.TypeName) { - parameter.SqlDbType = param.SqlDbType; - rowToCopy = parameter.Value = parameter.ConvertToFrameworkType (rowToCopy); - } - string colType = string.Format ("{0}", parameter.MetaParameter.TypeName); - if (colType == "nvarchar" || colType == "ntext" || colType == "nchar") { - if (row [i] != null && row [i] != DBNull.Value) { - size = ((string) parameter.Value).Length; - size <<= 1; - } - } else if (colType == "varchar" || colType == "text" || colType == "char") { - if (row [i] != null && row [i] != DBNull.Value) - size = ((string) parameter.Value).Length; - } else { - size = parameter.Size; - } - break; - } - } - } else { - foreach (SqlBulkCopyColumnMapping mapping - in _columnMappingCollection) { - if (mapping.DestinationColumn == param.ParameterName) { - rowToCopy = row [mapping.SourceColumn]; - SqlParameter parameter = new SqlParameter (mapping.SourceColumn, rowToCopy); - if (param.MetaParameter.TypeName != parameter.MetaParameter.TypeName) { - parameter.SqlDbType = param.SqlDbType; - rowToCopy = parameter.Value = parameter.ConvertToFrameworkType (rowToCopy); - } - string colType = string.Format ("{0}", parameter.MetaParameter.TypeName); - if (colType == "nvarchar" || colType == "ntext" || colType == "nchar") { - if (row [mapping.SourceColumn] != null && row [mapping.SourceColumn] != DBNull.Value) { - size = ((string) rowToCopy).Length; - size <<= 1; - } - } else if (colType == "varchar" || colType == "text" || colType == "char") { - if (row [mapping.SourceColumn] != null && row [mapping.SourceColumn] != DBNull.Value) - size = ((string) rowToCopy).Length; - } else { - size = parameter.Size; - } - break; - } - } - } - i++; - } else { - rowToCopy = row [param.ParameterName]; - string colType = param.MetaParameter.TypeName; - /* - If column type is SqlDbType.NVarChar the size of parameter is multiplied by 2 - FIXME: Need to check for other types - */ - if (colType == "nvarchar" || colType == "ntext" || colType == "nchar") { - size = ((string) row [param.ParameterName]).Length; - size <<= 1; - } else if (colType == "varchar" || colType == "text" || colType == "char") { - size = ((string) row [param.ParameterName]).Length; - } else { - size = param.Size; - } - } - if (rowToCopy == null) - continue; - - blkCopy.BulkCopyData (rowToCopy, isNewRow, size, param.MetaParameter); - - if (isNewRow) - isNewRow = false; - } // foreach (SqlParameter) - if (_notifyAfter > 0) { - noRowsCopied ++; - if (noRowsCopied >= _notifyAfter) { - RowsCopied (noRowsCopied); - noRowsCopied = 0; - } - } - } // foreach (DataRow) - blkCopy.BulkCopyEnd (); - } - - private bool IsTextType(SqlDbType sqlType) - { - return (sqlType == SqlDbType.NText || - sqlType == SqlDbType.NVarChar || - sqlType == SqlDbType.Text || - sqlType == SqlDbType.VarChar || - sqlType == SqlDbType.Char || - sqlType == SqlDbType.NChar); - } - - public void WriteToServer (DataRow [] rows) - { - if (rows == null) - throw new ArgumentNullException ("rows"); - if (rows.Length == 0) - return; - DataTable table = new DataTable (rows [0].Table.TableName); - foreach (DataColumn col in rows [0].Table.Columns) { - DataColumn tmpCol = new DataColumn (col.ColumnName, col.DataType); - table.Columns.Add (tmpCol); - } - foreach (DataRow row in rows) { - DataRow tmpRow = table.NewRow (); - for (int i = 0; i < table.Columns.Count; i++) { - tmpRow [i] = row [i]; - } - table.Rows.Add (tmpRow); - } - BulkCopyToServer (table, 0); - } - - public void WriteToServer (DataTable table) - { - BulkCopyToServer (table, 0); - } - - public void WriteToServer (IDataReader reader) - { - DataTable table = new DataTable ("SourceTable"); - SqlDataAdapter adapter = new SqlDataAdapter (); - adapter.FillInternal (table, reader); - BulkCopyToServer (table, 0); - } - - public void WriteToServer (DataTable table, DataRowState rowState) - { - BulkCopyToServer (table, rowState); - } - - [MonoTODO] - public void WriteToServer (DbDataReader reader) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public Task WriteToServerAsync (DataRow[] rows) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public Task WriteToServerAsync (DataRow[] rows, CancellationToken cancellationToken) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public Task WriteToServerAsync (IDataReader reader) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public Task WriteToServerAsync (IDataReader reader, CancellationToken cancellationToken) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public Task WriteToServerAsync (DbDataReader reader) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public Task WriteToServerAsync (DbDataReader reader, CancellationToken cancellationToken) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public Task WriteToServerAsync (DataTable table) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public Task WriteToServerAsync (DataTable table, CancellationToken cancellationToken) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public Task WriteToServerAsync (DataTable table, DataRowState rowState) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public Task WriteToServerAsync (DataTable table, DataRowState rowState, CancellationToken cancellationToken) - { - throw new NotImplementedException (); - } - - private void RowsCopied (long rowsCopied) - { - SqlRowsCopiedEventArgs e = new SqlRowsCopiedEventArgs (rowsCopied); - if (null != SqlRowsCopied) { - SqlRowsCopied (this, e); - } - } - - #endregion - - #region Events - - public event SqlRowsCopiedEventHandler SqlRowsCopied; - - #endregion - - void IDisposable.Dispose () - { - //throw new NotImplementedException (); - if (isLocalConnection) { - Close (); - connection = null; - } - } - - } -} - diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlBulkCopy.platformnotsupported.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlBulkCopy.platformnotsupported.cs deleted file mode 100644 index 3b5cc3116a7..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlBulkCopy.platformnotsupported.cs +++ /dev/null @@ -1,176 +0,0 @@ -// -// SqlBulkCopy.cs -// -// Author: -// Rolf Bjarne Kvinge <rolf@xamarin.com> -// -// Copyright (c) 2016 Xamarin, Inc. -// -// 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.Data.Common; -using System.Threading; -using System.Threading.Tasks; - -namespace System.Data.SqlClient { - public sealed class SqlBulkCopy : IDisposable - { - const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlBulkCopy is not supported on the current platform."; - - public SqlBulkCopy (SqlConnection connection) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlBulkCopy (string connectionString) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlBulkCopy (string connectionString, SqlBulkCopyOptions copyOptions) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlBulkCopy (SqlConnection connection, SqlBulkCopyOptions copyOptions, SqlTransaction externalTransaction) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public int BatchSize { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public int BulkCopyTimeout { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public SqlBulkCopyColumnMappingCollection ColumnMappings { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public string DestinationTableName { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public bool EnableStreaming { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public int NotifyAfter { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public void Close () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public void WriteToServer (DataRow [] rows) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public void WriteToServer (DataTable table) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public void WriteToServer (IDataReader reader) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public void WriteToServer (DataTable table, DataRowState rowState) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public void WriteToServer (DbDataReader reader) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public Task WriteToServerAsync (DataRow[] rows) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public Task WriteToServerAsync (DataRow[] rows, CancellationToken cancellationToken) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public Task WriteToServerAsync (IDataReader reader) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public Task WriteToServerAsync (IDataReader reader, CancellationToken cancellationToken) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public Task WriteToServerAsync (DbDataReader reader) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public Task WriteToServerAsync (DbDataReader reader, CancellationToken cancellationToken) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public Task WriteToServerAsync (DataTable table) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public Task WriteToServerAsync (DataTable table, CancellationToken cancellationToken) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public Task WriteToServerAsync (DataTable table, DataRowState rowState) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public Task WriteToServerAsync (DataTable table, DataRowState rowState, CancellationToken cancellationToken) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - private void RowsCopied (long rowsCopied) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public event SqlRowsCopiedEventHandler SqlRowsCopied; - - void IDisposable.Dispose () - { - } - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlBulkCopyColumnMapping.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlBulkCopyColumnMapping.cs deleted file mode 100644 index a6ce5e7a3f9..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlBulkCopyColumnMapping.cs +++ /dev/null @@ -1,136 +0,0 @@ -// -// System.Data.SqlClient.SqlBulkCopyColumnMapping.cs -// -// Author: -// Umadevi S <sumadevi@novell.com> -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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. -// - -namespace System.Data.SqlClient -{ - /// <summary> - /// Class that defines the mapping between a column in the destination table and an - /// column in the datasource of SqlBulkCopy's instance - /// </summary> - - public sealed class SqlBulkCopyColumnMapping { - - #region Fields - - int sourceOrdinal = -1; - int destinationOrdinal = -1; - string sourceColumn = null; - string destinationColumn = null; - - #endregion //Fields - - #region Constructors - - public SqlBulkCopyColumnMapping() { - } - - public SqlBulkCopyColumnMapping(int sourceColumnOrdinal, int destinationOrdinal){ - SourceOrdinal = sourceColumnOrdinal; - DestinationOrdinal = destinationOrdinal; - } - - public SqlBulkCopyColumnMapping(int sourceColumnOrdinal, string destinationColumn){ - SourceOrdinal = sourceColumnOrdinal; - DestinationColumn = destinationColumn; - } - - public SqlBulkCopyColumnMapping(string sourceColumn, int destinationOrdinal){ - SourceColumn = sourceColumn; - DestinationOrdinal = destinationOrdinal; - } - - public SqlBulkCopyColumnMapping(string sourceColumn, string destinationColumn){ - SourceColumn = sourceColumn; - DestinationColumn = destinationColumn; - } - - # endregion //Constructors - - # region Properties - - public String DestinationColumn { - get { - if (this.destinationColumn != null) - return destinationColumn; - else - return string.Empty; //ms:doesnot return null. - } - set { - // ms: whenever the name is set the ordinal is reset to -1 - this.destinationOrdinal = -1; - this.destinationColumn = value; - } - } - - public String SourceColumn { - get { - if (this.sourceColumn != null) - return sourceColumn; - else - return string.Empty;//ms doesnot return null - } - set { - // ms: whenever the name is set the ordinal is reset to -1 - this.sourceOrdinal = -1; - this.sourceColumn = value; - } - } - - public int DestinationOrdinal { - get { - return this.destinationOrdinal; - } - set { - // ms: whenever the ordinal is set, the name is null - if (value < 0) - throw new IndexOutOfRangeException (); - this.destinationColumn = null; - this.destinationOrdinal = value; - } - } - - public int SourceOrdinal { - get { - return this.sourceOrdinal; - } - set { - // ms: whenever the ordinal is set, the name is null - if (value < 0) - throw new IndexOutOfRangeException (); - this.sourceColumn = null; - this.sourceOrdinal = value; - } - } - - #endregion //Properties - - } -} - diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlBulkCopyColumnMappingCollection.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlBulkCopyColumnMappingCollection.cs deleted file mode 100644 index 2c0a32a8297..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlBulkCopyColumnMappingCollection.cs +++ /dev/null @@ -1,148 +0,0 @@ -// -// System.Data.SqlClient.SqlBulkCopyColumnMappingCollection.cs -// -// Author: -// Nagappan A <anagappan@novell.com> -// - -// -// Copyright (C) 2007 Novell, Inc (http://www.novell.com) -// -// 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.Collections; - -namespace System.Data.SqlClient -{ - public sealed class SqlBulkCopyColumnMappingCollection : CollectionBase - { - #region Constructors - - internal SqlBulkCopyColumnMappingCollection () - { - // Do nothing - Created the constructor as the class status page - // was reporting extra constructor which gets generated by default - } - - #endregion // Constructors - - public SqlBulkCopyColumnMapping this [int index] { - get { - if (index < 0 || index > base.Count) - throw new ArgumentOutOfRangeException ("Index is out of range"); - return (SqlBulkCopyColumnMapping) base.List [index]; - } - } - - #region Methods - - public SqlBulkCopyColumnMapping Add (SqlBulkCopyColumnMapping bulkCopyColumnMapping) - { - if (bulkCopyColumnMapping == null) - throw new ArgumentNullException ("bulkCopyColumnMapping"); - List.Add (bulkCopyColumnMapping); - return bulkCopyColumnMapping; - - } - - public SqlBulkCopyColumnMapping Add (int sourceColumnIndex, int destinationColumnIndex) - { - SqlBulkCopyColumnMapping columnMapping = new SqlBulkCopyColumnMapping (sourceColumnIndex, - destinationColumnIndex); - return Add (columnMapping); - } - - public SqlBulkCopyColumnMapping Add (int sourceColumnIndex, string destinationColumn) - { - SqlBulkCopyColumnMapping columnMapping = new SqlBulkCopyColumnMapping (sourceColumnIndex, - destinationColumn); - return Add (columnMapping); - } - - public SqlBulkCopyColumnMapping Add (string sourceColumn, int destinationColumnIndex) - { - SqlBulkCopyColumnMapping columnMapping = new SqlBulkCopyColumnMapping (sourceColumn, - destinationColumnIndex); - return Add (columnMapping); - } - - public SqlBulkCopyColumnMapping Add (string sourceColumn, string destinationColumn) - { - SqlBulkCopyColumnMapping columnMapping = new SqlBulkCopyColumnMapping (sourceColumn, - destinationColumn); - return Add (columnMapping); - } - - public new void Clear () - { - List.Clear (); - } - - public bool Contains (SqlBulkCopyColumnMapping value) - { - return List.Contains (value); - } - - public int IndexOf (SqlBulkCopyColumnMapping value) - { - return List.IndexOf (value); - } - - public void CopyTo (SqlBulkCopyColumnMapping [] array, int index) - { - if (index < 0 || index > base.Count) - throw new ArgumentOutOfRangeException ("Index is out of range"); - if (array == null) - throw new ArgumentNullException ("array"); - int len = base.Count; - if (len - index > array.Length) - len = array.Length; - for (int i = index, j = 0; i < base.Count; i++, j++) - array [j] = (SqlBulkCopyColumnMapping) List [i]; - } - - public void Insert (int index, SqlBulkCopyColumnMapping value) - { - if (index < 0 || index > base.Count) - throw new ArgumentOutOfRangeException ("Index is out of range"); - List.Insert (index, value); - } - - public void Remove (SqlBulkCopyColumnMapping value) - { - List.Remove (value); - } - - public new void RemoveAt (int index) - { - if (index < 0 || index > base.Count) - throw new ArgumentOutOfRangeException ("Index is out of range"); - base.RemoveAt (index); - } - -#endregion - } -} - diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlBulkCopyOptions.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlBulkCopyOptions.cs deleted file mode 100644 index dd18ca7d49f..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlBulkCopyOptions.cs +++ /dev/null @@ -1,77 +0,0 @@ -// -// System.Data.SqlClient.SqlBulkCopyOptions.cs -// -// Author: -// Umadevi S <sumadevi@novell.com> - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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. -// - - -namespace System.Data.SqlClient -{ - /// <summary> - /// Bitwise flag that specifies one or more options to use with an instance - /// of the SqlBulkCopy - /// </summary> - [Flags] - public enum SqlBulkCopyOptions { - /// <summary> - /// Use the default values for all options. - /// </summary> - Default = 0, - /// <summary> - /// Preserve source identity values. When not specified, - /// identity values are assigned by the destination. - /// </summary> - KeepIdentity = 1, - /// <summary> - /// Check constraints while data is being inserted. - /// By default, constraints are not checked. - /// </summary> - CheckConstraints = 2, - /// <summary> - /// Obtain a bulk update lock for the duration of the bulk copy operation. - /// When not specified, row locks are used. - /// </summary> - TableLock = 4, - /// <summary> - /// Preserve null values in the destination table regardless of the settings for default values. - /// When not specified, null values are replaced by default values where applicable. - /// </summary> - KeepNulls = 8, - /// <summary> - /// When specified, cause the server to fire the insert triggers - /// for the rows being inserted into the database. - /// </summary> - FireTriggers = 16, - /// <summary> - /// When specified, each batch of the bulk-copy operation will occur within a transaction. - /// If you indicate this option and also provide a SqlTransaction object to the constructor, - /// an ArgumentException occurs. - /// </summary> - UseInternalTransaction = 32 - } -} - - diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlClientFactory.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlClientFactory.cs deleted file mode 100644 index bb529ccf963..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlClientFactory.cs +++ /dev/null @@ -1,106 +0,0 @@ -// -// System.Data.SqlClient.SqlClientFactory.cs -// -// Author: -// Sureshkumar T (tsureshkumar@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.Data; -using System.Data.Common; -using System.Data.Sql; -using System.Security; -using System.Security.Permissions; - -namespace System.Data.SqlClient -{ - public sealed class SqlClientFactory : DbProviderFactory - { - #region Fields - - public static readonly SqlClientFactory Instance = new SqlClientFactory (); - - #endregion //Fields - - #region Constructors - - private SqlClientFactory () - { - } - - #endregion //Constructors - - #region Properties - - public override bool CanCreateDataSourceEnumerator { - get { return true; } - } - - #endregion //Properties - - #region public overrides - - public override DbCommand CreateCommand () - { - return new SqlCommand (); - } - - public override DbCommandBuilder CreateCommandBuilder () - { - return new SqlCommandBuilder (); - } - - public override DbConnection CreateConnection () - { - return new SqlConnection (); - } - - public override DbConnectionStringBuilder CreateConnectionStringBuilder () - { - return new SqlConnectionStringBuilder (); - } - - public override DbDataAdapter CreateDataAdapter () - { - return new SqlDataAdapter (); - } - - public override DbDataSourceEnumerator CreateDataSourceEnumerator () - { - return SqlDataSourceEnumerator.Instance; - } - - public override DbParameter CreateParameter () - { - return new SqlParameter (); - } - - public override CodeAccessPermission CreatePermission (PermissionState state) - { - return new SqlClientPermission(state); - } - - #endregion // public overrides - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlClientMetaDataCollectionNames.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlClientMetaDataCollectionNames.cs deleted file mode 100644 index 3bad9e9967a..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlClientMetaDataCollectionNames.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -// System.Data.SqlClient.SqlClientMetaDataCollectionNames.cs -// -// Author: -// Umadevi S <sumadevi@novell.com> -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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. -// - - -namespace System.Data.SqlClient -{ - /// <summary> - /// Collection names - /// </summary> - public static class SqlClientMetaDataCollectionNames { - - public static readonly string Columns = "Columns"; - public static readonly string Databases = "Databases"; - public static readonly string ForeignKeys = "ForeignKeys"; - public static readonly string IndexColumns = "IndexColumns"; - public static readonly string Indexes = "Indexes"; - public static readonly string Parameters = "Parameters"; - public static readonly string ProcedureColumns = "ProcedureColumns"; - public static readonly string Procedures = "Procedures"; - public static readonly string Tables = "Tables"; - public static readonly string UserDefinedTypes = "UserDefinedTypes"; - public static readonly string Users = "Users"; - public static readonly string ViewColumns = "ViewColumns"; - public static readonly string Views = "Views"; - - } -} - diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs deleted file mode 100644 index 1fd5443df85..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs +++ /dev/null @@ -1,1002 +0,0 @@ -// -// System.Data.SqlClient.SqlCommand.cs -// -// Author: -// Rodrigo Moya (rodrigo@ximian.com) -// Daniel Morgan (danmorg@sc.rr.com) -// Tim Coleman (tim@timcoleman.com) -// Diego Caravana (diego@toth.it) -// -// (C) Ximian, Inc 2002 http://www.ximian.com/ -// (C) Daniel Morgan, 2002 -// Copyright (C) Tim Coleman, 2002 -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.IO; -using System.Collections; -using System.Collections.Specialized; -using System.ComponentModel; -using System.Data; -using System.Data.Common; -using System.Data.Sql; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using System.Xml; - -namespace System.Data.SqlClient { - [DesignerAttribute ("Microsoft.VSDesigner.Data.VS.SqlCommandDesigner, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.ComponentModel.Design.IDesigner")] - [ToolboxItemAttribute ("System.Drawing.Design.ToolboxItem, "+ Consts.AssemblySystem_Drawing)] - [DefaultEventAttribute ("RecordsAffected")] - public sealed class SqlCommand : DbCommand, IDbCommand, ICloneable - { - #region Fields - - const int DEFAULT_COMMAND_TIMEOUT = 30; - - int commandTimeout; - bool designTimeVisible; - string commandText; - CommandType commandType; - SqlConnection connection; - SqlTransaction transaction; - UpdateRowSource updatedRowSource; - CommandBehavior behavior = CommandBehavior.Default; - SqlParameterCollection parameters; - string preparedStatement; - bool disposed; - SqlNotificationRequest notification; - bool notificationAutoEnlist; - - #endregion // Fields - - #region Constructors - - public SqlCommand() - : this (String.Empty, null, null) - { - } - - public SqlCommand (string cmdText) - : this (cmdText, null, null) - { - } - - public SqlCommand (string cmdText, SqlConnection connection) - : this (cmdText, connection, null) - { - } - - public SqlCommand (string cmdText, SqlConnection connection, SqlTransaction transaction) - { - this.commandText = cmdText; - this.connection = connection; - this.transaction = transaction; - this.commandType = CommandType.Text; - this.updatedRowSource = UpdateRowSource.Both; - - this.commandTimeout = DEFAULT_COMMAND_TIMEOUT; - notificationAutoEnlist = true; - designTimeVisible = true; - parameters = new SqlParameterCollection (this); - } - - private SqlCommand(string commandText, SqlConnection connection, SqlTransaction transaction, CommandType commandType, UpdateRowSource updatedRowSource, bool designTimeVisible, int commandTimeout, SqlParameterCollection 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 SqlParameterCollection(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; } - } - - [DefaultValue ("")] - [EditorAttribute ("Microsoft.VSDesigner.Data.SQL.Design.SqlCommandTextEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )] - [RefreshProperties (RefreshProperties.All)] - public - override - string CommandText { - get { - if (commandText == null) - return string.Empty; - return commandText; - } - set { - if (value != commandText && preparedStatement != null) - Unprepare (); - commandText = value; - } - } - - public - override - int CommandTimeout { - get { return commandTimeout; } - set { - if (value < 0) - throw new ArgumentException ("The property value assigned is less than 0.", - "CommandTimeout"); - commandTimeout = value; - } - } - - [DefaultValue (CommandType.Text)] - [RefreshProperties (RefreshProperties.All)] - public - override - CommandType CommandType { - get { return commandType; } - set { - if (value == CommandType.TableDirect) - throw new ArgumentOutOfRangeException ("CommandType.TableDirect is not supported " + - "by the Mono SqlClient Data Provider."); - - ExceptionHelper.CheckEnumValue (typeof (CommandType), value); - commandType = value; - } - } - - [DefaultValue (null)] - [EditorAttribute ("Microsoft.VSDesigner.Data.Design.DbConnectionEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )] - public - new - SqlConnection Connection { - get { return connection; } - set - { - connection = value; - } - } - - [Browsable (false)] - [DefaultValue (true)] - [DesignOnly (true)] - [EditorBrowsable (EditorBrowsableState.Never)] - public - override - bool DesignTimeVisible { - get { return designTimeVisible; } - set { designTimeVisible = value; } - } - - [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)] - public - new - SqlParameterCollection Parameters { - get { return parameters; } - } - - internal Tds Tds { - get { return Connection.Tds; } - } - - - [Browsable (false)] - [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] - public new SqlTransaction Transaction { - get { - if (transaction != null && !transaction.IsOpen) - transaction = null; - return transaction; - } - set - { - transaction = value; - } - } - - [DefaultValue (UpdateRowSource.Both)] - public - override - UpdateRowSource UpdatedRowSource { - get { return updatedRowSource; } - set { - ExceptionHelper.CheckEnumValue (typeof (UpdateRowSource), value); - updatedRowSource = value; - } - } - - [Browsable (false)] - [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] - public SqlNotificationRequest Notification { - get { return notification; } - set { notification = value; } - } - - [DefaultValue (true)] - public bool NotificationAutoEnlist { - get { return notificationAutoEnlist; } - set { notificationAutoEnlist = value; } - } - #endregion // Fields - - #region Methods - - public - override - void Cancel () - { - if (Connection == null || Connection.Tds == null) - return; - Connection.Tds.Cancel (); - } - - public SqlCommand Clone () - { - return new SqlCommand (commandText, connection, transaction, commandType, updatedRowSource, designTimeVisible, commandTimeout, parameters); - } - - internal void CloseDataReader () - { - if (Connection != null) { - Connection.DataReader = null; - - if ((behavior & CommandBehavior.CloseConnection) != 0) - Connection.Close (); - - if (Tds != null) - Tds.SequentialAccess = false; - } - - // Reset the behavior - behavior = CommandBehavior.Default; - } - - public new SqlParameter CreateParameter () - { - return new SqlParameter (); - } - - private string EscapeProcName (string name, bool schema) - { - string procName; - string tmpProcName = name.Trim (); - int procNameLen = tmpProcName.Length; - char[] brkts = new char [] {'[', ']'}; - bool foundMatching = false; - int start = 0, count = procNameLen; - int sindex = -1, eindex = -1; - - // We try to match most of the "brackets" combination here, however - // there could be other combinations that may generate a different type - // of exception in MS.NET - - if (procNameLen > 1) { - if ((sindex = tmpProcName.IndexOf ('[')) <= 0) - foundMatching = true; - else - foundMatching = false; - - if (foundMatching == true && sindex > -1) { - eindex = tmpProcName.IndexOf (']'); - if (sindex > eindex && eindex != -1) { - foundMatching = false; - } else if (eindex == procNameLen-1) { - if (tmpProcName.IndexOfAny (brkts, 1, procNameLen-2) != -1) { - foundMatching = false; - } else { - start = 1; - count = procNameLen - 2; - } - } else if (eindex == -1 && schema) { - foundMatching = true; - } else { - foundMatching = false; - } - } - - if (foundMatching) - procName = tmpProcName.Substring (start, count); - else - throw new ArgumentException (String.Format ("SqlCommand.CommandText property value is an invalid multipart name {0}, incorrect usage of quotes", CommandText)); - } else { - procName = tmpProcName; - } - - return procName; - } - internal void DeriveParameters () - { - if (commandType != CommandType.StoredProcedure) - throw new InvalidOperationException (String.Format ("SqlCommand DeriveParameters only supports CommandType.StoredProcedure, not CommandType.{0}", commandType)); - ValidateCommand ("DeriveParameters", false); - - string procName = CommandText; - string schemaName = String.Empty; - int dotPosition = procName.LastIndexOf ('.'); - - // Procedure name can be: [database].[user].[procname] - if (dotPosition >= 0) { - schemaName = procName.Substring (0, dotPosition); - procName = procName.Substring (dotPosition + 1); - if ((dotPosition = schemaName.LastIndexOf ('.')) >= 0) - schemaName = schemaName.Substring (dotPosition + 1); - } - - procName = EscapeProcName (procName, false); - schemaName = EscapeProcName (schemaName, true); - - SqlParameterCollection localParameters = new SqlParameterCollection (this); - localParameters.Add ("@procedure_name", SqlDbType.NVarChar, procName.Length).Value = procName; - if (schemaName.Length > 0) - localParameters.Add ("@procedure_schema", SqlDbType.NVarChar, schemaName.Length).Value = schemaName; - - string sql = "sp_procedure_params_rowset"; - - try { - Connection.Tds.ExecProc (sql, localParameters.MetaParameters, 0, true); - } catch (TdsTimeoutException ex) { - Connection.Tds.Reset (); - throw SqlException.FromTdsInternalException ((TdsInternalException) ex); - } catch (TdsInternalException ex) { - Connection.Close (); - throw SqlException.FromTdsInternalException ((TdsInternalException) ex); - } - - SqlDataReader reader = new SqlDataReader (this); - parameters.Clear (); - object[] dbValues = new object[reader.FieldCount]; - - while (reader.Read ()) { - reader.GetValues (dbValues); - parameters.Add (new SqlParameter (dbValues)); - } - reader.Close (); - - if (parameters.Count == 0) - throw new InvalidOperationException ("Stored procedure '" + procName + "' does not exist."); - } - - private void Execute (bool wantResults) - { - int index = 0; - Connection.Tds.RecordsAffected = -1; - TdsMetaParameterCollection parms = Parameters.MetaParameters; - foreach (TdsMetaParameter param in parms) { - param.Validate (index++); - } - - if (preparedStatement == null) { - bool schemaOnly = ((behavior & CommandBehavior.SchemaOnly) > 0); - bool keyInfo = ((behavior & CommandBehavior.KeyInfo) > 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: - try { - if (keyInfo || schemaOnly) - Connection.Tds.Execute (sql1.ToString ()); - Connection.Tds.ExecProc (CommandText, parms, CommandTimeout, wantResults); - if (keyInfo || schemaOnly) - Connection.Tds.Execute (sql2.ToString ()); - } catch (TdsTimeoutException ex) { - // If it is a timeout exception there can be many reasons: - // 1) Network is down/server is down/not reachable - // 2) Somebody has an exclusive lock on Table/DB - // In any of these cases, don't close the connection. Let the user do it - Connection.Tds.Reset (); - throw SqlException.FromTdsInternalException ((TdsInternalException) ex); - } catch (TdsInternalException ex) { - Connection.Close (); - throw SqlException.FromTdsInternalException ((TdsInternalException) ex); - } - break; - case CommandType.Text: - string sql; - if (sql2.Length > 0) { - sql = String.Format ("{0}{1};{2}", sql1.ToString (), CommandText, sql2.ToString ()); - } else { - sql = String.Format ("{0}{1}", sql1.ToString (), CommandText); - } - try { - Connection.Tds.Execute (sql, parms, CommandTimeout, wantResults); - } catch (TdsTimeoutException ex) { - Connection.Tds.Reset (); - throw SqlException.FromTdsInternalException ((TdsInternalException) ex); - } catch (TdsInternalException ex) { - Connection.Close (); - throw SqlException.FromTdsInternalException ((TdsInternalException) ex); - } - break; - } - } - else { - try { - Connection.Tds.ExecPrepared (preparedStatement, parms, CommandTimeout, wantResults); - } catch (TdsTimeoutException ex) { - Connection.Tds.Reset (); - throw SqlException.FromTdsInternalException ((TdsInternalException) ex); - } catch (TdsInternalException ex) { - Connection.Close (); - throw SqlException.FromTdsInternalException ((TdsInternalException) ex); - } - } - } - - public - override - int ExecuteNonQuery () - { - ValidateCommand ("ExecuteNonQuery", false); - int result = 0; - behavior = CommandBehavior.Default; - - try { - Execute (false); - result = Connection.Tds.RecordsAffected; - } catch (TdsTimeoutException e) { - Connection.Tds.Reset (); - throw SqlException.FromTdsInternalException ((TdsInternalException) e); - } - - GetOutputParameters (); - return result; - } - - public new SqlDataReader ExecuteReader () - { - return ExecuteReader (CommandBehavior.Default); - } - - public new SqlDataReader ExecuteReader (CommandBehavior behavior) - { - ValidateCommand ("ExecuteReader", false); - if ((behavior & CommandBehavior.SingleRow) != 0) - behavior |= CommandBehavior.SingleResult; - this.behavior = behavior; - if ((behavior & CommandBehavior.SequentialAccess) != 0) - Tds.SequentialAccess = true; - try { - Execute (true); - Connection.DataReader = new SqlDataReader (this); - return Connection.DataReader; - } catch { - if ((behavior & CommandBehavior.CloseConnection) != 0) - Connection.Close (); - throw; - } - } - - public new Task<SqlDataReader> ExecuteReaderAsync () - { - return ExecuteReaderAsync (CommandBehavior.Default, CancellationToken.None); - } - - public new Task<SqlDataReader> ExecuteReaderAsync (CancellationToken cancellationToken) - { - return ExecuteReaderAsync (behavior, CancellationToken.None); - } - - public new Task<SqlDataReader> ExecuteReaderAsync (CommandBehavior behavior) - { - return ExecuteReaderAsync (CommandBehavior.Default, CancellationToken.None); - } - - public new Task<SqlDataReader> ExecuteReaderAsync (CommandBehavior behavior, CancellationToken cancellationToken) - { - TaskCompletionSource<SqlDataReader> source = new TaskCompletionSource<SqlDataReader>(); - - CancellationTokenRegistration registration = new CancellationTokenRegistration(); - if (cancellationToken.CanBeCanceled) { - if (cancellationToken.IsCancellationRequested) { - source.SetCanceled(); - return source.Task; - } - registration = cancellationToken.Register(CancelIgnoreFailure); - } - - Task<SqlDataReader> returnedTask = source.Task; - try { - // TODO: RegisterForConnectionCloseNotification(ref returnedTask); - - Task<SqlDataReader>.Factory.FromAsync(BeginExecuteReaderAsync, EndExecuteReader, behavior, null).ContinueWith((t) => { - registration.Dispose(); - if (t.IsFaulted) { - Exception e = t.Exception.InnerException; - source.SetException(e); - } - else { - if (t.IsCanceled) { - source.SetCanceled(); - } - else { - source.SetResult(t.Result); - } - } - }, TaskScheduler.Default); - } - catch (Exception e) { - source.SetException(e); - } - - return returnedTask; - } - - public Task<XmlReader> ExecuteXmlReaderAsync () - { - return ExecuteXmlReaderAsync (CancellationToken.None); - } - - public Task<XmlReader> ExecuteXmlReaderAsync (CancellationToken cancellationToken) - { - TaskCompletionSource<XmlReader> source = new TaskCompletionSource<XmlReader>(); - - CancellationTokenRegistration registration = new CancellationTokenRegistration(); - if (cancellationToken.CanBeCanceled) { - if (cancellationToken.IsCancellationRequested) { - source.SetCanceled(); - return source.Task; - } - registration = cancellationToken.Register(CancelIgnoreFailure); - } - - Task<XmlReader> returnedTask = source.Task; - try { - // TODO: RegisterForConnectionCloseNotification(ref returnedTask); - - Task<XmlReader>.Factory.FromAsync(BeginExecuteXmlReader, EndExecuteXmlReader, null).ContinueWith((t) => { - registration.Dispose(); - if (t.IsFaulted) { - Exception e = t.Exception.InnerException; - source.SetException(e); - } - else { - if (t.IsCanceled) { - source.SetCanceled(); - } - else { - source.SetResult(t.Result); - } - } - }, TaskScheduler.Default); - } - catch (Exception e) { - source.SetException(e); - } - - return returnedTask; - } - - public - override - object ExecuteScalar () - { - try { - object result = null; - ValidateCommand ("ExecuteScalar", false); - behavior = CommandBehavior.Default; - Execute (true); - - try { - if (Connection.Tds.NextResult () && Connection.Tds.NextRow ()) - result = Connection.Tds.ColumnValues[0]; - - if (commandType == CommandType.StoredProcedure) { - Connection.Tds.SkipToEnd (); - GetOutputParameters (); - } - } catch (TdsTimeoutException ex) { - Connection.Tds.Reset (); - throw SqlException.FromTdsInternalException ((TdsInternalException) ex); - } catch (TdsInternalException ex) { - Connection.Close (); - throw SqlException.FromTdsInternalException ((TdsInternalException) ex); - } - - return result; - } finally { - CloseDataReader (); - } - } - - public XmlReader ExecuteXmlReader () - { - ValidateCommand ("ExecuteXmlReader", false); - behavior = CommandBehavior.Default; - try { - Execute (true); - } catch (TdsTimeoutException e) { - Connection.Tds.Reset (); - throw SqlException.FromTdsInternalException ((TdsInternalException) e); - } - - SqlDataReader dataReader = new SqlDataReader (this); - SqlXmlTextReader textReader = new SqlXmlTextReader (dataReader); - XmlReader xmlReader = new XmlTextReader (textReader); - return xmlReader; - } - - internal void GetOutputParameters () - { - IList list = Connection.Tds.OutputParameters; - - if (list != null && list.Count > 0) { - - int index = 0; - foreach (SqlParameter parameter in parameters) { - if (parameter.Direction != ParameterDirection.Input && - parameter.Direction != ParameterDirection.ReturnValue) { - parameter.Value = list [index]; - index += 1; - } - if (index >= list.Count) - break; - } - } - } - - object ICloneable.Clone () - { - return new SqlCommand (commandText, connection, transaction, commandType, updatedRowSource, designTimeVisible, commandTimeout, parameters); - - } - - - protected override void Dispose (bool disposing) - { - if (disposed) return; - if (disposing) { - parameters.Clear(); - if (Connection != null) - Connection.DataReader = null; - } - base.Dispose (disposing); - disposed = true; - } - - public - override - void Prepare () - { - if (Connection == null) - throw new NullReferenceException (); - - if (CommandType == CommandType.StoredProcedure || CommandType == CommandType.Text && Parameters.Count == 0) - return; - - ValidateCommand ("Prepare", false); - - try { - foreach (SqlParameter param in Parameters) - param.CheckIfInitialized (); - } catch (Exception e) { - throw new InvalidOperationException ("SqlCommand.Prepare requires " + e.Message); - } - - preparedStatement = Connection.Tds.Prepare (CommandText, Parameters.MetaParameters); - } - - public void ResetCommandTimeout () - { - commandTimeout = DEFAULT_COMMAND_TIMEOUT; - } - - private void Unprepare () - { - Connection.Tds.Unprepare (preparedStatement); - preparedStatement = null; - } - - private void ValidateCommand (string method, bool async) - { - if (Connection == null) - throw new InvalidOperationException (String.Format ("{0}: A Connection object is required to continue.", method)); - if (Transaction == null && Connection.Transaction != null) - throw new InvalidOperationException (String.Format ( - "{0} requires a transaction if the command's connection is in a pending transaction.", - method)); - if (Transaction != null && Transaction.Connection != Connection) - throw new InvalidOperationException ("The connection does not have the same transaction as the command."); - if (Connection.State != ConnectionState.Open) - throw new InvalidOperationException (String.Format ("{0} requires an open connection to continue. This connection is closed.", method)); - if (CommandText.Length == 0) - throw new InvalidOperationException (String.Format ("{0}: CommandText has not been set for this Command.", method)); - if (Connection.DataReader != null) - throw new InvalidOperationException ("There is already an open DataReader associated with this Connection which must be closed first."); - if (Connection.XmlReader != null) - throw new InvalidOperationException ("There is already an open XmlReader associated with this Connection which must be closed first."); - if (async && !Connection.AsyncProcessing) - throw new InvalidOperationException ("This Connection object is not " + - "in Asynchronous mode. Use 'Asynchronous" + - " Processing = true' to set it."); - } - - protected override DbParameter CreateDbParameter () - { - return CreateParameter (); - } - - protected override DbDataReader ExecuteDbDataReader (CommandBehavior behavior) - { - return ExecuteReader (behavior); - } - - protected override DbConnection DbConnection { - get { return Connection; } - set { Connection = (SqlConnection) value; } - } - - protected override DbParameterCollection DbParameterCollection { - get { return Parameters; } - } - - protected override DbTransaction DbTransaction { - get { return Transaction; } - set { Transaction = (SqlTransaction) value; } - } - - #endregion // Methods - - #region Asynchronous Methods - - internal IAsyncResult BeginExecuteInternal (CommandBehavior behavior, - bool wantResults, - AsyncCallback callback, - object state) - { - IAsyncResult ar = null; - Connection.Tds.RecordsAffected = -1; - TdsMetaParameterCollection parms = Parameters.MetaParameters; - if (preparedStatement == null) { - bool schemaOnly = ((behavior & CommandBehavior.SchemaOnly) > 0); - bool keyInfo = ((behavior & CommandBehavior.KeyInfo) > 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: - string prolog = ""; - string epilog = ""; - if (keyInfo || schemaOnly) - prolog = sql1.ToString (); - if (keyInfo || schemaOnly) - epilog = sql2.ToString (); - try { - ar = Connection.Tds.BeginExecuteProcedure (prolog, - epilog, - CommandText, - !wantResults, - parms, - callback, - state); - } catch (TdsTimeoutException ex) { - Connection.Tds.Reset (); - throw SqlException.FromTdsInternalException ((TdsInternalException) ex); - } catch (TdsInternalException ex) { - Connection.Close (); - throw SqlException.FromTdsInternalException ((TdsInternalException) ex); - } - break; - case CommandType.Text: - string sql = String.Format ("{0}{1};{2}", sql1.ToString (), CommandText, sql2.ToString ()); - try { - if (wantResults) - ar = Connection.Tds.BeginExecuteQuery (sql, parms, callback, state); - else - ar = Connection.Tds.BeginExecuteNonQuery (sql, parms, callback, state); - } catch (TdsTimeoutException ex) { - Connection.Tds.Reset (); - throw SqlException.FromTdsInternalException ((TdsInternalException) ex); - } catch (TdsInternalException ex) { - Connection.Close (); - throw SqlException.FromTdsInternalException ((TdsInternalException) ex); - } - break; - } - } - else { - try { - Connection.Tds.ExecPrepared (preparedStatement, parms, CommandTimeout, wantResults); - } catch (TdsTimeoutException ex) { - Connection.Tds.Reset (); - throw SqlException.FromTdsInternalException ((TdsInternalException) ex); - } catch (TdsInternalException ex) { - Connection.Close (); - throw SqlException.FromTdsInternalException ((TdsInternalException) ex); - } - } - return ar; - } - - internal void EndExecuteInternal (IAsyncResult ar) - { - SqlAsyncResult sqlResult = ( (SqlAsyncResult) ar); - Connection.Tds.WaitFor (sqlResult.InternalResult); - Connection.Tds.CheckAndThrowException (sqlResult.InternalResult); - } - - public IAsyncResult BeginExecuteNonQuery () - { - return BeginExecuteNonQuery (null, null); - } - - public IAsyncResult BeginExecuteNonQuery (AsyncCallback callback, object stateObject) - { - ValidateCommand ("BeginExecuteNonQuery", true); - SqlAsyncResult ar = new SqlAsyncResult (callback, stateObject); - ar.EndMethod = "EndExecuteNonQuery"; - ar.InternalResult = BeginExecuteInternal (CommandBehavior.Default, false, ar.BubbleCallback, ar); - return ar; - } - - public int EndExecuteNonQuery (IAsyncResult asyncResult) - { - ValidateAsyncResult (asyncResult, "EndExecuteNonQuery"); - EndExecuteInternal (asyncResult); - - int ret = Connection.Tds.RecordsAffected; - - GetOutputParameters (); - ((SqlAsyncResult) asyncResult).Ended = true; - return ret; - } - - public IAsyncResult BeginExecuteReader () - { - return BeginExecuteReader (null, null, CommandBehavior.Default); - } - - public IAsyncResult BeginExecuteReader (CommandBehavior behavior) - { - return BeginExecuteReader (null, null, behavior); - } - - public IAsyncResult BeginExecuteReader (AsyncCallback callback, object stateObject) - { - return BeginExecuteReader (callback, stateObject, CommandBehavior.Default); - } - - IAsyncResult BeginExecuteReaderAsync(CommandBehavior behavior, AsyncCallback callback, object stateObject) - { - return BeginExecuteReader (callback, stateObject, behavior); - } - - public IAsyncResult BeginExecuteReader (AsyncCallback callback, object stateObject, CommandBehavior behavior) - { - ValidateCommand ("BeginExecuteReader", true); - this.behavior = behavior; - SqlAsyncResult ar = new SqlAsyncResult (callback, stateObject); - ar.EndMethod = "EndExecuteReader"; - IAsyncResult tdsResult = BeginExecuteInternal (behavior, true, - ar.BubbleCallback, stateObject); - ar.InternalResult = tdsResult; - return ar; - } - - public SqlDataReader EndExecuteReader (IAsyncResult asyncResult) - { - ValidateAsyncResult (asyncResult, "EndExecuteReader"); - EndExecuteInternal (asyncResult); - SqlDataReader reader = null; - try { - reader = new SqlDataReader (this); - } catch (TdsTimeoutException e) { - throw SqlException.FromTdsInternalException ((TdsInternalException) e); - } catch (TdsInternalException e) { - // if behavior is closeconnection, even if it throws exception - // the connection has to be closed. - if ((behavior & CommandBehavior.CloseConnection) != 0) - Connection.Close (); - throw SqlException.FromTdsInternalException ((TdsInternalException) e); - } - - ((SqlAsyncResult) asyncResult).Ended = true; - return reader; - } - - public IAsyncResult BeginExecuteXmlReader (AsyncCallback callback, object stateObject) - { - ValidateCommand ("BeginExecuteXmlReader", true); - SqlAsyncResult ar = new SqlAsyncResult (callback, stateObject); - ar.EndMethod = "EndExecuteXmlReader"; - ar.InternalResult = BeginExecuteInternal (behavior, true, - ar.BubbleCallback, stateObject); - return ar; - } - - public IAsyncResult BeginExecuteXmlReader () - { - return BeginExecuteXmlReader (null, null); - } - - - public XmlReader EndExecuteXmlReader (IAsyncResult asyncResult) - { - ValidateAsyncResult (asyncResult, "EndExecuteXmlReader"); - EndExecuteInternal (asyncResult); - SqlDataReader reader = new SqlDataReader (this); - SqlXmlTextReader textReader = new SqlXmlTextReader (reader); - XmlReader xmlReader = new XmlTextReader (textReader); - ((SqlAsyncResult) asyncResult).Ended = true; - return xmlReader; - } - - internal void ValidateAsyncResult (IAsyncResult ar, string endMethod) - { - if (ar == null) - throw new ArgumentException ("result passed is null!"); - if (! (ar is SqlAsyncResult)) - throw new ArgumentException (String.Format ("cannot test validity of types {0}", - ar.GetType ())); - SqlAsyncResult result = (SqlAsyncResult) ar; - if (result.EndMethod != endMethod) - throw new InvalidOperationException (String.Format ("Mismatched {0} called for AsyncResult. " + - "Expected call to {1} but {0} is called instead.", - endMethod, result.EndMethod)); - if (result.Ended) - throw new InvalidOperationException (String.Format ("The method {0} cannot be called " + - "more than once for the same AsyncResult.", endMethod)); - } - - #endregion // Asynchronous Methods - -#pragma warning disable 0067 - // TODO: Not implemented - public event StatementCompletedEventHandler StatementCompleted; -#pragma warning restore - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.platformnotsupported.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.platformnotsupported.cs deleted file mode 100644 index 491483e1077..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.platformnotsupported.cs +++ /dev/null @@ -1,277 +0,0 @@ -// -// SqlCommand.cs -// -// Author: -// Rolf Bjarne Kvinge <rolf@xamarin.com> -// -// Copyright (c) 2016 Xamarin, Inc. -// -// 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.Data.Common; -using System.Data.Sql; -using System.Threading.Tasks; -using System.Threading; -using System.Xml; - -namespace System.Data.SqlClient { - public sealed class SqlCommand : DbCommand, IDbCommand, ICloneable - { - const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlCommand is not supported on the current platform."; - - public SqlCommand() - : this (String.Empty, null, null) - { - } - - public SqlCommand (string cmdText) - : this (cmdText, null, null) - { - } - - public SqlCommand (string cmdText, SqlConnection connection) - : this (cmdText, connection, null) - { - } - - public SqlCommand (string cmdText, SqlConnection connection, SqlTransaction transaction) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override string CommandText { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override int CommandTimeout { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override CommandType CommandType { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public new SqlConnection Connection { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override bool DesignTimeVisible { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public new SqlParameterCollection Parameters { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public new SqlTransaction Transaction { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override UpdateRowSource UpdatedRowSource { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public SqlNotificationRequest Notification { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public bool NotificationAutoEnlist { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override void Cancel () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlCommand Clone () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public new SqlParameter CreateParameter () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override int ExecuteNonQuery () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public new SqlDataReader ExecuteReader () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public new SqlDataReader ExecuteReader (CommandBehavior behavior) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public new Task<SqlDataReader> ExecuteReaderAsync () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public new Task<SqlDataReader> ExecuteReaderAsync (CancellationToken cancellationToken) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public new Task<SqlDataReader> ExecuteReaderAsync (CommandBehavior behavior) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public new Task<SqlDataReader> ExecuteReaderAsync (CommandBehavior behavior, CancellationToken cancellationToken) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public Task<XmlReader> ExecuteXmlReaderAsync () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public Task<XmlReader> ExecuteXmlReaderAsync (CancellationToken cancellationToken) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override object ExecuteScalar () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public XmlReader ExecuteXmlReader () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - object ICloneable.Clone () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - protected override void Dispose (bool disposing) - { - } - - public override void Prepare () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public void ResetCommandTimeout () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - protected override DbParameter CreateDbParameter () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - protected override DbDataReader ExecuteDbDataReader (CommandBehavior behavior) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - protected override DbConnection DbConnection { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - protected override DbParameterCollection DbParameterCollection { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - protected override DbTransaction DbTransaction { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public IAsyncResult BeginExecuteNonQuery () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public IAsyncResult BeginExecuteNonQuery (AsyncCallback callback, object stateObject) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public int EndExecuteNonQuery (IAsyncResult asyncResult) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public IAsyncResult BeginExecuteReader () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public IAsyncResult BeginExecuteReader (CommandBehavior behavior) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public IAsyncResult BeginExecuteReader (AsyncCallback callback, object stateObject) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public IAsyncResult BeginExecuteReader (AsyncCallback callback, object stateObject, CommandBehavior behavior) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlDataReader EndExecuteReader (IAsyncResult asyncResult) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public IAsyncResult BeginExecuteXmlReader (AsyncCallback callback, object stateObject) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public IAsyncResult BeginExecuteXmlReader () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public XmlReader EndExecuteXmlReader (IAsyncResult asyncResult) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public event StatementCompletedEventHandler StatementCompleted; - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.cs deleted file mode 100644 index 3ee48a6e9ea..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.cs +++ /dev/null @@ -1,358 +0,0 @@ -// -// System.Data.SqlClient.SqlCommandBuilder.cs -// -// Author: -// Tim Coleman (tim@timcoleman.com) -// Veerapuram Varadhan (vvaradhan@novell.com) -// -// Copyright (C) Tim Coleman, 2002 -// - -// -// Copyright (C) 2004, 2009 Novell, Inc (http://www.novell.com) -// -// 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.ComponentModel; -using System.Data; -using System.Data.Common; -using System.Data.SqlTypes; -using System.Text; - -namespace System.Data.SqlClient -{ - public sealed class SqlCommandBuilder : DbCommandBuilder - { - #region Fields - - readonly string _catalogSeparator = "."; - readonly string _schemaSeparator = "."; - readonly CatalogLocation _catalogLocation = CatalogLocation.Start; - - #endregion // Fields - - #region Constructors - - public SqlCommandBuilder () - { - QuoteSuffix = "]"; - QuotePrefix = "["; - } - - public SqlCommandBuilder (SqlDataAdapter adapter) - : this () - { - DataAdapter = adapter; - } - - #endregion // Constructors - - #region Properties - - [DefaultValue (null)] - public new SqlDataAdapter DataAdapter { - get { - return (SqlDataAdapter)base.DataAdapter; - } set { - base.DataAdapter = value; - } - } - - [Browsable (false)] - [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] - [EditorBrowsable (EditorBrowsableState.Never)] - public - override - string QuotePrefix { - get { - return base.QuotePrefix; - } - set { - if (value != "[" && value != "\"") - throw new ArgumentException ("Only '[' " + - "and '\"' are allowed as value " + - "for the 'QuoteSuffix' property."); - base.QuotePrefix = value; - } - } - - [Browsable (false)] - [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] - [EditorBrowsable (EditorBrowsableState.Never)] - public - override - string QuoteSuffix { - get { - return base.QuoteSuffix; - } - set { - if (value != "]" && value != "\"") - throw new ArgumentException ("Only ']' " + - "and '\"' are allowed as value " + - "for the 'QuoteSuffix' property."); - base.QuoteSuffix = value; - } - } - - [EditorBrowsable (EditorBrowsableState.Never)] - [Browsable (false)] - [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] - public override string CatalogSeparator { - get { return _catalogSeparator; } - set { - if (value != _catalogSeparator) - throw new ArgumentException ("Only " + - "'.' is allowed as value " + - "for the 'CatalogSeparator' " + - "property."); - } - } - - [EditorBrowsable (EditorBrowsableState.Never)] - [Browsable (false)] - [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] - public override string SchemaSeparator { - get { return _schemaSeparator; } - set { - if (value != _schemaSeparator) - throw new ArgumentException ("Only " + - "'.' is allowed as value " + - "for the 'SchemaSeparator' " + - "property."); - } - } - - [EditorBrowsable (EditorBrowsableState.Never)] - [Browsable (false)] - [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] - public override CatalogLocation CatalogLocation { - get { return _catalogLocation; } - set { - if (value != CatalogLocation.Start) - throw new ArgumentException ("Only " + - "'Start' is allowed as value " + - "for the 'CatalogLocation' " + - "property."); - } - } - - - - #endregion // Properties - - #region Methods - - - public static void DeriveParameters (SqlCommand command) - { - command.DeriveParameters (); - } - - - public - new - SqlCommand GetDeleteCommand () - { - return (SqlCommand) base.GetDeleteCommand (false); - } - - public - new - SqlCommand GetInsertCommand () - { - return (SqlCommand) base.GetInsertCommand (false); - } - - public - new - SqlCommand GetUpdateCommand () - { - return (SqlCommand) base.GetUpdateCommand (false); - } - - public new SqlCommand GetUpdateCommand (bool useColumnsForParameterNames) - { - return (SqlCommand) base.GetUpdateCommand (useColumnsForParameterNames); - } - - public new SqlCommand GetDeleteCommand (bool useColumnsForParameterNames) - { - return (SqlCommand) base.GetDeleteCommand (useColumnsForParameterNames); - } - - public new SqlCommand GetInsertCommand (bool useColumnsForParameterNames) - { - return (SqlCommand) base.GetInsertCommand (useColumnsForParameterNames); - } - - public override string QuoteIdentifier (string unquotedIdentifier) - { - if (unquotedIdentifier == null) - throw new ArgumentNullException ("unquotedIdentifier"); - - string prefix = QuotePrefix; - string suffix = QuoteSuffix; - - if ((prefix == "[" && suffix != "]") || (prefix == "\"" && suffix != "\"")) - throw new ArgumentException ("The QuotePrefix " + - "and QuoteSuffix properties do not match."); - - string escaped = unquotedIdentifier.Replace (suffix, - suffix + suffix); - return string.Concat (prefix, escaped, suffix); - } - - public override string UnquoteIdentifier (string quotedIdentifier) - { - return base.UnquoteIdentifier (quotedIdentifier); - } - - private bool IncludedInInsert (DataRow schemaRow) - { - // If the parameter has one of these properties, then we don't include it in the insert: - // AutoIncrement, Hidden, Expression, RowVersion, ReadOnly - - if (!schemaRow.IsNull ("IsAutoIncrement") && (bool) schemaRow ["IsAutoIncrement"]) - return false; - if (!schemaRow.IsNull ("IsHidden") && (bool) schemaRow ["IsHidden"]) - return false; - if (!schemaRow.IsNull ("IsExpression") && (bool) schemaRow ["IsExpression"]) - return false; - if (!schemaRow.IsNull ("IsRowVersion") && (bool) schemaRow ["IsRowVersion"]) - return false; - if (!schemaRow.IsNull ("IsReadOnly") && (bool) schemaRow ["IsReadOnly"]) - return false; - return true; - } - - private bool IncludedInUpdate (DataRow schemaRow) - { - // If the parameter has one of these properties, then we don't include it in the insert: - // AutoIncrement, Hidden, RowVersion - - if (!schemaRow.IsNull ("IsAutoIncrement") && (bool) schemaRow ["IsAutoIncrement"]) - return false; - if (!schemaRow.IsNull ("IsHidden") && (bool) schemaRow ["IsHidden"]) - return false; - if (!schemaRow.IsNull ("IsRowVersion") && (bool) schemaRow ["IsRowVersion"]) - return false; - if (!schemaRow.IsNull ("IsExpression") && (bool) schemaRow ["IsExpression"]) - return false; - if (!schemaRow.IsNull ("IsReadOnly") && (bool) schemaRow ["IsReadOnly"]) - return false; - - return true; - } - - private bool IncludedInWhereClause (DataRow schemaRow) - { - if ((bool) schemaRow ["IsLong"]) - return false; - return true; - } - - - protected override void ApplyParameterInfo (DbParameter parameter, - DataRow datarow, - StatementType statementType, - bool whereClause) - { - SqlParameter sqlParam = (SqlParameter) parameter; - sqlParam.SqlDbType = (SqlDbType) datarow ["ProviderType"]; - - object precision = datarow ["NumericPrecision"]; - if (precision != DBNull.Value) { - short val = (short) precision; - if (val < byte.MaxValue && val >= byte.MinValue) - sqlParam.Precision = (byte) val; - } - - object scale = datarow ["NumericScale"]; - if (scale != DBNull.Value) { - short val = ((short) scale); - if (val < byte.MaxValue && val >= byte.MinValue) - sqlParam.Scale = (byte) val; - } - } - - protected override - string GetParameterName (int parameterOrdinal) - { - return String.Format ("@p{0}", parameterOrdinal); - } - - protected override - string GetParameterName (string parameterName) - { - return String.Format ("@{0}", parameterName); - } - - protected override string GetParameterPlaceholder (int parameterOrdinal) - { - return GetParameterName (parameterOrdinal); - } - - #endregion // Methods - - #region Event Handlers - - void RowUpdatingHandler (object sender, SqlRowUpdatingEventArgs args) - { - base.RowUpdatingHandler (args); - } - - protected override void SetRowUpdatingHandler (DbDataAdapter adapter) - { - SqlDataAdapter sda = adapter as SqlDataAdapter; - if (sda == null) { - throw new InvalidOperationException ("Adapter needs to be a SqlDataAdapter"); - } - - if (sda != base.DataAdapter) - sda.RowUpdating += new SqlRowUpdatingEventHandler (RowUpdatingHandler); - else - sda.RowUpdating -= new SqlRowUpdatingEventHandler (RowUpdatingHandler);; - } - - protected override DataTable GetSchemaTable (DbCommand srcCommand) - { - using (SqlDataReader rdr = (SqlDataReader) srcCommand.ExecuteReader (CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly)) - return rdr.GetSchemaTable (); - } - - protected override DbCommand InitializeCommand (DbCommand command) - { - if (command == null) { - command = new SqlCommand (); - } else { - command.CommandTimeout = 30; - command.Transaction = null; - command.CommandType = CommandType.Text; - command.UpdatedRowSource = UpdateRowSource.None; - } - return command; - } - - #endregion // Event Handlers - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.platformnotsupported.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.platformnotsupported.cs deleted file mode 100644 index 155ddabc197..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.platformnotsupported.cs +++ /dev/null @@ -1,158 +0,0 @@ -// -// SqlCommandBuilder.cs -// -// Author: -// Rolf Bjarne Kvinge <rolf@xamarin.com> -// -// Copyright (c) 2016 Xamarin, Inc. -// -// 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.Data.SqlClient; - -namespace System.Data.SqlClient -{ - public class SqlCommandBuilder : DbCommandBuilder - { - const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlCommandBuilder is not supported on the current platform."; - - public SqlCommandBuilder () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlCommandBuilder (SqlDataAdapter adapter) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public static void DeriveParameters (SqlCommand command) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlCommand GetDeleteCommand () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlCommand GetInsertCommand () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlCommand GetUpdateCommand () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlCommand GetUpdateCommand (bool useColumnsForParameterNames) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlCommand GetDeleteCommand (bool useColumnsForParameterNames) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlCommand GetInsertCommand (bool useColumnsForParameterNames) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override string QuoteIdentifier (string unquotedIdentifier) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override string UnquoteIdentifier (string quotedIdentifier) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - protected override void ApplyParameterInfo (DbParameter parameter, DataRow datarow, StatementType statementType, bool whereClause) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - protected override string GetParameterName (int parameterOrdinal) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - protected override string GetParameterName (string parameterName) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - protected override string GetParameterPlaceholder (int parameterOrdinal) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - protected override void SetRowUpdatingHandler (DbDataAdapter adapter) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - protected override DataTable GetSchemaTable (DbCommand srcCommand) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - protected override DbCommand InitializeCommand (DbCommand command) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlDataAdapter DataAdapter { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override string QuotePrefix { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override string QuoteSuffix { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override string CatalogSeparator { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override string SchemaSeparator { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override CatalogLocation CatalogLocation { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs deleted file mode 100644 index 40ccb46eb11..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs +++ /dev/null @@ -1,1719 +0,0 @@ -// -// System.Data.SqlClient.SqlConnection.cs -// -// Authors: -// Rodrigo Moya (rodrigo@ximian.com) -// Daniel Morgan (danmorg@sc.rr.com) -// Tim Coleman (tim@timcoleman.com) -// Phillip Jerkins (Phillip.Jerkins@morgankeegan.com) -// Diego Caravana (diego@toth.it) -// -// Copyright (C) Ximian, Inc 2002 -// Copyright (C) Daniel Morgan 2002, 2003 -// Copyright (C) Tim Coleman, 2002, 2003 -// Copyright (C) Phillip Jerkins, 2003 -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.Collections; -using System.Collections.Specialized; -using System.ComponentModel; -using System.Data; -using System.Data.Common; -#if !MOBILE -using System.EnterpriseServices; -#endif -using System.Globalization; -using System.Net; -using System.Net.Sockets; -using System.Text; -using System.Xml; -using System.Collections.Generic; -using System.Security; - -namespace System.Data.SqlClient -{ - [DefaultEvent ("InfoMessage")] - public sealed class SqlConnection : DbConnection, IDbConnection, ICloneable - { - #region Fields - - bool disposed; - - // The set of SQL connection pools - static TdsConnectionPoolManager sqlConnectionPools = new TdsConnectionPoolManager (TdsVersion.tds80); - const int DEFAULT_PACKETSIZE = 8000; - const int MAX_PACKETSIZE = 32768; - const int MIN_PACKETSIZE = 512; - const int DEFAULT_CONNECTIONTIMEOUT = 15; - const int DEFAULT_CONNECTIONLIFETIME = 0; - const int DEFAULT_MAXPOOLSIZE = 100; - const int MIN_MAXPOOLSIZE = 1; - const int DEFAULT_MINPOOLSIZE = 0; - const int DEFAULT_PORT = 1433; - - // The current connection pool - TdsConnectionPool pool; - - // The connection string that identifies this connection - string connectionString; - - // The connection credentials - SqlCredential credentials; - - // The transaction object for the current transaction - SqlTransaction transaction; - - // Connection parameters - - TdsConnectionParameters parms; - bool connectionReset; - int connectionLifeTime; - bool pooling; - string dataSource; - int connectionTimeout; - int minPoolSize; - int maxPoolSize; - int packetSize; - int port; - bool fireInfoMessageEventOnUserErrors; - bool statisticsEnabled; - - // The current state - ConnectionState state = ConnectionState.Closed; - - SqlDataReader dataReader; - XmlReader xmlReader; - - // The TDS object - Tds tds; - - #endregion // Fields - - #region Constructors - - public SqlConnection () : this (null) - { - } - - public SqlConnection (string connectionString) - { - ConnectionString = connectionString; - } - - public SqlConnection (string connectionString, SqlCredential credential) - { - ConnectionString = connectionString; - Credentials = credential; - } - - #endregion // Constructors - - #region Properties - - [DefaultValue ("")] - [EditorAttribute ("Microsoft.VSDesigner.Data.SQL.Design.SqlConnectionStringEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )] -#pragma warning disable 618 // ignore obsolete warning about RecommendedAsConfigurable to use SettingsBindableAttribute - [RecommendedAsConfigurable(true)] -#pragma warning restore 618 - [RefreshProperties (RefreshProperties.All)] - public override string ConnectionString { - get { - if (connectionString == null) - return string.Empty; - return connectionString; - } - [MonoTODO("persist security info, encrypt, enlist keyword not implemented")] - set { - if (state == ConnectionState.Open) - throw new InvalidOperationException ("Not Allowed to change ConnectionString property while Connection state is OPEN"); - SetConnectionString (value); - } - } - - public SqlCredential Credentials { - get { - return credentials; - } - set { - credentials = value; - } - } - - [MonoTODO] - public Guid ClientConnectionId { - get { - throw new NotImplementedException (); - } - } - - [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] - public - override - int ConnectionTimeout { - get { return connectionTimeout; } - } - - [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] - public - override - string Database { - get { - if (State == ConnectionState.Open) - return tds.Database; - return parms.Database ; - } - } - - internal SqlDataReader DataReader { - get { return dataReader; } - set { dataReader = value; } - } - - [Browsable(true)] - [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] - public - override - string DataSource { - get { return dataSource; } - } - - [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] - public int PacketSize { - get { - if (State == ConnectionState.Open) - return ((Tds) tds).PacketSize; - return packetSize; - } - } - - [Browsable (false)] - [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] - public - override - string ServerVersion { - get { - if (state == ConnectionState.Closed) - throw ExceptionHelper.ConnectionClosed (); - else - return tds.ServerVersion; - } - } - - [Browsable (false)] - [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] - public - override - ConnectionState State { - get { return state; } - } - - internal Tds Tds { - get { return tds; } - } - - internal SqlTransaction Transaction { - get { return transaction; } - set { transaction = value; } - } - - [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] - public string WorkstationId { - get { return parms.Hostname; } - } - - internal XmlReader XmlReader { - get { return xmlReader; } - set { xmlReader = value; } - } - - public bool FireInfoMessageEventOnUserErrors { - get { return fireInfoMessageEventOnUserErrors; } - set { fireInfoMessageEventOnUserErrors = value; } - } - - [DefaultValue (false)] - public bool StatisticsEnabled { - get { return statisticsEnabled; } - set { statisticsEnabled = value; } - } - - protected override DbProviderFactory DbProviderFactory { - get { - return SqlClientFactory.Instance; - } - } - - #endregion // Properties - - #region Events - - public event SqlInfoMessageEventHandler InfoMessage; - - - #endregion // Events - - #region Delegates - - private void ErrorHandler (object sender, TdsInternalErrorMessageEventArgs e) - { - try { - if (!tds.IsConnected) - Close (); - } catch { - try { - Close (); - } catch { - } - } - throw new SqlException (e.Class, e.LineNumber, e.Message, e.Number, e.Procedure, e.Server, "Mono SqlClient Data Provider", e.State); - } - - private void MessageHandler (object sender, TdsInternalInfoMessageEventArgs e) - { - OnSqlInfoMessage (CreateSqlInfoMessageEvent (e.Errors)); - } - - #endregion // Delegates - - #region Methods - - public new SqlTransaction BeginTransaction () - { - return BeginTransaction (IsolationLevel.ReadCommitted, String.Empty); - } - - public new SqlTransaction BeginTransaction (IsolationLevel iso) - { - return BeginTransaction (iso, String.Empty); - } - - public SqlTransaction BeginTransaction (string transactionName) - { - return BeginTransaction (IsolationLevel.ReadCommitted, transactionName); - } - - public SqlTransaction BeginTransaction (IsolationLevel iso, string transactionName) - { - if (state == ConnectionState.Closed) - throw ExceptionHelper.ConnectionClosed (); - if (transaction != null) - throw new InvalidOperationException ("SqlConnection does not support parallel transactions."); - - string isolevel = String.Empty; - switch (iso) { - case IsolationLevel.ReadUncommitted: - isolevel = "READ UNCOMMITTED"; - break; - case IsolationLevel.RepeatableRead: - isolevel = "REPEATABLE READ"; - break; - case IsolationLevel.Serializable: - isolevel = "SERIALIZABLE"; - break; - case IsolationLevel.ReadCommitted: - isolevel = "READ COMMITTED"; - break; - case IsolationLevel.Snapshot: - isolevel = "SNAPSHOT"; - break; - case IsolationLevel.Unspecified: - iso = IsolationLevel.ReadCommitted; - isolevel = "READ COMMITTED"; - break; - case IsolationLevel.Chaos: - throw new ArgumentOutOfRangeException ("IsolationLevel", - string.Format (CultureInfo.CurrentCulture, - "The IsolationLevel enumeration " + - "value, {0}, is not supported by " + - "the .Net Framework SqlClient " + - "Data Provider.", (int) iso)); - default: - throw new ArgumentOutOfRangeException ("IsolationLevel", - string.Format (CultureInfo.CurrentCulture, - "The IsolationLevel enumeration value, {0}, is invalid.", - (int) iso)); - } - - tds.Execute (String.Format ("SET TRANSACTION ISOLATION LEVEL {0};BEGIN TRANSACTION {1}", isolevel, transactionName)); - - transaction = new SqlTransaction (this, iso); - return transaction; - } - - public - override - void ChangeDatabase (string database) - { - if (!IsValidDatabaseName (database)) - throw new ArgumentException (String.Format ("The database name {0} is not valid.", database)); - if (state != ConnectionState.Open) - throw new InvalidOperationException ("The connection is not open."); - tds.Execute (String.Format ("use [{0}]", database)); - } - - private void ChangeState (ConnectionState currentState) - { - if (currentState == state) - return; - - ConnectionState originalState = state; - state = currentState; - OnStateChange (CreateStateChangeEvent (originalState, currentState)); - } - - public - override - void Close () - { - if (transaction != null && transaction.IsOpen) - transaction.Rollback (); - - if (dataReader != null || xmlReader != null) { - if(tds != null) tds.SkipToEnd (); - dataReader = null; - xmlReader = null; - } - - if (tds != null && tds.IsConnected) { - if (pooling && tds.Pooling) { - if (pool != null) { - pool.ReleaseConnection (tds); - pool = null; - } - } else { - tds.Disconnect (); - } - } - - if (tds != null) { - tds.TdsErrorMessage -= new TdsInternalErrorMessageEventHandler (ErrorHandler); - tds.TdsInfoMessage -= new TdsInternalInfoMessageEventHandler (MessageHandler); - } - - ChangeState (ConnectionState.Closed); - } - - public new SqlCommand CreateCommand () - { - SqlCommand command = new SqlCommand (); - command.Connection = this; - return command; - } - - private SqlInfoMessageEventArgs CreateSqlInfoMessageEvent (TdsInternalErrorCollection errors) - { - foreach (TdsInternalError e in errors) - return new SqlInfoMessageEventArgs (new SqlException (e.Class, e.LineNumber, e.Message, e.Number, e.Procedure, e.Server, "Mono SqlClient Data Provider", e.State)); - - return null; - } - - private StateChangeEventArgs CreateStateChangeEvent (ConnectionState originalState, ConnectionState currentState) - { - return new StateChangeEventArgs (originalState, currentState); - } - - protected override void Dispose (bool disposing) - { - try { - if (disposing && !disposed) { - if (State == ConnectionState.Open) - Close (); - ConnectionString = null; - } - } finally { - disposed = true; - base.Dispose (disposing); - } - } - -#if !MOBILE - [MonoTODO ("Not sure what this means at present.")] - public void EnlistDistributedTransaction (ITransaction transaction) - { - throw new NotImplementedException (); - } -#endif - - object ICloneable.Clone () - { - return new SqlConnection (ConnectionString); - } - - protected override DbTransaction BeginDbTransaction (IsolationLevel isolationLevel) - { - return BeginTransaction (isolationLevel); - } - - protected override DbCommand CreateDbCommand () - { - return CreateCommand (); - } - - public - override - void Open () - { - string serverName = string.Empty; - if (state == ConnectionState.Open) - throw new InvalidOperationException ("The Connection is already Open (State=Open)"); - - if (connectionString == null || connectionString.Trim().Length == 0) - throw new InvalidOperationException ("Connection string has not been initialized."); - - try { - if (!pooling) { - if(!ParseDataSource (dataSource, out port, out serverName)) - throw new SqlException(20, 0, "SQL Server does not exist or access denied.", 17, "ConnectionOpen (Connect()).", dataSource, parms.ApplicationName, 0); - tds = new Tds80 (serverName, port, PacketSize, ConnectionTimeout, 0); - tds.Pooling = false; - } - else { - if(!ParseDataSource (dataSource, out port, out serverName)) - throw new SqlException(20, 0, "SQL Server does not exist or access denied.", 17, "ConnectionOpen (Connect()).", dataSource, parms.ApplicationName, 0); - - TdsConnectionInfo info = new TdsConnectionInfo (serverName, port, packetSize, ConnectionTimeout, minPoolSize, maxPoolSize, connectionLifeTime); - pool = sqlConnectionPools.GetConnectionPool (connectionString, info); - tds = pool.GetConnection (); - } - } catch (TdsTimeoutException e) { - throw SqlException.FromTdsInternalException ((TdsInternalException) e); - } catch (TdsInternalException e) { - throw SqlException.FromTdsInternalException (e); - } - - tds.TdsErrorMessage += new TdsInternalErrorMessageEventHandler (ErrorHandler); - tds.TdsInfoMessage += new TdsInternalInfoMessageEventHandler (MessageHandler); - - if (!tds.IsConnected) { - try { - if (Credentials != null) { - if (parms.User != String.Empty) - throw new ArgumentException("UserID already specified"); - if (parms.PasswordSet) - throw new ArgumentException("Password already specified"); - if (parms.DomainLogin != false) - throw new ArgumentException("Cannot use credentials with DomainLogin"); - parms.User = Credentials.UserId; - parms.Password = Credentials.Password; - } - tds.Connect (parms); - } catch { - if (pooling) - pool.ReleaseConnection (tds); - throw; - } - } - - disposed = false; // reset this, so using () would call Close (). - ChangeState (ConnectionState.Open); - } - - private bool ParseDataSource (string theDataSource, out int thePort, out string theServerName) - { - theServerName = string.Empty; - string theInstanceName = string.Empty; - - if (theDataSource == null) - throw new ArgumentException("Format of initialization string does not conform to specifications"); - - thePort = DEFAULT_PORT; // default TCP port for SQL Server - bool success = true; - - int idx = 0; - if ((idx = theDataSource.IndexOf (',')) > -1) { - theServerName = theDataSource.Substring (0, idx); - string p = theDataSource.Substring (idx + 1); - thePort = Int32.Parse (p); - } else if ((idx = theDataSource.IndexOf ('\\')) > -1) { - theServerName = theDataSource.Substring (0, idx); - theInstanceName = theDataSource.Substring (idx + 1); - - // do port discovery via UDP port 1434 - port = DiscoverTcpPortViaSqlMonitor (theServerName, theInstanceName); - if (port == -1) - success = false; - } else - theServerName = theDataSource; - - if (theServerName.Length == 0 || theServerName == "(local)" || theServerName == ".") - theServerName = "localhost"; - - if ((idx = theServerName.IndexOf ("tcp:")) > -1) - theServerName = theServerName.Substring (idx + 4); - - return success; - } - - private bool ConvertIntegratedSecurity (string value) - { - if (value.ToUpper() == "SSPI") - return true; - - return ConvertToBoolean ("integrated security", value, false); - } - - private bool ConvertToBoolean (string key, string value, bool defaultValue) - { - if (value.Length == 0) - return defaultValue; - - string upperValue = value.ToUpper (); - - if (upperValue == "TRUE" || upperValue == "YES") - return true; - else if (upperValue == "FALSE" || upperValue == "NO") - return false; - - throw new ArgumentException (string.Format (CultureInfo.InvariantCulture, - "Invalid value \"{0}\" for key '{1}'.", value, key)); - } - - private int ConvertToInt32 (string key, string value, int defaultValue) - { - if (value.Length == 0) - return defaultValue; - - try { - return int.Parse (value); - } catch (Exception ex) { - throw new ArgumentException (string.Format (CultureInfo.InvariantCulture, - "Invalid value \"{0}\" for key '{1}'.", value, key), ex); - } - } - - private int DiscoverTcpPortViaSqlMonitor (string ServerName, string InstanceName) - { - SqlMonitorSocket msock; - msock = new SqlMonitorSocket (ServerName, InstanceName); - int SqlServerPort = msock.DiscoverTcpPort (ConnectionTimeout); - msock = null; - return SqlServerPort; - } - - void SetConnectionString (string connectionString) - { - SetDefaultConnectionParameters (); - - if ((connectionString == null) || (connectionString.Trim().Length == 0)) { - this.connectionString = connectionString; - return; - } - - connectionString += ";"; - - bool inQuote = false; - bool inDQuote = false; - bool inName = true; - - string name = String.Empty; - string value = String.Empty; - StringBuilder sb = new StringBuilder (); - - for (int i = 0; i < connectionString.Length; i += 1) { - char c = connectionString [i]; - char peek; - if (i == connectionString.Length - 1) - peek = '\0'; - else - peek = connectionString [i + 1]; - - switch (c) { - case '\'': - if (inDQuote) - sb.Append (c); - else if (peek.Equals (c)) { - sb.Append (c); - i += 1; - } - else - inQuote = !inQuote; - break; - case '"': - if (inQuote) - sb.Append (c); - else if (peek.Equals (c)) { - sb.Append (c); - i += 1; - } - else - inDQuote = !inDQuote; - break; - case ';': - if (inDQuote || inQuote) - sb.Append (c); - else { - if (name != String.Empty && name != null) { - value = sb.ToString (); - SetProperties (name.ToLower ().Trim() , value); - } - else if (sb.Length != 0) - throw new ArgumentException ("Format of initialization string does not conform to specifications"); - inName = true; - name = String.Empty; - value = String.Empty; - sb = new StringBuilder (); - } - break; - case '=': - if (inDQuote || inQuote || !inName) - sb.Append (c); - else if (peek.Equals (c)) { - sb.Append (c); - i += 1; - - } - else { - name = sb.ToString (); - sb = new StringBuilder (); - inName = false; - } - break; - case ' ': - if (inQuote || inDQuote) - sb.Append (c); - else if (sb.Length > 0 && !peek.Equals (';')) - sb.Append (c); - break; - default: - sb.Append (c); - break; - } - } - - if (minPoolSize > maxPoolSize) - throw new ArgumentException ("Invalid value for " - + "'min pool size' or 'max pool size'; " - + "'min pool size' must not be greater " - + "than 'max pool size'."); - - connectionString = connectionString.Substring (0 , connectionString.Length-1); - this.connectionString = connectionString; - } - - void SetDefaultConnectionParameters () - { - if (parms == null) - parms = new TdsConnectionParameters (); - else - parms.Reset (); - dataSource = string.Empty; - connectionTimeout = DEFAULT_CONNECTIONTIMEOUT; - connectionLifeTime = DEFAULT_CONNECTIONLIFETIME; - connectionReset = true; - pooling = true; - maxPoolSize = DEFAULT_MAXPOOLSIZE; - minPoolSize = DEFAULT_MINPOOLSIZE; - packetSize = DEFAULT_PACKETSIZE; - port = DEFAULT_PORT; - async = false; - } - - private void SetProperties (string name , string value) - { - switch (name) { - case "app" : - case "application name" : - parms.ApplicationName = value; - break; - case "attachdbfilename" : - case "extended properties" : - case "initial file name" : - parms.AttachDBFileName = value; - break; - case "timeout" : - case "connect timeout" : - case "connection timeout" : - int tmpTimeout = ConvertToInt32 ("connect timeout", value, - DEFAULT_CONNECTIONTIMEOUT); - if (tmpTimeout < 0) - throw new ArgumentException ("Invalid 'connect timeout'. Must be an integer >=0 "); - else - connectionTimeout = tmpTimeout; - break; - case "connection lifetime" : - connectionLifeTime = ConvertToInt32 ("connection lifetime", value, DEFAULT_CONNECTIONLIFETIME); - break; - case "connection reset" : - connectionReset = ConvertToBoolean ("connection reset", value, true); - break; - case "language" : - case "current language" : - parms.Language = value; - break; - case "data source" : - case "server" : - case "address" : - case "addr" : - case "network address" : - dataSource = value; - break; - case "encrypt": - if (ConvertToBoolean (name, value, false)) - throw new NotImplementedException("SSL encryption for" - + " data sent between client and server is not" - + " implemented."); - break; - case "enlist" : - if (!ConvertToBoolean (name, value, true)) - throw new NotImplementedException("Disabling the automatic" - + " enlistment of connections in the thread's current" - + " transaction context is not implemented."); - break; - case "initial catalog" : - case "database" : - parms.Database = value; - break; - case "integrated security" : - case "trusted_connection" : - parms.DomainLogin = ConvertIntegratedSecurity(value); - break; - case "max pool size" : - int tmpMaxPoolSize = ConvertToInt32 (name, value, DEFAULT_MAXPOOLSIZE); - if (tmpMaxPoolSize < MIN_MAXPOOLSIZE) - throw new ArgumentException (string.Format (CultureInfo.InvariantCulture, - "Invalid '{0}'. The value must be greater than {1}.", - name, MIN_MAXPOOLSIZE)); - else - maxPoolSize = tmpMaxPoolSize; - break; - case "min pool size" : - int tmpMinPoolSize = ConvertToInt32 (name, value, DEFAULT_MINPOOLSIZE); - if (tmpMinPoolSize < 0) - throw new ArgumentException ("Invalid 'min pool size'. Must be a integer >= 0"); - else - minPoolSize = tmpMinPoolSize; - break; - case "multipleactiveresultsets": - // FIXME: not implemented - ConvertToBoolean (name, value, false); - break; - case "asynchronous processing" : - case "async" : - async = ConvertToBoolean (name, value, false); - break; - case "net" : - case "network" : - case "network library" : - if (!value.ToUpper ().Equals ("DBMSSOCN")) - throw new ArgumentException ("Unsupported network library."); - break; - case "packet size" : - int tmpPacketSize = ConvertToInt32 (name, value, DEFAULT_PACKETSIZE); - if (tmpPacketSize < MIN_PACKETSIZE || tmpPacketSize > MAX_PACKETSIZE) - throw new ArgumentException (string.Format (CultureInfo.InvariantCulture, - "Invalid 'Packet Size'. The value must be between {0} and {1}.", - MIN_PACKETSIZE, MAX_PACKETSIZE)); - else - packetSize = tmpPacketSize; - break; - case "password" : - case "pwd" : - parms.Password = new SecureString(); - foreach (char c in value) - parms.Password.AppendChar(c); - parms.PasswordSet = true; - break; - case "persistsecurityinfo" : - case "persist security info" : - // FIXME : not implemented - // throw new NotImplementedException (); - break; - case "pooling" : - pooling = ConvertToBoolean (name, value, true); - break; - case "uid" : - case "user" : - case "user id" : - parms.User = value; - break; - case "wsid" : - case "workstation id" : - parms.Hostname = value; - break; - case "user instance": - userInstance = ConvertToBoolean (name, value, false); - break; - default : - throw new ArgumentException("Keyword not supported : '" + name + "'."); - } - } - - static bool IsValidDatabaseName (string database) - { - if ( database == null || database.Trim().Length == 0 || database.Length > 128) - 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 != '_' && c != '-') - return false; - return true; - } - - private void OnSqlInfoMessage (SqlInfoMessageEventArgs value) - { - if (InfoMessage != null) - InfoMessage (this, value); - } - - - private sealed class SqlMonitorSocket : UdpClient - { - // UDP port that the SQL Monitor listens - private static readonly int SqlMonitorUdpPort = 1434; - //private static readonly string SqlServerNotExist = "SQL Server does not exist or access denied"; - - private string server; - private string instance; - - internal SqlMonitorSocket (string ServerName, string InstanceName) - : base (ServerName, SqlMonitorUdpPort) - { - server = ServerName; - instance = InstanceName; - } - - internal int DiscoverTcpPort (int timeoutSeconds) - { - int SqlServerTcpPort; - Client.Blocking = false; - // send command to UDP 1434 (SQL Monitor) to get - // the TCP port to connect to the MS SQL server - ASCIIEncoding enc = new ASCIIEncoding (); - Byte[] rawrq = new Byte [instance.Length + 1]; - rawrq[0] = 4; - enc.GetBytes (instance, 0, instance.Length, rawrq, 1); - Send (rawrq, rawrq.Length); - - if (!Active) - return -1; // Error - - bool result; - long timeout = timeoutSeconds * 1000000; - result = Client.Poll ((int)timeout, SelectMode.SelectRead); - if (result == false) - return -1; // Error - - if (Client.Available <= 0) - return -1; // Error - - IPEndPoint remoteEndpoint; - switch (Client.AddressFamily) { - case AddressFamily.InterNetwork: - remoteEndpoint = new IPEndPoint(IPAddress.Any, 0); - break; - case AddressFamily.InterNetworkV6: - remoteEndpoint = new IPEndPoint(IPAddress.IPv6Any, 0); - break; - default: - return -1; // Error - } - - Byte [] rawrs; - - rawrs = Receive (ref remoteEndpoint); - - string rs = Encoding.ASCII.GetString (rawrs); - - string[] rawtokens = rs.Split (';'); - Hashtable data = new Hashtable (); - for (int i = 0; i < rawtokens.Length / 2 && i < 256; i++) { - data [rawtokens [i * 2]] = rawtokens [ i * 2 + 1]; - } - - if (!data.ContainsKey ("tcp")) { - string msg = "Mono does not support names pipes or shared memory " - + "for connecting to SQL Server. Please enable the TCP/IP " - + "protocol."; - throw new NotImplementedException (msg); - } - - SqlServerTcpPort = int.Parse ((string) data ["tcp"]); - Close (); - - return SqlServerTcpPort; - } - } - - struct ColumnInfo - { - public string name; - public Type type; - - public ColumnInfo (string name, Type type) - { - this.name = name; this.type = type; - } - } - - static class ReservedWords - { - static readonly string [] reservedWords = - { - "ADD", "EXCEPT", "PERCENT", "ALL", "EXEC", "PLAN", "ALTER", - "EXECUTE", "PRECISION", "AND", "EXISTS", "PRIMARY", "ANY", - "EXIT", "PRINT", "AS", "FETCH", "PROC", "ASC", "FILE", - "PROCEDURE", "AUTHORIZATION", "FILLFACTOR", "PUBLIC", - "BACKUP", "FOR", "RAISERROR", "BEGIN", "FOREIGN", "READ", - "BETWEEN", "FREETEXT", "READTEXT", "BREAK", "FREETEXTTABLE", - "RECONFIGURE", "BROWSE", "FROM", "REFERENCES", "BULK", - "FULL", "REPLICATION", "BY", "FUNCTION", "RESTORE", - "CASCADE", "GOTO", "RESTRICT", "CASE", "GRANT", "RETURN", - "CHECK", "GROUP", "REVOKE", "CHECKPOINT", "HAVING", "RIGHT", - "CLOSE", "HOLDLOCK", "ROLLBACK", "CLUSTERED", "IDENTITY", - "ROWCOUNT", "COALESCE", "IDENTITY_INSERT", "ROWGUIDCOL", - "COLLATE", "IDENTITYCOL", "RULE", "COLUMN", "IF", "SAVE", - "COMMIT", "IN", "SCHEMA", "COMPUTE", "INDEX", "SELECT", - "CONSTRAINT", "INNER", "SESSION_USER", "CONTAINS", "INSERT", - "SET", "CONTAINSTABLE", "INTERSECT", "SETUSER", "CONTINUE", - "INTO", "SHUTDOWN", "CONVERT", "IS", "SOME", "CREATE", - "JOIN", "STATISTICS", "CROSS", "KEY", "SYSTEM_USER", - "CURRENT", "KILL", "TABLE", "CURRENT_DATE", "LEFT", - "TEXTSIZE", "CURRENT_TIME", "LIKE", "THEN", - "CURRENT_TIMESTAMP", "LINENO", "TO", "CURRENT_USER", "LOAD", - "TOP", "CURSOR", "NATIONAL", "TRAN", "DATABASE", "NOCHECK", - "TRANSACTION", "DBCC", "NONCLUSTERED", "TRIGGER", - "DEALLOCATE", "NOT", "TRUNCATE", "DECLARE", "NULL", - "TSEQUAL", "DEFAULT", "NULLIF", "UNION", "DELETE", "OF", - "UNIQUE", "DENY", "OFF", "UPDATE", "DESC", "OFFSETS", - "UPDATETEXT", "DISK", "ON", "USE", "DISTINCT", "OPEN", - "USER", "DISTRIBUTED", "OPENDATASOURCE", "VALUES", "DOUBLE", - "OPENQUERY", "VARYING", "DROP", "OPENROWSET", "VIEW", - "DUMMY", "OPENXML", "WAITFOR", "DUMP", "OPTION", "WHEN", - "ELSE", "OR", "WHERE", "END", "ORDER", "WHILE", "ERRLVL", - "OUTER", "WITH", "ESCAPE", "OVER", "WRITETEXT", "ABSOLUTE", - "FOUND", "PRESERVE", "ACTION", "FREE", "PRIOR", "ADMIN", - "GENERAL", "PRIVILEGES", "AFTER", "GET", "READS", - "AGGREGATE", "GLOBAL", "REAL", "ALIAS", "GO", "RECURSIVE", - "ALLOCATE", "GROUPING", "REF", "ARE", "HOST", "REFERENCING", - "ARRAY", "HOUR", "RELATIVE", "ASSERTION", "IGNORE", "RESULT", - "AT", "IMMEDIATE", "RETURNS", "BEFORE", "INDICATOR", "ROLE", - "BINARY", "INITIALIZE", "ROLLUP", "BIT", "INITIALLY", - "ROUTINE", "BLOB", "INOUT", "ROW", "BOOLEAN", "INPUT", - "ROWS", "BOTH", "INT", "SAVEPOINT", "BREADTH", "INTEGER", - "SCROLL", "CALL", "INTERVAL", "SCOPE", "CASCADED", - "ISOLATION", "SEARCH", "CAST", "ITERATE", "SECOND", - "CATALOG", "LANGUAGE", "SECTION", "CHAR", "LARGE", - "SEQUENCE", "CHARACTER", "LAST", "SESSION", "CLASS", - "LATERAL", "SETS", "CLOB", "LEADING", "SIZE", "COLLATION", - "LESS", "SMALLINT", "COMPLETION", "LEVEL", "SPACE", - "CONNECT", "LIMIT", "SPECIFIC", "CONNECTION", "LOCAL", - "SPECIFICTYPE", "CONSTRAINTS", "LOCALTIME", "SQL", - "CONSTRUCTOR", "LOCALTIMESTAMP", "SQLEXCEPTION", - "CORRESPONDING", "LOCATOR", "SQLSTATE", "CUBE", "MAP", - "SQLWARNING", "CURRENT_PATH", "MATCH", "START", - "CURRENT_ROLE", "MINUTE", "STATE", "CYCLE", "MODIFIES", - "STATEMENT", "DATA", "MODIFY", "STATIC", "DATE", "MODULE", - "STRUCTURE", "DAY", "MONTH", "TEMPORARY", "DEC", "NAMES", - "TERMINATE", "DECIMAL", "NATURAL", "THAN", "DEFERRABLE", - "NCHAR", "TIME", "DEFERRED", "NCLOB", "TIMESTAMP", "DEPTH", - "NEW", "TIMEZONE_HOUR", "DEREF", "NEXT", "TIMEZONE_MINUTE", - "DESCRIBE", "NO", "TRAILING", "DESCRIPTOR", "NONE", - "TRANSLATION", "DESTROY", "NUMERIC", "TREAT", "DESTRUCTOR", - "OBJECT", "TRUE", "DETERMINISTIC", "OLD", "UNDER", - "DICTIONARY", "ONLY", "UNKNOWN", "DIAGNOSTICS", "OPERATION", - "UNNEST", "DISCONNECT", "ORDINALITY", "USAGE", "DOMAIN", - "OUT", "USING", "DYNAMIC", "OUTPUT", "VALUE", "EACH", - "PAD", "VARCHAR", "END-EXEC", "PARAMETER", "VARIABLE", - "EQUALS", "PARAMETERS", "WHENEVER", "EVERY", "PARTIAL", - "WITHOUT", "EXCEPTION", "PATH", "WORK", "EXTERNAL", - "POSTFIX", "WRITE", "FALSE", "PREFIX", "YEAR", "FIRST", - "PREORDER", "ZONE", "FLOAT", "PREPARE", "ADA", "AVG", - "BIT_LENGTH", "CHAR_LENGTH", "CHARACTER_LENGTH", "COUNT", - "EXTRACT", "FORTRAN", "INCLUDE", "INSENSITIVE", "LOWER", - "MAX", "MIN", "OCTET_LENGTH", "OVERLAPS", "PASCAL", - "POSITION", "SQLCA", "SQLCODE", "SQLERROR", "SUBSTRING", - "SUM", "TRANSLATE", "TRIM", "UPPER" - }; - static DataTable instance; - static public DataTable Instance { - get { - if (instance == null) { - DataRow row = null; - var newInstance = new DataTable ("ReservedWords"); - newInstance.Columns.Add ("ReservedWord", typeof(string)); - foreach (string reservedWord in reservedWords) - { - row = newInstance.NewRow(); - - row["ReservedWord"] = reservedWord; - newInstance.Rows.Add(row); - } - instance = newInstance; - } - return instance; - } - } - } - - static class MetaDataCollections - { - static readonly ColumnInfo [] columns = { - new ColumnInfo ("CollectionName", typeof (string)), - new ColumnInfo ("NumberOfRestrictions", typeof (int)), - new ColumnInfo ("NumberOfIdentifierParts", typeof (int)) - }; - - static readonly object [][] rows = { - new object [] {"MetaDataCollections", 0, 0}, - new object [] {"DataSourceInformation", 0, 0}, - new object [] {"DataTypes", 0, 0}, - new object [] {"Restrictions", 0, 0}, - new object [] {"ReservedWords", 0, 0}, - new object [] {"Users", 1, 1}, - new object [] {"Databases", 1, 1}, - new object [] {"Tables", 4, 3}, - new object [] {"Columns", 4, 4}, - new object [] {"StructuredTypeMembers", 4, 4}, - new object [] {"Views", 3, 3}, - new object [] {"ViewColumns", 4, 4}, - new object [] {"ProcedureParameters", 4, 1}, - new object [] {"Procedures", 4, 3}, - new object [] {"ForeignKeys", 4, 3}, - new object [] {"IndexColumns", 5, 4}, - new object [] {"Indexes", 4, 3}, - new object [] {"UserDefinedTypes", 2, 1} - }; - - static DataTable instance; - static public DataTable Instance { - get { - if (instance == null) { - var newInstance = new DataTable ("MetaDataCollections"); - foreach (ColumnInfo c in columns) - newInstance.Columns.Add (c.name, c.type); - foreach (object [] row in rows) - newInstance.LoadDataRow (row, true); - instance = newInstance; - } - return instance; - } - } - } - - static class DataSourceInformation - { - static readonly ColumnInfo [] columns = { - new ColumnInfo ("CompositeIdentifierSeparatorPattern", typeof (string)), - new ColumnInfo ("DataSourceProductName", typeof(string)), - new ColumnInfo ("DataSourceProductVersion", typeof(string)), - new ColumnInfo ("DataSourceProductVersionNormalized", typeof(string)), - new ColumnInfo ("GroupByBehavior", typeof(GroupByBehavior)), - new ColumnInfo ("IdentifierPattern", typeof(string)), - new ColumnInfo ("IdentifierCase", typeof(IdentifierCase)), - new ColumnInfo ("OrderByColumnsInSelect", typeof(bool)), - new ColumnInfo ("ParameterMarkerFormat", typeof(string)), - new ColumnInfo ("ParameterMarkerPattern", typeof(string)), - new ColumnInfo ("ParameterNameMaxLength", typeof(int)), - new ColumnInfo ("ParameterNamePattern", typeof(string)), - new ColumnInfo ("QuotedIdentifierPattern", typeof(string)), - new ColumnInfo ("QuotedIdentifierCase", typeof(IdentifierCase)), - new ColumnInfo ("StatementSeparatorPattern", typeof(string)), - new ColumnInfo ("StringLiteralPattern", typeof(string)), - new ColumnInfo ("SupportedJoinOperators", typeof(SupportedJoinOperators)) - }; - - static public DataTable GetInstance (SqlConnection conn) - { - DataTable table = new DataTable ("DataSourceInformation"); - foreach (ColumnInfo c in columns) - table.Columns.Add (c.name, c.type); - DataRow row = table.NewRow (); - row [0] = "\\."; - row [1] = "Microsoft SQL Server"; - row [2] = conn.ServerVersion;; - row [3] = conn.ServerVersion;; - row [4] = GroupByBehavior.Unrelated; - row [5] = @"(^\[\p{Lo}\p{Lu}\p{Ll}_@#][\p{Lo}\p{Lu}\p{Ll}\p{Nd}@$#_]*$)|(^\[[^\]\0]|\]\]+\]$)|(^\""[^\""\0]|\""\""+\""$)"; - row [6] = IdentifierCase.Insensitive; // FIXME: obtain this from SQL Server - row [7] = false; - row [8] = "{0}"; - row [9] = @"@[\p{Lo}\p{Lu}\p{Ll}\p{Lm}_@#][\p{Lo}\p{Lu}\p{Ll}\p{Lm}\p{Nd}\uff3f_@#\$]*(?=\s+|$)"; - row [10] = 128; - row [11] = @"^[\p{Lo}\p{Lu}\p{Ll}\p{Lm}_@#][\p{Lo}\p{Lu}\p{Ll}\p{Lm}\p{Nd}\uff3f_@#\$]*(?=\s+|$)"; - row [12] = @"(([^\[]|\]\])*)"; - row [13] = IdentifierCase.Insensitive; // FIXME: obtain this from SQL Server - row [14] =";"; - row [15] = "'(([^']|'')*)'"; - row [16] = (SupportedJoinOperators.FullOuter | SupportedJoinOperators.Inner | - SupportedJoinOperators.LeftOuter | SupportedJoinOperators.RightOuter); - table.Rows.Add (row); - return table; - } - } - - static class DataTypes - { - static readonly ColumnInfo [] columns = { - new ColumnInfo ("TypeName", typeof(string)), - new ColumnInfo ("ProviderDbType", typeof(int)), - new ColumnInfo ("ColumnSize", typeof(long)), - new ColumnInfo ("CreateFormat", typeof(string)), - new ColumnInfo ("CreateParameters", typeof(string)), - new ColumnInfo ("DataType", typeof(string)), - new ColumnInfo ("IsAutoIncrementable", typeof(bool)), - new ColumnInfo ("IsBestMatch", typeof(bool)), - new ColumnInfo ("IsCaseSensitive", typeof(bool)), - new ColumnInfo ("IsFixedLength", typeof(bool)), - new ColumnInfo ("IsFixedPrecisionScale", typeof(bool)), - new ColumnInfo ("IsLong", typeof(bool)), - new ColumnInfo ("IsNullable", typeof(bool)), - new ColumnInfo ("IsSearchable", typeof(bool)), - new ColumnInfo ("IsSearchableWithLike", typeof(bool)), - new ColumnInfo ("IsUnsigned", typeof(bool)), - new ColumnInfo ("MaximumScale", typeof(short)), - new ColumnInfo ("MinimumScale", typeof(short)), - new ColumnInfo ("IsConcurrencyType", typeof(bool)), - new ColumnInfo ("IsLiteralSupported", typeof(bool)), - new ColumnInfo ("LiteralPrefix", typeof(string)), - new ColumnInfo ("LiteralSuffix", typeof(string)) - }; - - static readonly object [][] rows = { - new object [] {"smallint", 16, 5, "smallint", null, "System.Int16", true, true, - false, true, true, false, true, true, false, false, null, - null, false, null, null, null}, - new object [] {"int", 8, 10, "int", null, "System.Int32", - true, true, false, true, true, false, true, true, false, - false, null, null, false, null, null, null}, - new object [] {"real", 13, 7, "real", null, - "System.Single", false, true, false, true, false, false, - true, true, false, false, null, null, false, null, null, null}, - new object [] {"float", 6, 53, "float({0})", - "number of bits used to store the mantissa", "System.Double", - false, true, false, true, false, false, true, true, - false, false, null, null, false, null, null, null}, - new object [] {"money", 9, 19, "money", null, - "System.Decimal", false, false, false, true, true, - false, true, true, false, false, null, null, false, - null, null, null}, - new object [] {"smallmoney", 17, 10, "smallmoney", null, - "System.Decimal", false, false, false, true, true, false, - true, true, false, false, null, null, false, null, null, null}, - new object [] {"bit", 2, 1, "bit", null, "System.Boolean", - false, false, false, true, false, false, true, true, - false, null, null, null, false, null, null, null}, - new object [] {"tinyint", 20, 3, "tinyint", null, - "System.SByte", true, true, false, true, true, false, - true, true, false, true, null, null, false, null, null, null}, - new object [] {"bigint", 0, 19, "bigint", null, - "System.Int64", true, true, false, true, true, false, - true, true, false, false, null, null, false, null, null, null}, - new object [] {"timestamp", 19, 8, "timestamp", null, - "System.Byte[]", false, false, false, true, false, false, - false, true, false, null, null, null, true, null, "0x", null}, - new object [] {"binary", 1, 8000, "binary({0})", "length", - "System.Byte[]", false, true, false, true, false, false, - true, true, false, null, null, null, false, null, "0x", null}, - new object [] {"image", 7, 2147483647, "image", null, - "System.Byte[]", false, true, false, false, false, true, - true, false, false, null, null, null, false, null, "0x", null}, - new object [] {"text", 18, 2147483647, "text", null, - "System.String", false, true, false, false, false, true, - true, false, true, null, null, null, false, null, "'", "'"}, - new object [] {"ntext", 11, 1073741823, "ntext", null, - "System.String", false, true, false, false, false, true, - true, false, true, null, null, null, false, null, "N'", "'"}, - new object [] {"decimal", 5, 38, "decimal({0}, {1})", - "precision,scale", "System.Decimal", true, true, false, - true, false, false, true, true, false, false, 38, 0, - false, null, null, null}, - new object [] {"numeric", 5, 38, "numeric({0}, {1})", - "precision,scale", "System.Decimal", true, true, false, - true, false, false, true, true, false, false, 38, 0, - false, null, null, null}, - new object [] {"datetime", 4, 23, "datetime", null, - "System.DateTime", false, true, false, true, false, false, - true, true, true, null, null, null, false, null, "{ts '", "'}"}, - new object [] {"smalldatetime", 15, 16, "smalldatetime", null, - "System.DateTime", false, true, false, true, false, false, - true, true, true, null, null, null, false, null, "{ts '", "'}"}, - new object [] {"sql_variant", 23, null, "sql_variant", - null, "System.Object", false, true, false, false, false, - false, true, true, false, null, null, null, false, false, - null, null}, - new object [] {"xml", 25, 2147483647, "xml", null, - "System.String", false, false, false, false, false, true, - true, false, false, null, null, null, false, false, null, null}, - new object [] {"varchar", 22, 2147483647, "varchar({0})", - "max length", "System.String", false, true, false, false, - false, false, true, true, true, null, null, null, false, - null, "'", "'"}, - new object [] {"char", 3, 2147483647, "char({0})", "length", - "System.String", false, true, false, true, false, false, - true, true, true, null, null, null, false, null, "'", "'"}, - new object [] {"nchar", 10, 1073741823, "nchar({0})", "length", - "System.String", false, true, false, true, false, false, - true, true, true, null, null, null, false, null, "N'", "'"}, - new object [] {"nvarchar", 12, 1073741823, "nvarchar({0})", "max length", - "System.String", false, true, false, false, false, false, true, true, - true, null, null, null, false, null, "N'", "'"}, - new object [] {"varbinary", 21, 1073741823, "varbinary({0})", - "max length", "System.Byte[]", false, true, false, false, - false, false, true, true, false, null, null, null, false, - null, "0x", null}, - new object [] {"uniqueidentifier", 14, 16, "uniqueidentifier", null, - "System.Guid", false, true, false, true, false, false, true, - true, false, null, null, null, false, null, "'", "'"}, - new object [] {"date", 31, 3L, "date", DBNull.Value, - "System.DateTime", false, false, false, true, true, false, - true, true, true, DBNull.Value, DBNull.Value, DBNull.Value, - false, DBNull.Value, "{ts '", "'}"}, - new object [] {"time", 32, 5L, "time({0})", "scale", - "System.TimeSpan", false, false, false, false, false, false, - true, true, true, DBNull.Value, (short) 7, (short) 0, - false, DBNull.Value, "{ts '", "'}"}, - new object [] {"datetime2", 33, 8L, "datetime2({0})", "scale", - "System.DateTime", false, true, false, false, false, false, - true, true, true, DBNull.Value, (short) 7, (short) 0, - false, DBNull.Value, "{ts '", "'}"}, - new object [] {"datetimeoffset", 34, 10L, "datetimeoffset({0})", - "scale", "System.DateTimeOffset", false, true, false, false, - false, false, true, true, true, DBNull.Value, (short) 7, (short) 0, - false, DBNull.Value, "{ts '", "'}"} - }; - - static DataTable instance; - static public DataTable Instance { - get { - if (instance == null) { - instance = new DataTable ("DataTypes"); - foreach (ColumnInfo c in columns) - instance.Columns.Add (c.name, c.type); - foreach (object [] row in rows) - instance.LoadDataRow (row, true); - } - return instance; - } - } - } - - static class Restrictions - { - static readonly ColumnInfo [] columns = { - new ColumnInfo ("CollectionName", typeof (string)), - new ColumnInfo ("RestrictionName", typeof(string)), - new ColumnInfo ("ParameterName", typeof(string)), - new ColumnInfo ("RestrictionDefault", typeof(string)), - new ColumnInfo ("RestrictionNumber", typeof(int)) - }; - - static readonly object [][] rows = { - new object [] {"Users", "User_Name", "@Name", "name", 1}, - new object [] {"Databases", "Name", "@Name", "Name", 1}, - - new object [] {"Tables", "Catalog", "@Catalog", "TABLE_CATALOG", 1}, - new object [] {"Tables", "Owner", "@Owner", "TABLE_SCHEMA", 2}, - new object [] {"Tables", "Table", "@Name", "TABLE_NAME", 3}, - new object [] {"Tables", "TableType", "@TableType", "TABLE_TYPE", 4}, - - new object [] {"Columns", "Catalog", "@Catalog", "TABLE_CATALOG", 1}, - new object [] {"Columns", "Owner", "@Owner", "TABLE_SCHEMA", 2}, - new object [] {"Columns", "Table", "@Table", "TABLE_NAME", 3}, - new object [] {"Columns", "Column", "@Column", "COLUMN_NAME", 4}, - - new object [] {"StructuredTypeMembers", "Catalog", "@Catalog", "TYPE_CATALOG", 1}, - new object [] {"StructuredTypeMembers", "Owner", "@Owner", "TYPE_SCHEMA", 2}, - new object [] {"StructuredTypeMembers", "Type", "@Type", "TYPE_NAME", 3}, - new object [] {"StructuredTypeMembers", "Member", "@Member", "MEMBER_NAME", 4}, - - new object [] {"Views", "Catalog", "@Catalog", "TABLE_CATALOG", 1}, - new object [] {"Views", "Owner", "@Owner", "TABLE_SCHEMA", 2}, - new object [] {"Views", "Table", "@Table", "TABLE_NAME", 3}, - - new object [] {"ViewColumns", "Catalog", "@Catalog", "VIEW_CATALOG", 1}, - new object [] {"ViewColumns", "Owner", "@Owner", "VIEW_SCHEMA", 2}, - new object [] {"ViewColumns", "Table", "@Table", "VIEW_NAME", 3}, - new object [] {"ViewColumns", "Column", "@Column", "COLUMN_NAME", 4}, - - new object [] {"ProcedureParameters", "Catalog", "@Catalog", "SPECIFIC_CATALOG", 1}, - new object [] {"ProcedureParameters", "Owner", "@Owner", "SPECIFIC_SCHEMA", 2}, - new object [] {"ProcedureParameters", "Name", "@Name", "SPECIFIC_NAME", 3}, - new object [] {"ProcedureParameters", "Parameter", "@Parameter", "PARAMETER_NAME", 4}, - - new object [] {"Procedures", "Catalog", "@Catalog", "SPECIFIC_CATALOG", 1}, - new object [] {"Procedures", "Owner", "@Owner", "SPECIFIC_SCHEMA", 2}, - new object [] {"Procedures", "Name", "@Name", "SPECIFIC_NAME", 3}, - new object [] {"Procedures", "Type", "@Type", "ROUTINE_TYPE", 4}, - - new object [] {"IndexColumns", "Catalog", "@Catalog", "db_name()", 1}, - new object [] {"IndexColumns", "Owner", "@Owner", "user_name()", 2}, - new object [] {"IndexColumns", "Table", "@Table", "o.name", 3}, - new object [] {"IndexColumns", "ConstraintName", "@ConstraintName", "x.name", 4}, - new object [] {"IndexColumns", "Column", "@Column", "c.name", 5}, - - new object [] {"Indexes", "Catalog", "@Catalog", "db_name()", 1}, - new object [] {"Indexes", "Owner", "@Owner", "user_name()", 2}, - new object [] {"Indexes", "Table", "@Table", "o.name", 3}, - new object [] {"Indexes", "Name", "@Name", "x.name", 4}, - - new object [] {"UserDefinedTypes", "assembly_name", "@AssemblyName", "assemblies.name", 1}, - new object [] {"UserDefinedTypes", "udt_name", "@UDTName", "types.assembly_class", 2}, - - new object [] {"ForeignKeys", "Catalog", "@Catalog", "CONSTRAINT_CATALOG", 1}, - new object [] {"ForeignKeys", "Owner", "@Owner", "CONSTRAINT_SCHEMA", 2}, - new object [] {"ForeignKeys", "Table", "@Table", "TABLE_NAME", 3}, - new object [] {"ForeignKeys", "Name", "@Name", "CONSTRAINT_NAME", 4} - }; - - static DataTable instance; - static public DataTable Instance { - get { - if (instance == null) { - instance = new DataTable ("Restrictions"); - foreach (ColumnInfo c in columns) - instance.Columns.Add (c.name, c.type); - foreach (object [] row in rows) - instance.LoadDataRow (row, true); - } - return instance; - } - } - } - - public override DataTable GetSchema () - { - if (state == ConnectionState.Closed) - throw ExceptionHelper.ConnectionClosed (); - - return MetaDataCollections.Instance; - } - - public override DataTable GetSchema (String collectionName) - { - return GetSchema (collectionName, null); - } - - public override DataTable GetSchema (String collectionName, string [] restrictionValues) - { - // LAMESPEC: In MS.NET, if collectionName is null, it throws ArgumentException. - - if (state == ConnectionState.Closed) - throw ExceptionHelper.ConnectionClosed (); - - String cName = null; - DataTable schemaTable = MetaDataCollections.Instance; - int length = restrictionValues == null ? 0 : restrictionValues.Length; - - foreach (DataRow row in schemaTable.Rows) { - if (String.Compare ((string) row["CollectionName"], collectionName, true) == 0) { - if (length > (int) row["NumberOfRestrictions"]) { - throw new ArgumentException ("More restrictions were provided " + - "than the requested schema ('" + - row["CollectionName"].ToString () + "') supports"); - } - cName = row["CollectionName"].ToString(); - } - } - - if (cName == null) - throw new ArgumentException (string.Format (CultureInfo.InvariantCulture, - "The requested collection ({0}) is not defined.", - collectionName)); - - SqlCommand command = null; - DataTable dataTable = new DataTable (); - SqlDataAdapter dataAdapter = new SqlDataAdapter (); - - switch (cName) - { - case "Databases": - command = new SqlCommand ("select name as database_name, dbid, crdate as create_date " + - "from master.sys.sysdatabases where (name = @Name or (@Name " + - "is null))", this); - command.Parameters.Add ("@Name", SqlDbType.NVarChar, 4000); - break; - case "ForeignKeys": - command = new SqlCommand ("select CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_NAME, " + - "TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, CONSTRAINT_TYPE, " + - "IS_DEFERRABLE, INITIALLY_DEFERRED from " + - "INFORMATION_SCHEMA.TABLE_CONSTRAINTS where (CONSTRAINT_CATALOG" + - " = @Catalog or (@Catalog is null)) and (CONSTRAINT_SCHEMA = " + - "@Owner or (@Owner is null)) and (TABLE_NAME = @Table or (" + - "@Table is null)) and (CONSTRAINT_NAME = @Name or (@Name is null))" + - " and CONSTRAINT_TYPE = 'FOREIGN KEY' order by CONSTRAINT_CATALOG," + - " CONSTRAINT_SCHEMA, CONSTRAINT_NAME", this); - command.Parameters.Add ("@Catalog", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@Owner", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@Table", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@Name", SqlDbType.NVarChar, 4000); - break; - case "Indexes": - command = new SqlCommand ("select distinct db_name() as constraint_catalog, " + - "constraint_schema = user_name (o.uid), " + - "constraint_name = x.name, table_catalog = db_name (), " + - "table_schema = user_name (o.uid), table_name = o.name, " + - "index_name = x.name from sysobjects o, sysindexes x, " + - "sysindexkeys xk where o.type in ('U') and x.id = o.id and " + - "o.id = xk.id and x.indid = xk.indid and xk.keyno = x.keycnt " + - "and (db_name() = @Catalog or (@Catalog is null)) and " + - "(user_name() = @Owner or (@Owner is null)) and (o.name = " + - "@Table or (@Table is null)) and (x.name = @Name or (@Name is null))" + - "order by table_name, index_name", this); - command.Parameters.Add ("@Catalog", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@Owner", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@Table", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@Name", SqlDbType.NVarChar, 4000); - break; - case "IndexColumns": - command = new SqlCommand ("select distinct db_name() as constraint_catalog, " + - "constraint_schema = user_name (o.uid), constraint_name = x.name, " + - "table_catalog = db_name (), table_schema = user_name (o.uid), " + - "table_name = o.name, column_name = c.name, " + - "ordinal_position = convert (int, xk.keyno), keyType = c.xtype, " + - "index_name = x.name from sysobjects o, sysindexes x, syscolumns c, " + - "sysindexkeys xk where o.type in ('U') and x.id = o.id and o.id = c.id " + - "and o.id = xk.id and x.indid = xk.indid and c.colid = xk.colid " + - "and xk.keyno <= x.keycnt and permissions (o.id, c.name) <> 0 " + - "and (db_name() = @Catalog or (@Catalog is null)) and (user_name() " + - "= @Owner or (@Owner is null)) and (o.name = @Table or (@Table is" + - " null)) and (x.name = @ConstraintName or (@ConstraintName is null)) " + - "and (c.name = @Column or (@Column is null)) order by table_name, " + - "index_name", this); - command.Parameters.Add ("@Catalog", SqlDbType.NVarChar, 8); - command.Parameters.Add ("@Owner", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@Table", SqlDbType.NVarChar, 13); - command.Parameters.Add ("@ConstraintName", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@Column", SqlDbType.NVarChar, 4000); - break; - case "Procedures": - command = new SqlCommand ("select SPECIFIC_CATALOG, SPECIFIC_SCHEMA, SPECIFIC_NAME, " + - "ROUTINE_CATALOG, ROUTINE_SCHEMA, ROUTINE_NAME, ROUTINE_TYPE, " + - "CREATED, LAST_ALTERED from INFORMATION_SCHEMA.ROUTINES where " + - "(SPECIFIC_CATALOG = @Catalog or (@Catalog is null)) and " + - "(SPECIFIC_SCHEMA = @Owner or (@Owner is null)) and (SPECIFIC_NAME" + - " = @Name or (@Name is null)) and (ROUTINE_TYPE = @Type or (@Type " + - "is null)) order by SPECIFIC_CATALOG, SPECIFIC_SCHEMA, SPECIFIC_NAME", this); - command.Parameters.Add ("@Catalog", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@Owner", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@Name", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@Type", SqlDbType.NVarChar, 4000); - break; - case "ProcedureParameters": - command = new SqlCommand ("select SPECIFIC_CATALOG, SPECIFIC_SCHEMA, SPECIFIC_NAME, " + - "ORDINAL_POSITION, PARAMETER_MODE, IS_RESULT, AS_LOCATOR, " + - "PARAMETER_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, " + - "CHARACTER_OCTET_LENGTH, COLLATION_CATALOG, COLLATION_SCHEMA, " + - "COLLATION_NAME, CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, " + - "CHARACTER_SET_NAME, NUMERIC_PRECISION, NUMERIC_PRECISION_RADIX, " + - "NUMERIC_SCALE, DATETIME_PRECISION, INTERVAL_TYPE, " + - "INTERVAL_PRECISION from INFORMATION_SCHEMA.PARAMETERS where " + - "(SPECIFIC_CATALOG = @Catalog or (@Catalog is null)) and " + - "(SPECIFIC_SCHEMA = @Owner or (@Owner is null)) and (SPECIFIC_NAME = " + - "@Name or (@Name is null)) and (PARAMETER_NAME = @Parameter or (" + - "@Parameter is null)) order by SPECIFIC_CATALOG, SPECIFIC_SCHEMA," + - " SPECIFIC_NAME, PARAMETER_NAME", this); - command.Parameters.Add ("@Catalog", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@Owner", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@Name", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@Parameter", SqlDbType.NVarChar, 4000); - break; - case "Tables": - command = new SqlCommand ("select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE " + - "from INFORMATION_SCHEMA.TABLES where" + - " (TABLE_CATALOG = @catalog or (@catalog is null)) and " + - "(TABLE_SCHEMA = @owner or (@owner is null))and " + - "(TABLE_NAME = @name or (@name is null)) and " + - "(TABLE_TYPE = @table_type or (@table_type is null))", this); - command.Parameters.Add ("@catalog", SqlDbType.NVarChar, 8); - command.Parameters.Add ("@owner", SqlDbType.NVarChar, 3); - command.Parameters.Add ("@name", SqlDbType.NVarChar, 11); - command.Parameters.Add ("@table_type", SqlDbType.NVarChar, 10); - break; - case "Columns": - command = new SqlCommand ("select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, " + - "ORDINAL_POSITION, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, " + - "CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH, " + - "NUMERIC_PRECISION, NUMERIC_PRECISION_RADIX, NUMERIC_SCALE, " + - "DATETIME_PRECISION, CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, " + - "CHARACTER_SET_NAME, COLLATION_CATALOG from INFORMATION_SCHEMA.COLUMNS" + - " where (TABLE_CATALOG = @Catalog or (@Catalog is null)) and (" + - "TABLE_SCHEMA = @Owner or (@Owner is null)) and (TABLE_NAME = @table" + - " or (@Table is null)) and (COLUMN_NAME = @column or (@Column is null" + - ")) order by TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME", this); - command.Parameters.Add ("@Catalog", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@Owner", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@Table", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@Column", SqlDbType.NVarChar, 4000); - break; - case "Users": - command = new SqlCommand ("select uid, name as user_name, createdate, updatedate from sysusers" + - " where (name = @Name or (@Name is null))", this); - command.Parameters.Add ("@Name", SqlDbType.NVarChar, 4000); - break; - case "StructuredTypeMembers": - // Only available on SQL Server 2008 - // Running it again SQL 2005 results in the following exception: - // Unable to build the 'StructuredTypeMembers' collection because - // execution of the SQL query failed. See the inner exception for details. - // ---> System.Data.SqlClient.SqlException: Invalid object name 'sys.table_types'. - // - // I don't have access to SQL Server 2008 right now, - // and can't find any online documentation on the 'sys.table_types' - // view - throw new NotImplementedException (); - case "Views": - command = new SqlCommand ("select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, CHECK_OPTION, " + - "IS_UPDATABLE from INFORMATION_SCHEMA.VIEWS where (TABLE_CATALOG" + - " = @Catalog or (@Catalog is null)) TABLE_SCHEMA = @Owner or " + - "(@Owner is null)) and (TABLE_NAME = @table or (@Table is null))" + - " order by TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME", this); - command.Parameters.Add ("@Catalog", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@Owner", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@Table", SqlDbType.NVarChar, 4000); - break; - case "ViewColumns": - command = new SqlCommand ("select VIEW_CATALOG, VIEW_SCHEMA, VIEW_NAME, TABLE_CATALOG, " + - "TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME from " + - "INFORMATION_SCHEMA.VIEW_COLUMN_USAGE where (VIEW_CATALOG = " + - "@Catalog (@Catalog is null)) and (VIEW_SCHEMA = @Owner (@Owner" + - " is null)) and (VIEW_NAME = @Table or (@Table is null)) and " + - "(COLUMN_NAME = @Column or (@Column is null)) order by " + - "VIEW_CATALOG, VIEW_SCHEMA, VIEW_NAME", this); - command.Parameters.Add ("@Catalog", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@Owner", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@Table", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@Column", SqlDbType.NVarChar, 4000); - break; - case "UserDefinedTypes": - command = new SqlCommand ("select assemblies.name as assembly_name, types.assembly_class " + - "as udt_name, ASSEMBLYPROPERTY(assemblies.name, 'VersionMajor') " + - "as version_major, ASSEMBLYPROPERTY(assemblies.name, 'VersionMinor') " + - "as version_minor, ASSEMBLYPROPERTY(assemblies.name, 'VersionBuild') " + - "as version_build, ASSEMBLYPROPERTY(assemblies.name, 'VersionRevision') " + - "as version_revision, ASSEMBLYPROPERTY(assemblies.name, 'CultureInfo') " + - "as culture_info, ASSEMBLYPROPERTY(assemblies.name, 'PublicKey') " + - "as public_key, is_fixed_length, max_length, Create_Date, " + - "Permission_set_desc from sys.assemblies as assemblies join " + - "sys.assembly_types as types on assemblies.assembly_id = types.assembly_id" + - " where (assportemblies.name = @AssemblyName or (@AssemblyName is null)) and " + - "(types.assembly_class = @UDTName or (@UDTName is null))", - this); - command.Parameters.Add ("@AssemblyName", SqlDbType.NVarChar, 4000); - command.Parameters.Add ("@UDTName", SqlDbType.NVarChar, 4000); - break; - case "MetaDataCollections": - return MetaDataCollections.Instance; - case "DataSourceInformation": - return DataSourceInformation.GetInstance (this); - case "DataTypes": - return DataTypes.Instance; - case "ReservedWords": - return ReservedWords.Instance; - case "Restrictions": - return Restrictions.Instance; - } - for (int i = 0; i < length; i++) { - command.Parameters[i].Value = restrictionValues[i]; - } - dataAdapter.SelectCommand = command; - dataAdapter.Fill (dataTable); - return dataTable; - } - - public static void ChangePassword (string connectionString, string newPassword) - { - if (String.IsNullOrEmpty (connectionString)) - throw new ArgumentNullException ("The 'connectionString' cannot be null or empty."); - if (String.IsNullOrEmpty (newPassword)) - throw new ArgumentNullException ("The 'newPassword' cannot be null or empty."); - if (newPassword.Length > 128) - throw new ArgumentException ("The length of 'newPassword' cannot exceed 128 characters."); - using (SqlConnection conn = new SqlConnection (connectionString)) { - conn.Open (); - conn.tds.Execute (String.Format ("sp_password '{0}', '{1}', '{2}'", - conn.parms.Password, newPassword, conn.parms.User)); - } - } - - public static void ClearAllPools () - { - // FIXME: locking - IDictionary pools = SqlConnection.sqlConnectionPools.GetConnectionPool (); - foreach (TdsConnectionPool pool in pools.Values) { - if (pool != null) - pool.ResetConnectionPool (); - } - pools.Clear (); - } - - public static void ClearPool (SqlConnection connection) - { - if (connection == null) - throw new ArgumentNullException ("connection"); - - // FIXME: locking - if (connection.pooling) { - TdsConnectionPool pool = sqlConnectionPools.GetConnectionPool (connection.ConnectionString); - if (pool != null) - pool.ResetConnectionPool (); - } - } - - [MonoTODO] - public void ResetStatistics () - { - throw new NotImplementedException (); - } - - [MonoTODO] - public IDictionary RetrieveStatistics () - { - throw new NotImplementedException (); - } - - #endregion // Methods - - #region Fields Net 2 - - bool async; - bool userInstance; - - #endregion // Fields Net 2 - - #region Properties Net 2 - - [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] - internal bool AsyncProcessing { - get { return async; } - } - - #endregion // Properties Net 2 - - - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.platformnotsupported.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.platformnotsupported.cs deleted file mode 100644 index bb350264499..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.platformnotsupported.cs +++ /dev/null @@ -1,214 +0,0 @@ -// -// SqlConnection.cs -// -// Author: -// Rolf Bjarne Kvinge <rolf@xamarin.com> -// -// Copyright (c) 2016 Xamarin, Inc. -// -// 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.Collections; -using System.Data.Common; - -namespace System.Data.SqlClient -{ - public sealed class SqlConnection : DbConnection, IDbConnection, ICloneable - { - const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlConnection is not supported on the current platform."; - - public SqlConnection () : this (null) - { - } - - public SqlConnection (string connectionString) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlConnection (string connectionString, SqlCredential cred) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override string ConnectionString { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public SqlCredential Credentials { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public Guid ClientConnectionId { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override int ConnectionTimeout { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override string Database { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override string DataSource { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public int PacketSize { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override string ServerVersion { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override ConnectionState State { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public string WorkstationId { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public bool FireInfoMessageEventOnUserErrors { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public bool StatisticsEnabled { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - protected override DbProviderFactory DbProviderFactory { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public event SqlInfoMessageEventHandler InfoMessage; - - public new SqlTransaction BeginTransaction () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public new SqlTransaction BeginTransaction (IsolationLevel iso) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlTransaction BeginTransaction (string transactionName) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlTransaction BeginTransaction (IsolationLevel iso, string transactionName) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override void ChangeDatabase (string database) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override void Close () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public new SqlCommand CreateCommand () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - protected override void Dispose (bool disposing) - { - } - -#if !MOBILE - public void EnlistDistributedTransaction (ITransaction transaction) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } -#endif - - object ICloneable.Clone () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - protected override DbTransaction BeginDbTransaction (IsolationLevel isolationLevel) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - protected override DbCommand CreateDbCommand () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override void Open () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override DataTable GetSchema () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override DataTable GetSchema (String collectionName) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override DataTable GetSchema (String collectionName, string [] restrictionValues) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public static void ChangePassword (string connectionString, string newPassword) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public static void ClearAllPools () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public static void ClearPool (SqlConnection connection) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public void ResetStatistics () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public IDictionary RetrieveStatistics () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlConnectionFactory.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlConnectionFactory.cs deleted file mode 100644 index 14e0a3be084..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlConnectionFactory.cs +++ /dev/null @@ -1,140 +0,0 @@ -// -// System.Data.SqlClient.SqlConnectionFactory -// -// Author: -// Sureshkumar T <tsureshkumar@novell.com> -// -// -// Copyright (C) 2005 Novell, Inc (http://www.novell.com) -// -// 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.Data; -using System.Data.Common; - -namespace System.Data.SqlClient { - internal class SqlConnectionFactory : DbConnectionFactory - { - #region Fields - internal static SqlConnectionFactory Instance; // singleton - private static DbProviderFactory _providerFactory; - static readonly object lockobj = new object (); - #endregion // Fields - - #region Constructors - - private SqlConnectionFactory (DbProviderFactory pvdrfactory) - { - _providerFactory = pvdrfactory; - } - - #endregion // Constructors - - #region Properties - - public override DbProviderFactory ProviderFactory { get { return _providerFactory; }} - - #endregion // Properties - - #region Methods - - // create singleton connection factory. - internal static DbConnectionFactory GetSingleton (DbProviderFactory pvdrFactory) - { - lock (lockobj) { - if (Instance == null) - Instance = new SqlConnectionFactory (pvdrFactory); - return Instance; - } - } - - - [MonoTODO] - protected override IAsyncResult BeginCreateConnection (DbConnectionBase owningObject, DbConnectionString connectionOptions, DbConnectionInternal connection, AsyncCallback callback, object asyncStateObject) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public new void ClearAllPools () - { - throw new NotImplementedException (); - } - - [MonoTODO] - public new void ClearPool (DbConnectionBase connection) - { - throw new NotImplementedException (); - } - - [MonoTODO] - protected override DbConnectionInternal CreateConnection (DbConnectionString options, DbConnectionBase owningObject) - { - throw new NotImplementedException (); - } - - [MonoTODO] - protected override DbConnectionString CreateConnectionOptions (string connectionString) - { - throw new NotImplementedException (); - } - - [MonoTODO] - protected override DbConnectionPoolOptions CreateConnectionPoolOptions (DbConnectionString options) - { - throw new NotImplementedException (); - } - - - [MonoTODO] - protected override DbMetaDataFactory CreateMetaDataFactory (DbConnectionInternal internalConnection) - { - throw new NotImplementedException (); - } - - [MonoTODO] - protected override DbConnectionInternal EndCreateConnection (IAsyncResult asyncResult) - { - throw new NotImplementedException (); - } - - [MonoTODO] - protected internal new DbMetaDataFactory GetMetaDataFactory (DbConnectionString connectionOptions, DbConnectionInternal internalConnection) - { - throw new NotImplementedException (); - } - - internal new DbConnectionString CreateConnectionOptionsInternal (string connectionString) - { - return CreateConnectionOptions (connectionString); - } - - [MonoTODO] - public new void SetConnectionPoolOptions (string connectionString, DbConnectionPoolOptions poolOptions) - { - throw new NotImplementedException (); - } - - #endregion // Methods - } -} - diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlDataAdapter.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlDataAdapter.cs deleted file mode 100644 index 41564093e5c..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlDataAdapter.cs +++ /dev/null @@ -1,498 +0,0 @@ -// -// System.Data.SqlClient.SqlDataAdapter.cs -// -// Author: -// Rodrigo Moya (rodrigo@ximian.com) -// Daniel Morgan (danmorg@sc.rr.com) -// Tim Coleman (tim@timcoleman.com) -// Veerapuram Varadhan (vvaradhan@novell.com) -// -// (C) Ximian, Inc 2002 -// Copyright (C) 2002 Tim Coleman -// -// Copyright (C) 2004, 2009 Novell, Inc (http://www.novell.com) -// -// 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.ComponentModel; -using System.Data; -using System.Data.Common; - -namespace System.Data.SqlClient { - [DefaultEvent ("RowUpdated")] - [DesignerAttribute ("Microsoft.VSDesigner.Data.VS.SqlDataAdapterDesigner, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.ComponentModel.Design.IDesigner")] - [ToolboxItemAttribute ("Microsoft.VSDesigner.Data.VS.SqlDataAdapterToolboxItem, "+ Consts.AssemblyMicrosoft_VSDesigner)] - - public sealed class SqlDataAdapter : DbDataAdapter, IDbDataAdapter, IDataAdapter, ICloneable - { - -#region Copy from old DataColumn - internal static bool CanAutoIncrement (Type type) - { - switch (Type.GetTypeCode (type)) { - case TypeCode.Int16: - case TypeCode.Int32: - case TypeCode.Int64: - case TypeCode.Decimal: - return true; - } - - return false; - } -#endregion - -#region Copy from old DataAdapter - - private const string DefaultSourceColumnName = "Column"; - - internal FillErrorEventArgs CreateFillErrorEvent (DataTable dataTable, object[] values, Exception e) - { - FillErrorEventArgs args = new FillErrorEventArgs (dataTable, values); - args.Errors = e; - args.Continue = false; - return args; - } - - internal void OnFillErrorInternal (FillErrorEventArgs value) - { - OnFillError (value); - } - - // this method builds the schema for a given datatable. it returns a int array with - // "array[ordinal of datatable column] == index of source column in data reader". - // each column in the datatable has a mapping to a specific column in the datareader, - // the int array represents this match. - internal int[] BuildSchema (IDataReader reader, DataTable table, SchemaType schemaType) - { - return BuildSchema (reader, table, schemaType, MissingSchemaAction, - MissingMappingAction, TableMappings); - } - - /// <summary> - /// Creates or Modifies the schema of the given DataTable based on the schema of - /// the reader and the arguments passed. - /// </summary> - internal static int[] BuildSchema (IDataReader reader, DataTable table, - SchemaType schemaType, - MissingSchemaAction missingSchAction, - MissingMappingAction missingMapAction, - DataTableMappingCollection dtMapping - ) - { - int readerIndex = 0; - // FIXME : this fails if query has fewer columns than a table - int[] mapping = new int[table.Columns.Count]; // mapping the reader indexes to the datatable indexes - - for(int i=0; i < mapping.Length; i++) { - mapping[i] = -1; - } - - ArrayList primaryKey = new ArrayList (); - ArrayList sourceColumns = new ArrayList (); - bool createPrimaryKey = true; - - DataTable schemaTable = reader.GetSchemaTable (); - - DataColumn ColumnNameCol = schemaTable.Columns["ColumnName"]; - DataColumn DataTypeCol = schemaTable.Columns["DataType"]; - DataColumn IsAutoIncrementCol = schemaTable.Columns["IsAutoIncrement"]; - DataColumn AllowDBNullCol = schemaTable.Columns["AllowDBNull"]; - DataColumn IsReadOnlyCol = schemaTable.Columns["IsReadOnly"]; - DataColumn IsKeyCol = schemaTable.Columns["IsKey"]; - DataColumn IsUniqueCol = schemaTable.Columns["IsUnique"]; - DataColumn ColumnSizeCol = schemaTable.Columns["ColumnSize"]; - - foreach (DataRow schemaRow in schemaTable.Rows) { - // generate a unique column name in the source table. - string sourceColumnName; - string realSourceColumnName ; - if (ColumnNameCol == null || schemaRow.IsNull(ColumnNameCol) || - (string)schemaRow [ColumnNameCol] == String.Empty) { - sourceColumnName = DefaultSourceColumnName; - realSourceColumnName = DefaultSourceColumnName + "1"; - } else { - sourceColumnName = (string) schemaRow [ColumnNameCol]; - realSourceColumnName = sourceColumnName; - } - - for (int i = 1; sourceColumns.Contains (realSourceColumnName); i += 1) - realSourceColumnName = String.Format ("{0}{1}", sourceColumnName, i); - sourceColumns.Add(realSourceColumnName); - - // generate DataSetColumnName from DataTableMapping, if any - DataTableMapping tableMapping = null; - - //FIXME : The sourcetable name shud get passed as a parameter.. - int index = dtMapping.IndexOfDataSetTable (table.TableName); - string srcTable = (index != -1 ? dtMapping[index].SourceTable : table.TableName); - tableMapping = DataTableMappingCollection.GetTableMappingBySchemaAction (dtMapping, ADP.IsEmpty (srcTable) ? " " : srcTable, table.TableName, missingMapAction); - if (tableMapping != null) { - table.TableName = tableMapping.DataSetTable; - // check to see if the column mapping exists - DataColumnMapping columnMapping = DataColumnMappingCollection.GetColumnMappingBySchemaAction(tableMapping.ColumnMappings, realSourceColumnName, missingMapAction); - if (columnMapping != null) { - Type columnType = schemaRow[DataTypeCol] as Type; - DataColumn col = columnType != null ? columnMapping.GetDataColumnBySchemaAction( - table , - columnType, - missingSchAction) : null; - - if (col != null) { - // if the column is not in the table - add it. - if (table.Columns.IndexOf(col) == -1) { - if (missingSchAction == MissingSchemaAction.Add - || missingSchAction == MissingSchemaAction.AddWithKey) - table.Columns.Add(col); - - int[] tmp = new int[mapping.Length + 1]; - Array.Copy(mapping,0,tmp,0,col.Ordinal); - Array.Copy(mapping,col.Ordinal,tmp,col.Ordinal + 1,mapping.Length - col.Ordinal); - mapping = tmp; - } - - if (missingSchAction == MissingSchemaAction.AddWithKey) { - object value = (AllowDBNullCol != null) ? schemaRow[AllowDBNullCol] : null; - bool allowDBNull = value is bool ? (bool)value : true; - - value = (IsKeyCol != null) ? schemaRow[IsKeyCol] : null; - bool isKey = value is bool ? (bool)value : false; - - value = (IsAutoIncrementCol != null) ? schemaRow[IsAutoIncrementCol] : null; - bool isAutoIncrement = value is bool ? (bool)value : false; - - value = (IsReadOnlyCol != null) ? schemaRow[IsReadOnlyCol] : null; - bool isReadOnly = value is bool ? (bool)value : false; - - value = (IsUniqueCol != null) ? schemaRow[IsUniqueCol] : null; - bool isUnique = value is bool ? (bool)value : false; - - col.AllowDBNull = allowDBNull; - // fill woth key info - if (isAutoIncrement && CanAutoIncrement(columnType)) { - col.AutoIncrement = true; - if (!allowDBNull) - col.AllowDBNull = false; - } - - if (columnType == DbTypes.TypeOfString) { - col.MaxLength = (ColumnSizeCol != null) ? (int)schemaRow[ColumnSizeCol] : 0; - } - - if (isReadOnly) - col.ReadOnly = true; - - if (!allowDBNull && (!isReadOnly || isKey)) - col.AllowDBNull = false; - if (isUnique && !isKey && !columnType.IsArray) { - col.Unique = true; - if (!allowDBNull) - col.AllowDBNull = false; - } - - // This might not be set by all DataProviders - bool isHidden = false; - if (schemaTable.Columns.Contains ("IsHidden")) { - value = schemaRow["IsHidden"]; - isHidden = ((value is bool) ? (bool)value : false); - } - - if (isKey && !isHidden) { - primaryKey.Add (col); - if (allowDBNull) - createPrimaryKey = false; - } - } - // add the ordinal of the column as a key and the index of the column in the datareader as a value. - mapping[col.Ordinal] = readerIndex++; - } - } - } - } - if (primaryKey.Count > 0) { - DataColumn[] colKey = (DataColumn[])(primaryKey.ToArray(typeof (DataColumn))); - if (createPrimaryKey) - table.PrimaryKey = colKey; - else { - UniqueConstraint uConstraint = new UniqueConstraint(colKey); - for (int i = 0; i < table.Constraints.Count; i++) { - if (table.Constraints[i].Equals(uConstraint)) { - uConstraint = null; - break; - } - } - - if (uConstraint != null) - table.Constraints.Add(uConstraint); - } - } - return mapping; - } - - internal int FillInternal (DataTable dataTable, IDataReader dataReader) - { - if (dataReader.FieldCount == 0) { - dataReader.Close (); - return 0; - } - - int count = 0; - - try { - string tableName = SetupSchema (SchemaType.Mapped, dataTable.TableName); - if (tableName != null) { - dataTable.TableName = tableName; - FillTable (dataTable, dataReader, 0, 0, ref count); - } - } finally { - dataReader.Close (); - } - - return count; - } - - internal bool FillTable (DataTable dataTable, IDataReader dataReader, int startRecord, int maxRecords, ref int counter) - { - if (dataReader.FieldCount == 0) - return false; - - int counterStart = counter; - - int[] mapping = BuildSchema (dataReader, dataTable, SchemaType.Mapped); - - int [] sortedMapping = new int [mapping.Length]; - int length = sortedMapping.Length; - for (int i = 0; i < sortedMapping.Length; i++) { - if (mapping [i] >= 0) - sortedMapping [mapping [i]] = i; - else - sortedMapping [--length] = i; - } - - for (int i = 0; i < startRecord; i++) { - dataReader.Read (); - } - - dataTable.BeginLoadData (); - object [] values = new object [length]; - while (dataReader.Read () && (maxRecords == 0 || (counter - counterStart) < maxRecords)) { - try { - for (int iColumn = 0; iColumn < values.Length; iColumn++) - values [iColumn] = dataReader [iColumn]; - dataTable.LoadDataRow (values, AcceptChangesDuringFill); - counter++; - } - catch (Exception e) { - object[] readerArray = new object [dataReader.FieldCount]; - object[] tableArray = new object [mapping.Length]; - // we get the values from the datareader - dataReader.GetValues (readerArray); - // copy from datareader columns to table columns according to given mapping - for (int i = 0; i < mapping.Length; i++) { - if (mapping [i] >= 0) { - tableArray [i] = readerArray [mapping [i]]; - } - } - FillErrorEventArgs args = CreateFillErrorEvent (dataTable, tableArray, e); - OnFillErrorInternal (args); - - // if args.Continue is not set to true or if a handler is not set, rethrow the error.. - if(!args.Continue) - throw e; - } - } - dataTable.EndLoadData (); - return true; - } - - internal string SetupSchema (SchemaType schemaType, string sourceTableName) - { - DataTableMapping tableMapping = null; - - if (schemaType == SchemaType.Mapped) { - tableMapping = DataTableMappingCollection.GetTableMappingBySchemaAction (TableMappings, sourceTableName, sourceTableName, MissingMappingAction); - if (tableMapping != null) - return tableMapping.DataSetTable; - return null; - } else - return sourceTableName; - } -#endregion - - #region Fields - - int updateBatchSize; - #endregion - - #region Constructors - - public SqlDataAdapter () : this ((SqlCommand) null) - { - } - - public SqlDataAdapter (SqlCommand selectCommand) - { - SelectCommand = selectCommand; - UpdateBatchSize = 1; - } - - public SqlDataAdapter (string selectCommandText, SqlConnection selectConnection) - : this (new SqlCommand (selectCommandText, selectConnection)) - { - } - - public SqlDataAdapter (string selectCommandText, string selectConnectionString) - : this (selectCommandText, new SqlConnection (selectConnectionString)) - { - } - - #endregion - - #region Properties - - [DefaultValue (null)] - [EditorAttribute ("Microsoft.VSDesigner.Data.Design.DBCommandEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )] - public new SqlCommand DeleteCommand { get; set; } - - [DefaultValue (null)] - [EditorAttribute ("Microsoft.VSDesigner.Data.Design.DBCommandEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )] - public new SqlCommand InsertCommand { get; set; } - - [DefaultValue (null)] - [EditorAttribute ("Microsoft.VSDesigner.Data.Design.DBCommandEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )] - public new SqlCommand SelectCommand { get; set; } - - [DefaultValue (null)] - [EditorAttribute ("Microsoft.VSDesigner.Data.Design.DBCommandEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )] - public new SqlCommand UpdateCommand { get; set; } - - IDbCommand IDbDataAdapter.SelectCommand { - get { return SelectCommand; } - set { SelectCommand = (SqlCommand) value; } - } - - IDbCommand IDbDataAdapter.InsertCommand { - get { return InsertCommand; } - set { InsertCommand = (SqlCommand) value; } - } - - IDbCommand IDbDataAdapter.UpdateCommand { - get { return UpdateCommand; } - set { UpdateCommand = (SqlCommand) value; } - } - IDbCommand IDbDataAdapter.DeleteCommand { - get { return DeleteCommand; } - set { DeleteCommand = (SqlCommand) value; } - } - - public override int UpdateBatchSize { - get { return updateBatchSize; } - set { - if (value < 0) - throw new ArgumentOutOfRangeException ("UpdateBatchSize"); - updateBatchSize = value; - } - } - - #endregion // Properties - - #region Methods - - protected override RowUpdatedEventArgs CreateRowUpdatedEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) - { - return new SqlRowUpdatedEventArgs (dataRow, command, statementType, tableMapping); - } - - - protected override RowUpdatingEventArgs CreateRowUpdatingEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) - { - return new SqlRowUpdatingEventArgs (dataRow, command, statementType, tableMapping); - } - - - protected override void OnRowUpdated (RowUpdatedEventArgs value) - { - if (RowUpdated != null) - RowUpdated (this, (SqlRowUpdatedEventArgs) value); - } - - protected override void OnRowUpdating (RowUpdatingEventArgs value) - { - if (RowUpdating != null) - RowUpdating (this, (SqlRowUpdatingEventArgs) value); - } - - [MonoTODO] - object ICloneable.Clone() - { - throw new NotImplementedException (); - } - - // All the batch methods, should be implemented, if supported, - // by individual providers - - [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 (); - } - #endregion // Methods - - #region Events and Delegates - - public event SqlRowUpdatedEventHandler RowUpdated; - - public event SqlRowUpdatingEventHandler RowUpdating; - - #endregion // Events and Delegates - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs deleted file mode 100644 index 9cb4b8a6eea..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs +++ /dev/null @@ -1,1452 +0,0 @@ -// -// System.Data.SqlClient.SqlDataReader.cs -// -// Author: -// Rodrigo Moya (rodrigo@ximian.com) -// Daniel Morgan (danmorg@sc.rr.com) -// Tim Coleman (tim@timcoleman.com) -// -// (C) Ximian, Inc 2002 -// (C) Daniel Morgan 2002 -// Copyright (C) Tim Coleman, 2002 -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.IO; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using System.Collections; -using System.ComponentModel; -using System.Data; -using System.Data.Common; -using System.Data.SqlTypes; -using System.Globalization; -using System.Xml; - -namespace System.Data.SqlClient -{ - public class SqlDataReader : DbDataReader, IDataReader, IDisposable, IDataRecord - { - #region Fields - - SqlCommand command; - bool disposed; - bool isClosed; - bool moreResults; - int resultsRead; - int rowsRead; - DataTable schemaTable; - bool haveRead; - bool readResult; - bool readResultUsed; - int visibleFieldCount; - - #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; - const int PROVIDER_SPECIFIC_TYPE_IDX = 23; - const int DATA_TYPE_NAME_IDX = 24; - const int XML_SCHEMA_COLLCTN_DB_IDX = 25; - const int XML_SCHEMA_COLLCTN_OWN_SCHEMA_IDX = 26; - const int XML_SCHEMA_COLLCTN_NAME_IDX = 27; - const int UDT_ASMBLY_QUALIFIED_NAME_IDX = 28; - const int NON_VER_PROVIDER_TYPE_IDX = 29; - const int IS_COLUMN_SET = 30; - - #region Constructors - - internal SqlDataReader (SqlCommand command) - { - this.command = command; - command.Tds.RecordsAffected = -1; - NextResult (); - } - - #endregion // Constructors - - #region Properties - - public - override - int Depth { - get { return 0; } - } - - public - override - int FieldCount { - get { - ValidateState (); - return command.Tds.Columns.Count; - } - } - - public - override - bool IsClosed { - get { return isClosed; } - } - - public - override - object this [int i] { - get { return GetValue (i); } - } - - public - override - object this [string name] { - get { return GetValue (GetOrdinal (name)); } - } - - public - override - int RecordsAffected { - get { - return command.Tds.RecordsAffected; - } - } - - public - override - bool HasRows { - get { - ValidateState (); - - if (rowsRead > 0) - return true; - if (!haveRead) - readResult = ReadRecord (); - return readResult; - } - } - public override int VisibleFieldCount { - get { return visibleFieldCount; } - } - - protected SqlConnection Connection { - get { return command.Connection; } - } - - protected bool IsCommandBehavior (CommandBehavior condition) { - return condition == command.CommandBehavior; - } - - #endregion // Properties - - #region Methods - - public - override - void Close () - { - if (IsClosed) - return; - // skip to end & read output parameters. - while (NextResult ()) - ; - isClosed = true; - command.CloseDataReader (); - } - - 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); - schemaTable.Columns.Add ("ProviderSpecificDataType", typeType); - schemaTable.Columns.Add ("DataTypeName", stringType); - schemaTable.Columns.Add ("XmlSchemaCollectionDatabase", stringType); - schemaTable.Columns.Add ("XmlSchemaCollectionOwningSchema", stringType); - schemaTable.Columns.Add ("XmlSchemaCollectionName", stringType); - schemaTable.Columns.Add ("UdtAssemblyQualifiedName", stringType); - schemaTable.Columns.Add ("NonVersionedProviderType", intType); - schemaTable.Columns.Add ("IsColumnSet", booleanType); - - return schemaTable; - } - - private string GetSchemaRowTypeName (TdsColumnType ctype, int csize, short precision, short scale) - { - int dbType; - bool isLong; - Type fieldType; - - string typeName; - GetSchemaRowType (ctype, csize, precision, scale, - out dbType, out fieldType, out isLong, - out typeName); - return typeName; - } - - private Type GetSchemaRowFieldType (TdsColumnType ctype, int csize, short precision, short scale) - { - int dbType; - bool isLong; - Type fieldType; - string typeName; - - GetSchemaRowType (ctype, csize, precision, scale, - out dbType, out fieldType, out isLong, - out typeName); - return fieldType; - } - - SqlDbType GetSchemaRowDbType (int ordinal) - { - int csize; - short precision, scale; - TdsColumnType ctype; - TdsDataColumn column; - - if (ordinal < 0 || ordinal >= command.Tds.Columns.Count) - throw new IndexOutOfRangeException (); - - column = command.Tds.Columns [ordinal]; - ctype = (TdsColumnType) column.ColumnType; - csize = (int) column.ColumnSize; - precision = (short) (column.NumericPrecision ?? 0); - scale = (short) (column.NumericScale ?? 0); - return GetSchemaRowDbType (ctype, csize, precision, scale); - } - - private SqlDbType GetSchemaRowDbType (TdsColumnType ctype, int csize, short precision, short scale) - { - Type fieldType; - bool isLong; - string typeName; - int dbType; - - GetSchemaRowType (ctype, csize, precision, scale, - out dbType, out fieldType, out isLong, - out typeName); - return (SqlDbType) dbType; - } - - private void GetSchemaRowType (TdsColumnType ctype, int csize, - short precision, short scale, - 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: - case TdsColumnType.BigInt: - switch (csize) { - case 1: - typeName = "tinyint"; - dbType = (int) SqlDbType.TinyInt; - fieldType = typeof (byte); - isLong = false; - break; - case 2: - typeName = "smallint"; - dbType = (int) SqlDbType.SmallInt; - fieldType = typeof (short); - isLong = false; - break; - case 4: - typeName = "int"; - dbType = (int) SqlDbType.Int; - fieldType = typeof (int); - isLong = false; - break; - case 8: - typeName = "bigint"; - dbType = (int) SqlDbType.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) SqlDbType.Real; - fieldType = typeof (float); - isLong = false; - break; - case 8: - typeName = "float"; - dbType = (int) SqlDbType.Float; - fieldType = typeof (double); - isLong = false; - break; - } - break; - case TdsColumnType.Image : - typeName = "image"; - dbType = (int) SqlDbType.Image; - fieldType = typeof (byte[]); - isLong = true; - break; - case TdsColumnType.Text : - typeName = "text"; - dbType = (int) SqlDbType.Text; - fieldType = typeof (string); - isLong = true; - break; - case TdsColumnType.UniqueIdentifier : - typeName = "uniqueidentifier"; - dbType = (int) SqlDbType.UniqueIdentifier; - fieldType = typeof (Guid); - isLong = false; - break; - case TdsColumnType.VarBinary : - case TdsColumnType.BigVarBinary : - typeName = "varbinary"; - dbType = (int) SqlDbType.VarBinary; - fieldType = typeof (byte[]); - isLong = false; - break; - case TdsColumnType.VarChar : - case TdsColumnType.BigVarChar : - typeName = "varchar"; - dbType = (int) SqlDbType.VarChar; - fieldType = typeof (string); - isLong = false; - break; - case TdsColumnType.Binary : - case TdsColumnType.BigBinary : - typeName = "binary"; - dbType = (int) SqlDbType.Binary; - fieldType = typeof (byte[]); - isLong = false; - break; - case TdsColumnType.Char : - case TdsColumnType.BigChar : - typeName = "char"; - dbType = (int) SqlDbType.Char; - fieldType = typeof (string); - isLong = false; - break; - case TdsColumnType.Bit : - case TdsColumnType.BitN : - typeName = "bit"; - dbType = (int) SqlDbType.Bit; - fieldType = typeof (bool); - isLong = false; - break; - case TdsColumnType.DateTime4 : - case TdsColumnType.DateTime : - case TdsColumnType.DateTimeN : - switch (csize) { - case 4: - typeName = "smalldatetime"; - dbType = (int) SqlDbType.SmallDateTime; - fieldType = typeof (DateTime); - isLong = false; - break; - case 8: - typeName = "datetime"; - dbType = (int) SqlDbType.DateTime; - fieldType = typeof (DateTime); - isLong = false; - break; - } - break; - case TdsColumnType.Money : - case TdsColumnType.MoneyN : - case TdsColumnType.Money4 : - switch (csize) { - case 4: - typeName = "smallmoney"; - dbType = (int) SqlDbType.SmallMoney; - fieldType = typeof (decimal); - isLong = false; - break; - case 8: - typeName = "money"; - dbType = (int) SqlDbType.Money; - fieldType = typeof (decimal); - isLong = false; - break; - } - break; - case TdsColumnType.NText : - typeName = "ntext"; - dbType = (int) SqlDbType.NText; - fieldType = typeof (string); - isLong = true; - break; - case TdsColumnType.NVarChar : - typeName = "nvarchar"; - dbType = (int) SqlDbType.NVarChar; - fieldType = typeof (string); - isLong = false; - break; - case TdsColumnType.Decimal : - case TdsColumnType.Numeric : - // TDS 7.0 returns bigint as decimal(19,0) - if (precision == 19 && scale == 0) { - typeName = "bigint"; - dbType = (int) SqlDbType.BigInt; - fieldType = typeof (long); - } else { - typeName = "decimal"; - dbType = (int) SqlDbType.Decimal; - fieldType = typeof (decimal); - } - isLong = false; - break; - case TdsColumnType.NChar : - typeName = "nchar"; - dbType = (int) SqlDbType.NChar; - fieldType = typeof (string); - isLong = false; - break; - case TdsColumnType.SmallMoney : - typeName = "smallmoney"; - dbType = (int) SqlDbType.SmallMoney; - fieldType = typeof (decimal); - isLong = false; - break; - default : - typeName = "variant"; - dbType = (int) SqlDbType.Variant; - fieldType = typeof (object); - isLong = false; - break; - } - } - - new - void Dispose (bool disposing) - { - if (!disposed) { - if (disposing) { - if (schemaTable != null) - schemaTable.Dispose (); - Close (); - command = null; - } - disposed = true; - } - } - - public - override - bool GetBoolean (int i) - { - object value = GetValue (i); - if (!(value is bool)) { - if (value is DBNull) throw new SqlNullValueException (); - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - } - return (bool) value; - } - - public - override - byte GetByte (int i) - { - object value = GetValue (i); - if (!(value is byte)) { - if (value is DBNull) throw new SqlNullValueException (); - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - } - return (byte) value; - } - - public - override - long GetBytes (int i, long dataIndex, byte[] buffer, int bufferIndex, int length) - { - if ((command.CommandBehavior & CommandBehavior.SequentialAccess) != 0) { - ValidateState (); - EnsureDataAvailable (); - - try { - long len = ((Tds)command.Tds).GetSequentialColumnValue (i, dataIndex, buffer, bufferIndex, length); - if (len == -1) - throw CreateGetBytesOnInvalidColumnTypeException (i); - if (len == -2) - throw new SqlNullValueException (); - return len; - } catch (TdsInternalException ex) { - command.Connection.Close (); - throw SqlException.FromTdsInternalException ((TdsInternalException) ex); - } - } - - object value = GetValue (i); - if (!(value is byte [])) { - SqlDbType type = GetSchemaRowDbType (i); - switch (type) { - case SqlDbType.Image: - if (value is DBNull) - throw new SqlNullValueException (); - break; - case SqlDbType.Text: - string text = value as string; - if (text != null) - value = Encoding.Default.GetBytes (text); - else - value = null; - break; - case SqlDbType.NText: - string ntext = value as string; - if (ntext != null) - value = Encoding.Unicode.GetBytes (ntext); - else - value = null; - break; - default: - throw CreateGetBytesOnInvalidColumnTypeException (i); - } - } - - if (buffer == null) - return ((byte []) value).Length; // Return length of data - - // Copy data into buffer - int availLen = (int) ( ( (byte []) value).Length - dataIndex); - if (availLen < length) - length = availLen; - if (dataIndex < 0) - return 0; - - Array.Copy ((byte []) value, (int) dataIndex, buffer, bufferIndex, length); - return length; // return actual read count - } - - [EditorBrowsableAttribute (EditorBrowsableState.Never)] - public - override - char GetChar (int i) - { - throw new NotSupportedException (); - } - - public - override - long GetChars (int i, long dataIndex, char[] buffer, int bufferIndex, int length) - { - if ((command.CommandBehavior & CommandBehavior.SequentialAccess) != 0) { - ValidateState (); - EnsureDataAvailable (); - - if (i < 0 || i >= command.Tds.Columns.Count) - throw new IndexOutOfRangeException (); - - Encoding encoding = null; - byte mul = 1; - TdsColumnType colType = (TdsColumnType) command.Tds.Columns[i]["ColumnType"]; - switch (colType) { - case TdsColumnType.Text : - case TdsColumnType.VarChar: - case TdsColumnType.Char: - case TdsColumnType.BigVarChar: - encoding = Encoding.ASCII; - break; - case TdsColumnType.NText : - case TdsColumnType.NVarChar: - case TdsColumnType.NChar: - encoding = Encoding.Unicode; - mul = 2; - break; - default : - return -1; - } - - long count = 0; - if (buffer == null) { - count = GetBytes (i,0,(byte[]) null,0,0); - return (count/mul); - } - - length *= mul; - byte[] arr = new byte [length]; - count = GetBytes (i, dataIndex, arr, 0, length); - if (count == -1) - throw new InvalidCastException ("Specified cast is not valid"); - - Char[] val = encoding.GetChars (arr, 0, (int)count); - val.CopyTo (buffer, bufferIndex); - return val.Length; - } - - char [] valueBuffer; - object value = GetValue (i); - - if (value is char[]) - valueBuffer = (char[])value; - else if (value is string) - valueBuffer = ((string)value).ToCharArray(); - else { - if (value is DBNull) throw new SqlNullValueException (); - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - } - - if ( buffer == null ) { - // Return length of data - return valueBuffer.Length; - } - else { - // Copy data into buffer - Array.Copy (valueBuffer, (int) dataIndex, buffer, bufferIndex, length); - return valueBuffer.Length - dataIndex; - } - } - - - public - override - string GetDataTypeName (int i) - { - TdsDataColumn column; - TdsColumnType ctype; - int csize; - short precision; - short scale; - - ValidateState (); - - if (i < 0 || i >= command.Tds.Columns.Count) - throw new IndexOutOfRangeException (); - - column = command.Tds.Columns [i]; - ctype = (TdsColumnType) column.ColumnType; - csize = (int) column.ColumnSize; - precision = (short) (column.NumericPrecision ?? 0); - scale = (short) (column.NumericScale ?? 0); - return GetSchemaRowTypeName (ctype, csize, precision, scale); - } - - public - override - DateTime GetDateTime (int i) - { - object value = GetValue (i); - if (!(value is DateTime)) { - if (value is DBNull) throw new SqlNullValueException (); - else throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - } - return (DateTime) value; - } - - [MonoTODO] - public virtual DateTimeOffset GetDateTimeOffset (int i) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public virtual TimeSpan GetTimeSpan (int i) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public virtual SqlChars GetSqlChars (int i) - { - throw new NotImplementedException (); - } - - public - override - decimal GetDecimal (int i) - { - object value = GetValue (i); - if (!(value is decimal)) { - if (value is DBNull) throw new SqlNullValueException (); - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - } - return (decimal) value; - } - - public - override - double GetDouble (int i) - { - object value = GetValue (i); - if (!(value is double)) { - if (value is DBNull) throw new SqlNullValueException (); - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - } - return (double) value; - } - - public - override - Type GetFieldType (int i) - { - TdsDataColumn column; - TdsColumnType ctype; - int csize; - short precision; - short scale; - - ValidateState (); - - if (i < 0 || i >= command.Tds.Columns.Count) - throw new IndexOutOfRangeException (); - - column = command.Tds.Columns [i]; - ctype = (TdsColumnType) column.ColumnType; - csize = (int) column.ColumnSize; - precision = (short) (column.NumericPrecision ?? 0); - scale = (short) (column.NumericScale ?? 0); - return GetSchemaRowFieldType (ctype, csize, precision, - scale); - } - - public - override - float GetFloat (int i) - { - object value = GetValue (i); - if (!(value is float)) { - if (value is DBNull) throw new SqlNullValueException (); - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - } - return (float) value; - } - - public - override - Guid GetGuid (int i) - { - object value = GetValue (i); - if (!(value is Guid)) { - if (value is DBNull) throw new SqlNullValueException (); - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - } - return (Guid) value; - } - - public - override - short GetInt16 (int i) - { - object value = GetValue (i); - if (!(value is short)) { - if (value is DBNull) throw new SqlNullValueException (); - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - } - return (short) value; - } - - public - override - int GetInt32 (int i) - { - object value = GetValue (i); - if (!(value is int)) { - if (value is DBNull) throw new SqlNullValueException (); - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - } - return (int) value; - } - - public - override - long GetInt64 (int i) - { - object value = GetValue (i); - if (!(value is long)) { - if (value is DBNull) throw new SqlNullValueException (); - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - } - return (long) value; - } - - public - override - string GetName (int i) - { - ValidateState (); - - if (i < 0 || i >= command.Tds.Columns.Count) - throw new IndexOutOfRangeException (); - return (string) command.Tds.Columns[i].ColumnName; - } - - public - override - int GetOrdinal (string name) - { - ValidateState (); - - if (name == null) - throw new ArgumentNullException ("fieldName"); - - string colName; - foreach (TdsDataColumn schema in command.Tds.Columns) { - colName = schema.ColumnName; - if (colName.Equals (name) || String.Compare (colName, name, true) == 0) - return (int) schema.ColumnOrdinal; - } - throw new IndexOutOfRangeException (); - } - - public - override - DataTable GetSchemaTable () - { - ValidateState (); - - if (schemaTable == null) - schemaTable = ConstructSchemaTable (); - - if (schemaTable.Rows != null && schemaTable.Rows.Count > 0) - return schemaTable; - - if (!moreResults) - return null; - - foreach (TdsDataColumn schema in command.Tds.Columns) { - DataRow row = schemaTable.NewRow (); - - 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 [NUMERIC_PRECISION_IDX] = GetSchemaValue (schema.NumericPrecision); - 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); - row [PROVIDER_SPECIFIC_TYPE_IDX] = DBNull.Value; - row [DATA_TYPE_NAME_IDX] = GetSchemaValue (schema.DataTypeName); - row [XML_SCHEMA_COLLCTN_DB_IDX] = DBNull.Value; - row [XML_SCHEMA_COLLCTN_OWN_SCHEMA_IDX] = DBNull.Value; - row [XML_SCHEMA_COLLCTN_NAME_IDX] = DBNull.Value; - row [UDT_ASMBLY_QUALIFIED_NAME_IDX] = DBNull.Value; - row [NON_VER_PROVIDER_TYPE_IDX] = DBNull.Value; - row [IS_COLUMN_SET] = DBNull.Value; - // 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; - short precision; - short scale; - ctype = (TdsColumnType) schema.ColumnType; - csize = (int) schema.ColumnSize; - precision = (short) GetSchemaValue (schema.NumericPrecision); - scale = (short) GetSchemaValue (schema.NumericScale); - - GetSchemaRowType (ctype, csize, precision, scale, - out dbType, out fieldType, out isLong, - out typeName); - - row [COLUMN_SIZE_IDX] = csize; - row [NUMERIC_PRECISION_IDX] = precision; - row [NUMERIC_SCALE_IDX] = scale; - row [PROVIDER_TYPE_IDX] = dbType; - row [DATA_TYPE_IDX] = fieldType; - row [IS_LONG_IDX] = isLong; - if ((bool)row [IS_HIDDEN_IDX] == false) - visibleFieldCount += 1; - - 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; - } - - static object GetSchemaValue (object value) - { - if (value == null) - return DBNull.Value; - - return value; - } - - public - virtual - SqlBinary GetSqlBinary (int i) - { - object value = GetSqlValue (i); - if (!(value is SqlBinary)) - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - return (SqlBinary) value; - } - - public - virtual - SqlBoolean GetSqlBoolean (int i) - { - object value = GetSqlValue (i); - if (!(value is SqlBoolean)) - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - return (SqlBoolean) value; - } - - public - virtual - SqlByte GetSqlByte (int i) - { - object value = GetSqlValue (i); - if (!(value is SqlByte)) - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - return (SqlByte) value; - } - - public - virtual - SqlDateTime GetSqlDateTime (int i) - { - object value = GetSqlValue (i); - if (!(value is SqlDateTime)) - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - return (SqlDateTime) value; - } - - public - virtual - SqlDecimal GetSqlDecimal (int i) - { - object value = GetSqlValue (i); - if (!(value is SqlDecimal)) - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - return (SqlDecimal) value; - } - - public - virtual - SqlDouble GetSqlDouble (int i) - { - object value = GetSqlValue (i); - if (!(value is SqlDouble)) - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - return (SqlDouble) value; - } - - public - virtual - SqlGuid GetSqlGuid (int i) - { - object value = GetSqlValue (i); - if (!(value is SqlGuid)) - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - return (SqlGuid) value; - } - - public - virtual - SqlInt16 GetSqlInt16 (int i) - { - object value = GetSqlValue (i); - if (!(value is SqlInt16)) - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - return (SqlInt16) value; - } - - public - virtual - SqlInt32 GetSqlInt32 (int i) - { - object value = GetSqlValue (i); - if (!(value is SqlInt32)) - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - return (SqlInt32) value; - } - - public - virtual - SqlInt64 GetSqlInt64 (int i) - { - object value = GetSqlValue (i); - if (!(value is SqlInt64)) - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - return (SqlInt64) value; - } - - public - virtual - SqlMoney GetSqlMoney (int i) - { - object value = GetSqlValue (i); - if (!(value is SqlMoney)) - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - return (SqlMoney) value; - } - - public - virtual - SqlSingle GetSqlSingle (int i) - { - object value = GetSqlValue (i); - if (!(value is SqlSingle)) - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - return (SqlSingle) value; - } - - public - virtual - SqlString GetSqlString (int i) - { - object value = GetSqlValue (i); - if (!(value is SqlString)) - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - return (SqlString) value; - } - - public virtual SqlXml GetSqlXml (int i) - { - object value = GetSqlValue (i); - if (!(value is SqlXml)) { - if (value is DBNull) { - throw new SqlNullValueException (); - } else if (command.Tds.TdsVersion <= TdsVersion.tds80 && value is SqlString) { - // Workaround for TDS 7/8/8.1 clients - // Xml column types are supported only from Sql Server 2005 / TDS 9, however - // when a TDS 7/8/8.1 client requests for Xml column data, Sql Server 2005 returns - // it as NTEXT - MemoryStream stream = null; - if (!((SqlString) value).IsNull) - stream = new MemoryStream (Encoding.Unicode.GetBytes (value.ToString())); - value = new SqlXml (stream); - } else { - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - } - } - return (SqlXml) value; - } - - public - virtual - object GetSqlValue (int i) - { - object value = GetValue (i); - //Console.WriteLine ("Type of value: {0}", value.GetType ()); - - SqlDbType type = GetSchemaRowDbType (i); - switch (type) { - case SqlDbType.BigInt: - if (value == DBNull.Value) - return SqlInt64.Null; - return (SqlInt64) ((long) value); - case SqlDbType.Binary: - case SqlDbType.Image: - case SqlDbType.VarBinary: - case SqlDbType.Timestamp: - if (value == DBNull.Value) - return SqlBinary.Null; - return (SqlBinary) ((byte[]) value); - case SqlDbType.Bit: - if (value == DBNull.Value) - return SqlBoolean.Null; - return (SqlBoolean) ((bool) value); - case SqlDbType.Char: - case SqlDbType.NChar: - case SqlDbType.NText: - case SqlDbType.NVarChar: - case SqlDbType.Text: - case SqlDbType.VarChar: - if (value == DBNull.Value) - return SqlString.Null; - return (SqlString) ((string) value); - case SqlDbType.DateTime: - case SqlDbType.SmallDateTime: - if (value == DBNull.Value) - return SqlDateTime.Null; - return (SqlDateTime) ((DateTime) value); - case SqlDbType.Decimal: - if (value == DBNull.Value) - return SqlDecimal.Null; - if (value is TdsBigDecimal) - return SqlDecimalExtensions.FromTdsBigDecimal ((TdsBigDecimal) value); - if (value is Int64) - return (SqlDecimal)((long) value); - return (SqlDecimal) ((decimal) value); - case SqlDbType.Float: - if (value == DBNull.Value) - return SqlDouble.Null; - return (SqlDouble) ((double) value); - case SqlDbType.Int: - if (value == DBNull.Value) - return SqlInt32.Null; - return (SqlInt32) ((int) value); - case SqlDbType.Money: - case SqlDbType.SmallMoney: - if (value == DBNull.Value) - return SqlMoney.Null; - return (SqlMoney) ((decimal) value); - case SqlDbType.Real: - if (value == DBNull.Value) - return SqlSingle.Null; - return (SqlSingle) ((float) value); - case SqlDbType.UniqueIdentifier: - if (value == DBNull.Value) - return SqlGuid.Null; - return (SqlGuid) ((Guid) value); - case SqlDbType.SmallInt: - if (value == DBNull.Value) - return SqlInt16.Null; - return (SqlInt16) ((short) value); - case SqlDbType.TinyInt: - if (value == DBNull.Value) - return SqlByte.Null; - return (SqlByte) ((byte) value); - case SqlDbType.Xml: - if (value == DBNull.Value) - return SqlByte.Null; - return (SqlXml) value; - } - - throw new InvalidOperationException ("The type of this column is unknown."); - } - - public - virtual - int GetSqlValues (object[] values) - { - ValidateState (); - EnsureDataAvailable (); - - if (values == null) - throw new ArgumentNullException ("values"); - - int count = 0; - int columnCount = command.Tds.Columns.Count; - int arrayCount = values.Length; - - if (arrayCount > columnCount) - count = columnCount; - else - count = arrayCount; - - for (int i = 0; i < count; i += 1) - values [i] = GetSqlValue (i); - - return count; - } - - public - override - string GetString (int i) - { - object value = GetValue (i); - if (!(value is string)) { - if (value is DBNull) throw new SqlNullValueException (); - throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - } - return (string) value; - } - - public - override - object GetValue (int i) - { - ValidateState (); - EnsureDataAvailable (); - - if (i < 0 || i >= command.Tds.Columns.Count) - throw new IndexOutOfRangeException (); - - try { - if ((command.CommandBehavior & CommandBehavior.SequentialAccess) != 0) { - return ((Tds)command.Tds).GetSequentialColumnValue (i); - } - } catch (TdsInternalException ex) { - command.Connection.Close (); - throw SqlException.FromTdsInternalException ((TdsInternalException) ex); - } - - return command.Tds.ColumnValues [i]; - } - - public - override - int GetValues (object[] values) - { - ValidateState (); - EnsureDataAvailable (); - - if (values == null) - throw new ArgumentNullException ("values"); - - int len = values.Length; - var tds = command.Tds; - int columns = Math.Min (len, tds.Columns.Count); - - if ((command.CommandBehavior & CommandBehavior.SequentialAccess) != 0) { - for (int i = 0; i < columns; ++i) { - values [i] = tds.GetSequentialColumnValue (i); - } - } else { - int bigDecimalIndex = 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 (); - try { - tds.ColumnValues.CopyTo (0, values, 0, columns); - } catch (TdsInternalException ex) { - command.Connection.Close (); - throw SqlException.FromTdsInternalException ((TdsInternalException)ex); - } - } - - return columns; - } - - - public override IEnumerator GetEnumerator () - { - return new DbEnumerator (this); - } - - public - override - bool IsDBNull (int i) - { - return GetValue (i) == DBNull.Value; - } - - public - override - bool NextResult () - { - ValidateState (); - - if ((command.CommandBehavior & CommandBehavior.SingleResult) != 0 && resultsRead > 0) { - moreResults = false; - rowsRead = 0; - haveRead = false; - return false; - } - - try { - moreResults = command.Tds.NextResult (); - } catch (TdsInternalException ex) { - command.Connection.Close (); - throw SqlException.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; - } - - rowsRead = 0; - haveRead = false; - resultsRead += 1; - return moreResults; - } - - public - override - bool Read () - { - ValidateState (); - - if (!haveRead || readResultUsed) - readResult = ReadRecord (); - readResultUsed = true; - return readResult; - } - - internal bool ReadRecord () - { - readResultUsed = false; - - if ((command.CommandBehavior & CommandBehavior.SingleRow) != 0 && haveRead) - return false; - if ((command.CommandBehavior & CommandBehavior.SchemaOnly) != 0) - return false; - if (!moreResults) - return false; - - try { - bool result = command.Tds.NextRow (); - if (result) - rowsRead++; - haveRead = true; - return result; - } catch (TdsInternalException ex) { - command.Connection.Close (); - throw SqlException.FromTdsInternalException ((TdsInternalException) ex); - } - } - - void ValidateState () - { - if (IsClosed) - throw new InvalidOperationException ("Invalid attempt to read data when reader is closed"); - } - - void EnsureDataAvailable () - { - if (!readResult || !haveRead || !readResultUsed) - throw new InvalidOperationException ("No data available."); - } - - InvalidCastException CreateGetBytesOnInvalidColumnTypeException (int ordinal) - { - string message = string.Format (CultureInfo.InvariantCulture, - "Invalid attempt to GetBytes on column '{0}'." + - "The GetBytes function can only be used on " + - "columns of type Text, NText, or Image.", - GetName (ordinal)); - return new InvalidCastException (message); - } - - public override Type GetProviderSpecificFieldType (int i) - { - return (GetSqlValue (i).GetType()); - } - - public override object GetProviderSpecificValue (int i) - { - return (GetSqlValue (i)); - } - - public override int GetProviderSpecificValues (object [] values) - { - return (GetSqlValues (values)); - } - - public virtual SqlBytes GetSqlBytes (int i) - { - //object value = GetSqlValue (i); - //if (!(value is SqlBinary)) - // throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - Byte[] val = (byte[])GetValue(i); - SqlBytes sb = new SqlBytes (val); - return (sb); - } - - public override T GetFieldValue<T> (int i) - { - return (T)GetValue(i); - } - - [MonoTODO] - public virtual XmlReader GetXmlReader (int i) - { - throw new NotImplementedException (); - } - - override public Task<T> GetFieldValueAsync<T> (int i, CancellationToken cancellationToken) - { - return base.GetFieldValueAsync<T> (i, cancellationToken); - } - - override public Stream GetStream (int i) - { - return base.GetStream (i); - } - override public TextReader GetTextReader (int i) - { - return base.GetTextReader (i); - } - - override public Task<bool> IsDBNullAsync (int i, CancellationToken cancellationToken) - { - return base.IsDBNullAsync (i, cancellationToken); - } - - #endregion // Methods - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.platformnotsupported.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.platformnotsupported.cs deleted file mode 100644 index 395e97ac19e..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.platformnotsupported.cs +++ /dev/null @@ -1,363 +0,0 @@ -// -// SqlDataReader.cs -// -// Author: -// Rolf Bjarne Kvinge <rolf@xamarin.com> -// -// Copyright (c) 2016 Xamarin, Inc. -// -// 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.Common; -using System.Data.SqlClient; -using System.Data.SqlTypes; -using System.Data; -using System.IO; -using System.Threading.Tasks; -using System.Threading; -using System.Xml; - - -namespace System.Data.SqlClient -{ - public class SqlDataReader : DbDataReader , IDataReader, IDisposable, IDataRecord - { - const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlDataReader is not supported on the current platform."; - - SqlDataReader () {} - - protected bool IsCommandBehavior (CommandBehavior condition) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override void Close () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override bool GetBoolean (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override byte GetByte (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override long GetBytes (int i, long dataIndex, byte [] buffer, int bufferIndex, int length) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override char GetChar (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override long GetChars (int i, long dataIndex, char [] buffer, int bufferIndex, int length) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override string GetDataTypeName (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override DateTime GetDateTime (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public virtual DateTimeOffset GetDateTimeOffset (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public virtual TimeSpan GetTimeSpan (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public virtual SqlChars GetSqlChars (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override Decimal GetDecimal (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override Double GetDouble (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override Type GetFieldType (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override Single GetFloat (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override Guid GetGuid (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override short GetInt16 (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override int GetInt32 (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override long GetInt64 (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override string GetName (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override int GetOrdinal (string name) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override DataTable GetSchemaTable () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public virtual SqlBinary GetSqlBinary (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public virtual SqlBoolean GetSqlBoolean (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public virtual SqlByte GetSqlByte (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public virtual SqlDateTime GetSqlDateTime (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public virtual SqlDecimal GetSqlDecimal (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public virtual SqlDouble GetSqlDouble (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public virtual SqlGuid GetSqlGuid (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public virtual SqlInt16 GetSqlInt16 (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public virtual SqlInt32 GetSqlInt32 (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public virtual SqlInt64 GetSqlInt64 (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public virtual SqlMoney GetSqlMoney (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public virtual SqlSingle GetSqlSingle (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public virtual SqlString GetSqlString (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public virtual SqlXml GetSqlXml (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public virtual object GetSqlValue (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public virtual int GetSqlValues (object [] values) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override string GetString (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override object GetValue (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override int GetValues (object [] values) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override IEnumerator GetEnumerator () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override bool IsDBNull (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override bool NextResult () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override bool Read () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override Type GetProviderSpecificFieldType (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override object GetProviderSpecificValue (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override int GetProviderSpecificValues (object [] values) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public virtual SqlBytes GetSqlBytes (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override T GetFieldValue<T> (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public virtual XmlReader GetXmlReader (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override Task<T> GetFieldValueAsync<T> (int i, CancellationToken cancellationToken) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override Stream GetStream (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override TextReader GetTextReader (int i) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override Task<bool> IsDBNullAsync (int i, CancellationToken cancellationToken) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override int Depth { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override int FieldCount { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override bool IsClosed { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override object this [int i] { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override object this [string name] { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override int RecordsAffected { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override bool HasRows { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override int VisibleFieldCount { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - protected SqlConnection Connection { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlDataSourceConverter.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlDataSourceConverter.cs deleted file mode 100644 index c16c0d8285d..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlDataSourceConverter.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -// System.Data.SqlClient.SqlDataSourceConverter.cs -// -// Author: -// Nagappan A (anagappan@novell.com) -// - -// -// Copyright (C) 2007 Novell, Inc (http://www.novell.com) -// -// 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.Globalization; - -namespace System.Data.SqlClient { - internal sealed class SqlDataSourceConverter : ExpandableObjectConverter - { - #region Constructors - - [MonoTODO] - public SqlDataSourceConverter () - { - throw new NotImplementedException (); - } - - #endregion // Constructors - - #region Methods - - [MonoTODO] - public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) - { - throw new NotImplementedException (); - } - - #endregion // Methods - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlDecimalExtensions.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlDecimalExtensions.cs deleted file mode 100644 index 5c93ee52c71..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlDecimalExtensions.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Data.SqlTypes; -using Mono.Data.Tds.Protocol; - -namespace System.Data.SqlClient -{ - static class SqlDecimalExtensions - { - public static readonly SqlDecimal Null; - - internal static SqlDecimal FromTdsBigDecimal (TdsBigDecimal x) - { - if (x == null) - return Null; - else - return new SqlDecimal (x.Precision, x.Scale, !x.IsNegative, x.Data); - } - } -}
\ No newline at end of file diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlDependency.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlDependency.cs deleted file mode 100644 index 5cb920c0e9a..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlDependency.cs +++ /dev/null @@ -1,109 +0,0 @@ -// -// System.Data.SqlClient.SqlDependency.cs -// -// Authors: -// Veerapuram Varadhan (vvaradhan@novell.com) -// -// Copyright (C) 2008 Novell, Inc (http://www.novell.com) -// -// 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.Security.Permissions; -using System.Data; -using System.Data.SqlClient; - -namespace System.Data.SqlClient -{ - public sealed class SqlDependency - { -#region ReferenceSource - internal const Bid.ApiGroup NotificationsTracePoints = (Bid.ApiGroup)0x2000; -#endregion - - string uniqueId = Guid.NewGuid().ToString(); - - [MonoTODO] - public SqlDependency() - { - - } - [MonoTODO] - public SqlDependency (SqlCommand command) - { - - } - - [MonoTODO] - public SqlDependency (SqlCommand command, string options, int timeout) - { - - } - - public string Id { - get { return uniqueId; } - } - - [MonoTODO] - public bool HasChanges { - get { return true; } - } - -#pragma warning disable 0067 - [MonoTODO] - public event OnChangeEventHandler OnChange; -#pragma warning restore - - [MonoTODO] - public void AddCommandDependency(SqlCommand command) - { - - } - - [MonoTODO] - [HostProtectionAttribute(SecurityAction.LinkDemand, ExternalThreading = true)] - public static bool Start(string connectionString) - { - return true; - } - - [MonoTODO] - [HostProtectionAttribute(SecurityAction.LinkDemand, ExternalThreading = true)] - public static bool Start(string connectionString, string queue) - { - return true; - } - - [MonoTODO] - [HostProtectionAttribute(SecurityAction.LinkDemand, ExternalThreading = true)] - public static bool Stop(string connectionString) - { - return true; - } - - [MonoTODO] - [HostProtectionAttribute(SecurityAction.LinkDemand, ExternalThreading = true)] - public static bool Stop(string connectionString, string queue) - { - return true; - } - - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlException.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlException.cs deleted file mode 100644 index 99cfb66fb73..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlException.cs +++ /dev/null @@ -1,239 +0,0 @@ -// -// System.Data.SqlClient.SqlException.cs -// -// Author: -// Rodrigo Moya (rodrigo@ximian.com) -// Daniel Morgan (danmorg@sc.rr.com) -// Tim Coleman (tim@timcoleman.com) -// -// (C) Ximian, Inc -// Copyright (C) Tim Coleman, 2002 -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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; -using System.Runtime.Serialization; -using System.Text; -using System.Diagnostics; -using System.Globalization; - -using Mono.Data.Tds.Protocol; - -namespace System.Data.SqlClient -{ - [Serializable] - public sealed class SqlException : DbException - { -#region ReferenceSource - internal SqlException InternalClone() { - var ret = new SqlException (); - foreach (SqlError e in errors) - ret.errors.Add (e); - return ret; - } - - static internal SqlException CreateException(SqlErrorCollection errorCollection, string serverVersion) { - return CreateException(errorCollection, serverVersion, Guid.Empty); - } - - static internal SqlException CreateException(SqlErrorCollection errorCollection, string serverVersion, SqlInternalConnectionTds internalConnection, Exception innerException = null) { - Guid connectionId = Guid.Empty; - var exception = CreateException(errorCollection, serverVersion, connectionId, innerException); -/* - if (internalConnection != null) { - if ((internalConnection.OriginalClientConnectionId != Guid.Empty) && (internalConnection.OriginalClientConnectionId != internalConnection.ClientConnectionId)) { - exception.Data.Add(OriginalClientConnectionIdKey, internalConnection.OriginalClientConnectionId); - } - - if (!string.IsNullOrEmpty(internalConnection.RoutingDestination)) { - exception.Data.Add(RoutingDestinationKey, internalConnection.RoutingDestination); - } - } -*/ - return exception; - } - - - static internal SqlException CreateException(SqlErrorCollection errorCollection, string serverVersion, Guid conId, Exception innerException = null) { - Debug.Assert(null != errorCollection && errorCollection.Count > 0, "no errorCollection?"); - - // concat all messages together MDAC 65533 - StringBuilder message = new StringBuilder(); - for (int i = 0; i < errorCollection.Count; i++) { - if (i > 0) { - message.Append(Environment.NewLine); - } - message.Append(errorCollection[i].Message); - } - - if (innerException == null && errorCollection[0].Win32ErrorCode != 0 && errorCollection[0].Win32ErrorCode != -1) { - innerException = new Win32Exception(errorCollection[0].Win32ErrorCode); - } - - SqlException exception = new SqlException(message.ToString(), /*errorCollection, */innerException/*, conId*/); - - exception.Data.Add("HelpLink.ProdName", "Microsoft SQL Server"); - - if (!ADP.IsEmpty(serverVersion)) { - exception.Data.Add("HelpLink.ProdVer", serverVersion); - } - exception.Data.Add("HelpLink.EvtSrc", "MSSQLServer"); - exception.Data.Add("HelpLink.EvtID", errorCollection[0].Number.ToString(CultureInfo.InvariantCulture)); - exception.Data.Add("HelpLink.BaseHelpUrl", "http://go.microsoft.com/fwlink"); - exception.Data.Add("HelpLink.LinkId", "20476"); - - return exception; - } - - internal bool _doNotReconnect = false; -#endregion - - #region Fields - - private readonly SqlErrorCollection errors; - private const string DEF_MESSAGE = "SQL Exception has occured."; - - #endregion // Fields - - #region Constructors - - internal SqlException () - : this (DEF_MESSAGE, null, null) - { - } - - internal SqlException (string message, Exception inner) - : this (message, inner, null) - { - } - - internal SqlException (string message, Exception inner, SqlError sqlError) - : base (message == null ? DEF_MESSAGE : message, inner) - { - HResult = -2146232060; - errors = new SqlErrorCollection (); - if (sqlError != null) - errors.Add (sqlError); - } - - internal SqlException (byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state) - : this (null, - null, - new SqlError (number, state, theClass, server, message, procedure, lineNumber, 0)) - { - } - - private SqlException(SerializationInfo si, StreamingContext sc) - { - HResult = -2146232060; - errors = (SqlErrorCollection) si.GetValue ("Errors", typeof (SqlErrorCollection)); - } - - #endregion // Constructors - - #region Properties - - public byte Class { - get { return Errors [0].Class; } - } - - [MonoTODO] - public Guid ClientConnectionId { - get { throw new NotImplementedException (); } - } - - [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)] - public SqlErrorCollection Errors { - get { return errors; } - } - - public int LineNumber { - get { return Errors [0].LineNumber; } - } - - public override string Message { - get { - if (Errors.Count == 0) - return base.Message; - StringBuilder result = new StringBuilder (); - if (base.Message != DEF_MESSAGE) { - result.Append (base.Message); - result.Append ("\n"); - } - for (int i = 0; i < Errors.Count -1; i++) { - result.Append (Errors [i].Message); - result.Append ("\n"); - } - result.Append (Errors [Errors.Count - 1].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 - - internal static SqlException FromTdsInternalException (TdsInternalException e) - { - return new SqlException (e.Class, e.LineNumber, e.Message, - e.Number, e.Procedure, e.Server, - "Mono SqlClient Data Provider", e.State); - } - - public override void GetObjectData (SerializationInfo si, StreamingContext context) - { - if (si == null) - throw new ArgumentNullException ("si"); - - si.AddValue ("Errors", errors, typeof(SqlErrorCollection)); - base.GetObjectData (si, context); - } - - #endregion // Methods - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlException.platformnotsupported.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlException.platformnotsupported.cs deleted file mode 100644 index 24d102d76f6..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlException.platformnotsupported.cs +++ /dev/null @@ -1,102 +0,0 @@ -// -// SqlException.cs -// -// Author: -// Rolf Bjarne Kvinge <rolf@xamarin.com> -// -// Copyright (c) 2016 Xamarin, Inc. -// -// 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.Common; -using System.Data.SqlClient; -using System.Runtime.Serialization; - -namespace System.Data.SqlClient -{ - public class SqlException : DbException - { - const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlException is not supported on the current platform."; - - internal bool _doNotReconnect; - - static internal SqlException CreateException(SqlErrorCollection errorCollection, string serverVersion) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - static internal SqlException CreateException(SqlErrorCollection errorCollection, string serverVersion, SqlInternalConnectionTds internalConnection, Exception innerException = null) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - static internal SqlException CreateException(SqlErrorCollection errorCollection, string serverVersion, Guid conId, Exception innerException = null) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - SqlException () {} - - public override void GetObjectData (SerializationInfo si, StreamingContext context) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public byte Class { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public Guid ClientConnectionId { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public SqlErrorCollection Errors { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public int LineNumber { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override string Message { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public int Number { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public string Procedure { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public string Server { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override string Source { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public byte State { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlInfoMessageEventHandler.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlInfoMessageEventHandler.cs deleted file mode 100644 index 3d1cd4fdd1a..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlInfoMessageEventHandler.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -// System.Data.SqlClient.SqlInfoMessageEventHandler.cs -// -// Author: -// Rodrigo Moya (rodrigo@ximian.com) -// Daniel Morgan (danmorg@sc.rr.com) -// -// (C) Ximian, Inc 2002 -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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 System.Data.SqlClient { - public delegate void SqlInfoMessageEventHandler (object sender, SqlInfoMessageEventArgs e); -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlInitialCatalogConverter.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlInitialCatalogConverter.cs deleted file mode 100644 index 14b126b9766..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlInitialCatalogConverter.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -// System.Data.SqlClient.SqlInitialCatalogConverter.cs -// -// Author: -// Nagappan A (anagappan@novell.com) -// - -// -// Copyright (C) 2007 Novell, Inc (http://www.novell.com) -// -// 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.Globalization; - -namespace System.Data.SqlClient { - internal sealed class SqlInitialCatalogConverter : ExpandableObjectConverter - { - #region Constructors - - [MonoTODO] - public SqlInitialCatalogConverter () - { - throw new NotImplementedException (); - } - - #endregion // Constructors - - #region Methods - - [MonoTODO] - public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) - { - throw new NotImplementedException (); - } - - #endregion // Methods - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlNotificationEventArgs.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlNotificationEventArgs.cs deleted file mode 100644 index 8ace671ff5a..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlNotificationEventArgs.cs +++ /dev/null @@ -1,85 +0,0 @@ -// -// System.Data.SqlClient.SqlNotificationEventArgs.cs -// -// Author: -// Umadevi S (sumadevi@novell.com) -// -// (C) Ximian, Inc 2002 -// Copyright (C) Tim Coleman, 2002 -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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 System.Data.SqlClient { - public class SqlNotificationEventArgs : EventArgs - { - #region Fields - - private SqlNotificationType type; - private SqlNotificationInfo info; - private SqlNotificationSource source; - - #endregion //Fields - - - #region Constructors - - public SqlNotificationEventArgs( SqlNotificationType type, SqlNotificationInfo info, SqlNotificationSource source) { - this.type = type; - this.info = info; - this.source = source; - } - - #endregion // Constructors - - #region Properties - - public SqlNotificationType Type { - get { - return this.type; - } - } - - public SqlNotificationInfo Info { - get { - return this.info; - } - } - - public SqlNotificationSource Source { - get { - return this.source; - } - - } - - #endregion // Properties - } -} - diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlNotificationInfo.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlNotificationInfo.cs deleted file mode 100644 index d59de9a5ccc..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlNotificationInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -// -// System.Data.SqlClient.SqlNotificationInfo.cs -// -// Author: -// Umadevi S <sumadevi@novell.com> -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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. -// - -namespace System.Data.SqlClient -{ - /// <summary> - /// Provides additional infoatmion about the different notifications that can be - /// received by the dependency event handler - /// </summary> - public enum SqlNotificationInfo - { - AlreadyChanged = -2, - Alter = 5, - Delete = 3, - Drop = 4, - Error = 7, - Expired = 12, - Insert = 1, - Invalid = 9, - Isolation = 11, - Options = 10, - PreviousFire = 14, - Query = 8, - Resource = 13, - Restart = 6, - TemplateLimit = 15, - Truncate = 0, - Unknown = -1, - Update = 2 - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlNotificationSource.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlNotificationSource.cs deleted file mode 100644 index 7bf6e6043e3..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlNotificationSource.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -// System.Data.SqlClient.SqlNotificationSource.cs -// -// Author: -// Umadevi S <sumadevi@novell.com> -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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. -// - -namespace System.Data.SqlClient -{ - /// <summary> - /// Indicates the source of the notification received by the dependency event handler - /// </summary> - public enum SqlNotificationSource - { - Client = -2, - Data = 0, - Database = 3, - Environment = 6, - Execution = 7, - Object = 2, - Owner = 8, - Statement = 5, - System = 4, - Timeout = 1, - Unknown = -1, - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlNotificationType.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlNotificationType.cs deleted file mode 100644 index e3db2f2ee0b..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlNotificationType.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -// System.Data.SqlClient.SqlNotificationType.cs -// -// Author: -// Umadevi S <sumadevi@novell.com> -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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. -// - -namespace System.Data.SqlClient -{ - /// <summary> - /// Describes the differnt notification types that can be received by the dependency - /// event handler. - /// </summary> - public enum SqlNotificationType - { - Change = 0, - Subscribe = 1, - Unknown = -1 - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlParameter.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlParameter.cs deleted file mode 100644 index 33531b7c1ff..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlParameter.cs +++ /dev/null @@ -1,1112 +0,0 @@ -// -// System.Data.SqlClient.SqlParameter.cs -// -// Author: -// Rodrigo Moya (rodrigo@ximian.com) -// Daniel Morgan (danmorg@sc.rr.com) -// Tim Coleman (tim@timcoleman.com) -// Diego Caravana (diego@toth.it) -// Umadevi S (sumadevi@novell.com) -// Amit Biswas (amit@amitbiswas.com) -// Veerapuram Varadhan (vvaradhan@novell.com) -// -// (C) Ximian, Inc. 2002 -// Copyright (C) Tim Coleman, 2002 -// - -// -// Copyright (C) 2004, 2008, 2009 Novell, Inc (http://www.novell.com) -// -// 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.Collections; -using System.ComponentModel; -using System.Data; -using System.Data.Common; -using System.Data.SqlTypes; -using System.Globalization; -using System.Runtime.InteropServices; -using System.Text; -using System.Xml; - -namespace System.Data.SqlClient { - [TypeConverterAttribute ("System.Data.SqlClient.SqlParameter+SqlParameterConverter, " + Consts.AssemblySystem_Data)] - public sealed class SqlParameter : DbParameter, IDbDataParameter, IDataParameter, ICloneable - { -#region Import from old DbParameter - static Hashtable dbTypeMapping = new Hashtable (); - internal static Hashtable DbTypeMapping { - get { return dbTypeMapping;} - set { dbTypeMapping = value;} - } - - // LAMESPEC: Implementors should populate the dbTypeMapping accordingly - internal Type SystemType { - get { - return (Type) dbTypeMapping [SqlDbType]; - } - } -#endregion - - #region Fields - - TdsMetaParameter metaParameter; - - SqlParameterCollection container; - DbType dbType; - ParameterDirection direction = ParameterDirection.Input; - bool isTypeSet; - int offset; - SqlDbType sqlDbType; - string sourceColumn; - DataRowVersion sourceVersion; - SqlCompareOptions compareInfo; - int localeId; - Type sqlType; - bool typeChanged; - bool sourceColumnNullMapping; - string xmlSchemaCollectionDatabase = String.Empty; - string xmlSchemaCollectionOwningSchema = String.Empty; - string xmlSchemaCollectionName = String.Empty; - - static Hashtable type_mapping; - - #endregion // Fields - - #region Constructors - - - static SqlParameter () - { - if (DbTypeMapping == null) - DbTypeMapping = new Hashtable (); - - DbTypeMapping.Add (SqlDbType.BigInt, typeof (long)); - DbTypeMapping.Add (SqlDbType.Bit, typeof (bool)); - DbTypeMapping.Add (SqlDbType.Char, typeof (string)); - DbTypeMapping.Add (SqlDbType.NChar, typeof (string)); - DbTypeMapping.Add (SqlDbType.Text, typeof (string)); - DbTypeMapping.Add (SqlDbType.NText, typeof (string)); - DbTypeMapping.Add (SqlDbType.VarChar, typeof (string)); - DbTypeMapping.Add (SqlDbType.NVarChar, typeof (string)); - DbTypeMapping.Add (SqlDbType.SmallDateTime, typeof (DateTime)); - DbTypeMapping.Add (SqlDbType.DateTime, typeof (DateTime)); - DbTypeMapping.Add (SqlDbType.DateTime2, typeof (DateTime)); - DbTypeMapping.Add (SqlDbType.DateTimeOffset, typeof (DateTimeOffset)); - DbTypeMapping.Add (SqlDbType.Decimal, typeof (decimal)); - DbTypeMapping.Add (SqlDbType.Float, typeof (double)); - DbTypeMapping.Add (SqlDbType.Binary, typeof (byte [])); - DbTypeMapping.Add (SqlDbType.Image, typeof (byte [])); - DbTypeMapping.Add (SqlDbType.Money, typeof (decimal)); - DbTypeMapping.Add (SqlDbType.SmallMoney, typeof (decimal)); - DbTypeMapping.Add (SqlDbType.VarBinary, typeof (byte [])); - DbTypeMapping.Add (SqlDbType.TinyInt, typeof (byte)); - DbTypeMapping.Add (SqlDbType.Int, typeof (int)); - DbTypeMapping.Add (SqlDbType.Real, typeof (float)); - DbTypeMapping.Add (SqlDbType.SmallInt, typeof (short)); - DbTypeMapping.Add (SqlDbType.UniqueIdentifier, typeof (Guid)); - DbTypeMapping.Add (SqlDbType.Variant, typeof (object)); - DbTypeMapping.Add (SqlDbType.Xml, typeof (string)); - - type_mapping = new Hashtable (); - - type_mapping.Add (typeof (long), SqlDbType.BigInt); - type_mapping.Add (typeof (SqlTypes.SqlInt64), SqlDbType.BigInt); - - type_mapping.Add (typeof (bool), SqlDbType.Bit); - type_mapping.Add (typeof (SqlTypes.SqlBoolean), SqlDbType.Bit); - - type_mapping.Add (typeof (char), SqlDbType.NVarChar); - type_mapping.Add (typeof (char []), SqlDbType.NVarChar); - type_mapping.Add (typeof (SqlTypes.SqlChars), SqlDbType.NVarChar); - - type_mapping.Add (typeof (string), SqlDbType.NVarChar); - type_mapping.Add (typeof (SqlTypes.SqlString), SqlDbType.NVarChar); - - type_mapping.Add (typeof (DateTime), SqlDbType.DateTime); - type_mapping.Add (typeof (SqlTypes.SqlDateTime), SqlDbType.DateTime); - - type_mapping.Add (typeof (decimal), SqlDbType.Decimal); - type_mapping.Add (typeof (SqlTypes.SqlDecimal), SqlDbType.Decimal); - - type_mapping.Add (typeof (double), SqlDbType.Float); - type_mapping.Add (typeof (SqlTypes.SqlDouble), SqlDbType.Float); - - type_mapping.Add (typeof (byte []), SqlDbType.VarBinary); - type_mapping.Add (typeof (SqlTypes.SqlBinary), SqlDbType.VarBinary); - - type_mapping.Add (typeof (SqlTypes.SqlBytes), SqlDbType.VarBinary); - - type_mapping.Add (typeof (byte), SqlDbType.TinyInt); - type_mapping.Add (typeof (SqlTypes.SqlByte), SqlDbType.TinyInt); - - type_mapping.Add (typeof (int), SqlDbType.Int); - type_mapping.Add (typeof (SqlTypes.SqlInt32), SqlDbType.Int); - - type_mapping.Add (typeof (float), SqlDbType.Real); - type_mapping.Add (typeof (SqlTypes.SqlSingle), SqlDbType.Real); - - type_mapping.Add (typeof (short), SqlDbType.SmallInt); - type_mapping.Add (typeof (SqlTypes.SqlInt16), SqlDbType.SmallInt); - - type_mapping.Add (typeof (Guid), SqlDbType.UniqueIdentifier); - type_mapping.Add (typeof (SqlTypes.SqlGuid), SqlDbType.UniqueIdentifier); - - type_mapping.Add (typeof (SqlTypes.SqlMoney), SqlDbType.Money); - - type_mapping.Add (typeof (XmlReader), SqlDbType.Xml); - type_mapping.Add (typeof (SqlTypes.SqlXml), SqlDbType.Xml); - - type_mapping.Add (typeof (object), SqlDbType.Variant); - type_mapping.Add (typeof (DateTimeOffset), SqlDbType.DateTimeOffset); - } - - public SqlParameter () - : this (String.Empty, SqlDbType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, null) - { - isTypeSet = false; - } - - public SqlParameter (string parameterName, object value) - { - if (parameterName == null) - parameterName = string.Empty; - metaParameter = new TdsMetaParameter (parameterName, GetFrameworkValue); - metaParameter.RawValue = value; - InferSqlType (value); - sourceVersion = DataRowVersion.Current; - } - - public SqlParameter (string parameterName, SqlDbType dbType) - : this (parameterName, dbType, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, null) - { - } - - public SqlParameter (string parameterName, SqlDbType dbType, int size) - : this (parameterName, dbType, size, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, null) - { - } - - public SqlParameter (string parameterName, SqlDbType dbType, int size, string sourceColumn) - : this (parameterName, dbType, size, ParameterDirection.Input, false, 0, 0, sourceColumn, DataRowVersion.Current, null) - { - } - - [EditorBrowsable (EditorBrowsableState.Advanced)] - public SqlParameter (string parameterName, SqlDbType dbType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value) - { - if (parameterName == null) - parameterName = string.Empty; - - metaParameter = new TdsMetaParameter (parameterName, size, - isNullable, precision, - scale, - GetFrameworkValue); - metaParameter.RawValue = value; - SqlDbType = dbType; - Direction = direction; - SourceColumn = sourceColumn; - SourceVersion = sourceVersion; - } - - public SqlParameter (string parameterName, SqlDbType dbType, int size, ParameterDirection direction, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, bool sourceColumnNullMapping, Object value, string xmlSchemaCollectionDatabase, string xmlSchemaCollectionOwningSchema, string xmlSchemaCollectionName) - : this (parameterName, dbType, size, direction, false, precision, scale, sourceColumn, sourceVersion, value) - { - XmlSchemaCollectionDatabase = xmlSchemaCollectionDatabase; - XmlSchemaCollectionOwningSchema = xmlSchemaCollectionOwningSchema; - XmlSchemaCollectionName = xmlSchemaCollectionName; - SourceColumnNullMapping = sourceColumnNullMapping; - } - - // This constructor is used internally to construct a - // SqlParameter. The value array comes from sp_procedure_params_rowset. - // This is in SqlCommand.DeriveParameters. - // - // http://social.msdn.microsoft.com/forums/en-US/transactsql/thread/900756fd-3980-48e3-ae59-a15d7fc15b4c/ - internal SqlParameter (object[] dbValues) - : this (dbValues [3].ToString (), (object) null) - { - ParameterName = (string) dbValues [3]; - - switch ((short) dbValues [5]) { - case 1: - Direction = ParameterDirection.Input; - break; - case 2: - Direction = ParameterDirection.InputOutput; - break; - case 3: - Direction = ParameterDirection.Output; - break; - case 4: - Direction = ParameterDirection.ReturnValue; - break; - default: - Direction = ParameterDirection.Input; - break; - } - - SqlDbType = (SqlDbType) FrameworkDbTypeFromName ((string) dbValues [16]); - - if (MetaParameter.IsVariableSizeType) { - if (dbValues [10] != DBNull.Value) - Size = (int) dbValues [10]; - } - - if (SqlDbType == SqlDbType.Decimal) { - if (dbValues [12] != null && dbValues [12] != DBNull.Value) - Precision = (byte) ((short) dbValues [12]); - if (dbValues [13] != null && dbValues [13] != DBNull.Value) - Scale = (byte) ((short) dbValues [13]); - } - } - - #endregion // Constructors - - #region Properties - - // Used to ensure that only one collection can contain this - // parameter - internal SqlParameterCollection Container { - get { return container; } - set { container = value; } - } - - internal void CheckIfInitialized () - { - if (!isTypeSet) - throw new Exception ("all parameters to have an explicity set type"); - - if (MetaParameter.IsVariableSizeType) { - if (SqlDbType == SqlDbType.Decimal && Precision == 0) - throw new Exception ("Parameter of type 'Decimal' have an explicitly set Precision and Scale"); - else if (Size == 0) - throw new Exception ("all variable length parameters to have an explicitly set non-zero Size"); - } - } - - public override DbType DbType { - get { return dbType; } - set { - SetDbType (value); - typeChanged = true; - isTypeSet = true; - } - } - - [RefreshProperties (RefreshProperties.All)] - public override - ParameterDirection Direction { - get { return direction; } - set { - direction = value; - switch( direction ) { - case ParameterDirection.Output: - MetaParameter.Direction = TdsParameterDirection.Output; - break; - case ParameterDirection.InputOutput: - MetaParameter.Direction = TdsParameterDirection.InputOutput; - break; - case ParameterDirection.ReturnValue: - MetaParameter.Direction = TdsParameterDirection.ReturnValue; - break; - } - } - } - - internal TdsMetaParameter MetaParameter { - get { return metaParameter; } - } - - public override bool IsNullable { - get { return metaParameter.IsNullable; } - set { metaParameter.IsNullable = value; } - } - - [Browsable (false)] - [EditorBrowsable (EditorBrowsableState.Advanced)] - public int Offset { - get { return offset; } - set { offset = value; } - } - - public override string ParameterName { - get { return metaParameter.ParameterName; } - set { - if (value == null) - value = string.Empty; - metaParameter.ParameterName = value; - } - } - - [DefaultValue (0)] - public new byte Precision { - get { return metaParameter.Precision; } - set { metaParameter.Precision = value; } - } - - [DefaultValue (0)] - public new byte Scale { - get { return metaParameter.Scale; } - set { metaParameter.Scale = value; } - } - - public override int Size { - get { return metaParameter.Size; } - set { metaParameter.Size = value; } - } - - public override string SourceColumn { - get { - if (sourceColumn == null) - return string.Empty; - return sourceColumn; - } - set { sourceColumn = value; } - } - - public override DataRowVersion SourceVersion { - get { return sourceVersion; } - set { sourceVersion = value; } - } - - [RefreshProperties (RefreshProperties.All)] - [DbProviderSpecificTypeProperty(true)] - public SqlDbType SqlDbType { - get { return sqlDbType; } - set { - SetSqlDbType (value); - typeChanged = true; - isTypeSet = true; - } - } - - [TypeConverterAttribute (typeof (StringConverter))] - [RefreshProperties (RefreshProperties.All)] - public override object Value { - get { - if (sqlType != null) - return GetSqlValue (metaParameter.RawValue); - return metaParameter.RawValue; - } - set { - if (!isTypeSet) { - InferSqlType (value); - } - - if (value is INullable) { - sqlType = value.GetType (); - value = SqlTypeToFrameworkType (value); - } - metaParameter.RawValue = value; - } - } - - [Browsable (false)] - public SqlCompareOptions CompareInfo{ - get{ return compareInfo; } - set{ compareInfo = value; } - } - - [Browsable (false)] - public int LocaleId { - get { return localeId; } - set { localeId = value; } - } - - [Browsable (false)] - [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] - public Object SqlValue { - get { - return GetSqlValue (metaParameter.RawValue); - } - set { - Value = value; - } - } - - public override bool SourceColumnNullMapping { - get { return sourceColumnNullMapping; } - set { sourceColumnNullMapping = value; } - } - - public string XmlSchemaCollectionDatabase { - get { return xmlSchemaCollectionDatabase; } - set { xmlSchemaCollectionDatabase = (value == null ? String.Empty : value); } - } - - public string XmlSchemaCollectionName { - get { return xmlSchemaCollectionName; } - set { - xmlSchemaCollectionName = (value == null ? String.Empty : value); - } - } - - public string XmlSchemaCollectionOwningSchema { - get { return xmlSchemaCollectionOwningSchema; } - set { - xmlSchemaCollectionOwningSchema = (value == null ? String.Empty : value); - } - } - - [BrowsableAttribute(false)] - public string UdtTypeName { get; set; } - - [BrowsableAttribute(false)] - public string TypeName { get; set; } - - #endregion // Properties - - #region Methods - - object ICloneable.Clone () - { - return new SqlParameter (ParameterName, SqlDbType, Size, Direction, IsNullable, Precision, Scale, SourceColumn, SourceVersion, Value); - } - - // If the value is set without the DbType/SqlDbType being set, then we - // infer type information. - void InferSqlType (object value) - { - if (value == null || value == DBNull.Value) { - SetSqlDbType (SqlDbType.NVarChar); - return; - } - - Type type = value.GetType (); - if (type.IsEnum) - type = Enum.GetUnderlyingType (type); - object t = type_mapping [type]; - if (t == null) - throw new ArgumentException (String.Format ("The parameter data type of {0} is invalid.", type.FullName)); - SetSqlDbType ((SqlDbType) t); - } - -/* - // Returns System.Type corresponding to the underlying SqlDbType - internal override Type SystemType { - get { - return (Type) DbTypeMapping [sqlDbType]; - } - } - - internal override object FrameworkDbType { - get { - return sqlDbType; - } - - set { - object t; - try { - t = (DbType) DbTypeFromName ((string)value); - SetDbType ((DbType)t); - } catch (ArgumentException) { - t = (SqlDbType)FrameworkDbTypeFromName ((string)value); - SetSqlDbType ((SqlDbType) t); - } - } - } -*/ - - DbType DbTypeFromName (string name) - { - switch (name.ToLower ()) { - case "ansistring": - return DbType.AnsiString; - case "ansistringfixedlength": - return DbType.AnsiStringFixedLength; - case "binary": - return DbType.Binary; - case "boolean": - return DbType.Boolean; - case "byte": - return DbType.Byte; - case "currency": - return DbType.Currency; - case "date": - return DbType.Date; - case "datetime": - return DbType.DateTime; - case "decimal": - return DbType.Decimal; - case "double": - return DbType.Double; - case "guid": - return DbType.Guid; - case "int16": - return DbType.Int16; - case "int32": - return DbType.Int32; - case "int64": - return DbType.Int64; - case "object": - return DbType.Object; - case "single": - return DbType.Single; - case "string": - return DbType.String; - case "stringfixedlength": - return DbType.StringFixedLength; - case "time": - return DbType.Time; - case "xml": - return DbType.Xml; - default: - string exception = String.Format ("No mapping exists from {0} to a known DbType.", name); - throw new ArgumentException (exception); - } - } - - // When the DbType is set, we also set the SqlDbType, as well as the SQL Server - // string representation of the type name. If the DbType is not convertible - // to an SqlDbType, throw an exception. - private void SetDbType (DbType type) - { - switch (type) { - case DbType.AnsiString: - MetaParameter.TypeName = "varchar"; - sqlDbType = SqlDbType.VarChar; - MetaParameter.IsVariableSizeType = true; - break; - case DbType.AnsiStringFixedLength: - MetaParameter.TypeName = "char"; - sqlDbType = SqlDbType.Char; - MetaParameter.IsVariableSizeType = true; - break; - case DbType.Binary: - MetaParameter.TypeName = "varbinary"; - sqlDbType = SqlDbType.VarBinary; - MetaParameter.IsVariableSizeType = true; - break; - case DbType.Boolean: - MetaParameter.TypeName = "bit"; - sqlDbType = SqlDbType.Bit; - break; - case DbType.Byte: - MetaParameter.TypeName = "tinyint"; - sqlDbType = SqlDbType.TinyInt; - break; - case DbType.Currency: - sqlDbType = SqlDbType.Money; - MetaParameter.TypeName = "money"; - break; - case DbType.Date: - case DbType.DateTime: - MetaParameter.TypeName = "datetime"; - sqlDbType = SqlDbType.DateTime; - break; - case DbType.DateTime2: - MetaParameter.TypeName = "datetime2"; - sqlDbType = SqlDbType.DateTime2; - break; - case DbType.Decimal: - MetaParameter.TypeName = "decimal"; - sqlDbType = SqlDbType.Decimal; - break; - case DbType.Double: - MetaParameter.TypeName = "float"; - sqlDbType = SqlDbType.Float; - break; - case DbType.Guid: - MetaParameter.TypeName = "uniqueidentifier"; - sqlDbType = SqlDbType.UniqueIdentifier; - break; - case DbType.Int16: - MetaParameter.TypeName = "smallint"; - sqlDbType = SqlDbType.SmallInt; - break; - case DbType.Int32: - MetaParameter.TypeName = "int"; - sqlDbType = SqlDbType.Int; - break; - case DbType.Int64: - MetaParameter.TypeName = "bigint"; - sqlDbType = SqlDbType.BigInt; - break; - case DbType.Object: - MetaParameter.TypeName = "sql_variant"; - sqlDbType = SqlDbType.Variant; - break; - case DbType.Single: - MetaParameter.TypeName = "real"; - sqlDbType = SqlDbType.Real; - break; - case DbType.String: - MetaParameter.TypeName = "nvarchar"; - sqlDbType = SqlDbType.NVarChar; - MetaParameter.IsVariableSizeType = true; - break; - case DbType.StringFixedLength: - MetaParameter.TypeName = "nchar"; - sqlDbType = SqlDbType.NChar; - MetaParameter.IsVariableSizeType = true; - break; - case DbType.Time: - MetaParameter.TypeName = "datetime"; - sqlDbType = SqlDbType.DateTime; - break; - // Handle Xml type as string - case DbType.Xml: - MetaParameter.TypeName = "xml"; - sqlDbType = SqlDbType.Xml; - MetaParameter.IsVariableSizeType = true; - break; - default: - string exception = String.Format ("No mapping exists from DbType {0} to a known SqlDbType.", type); - throw new ArgumentException (exception); - } - dbType = type; - } - - // Used by internal constructor which has a SQL Server typename - private SqlDbType FrameworkDbTypeFromName (string dbTypeName) - { - switch (dbTypeName.ToLower ()) { - case "bigint": - return SqlDbType.BigInt; - case "binary": - return SqlDbType.Binary; - case "bit": - return SqlDbType.Bit; - case "char": - return SqlDbType.Char; - case "datetime": - return SqlDbType.DateTime; - case "decimal": - return SqlDbType.Decimal; - case "float": - return SqlDbType.Float; - case "image": - return SqlDbType.Image; - case "int": - return SqlDbType.Int; - case "money": - return SqlDbType.Money; - case "nchar": - return SqlDbType.NChar; - case "ntext": - return SqlDbType.NText; - case "nvarchar": - return SqlDbType.NVarChar; - case "real": - return SqlDbType.Real; - case "smalldatetime": - return SqlDbType.SmallDateTime; - case "smallint": - return SqlDbType.SmallInt; - case "smallmoney": - return SqlDbType.SmallMoney; - case "text": - return SqlDbType.Text; - case "timestamp": - return SqlDbType.Timestamp; - case "tinyint": - return SqlDbType.TinyInt; - case "uniqueidentifier": - return SqlDbType.UniqueIdentifier; - case "varbinary": - return SqlDbType.VarBinary; - case "varchar": - return SqlDbType.VarChar; - case "sql_variant": - return SqlDbType.Variant; - case "xml": - return SqlDbType.Xml; - default: - return SqlDbType.Variant; - } - } - - // When the SqlDbType is set, we also set the DbType, as well as the SQL Server - // string representation of the type name. If the SqlDbType is not convertible - // to a DbType, throw an exception. - internal void SetSqlDbType (SqlDbType type) - { - switch (type) { - case SqlDbType.BigInt: - MetaParameter.TypeName = "bigint"; - dbType = DbType.Int64; - break; - case SqlDbType.Binary: - MetaParameter.TypeName = "binary"; - dbType = DbType.Binary; - MetaParameter.IsVariableSizeType = true; - break; - case SqlDbType.Timestamp: - MetaParameter.TypeName = "timestamp"; - dbType = DbType.Binary; - break; - case SqlDbType.VarBinary: - MetaParameter.TypeName = "varbinary"; - dbType = DbType.Binary; - MetaParameter.IsVariableSizeType = true; - break; - case SqlDbType.Bit: - MetaParameter.TypeName = "bit"; - dbType = DbType.Boolean; - break; - case SqlDbType.Char: - MetaParameter.TypeName = "char"; - dbType = DbType.AnsiStringFixedLength; - MetaParameter.IsVariableSizeType = true; - break; - case SqlDbType.DateTime: - MetaParameter.TypeName = "datetime"; - dbType = DbType.DateTime; - break; - case SqlDbType.SmallDateTime: - MetaParameter.TypeName = "smalldatetime"; - dbType = DbType.DateTime; - break; - case SqlDbType.DateTime2: - MetaParameter.TypeName = "datetime2"; - dbType = DbType.DateTime2; - break; - case SqlDbType.DateTimeOffset: - MetaParameter.TypeName = "datetimeoffset"; - dbType = DbType.DateTimeOffset; - break; - case SqlDbType.Decimal: - MetaParameter.TypeName = "decimal"; - dbType = DbType.Decimal; - break; - case SqlDbType.Float: - MetaParameter.TypeName = "float"; - dbType = DbType.Double; - break; - case SqlDbType.Image: - MetaParameter.TypeName = "image"; - dbType = DbType.Binary; - MetaParameter.IsVariableSizeType = true; - break; - case SqlDbType.Int: - MetaParameter.TypeName = "int"; - dbType = DbType.Int32; - break; - case SqlDbType.Money: - MetaParameter.TypeName = "money"; - dbType = DbType.Currency; - break; - case SqlDbType.SmallMoney: - MetaParameter.TypeName = "smallmoney"; - dbType = DbType.Currency; - break; - case SqlDbType.NChar: - MetaParameter.TypeName = "nchar"; - dbType = DbType.StringFixedLength; - MetaParameter.IsVariableSizeType = true; - break; - case SqlDbType.NText: - MetaParameter.TypeName = "ntext"; - dbType = DbType.String; - MetaParameter.IsVariableSizeType = true; - break; - case SqlDbType.NVarChar: - MetaParameter.TypeName = "nvarchar"; - dbType = DbType.String; - MetaParameter.IsVariableSizeType = true; - break; - case SqlDbType.Real: - MetaParameter.TypeName = "real"; - dbType = DbType.Single; - break; - case SqlDbType.SmallInt: - MetaParameter.TypeName = "smallint"; - dbType = DbType.Int16; - break; - case SqlDbType.Text: - MetaParameter.TypeName = "text"; - dbType = DbType.AnsiString; - MetaParameter.IsVariableSizeType = true; - break; - case SqlDbType.VarChar: - MetaParameter.TypeName = "varchar"; - dbType = DbType.AnsiString; - MetaParameter.IsVariableSizeType = true; - break; - case SqlDbType.TinyInt: - MetaParameter.TypeName = "tinyint"; - dbType = DbType.Byte; - break; - case SqlDbType.UniqueIdentifier: - MetaParameter.TypeName = "uniqueidentifier"; - dbType = DbType.Guid; - break; - case SqlDbType.Variant: - MetaParameter.TypeName = "sql_variant"; - dbType = DbType.Object; - break; - case SqlDbType.Xml: - MetaParameter.TypeName = "xml"; - dbType = DbType.Xml; - MetaParameter.IsVariableSizeType = true; - break; - default: - string exception = String.Format ("No mapping exists from SqlDbType {0} to a known DbType.", type); - throw new ArgumentOutOfRangeException ("SqlDbType", exception); - } - sqlDbType = type; - } - - public override string ToString() - { - return ParameterName; - } - - object GetFrameworkValue (object rawValue, ref bool updated) - { - object tdsValue; - - updated = typeChanged || updated; - if (updated) { - tdsValue = SqlTypeToFrameworkType (rawValue); - typeChanged = false; - } else - tdsValue = null; - return tdsValue; - } - - // TODO: Code copied from SqlDataReader, need a better approach - object GetSqlValue (object value) - { - if (value == null) - return value; - switch (sqlDbType) { - case SqlDbType.BigInt: - if (value == DBNull.Value) - return SqlInt64.Null; - return (SqlInt64) ((long) value); - case SqlDbType.Binary: - case SqlDbType.Image: - case SqlDbType.VarBinary: - case SqlDbType.Timestamp: - if (value == DBNull.Value) - return SqlBinary.Null; - return (SqlBinary) (byte[]) value; - case SqlDbType.Bit: - if (value == DBNull.Value) - return SqlBoolean.Null; - return (SqlBoolean) ((bool) value); - case SqlDbType.Char: - case SqlDbType.NChar: - case SqlDbType.NText: - case SqlDbType.NVarChar: - case SqlDbType.Text: - case SqlDbType.VarChar: - if (value == DBNull.Value) - return SqlString.Null; - - string str; - Type type = value.GetType (); - if (type == typeof (char)) - str = value.ToString (); - else if (type == typeof (char[])) - str = new String ((char[])value); - else - str = ((string)value); - return (SqlString) str; - case SqlDbType.DateTime: - case SqlDbType.SmallDateTime: - if (value == DBNull.Value) - return SqlDateTime.Null; - return (SqlDateTime) ((DateTime) value); - case SqlDbType.Decimal: - if (value == DBNull.Value) - return SqlDecimal.Null; - if (value is TdsBigDecimal) - return SqlDecimalExtensions.FromTdsBigDecimal ((TdsBigDecimal) value); - return (SqlDecimal) ((decimal) value); - case SqlDbType.Float: - if (value == DBNull.Value) - return SqlDouble.Null; - return (SqlDouble) ((double) value); - case SqlDbType.Int: - if (value == DBNull.Value) - return SqlInt32.Null; - return (SqlInt32) ((int) value); - case SqlDbType.Money: - case SqlDbType.SmallMoney: - if (value == DBNull.Value) - return SqlMoney.Null; - return (SqlMoney) ((decimal) value); - case SqlDbType.Real: - if (value == DBNull.Value) - return SqlSingle.Null; - return (SqlSingle) ((float) value); - case SqlDbType.UniqueIdentifier: - if (value == DBNull.Value) - return SqlGuid.Null; - return (SqlGuid) ((Guid) value); - case SqlDbType.SmallInt: - if (value == DBNull.Value) - return SqlInt16.Null; - return (SqlInt16) ((short) value); - case SqlDbType.TinyInt: - if (value == DBNull.Value) - return SqlByte.Null; - return (SqlByte) ((byte) value); - case SqlDbType.Xml: - if (value == DBNull.Value) - return SqlXml.Null; - return (SqlXml) value; - default: - throw new NotImplementedException ("Type '" + sqlDbType + "' not implemented."); - } - } - - object SqlTypeToFrameworkType (object value) - { - INullable nullable = value as INullable; - if (nullable == null) - return ConvertToFrameworkType (value); - - if (nullable.IsNull) - return DBNull.Value; - - Type type = value.GetType (); - // Map to .net type, as Mono TDS respects only types from .net - - if (typeof (SqlString) == type) { - return ((SqlString) value).Value; - } - - if (typeof (SqlInt16) == type) { - return ((SqlInt16) value).Value; - } - - if (typeof (SqlInt32) == type) { - return ((SqlInt32) value).Value; - } - - if (typeof (SqlDateTime) == type) { - return ((SqlDateTime) value).Value; - } - - if (typeof (SqlInt64) == type) { - return ((SqlInt64) value).Value; - } - - if (typeof (SqlBinary) == type) { - return ((SqlBinary) value).Value; - } - - if (typeof (SqlBytes) == type) { - return ((SqlBytes) value).Value; - } - - if (typeof (SqlChars) == type) { - return ((SqlChars) value).Value; - } - - if (typeof (SqlBoolean) == type) { - return ((SqlBoolean) value).Value; - } - - if (typeof (SqlByte) == type) { - return ((SqlByte) value).Value; - } - - if (typeof (SqlDecimal) == type) { - return ((SqlDecimal) value).Value; - } - - if (typeof (SqlDouble) == type) { - return ((SqlDouble) value).Value; - } - - if (typeof (SqlGuid) == type) { - return ((SqlGuid) value).Value; - } - - if (typeof (SqlMoney) == type) { - return ((SqlMoney) value).Value; - } - - if (typeof (SqlSingle) == type) { - return ((SqlSingle) value).Value; - } - - return value; - } - - internal object ConvertToFrameworkType (object value) - { - if (value == null || value == DBNull.Value) - return value; - if (sqlDbType == SqlDbType.Variant) - return metaParameter.Value; - - Type frameworkType = SystemType; - if (frameworkType == null) - throw new NotImplementedException ("Type Not Supported : " + sqlDbType.ToString()); - - Type valueType = value.GetType (); - if (valueType == frameworkType) - return value; - - object sqlvalue = null; - - try { - sqlvalue = ConvertToFrameworkType (value, frameworkType); - } catch (FormatException ex) { - throw new FormatException (string.Format (CultureInfo.InvariantCulture, - "Parameter value could not be converted from {0} to {1}.", - valueType.Name, frameworkType.Name), ex); - } - - return sqlvalue; - } - - object ConvertToFrameworkType (object value, Type frameworkType) - { - if (frameworkType == typeof (string)) { - if (value is DateTime) - return ((DateTime) value).ToString ("yyyy-MM-dd'T'HH':'mm':'ss.fffffff"); - if (value is DateTimeOffset) - return ((DateTimeOffset) value).ToString ("yyyy-MM-dd'T'HH':'mm':'ss.fffffffzzz"); - } - - object sqlvalue = Convert.ChangeType (value, frameworkType); - switch (sqlDbType) { - case SqlDbType.Money: - case SqlDbType.SmallMoney: - sqlvalue = Decimal.Round ((decimal) sqlvalue, 4); - break; - } - return sqlvalue; - } - - public override void ResetDbType () - { - InferSqlType (Value); - } - - public void ResetSqlDbType () - { - InferSqlType (Value); - } - - #endregion // Methods - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlParameter.platformnotsupported.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlParameter.platformnotsupported.cs deleted file mode 100644 index 79f6f95baed..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlParameter.platformnotsupported.cs +++ /dev/null @@ -1,198 +0,0 @@ -// -// SqlParameter.cs -// -// Author: -// Rolf Bjarne Kvinge <rolf@xamarin.com> -// -// Copyright (c) 2016 Xamarin, Inc. -// -// 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.Data.SqlTypes; - -namespace System.Data.SqlClient -{ - public class SqlParameter : DbParameter , IDbDataParameter, IDataParameter, ICloneable - { - const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlParameter is not supported on the current platform."; - - public SqlParameter () - : this (String.Empty, SqlDbType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, null) - { - } - - public SqlParameter (string parameterName, object value) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlParameter (string parameterName, SqlDbType dbType) - : this (parameterName, dbType, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, null) - { - } - - public SqlParameter (string parameterName, SqlDbType dbType, int size) - : this (parameterName, dbType, size, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, null) - { - } - - public SqlParameter (string parameterName, SqlDbType dbType, int size, string sourceColumn) - : this (parameterName, dbType, size, ParameterDirection.Input, false, 0, 0, sourceColumn, DataRowVersion.Current, null) - { - } - - public SqlParameter (string parameterName, SqlDbType dbType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlParameter (string parameterName, SqlDbType dbType, int size, ParameterDirection direction, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, bool sourceColumnNullMapping, Object value, string xmlSchemaCollectionDatabase, string xmlSchemaCollectionOwningSchema, string xmlSchemaCollectionName) - : this (parameterName, dbType, size, direction, false, precision, scale, sourceColumn, sourceVersion, value) - { - } - - public override string ToString () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override void ResetDbType () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public void ResetSqlDbType () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override DbType DbType { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override ParameterDirection Direction { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override bool IsNullable { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public int Offset { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override string ParameterName { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public byte Precision { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public byte Scale { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override int Size { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override string SourceColumn { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override DataRowVersion SourceVersion { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public SqlDbType SqlDbType { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override object Value { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public SqlCompareOptions CompareInfo { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public int LocaleId { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public object SqlValue { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override bool SourceColumnNullMapping { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public string XmlSchemaCollectionDatabase { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public string XmlSchemaCollectionName { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public string XmlSchemaCollectionOwningSchema { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public string UdtTypeName { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public string TypeName { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - object ICloneable.Clone () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlParameterCollection.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlParameterCollection.cs deleted file mode 100644 index bd478795a1f..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlParameterCollection.cs +++ /dev/null @@ -1,366 +0,0 @@ -// -// System.Data.SqlClient.SqlParameterCollection.cs -// -// Author: -// Rodrigo Moya (rodrigo@ximian.com) -// Daniel Morgan (danmorg@sc.rr.com) -// Tim Coleman (tim@timcoleman.com) -// Diego Caravana (diego@toth.it) -// Umadevi S (sumadevi@novell.com) -// -// (C) Ximian, Inc 2002 -// Copyright (C) Tim Coleman, 2002 -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.ComponentModel; -using System.Data; -using System.Data.Common; - -using Mono.Data.Tds; - -namespace System.Data.SqlClient -{ - [ListBindable (false)] - [Editor ("Microsoft.VSDesigner.Data.Design.DBParametersEditor, " + Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)] - public sealed class SqlParameterCollection : DbParameterCollection, IDataParameterCollection, IList, ICollection, IEnumerable - { - #region Fields - - ArrayList list = new ArrayList(); - TdsMetaParameterCollection metaParameters; - SqlCommand command; - - #endregion // Fields - - #region Constructors - - internal SqlParameterCollection (SqlCommand command) - { - this.command = command; - metaParameters = new TdsMetaParameterCollection (); - } - - #endregion // Constructors - - #region Properties - - public - override - int Count { - get { return list.Count; } - } - - 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; - } - } - - [Browsable (false)] - [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] - public - new - SqlParameter this [int index] { - get { - if (index < 0 || index >= list.Count) - throw new IndexOutOfRangeException ("The specified index is out of range."); - return (SqlParameter) list [index]; - } - set { - if (index < 0 || index >= list.Count) - throw new IndexOutOfRangeException ("The specified index is out of range."); - list [index] = (SqlParameter) value; - } - } - - [Browsable (false)] - [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] - public - new - SqlParameter this [string parameterName] { - get { - foreach (SqlParameter 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; - } - } - - 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] = (SqlParameter) value; - } - - protected override void SetParameter (string parameterName, DbParameter value) - { - this [parameterName] = (SqlParameter) value; - } - - internal TdsMetaParameterCollection MetaParameters { - get { return metaParameters; } - } - - #endregion // Properties - - #region Methods - - [EditorBrowsable (EditorBrowsableState.Never)] - public - override - int Add (object value) - { - if (!(value is SqlParameter)) - throw new InvalidCastException ("The parameter was not an SqlParameter."); - Add ((SqlParameter) value); - return IndexOf (value); - } - - public SqlParameter Add (SqlParameter value) - { - if (value.Container != null) - throw new ArgumentException ("The SqlParameter specified in the value parameter is already added to this or another SqlParameterCollection."); - - value.Container = this; - list.Add (value); - metaParameters.Add (value.MetaParameter); - return value; - } - - [EditorBrowsable (EditorBrowsableState.Never)] - [Obsolete ("Do not call this method.")] - public SqlParameter Add (string parameterName, object value) - { - return Add (new SqlParameter (parameterName, value)); - } - - public SqlParameter AddWithValue (string parameterName, object value) - { - return Add (new SqlParameter (parameterName, value)); - } - - public SqlParameter Add (string parameterName, SqlDbType sqlDbType) - { - return Add (new SqlParameter (parameterName, sqlDbType)); - } - - public SqlParameter Add (string parameterName, SqlDbType sqlDbType, int size) - { - return Add (new SqlParameter (parameterName, sqlDbType, size)); - } - - public SqlParameter Add (string parameterName, SqlDbType sqlDbType, int size, string sourceColumn) - { - return Add (new SqlParameter (parameterName, sqlDbType, size, sourceColumn)); - } - - public - override - void Clear() - { - metaParameters.Clear (); - - foreach (SqlParameter p in list) - p.Container = null; - - list.Clear (); - } - - public - override - bool Contains (object value) - { - if (!(value is SqlParameter)) - throw new InvalidCastException ("The parameter was not an SqlParameter."); - return Contains (((SqlParameter) value).ParameterName); - } - - public - override - bool Contains (string value) - { - foreach (SqlParameter p in list) - if (p.ParameterName.Equals (value)) - return true; - return false; - } - - public bool Contains (SqlParameter value) - { - return (this.IndexOf(value) != -1); - } - - public - override - void CopyTo (Array array, int index) - { - list.CopyTo (array, index); - } - - public - override - IEnumerator GetEnumerator() - { - return list.GetEnumerator (); - } - - public - override - int IndexOf (object value) - { - if (!(value is SqlParameter)) - throw new InvalidCastException ("The parameter was not an SqlParameter."); - return IndexOf (((SqlParameter) value).ParameterName); - } - - public - override - int IndexOf (string parameterName) - { - for (int i = 0; i < Count; i += 1) - if (this [i].ParameterName.Equals (parameterName)) - return i; - return -1; - } - - public int IndexOf (SqlParameter value) - { - return list.IndexOf(value); - } - - public - override - void Insert (int index, object value) - { - list.Insert (index, value); - } - - public void Insert (int index, SqlParameter value) - { - list.Insert (index,value); - } - - public - override - void Remove (object value) - { - //TODO : this neds validation to check if the object is a - // sqlparameter. - - ((SqlParameter) value).Container = null; - - metaParameters.Remove (((SqlParameter) value).MetaParameter); - list.Remove (value); - } - - public void Remove (SqlParameter 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); - } - - public - override - void RemoveAt (int index) - { - this [index].Container = null; - metaParameters.RemoveAt (index); - list.RemoveAt (index); - } - - public - override - void RemoveAt (string parameterName) - { - RemoveAt (IndexOf (parameterName)); - } - - 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 SqlParameter)) - throw new InvalidCastException ("Element in the array parameter was not an SqlParameter."); - SqlParameter param = (SqlParameter) 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 (SqlParameter[] values) - { - AddRange((Array) values); - } - - public void CopyTo (SqlParameter[] array, int index) - { - list.CopyTo (array, index); - } - - #endregion // Methods - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlParameterCollection.platformnotsupported.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlParameterCollection.platformnotsupported.cs deleted file mode 100644 index cc3a6ab1537..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlParameterCollection.platformnotsupported.cs +++ /dev/null @@ -1,216 +0,0 @@ -// -// SqlParameterCollection.cs -// -// Author: -// Rolf Bjarne Kvinge <rolf@xamarin.com> -// -// Copyright (c) 2016 Xamarin, Inc. -// -// 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.Data.Common; -using System.Data.SqlClient; - -namespace System.Data.SqlClient -{ - public class SqlParameterCollection : DbParameterCollection , IDataParameterCollection, IList, ICollection, IEnumerable - { - const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlParameterCollection is not supported on the current platform."; - - SqlParameterCollection () {} - - protected override DbParameter GetParameter (int index) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - protected override DbParameter GetParameter (string parameterName) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - protected override void SetParameter (int index, DbParameter value) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - protected override void SetParameter (string parameterName, DbParameter value) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override int Add (object value) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlParameter Add (SqlParameter value) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlParameter Add (string parameterName, object value) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlParameter AddWithValue (string parameterName, object value) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlParameter Add (string parameterName, SqlDbType sqlDbType) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlParameter Add (string parameterName, SqlDbType sqlDbType, int size) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlParameter Add (string parameterName, SqlDbType sqlDbType, int size, string sourceColumn) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override void Clear () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override bool Contains (object value) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override bool Contains (string value) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public bool Contains (SqlParameter value) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override void CopyTo (Array array, int index) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override IEnumerator GetEnumerator () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override int IndexOf (object value) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override int IndexOf (string parameterName) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public int IndexOf (SqlParameter value) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override void Insert (int index, object value) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public void Insert (int index, SqlParameter value) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override void Remove (object value) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public void Remove (SqlParameter value) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override void RemoveAt (int index) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override void RemoveAt (string parameterName) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override void AddRange (Array values) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public void AddRange (SqlParameter [] values) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public void CopyTo (SqlParameter [] array, int index) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override int Count { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override bool IsFixedSize { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override bool IsReadOnly { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override bool IsSynchronized { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override object SyncRoot { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public SqlParameter this [int index] { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public SqlParameter this [string parameterName] { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlParameterConverter.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlParameterConverter.cs deleted file mode 100644 index c14be972e53..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlParameterConverter.cs +++ /dev/null @@ -1,66 +0,0 @@ -// -// System.Data.SqlClient.SqlParameterConverter.cs -// -// Author: -// Tim Coleman (tim@timcoleman.com) -// -// Copyright (C) Tim Coleman, 2002 -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.Globalization; - -namespace System.Data.SqlClient { - internal sealed class SqlParameterConverter : ExpandableObjectConverter - { - #region Constructors - - [MonoTODO] - public SqlParameterConverter () - { - throw new NotImplementedException (); - } - - #endregion // Constructors - - #region Methods - - [MonoTODO] - public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) - { - throw new NotImplementedException (); - } - - #endregion // Methods - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventArgs.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventArgs.cs deleted file mode 100644 index daa42d3311c..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventArgs.cs +++ /dev/null @@ -1,60 +0,0 @@ -// -// System.Data.SqlClient.SqlRowUpdatedEventArgs.cs -// -// Author: -// Rodrigo Moya (rodrigo@ximian.com) -// Daniel Morgan (danmorg@sc.rr.com) -// Tim Coleman (tim@timcoleman.com) -// -// (C) Ximian, Inc 2002 -// Copyright (C) Tim Coleman, 2002 -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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 System.Data.SqlClient { - public sealed class SqlRowUpdatedEventArgs : RowUpdatedEventArgs - { - #region Constructors - - public SqlRowUpdatedEventArgs (DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) - : base (row, command, statementType, tableMapping) - { - } - - #endregion // Constructors - - #region Properties - - public new SqlCommand Command { - get { return (SqlCommand) base.Command; } - } - - #endregion // Properties - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventHandler.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventHandler.cs deleted file mode 100644 index ec3a4389ecf..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventHandler.cs +++ /dev/null @@ -1,38 +0,0 @@ -// -// System.Data.SqlClient.SqlRowUpdatedEventHandler.cs -// -// Author: -// Rodrigo Moya (rodrigo@ximian.com) -// Daniel Morgan (danmorg@sc.rr.com) -// -// (C) Ximian, Inc 2002 -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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 System.Data.SqlClient { - public delegate void SqlRowUpdatedEventHandler (object sender, SqlRowUpdatedEventArgs e); -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventArgs.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventArgs.cs deleted file mode 100644 index 20e4dab04bc..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventArgs.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// System.Data.SqlClient.SqlRowUpdatingEventArgs.cs -// -// Author: -// Rodrigo Moya (rodrigo@ximian.com) -// Daniel Morgan (danmorg@sc.rr.com) -// Tim Coleman (tim@timcoleman.com) -// Umadevi S (sumadevi@novell.com) -// -// (C) Ximian, Inc 2002 -// Copyright (C) Tim Coleman, 2002 -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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 System.Data.SqlClient { - public sealed class SqlRowUpdatingEventArgs : RowUpdatingEventArgs - { - #region Constructors - - public SqlRowUpdatingEventArgs (DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) - : base (row, command, statementType, tableMapping) - { - } - - #endregion // Constructors - - #region Properties - - public new SqlCommand Command { - get { return (SqlCommand) base.Command; } - set { base.Command = value; } - } - - - protected override IDbCommand BaseCommand { - get { - return base.BaseCommand; - } - set { - base.BaseCommand = value as SqlCommand; - } - - - } - - - - #endregion // Properties - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventHandler.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventHandler.cs deleted file mode 100644 index 6ee625c94ee..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventHandler.cs +++ /dev/null @@ -1,38 +0,0 @@ -// -// System.Data.SqlClient.SqlRowUpdatingEventHandler.cs -// -// Author: -// Rodrigo Moya (rodrigo@ximian.com) -// Daniel Morgan (danmorg@sc.rr.com) -// -// (C) Ximian, Inc 2002 -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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 System.Data.SqlClient { - public delegate void SqlRowUpdatingEventHandler(object sender, SqlRowUpdatingEventArgs e); -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlRowsCopiedEventArgs.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlRowsCopiedEventArgs.cs deleted file mode 100644 index 245ab94780d..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlRowsCopiedEventArgs.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// System.Data.SqlClient.SqlRowsCopiedEventArgs.cs -// -// Author: -// Umadevi S (sumadevi@novell.com) -// -// (C) Ximian, Inc 2002 -// Copyright (C) Tim Coleman, 2002 -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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 System.Data.SqlClient { - public class SqlRowsCopiedEventArgs : EventArgs - { - #region Fields - - private long rowsCopied; - private bool abort; - - #endregion - - #region Constructors - - public SqlRowsCopiedEventArgs (long rowsCopied) { - this.rowsCopied = rowsCopied; - } - - #endregion // Constructors - - #region Properties - - public bool Abort { - get { - return this.abort; - } - set { - this.abort = value; - } - } - - public long RowsCopied { - get { - return this.rowsCopied; - } - } - - #endregion // Properties - } -} - diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlRowsCopiedEventHandler.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlRowsCopiedEventHandler.cs deleted file mode 100644 index 0d9e27736f4..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlRowsCopiedEventHandler.cs +++ /dev/null @@ -1,36 +0,0 @@ -// -// System.Data.SqlClient.SqlRowsCopiedEventHandler.cs -// -// Author: -// Umadevi S (sumadevi@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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 System.Data.SqlClient { - public delegate void SqlRowsCopiedEventHandler(object sender, SqlRowsCopiedEventArgs e); -} - diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs deleted file mode 100644 index 3d025a9041d..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs +++ /dev/null @@ -1,149 +0,0 @@ -// -// System.Data.SqlClient.SqlTransaction.cs -// -// Author: -// Tim Coleman (tim@timcoleman.com) -// -// Copyright (C) Tim Coleman, 2002 -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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 System.Data.SqlClient -{ - public sealed class SqlTransaction : DbTransaction, IDbTransaction, IDisposable - { - #region Fields - - bool disposed; - SqlConnection connection; - IsolationLevel isolationLevel; - bool isOpen; - - #endregion - - #region Constructors - - internal SqlTransaction (SqlConnection connection, IsolationLevel isolevel) - { - this.connection = connection; - this.isolationLevel = isolevel; - isOpen = true; - } - - #endregion // Constructors - - #region Properties - - public - new - SqlConnection Connection { - get { return connection; } - } - - internal bool IsOpen { - get { return isOpen; } - } - - public - override - IsolationLevel IsolationLevel { - get { - if (!isOpen) - throw ExceptionHelper.TransactionNotUsable (GetType ()); - return isolationLevel; - } - } - - protected override DbConnection DbConnection { - get { return Connection; } - } - - #endregion // Properties - - #region Methods - - public - override - void Commit () - { - if (!isOpen) - throw ExceptionHelper.TransactionNotUsable (GetType ()); - - connection.Tds.Execute ("COMMIT TRANSACTION"); - connection.Transaction = null; - connection = null; - isOpen = false; - } - - protected override - void Dispose (bool disposing) - { - if (!disposed) { - if (disposing) { - if (isOpen) // in case it is called in the dispose of the class, then the isOpen is already false - Rollback (); - } - disposed = true; - } - } - - - public - override - void Rollback () - { - Rollback (String.Empty); - } - - public void Rollback (string transactionName) - { - if (disposed) - return; - - if (!isOpen) - throw ExceptionHelper.TransactionNotUsable (GetType ()); - - if (connection.Tds.IsConnected) - 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 ExceptionHelper.TransactionNotUsable (GetType ()); - connection.Tds.Execute (String.Format ("SAVE TRANSACTION {0}", savePointName)); - } - - #endregion // Methods - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.platformnotsupported.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.platformnotsupported.cs deleted file mode 100644 index 880b740c48f..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.platformnotsupported.cs +++ /dev/null @@ -1,77 +0,0 @@ -// -// SqlTransaction.cs -// -// Author: -// Rolf Bjarne Kvinge <rolf@xamarin.com> -// -// Copyright (c) 2016 Xamarin, Inc. -// -// 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.Data.SqlClient; - -namespace System.Data.SqlClient -{ - public class SqlTransaction : DbTransaction , IDbTransaction, IDisposable - { - const string EXCEPTION_MESSAGE = "System.Data.SqlClient.SqlTransaction is not supported on the current platform."; - - SqlTransaction () {} - - public override void Commit () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - protected override void Dispose (bool disposing) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public override void Rollback () - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public void Rollback (string transactionName) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public void Save (string savePointName) - { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - } - - public SqlConnection Connection { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - public override IsolationLevel IsolationLevel { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - - protected override DbConnection DbConnection { - get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } - } - } -} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlXmlTextReader.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlXmlTextReader.cs deleted file mode 100644 index 8035991039d..00000000000 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlXmlTextReader.cs +++ /dev/null @@ -1,185 +0,0 @@ -// -// System.Data.SqlClient.SqlXmlTextReader.cs -// -// Author: -// Rodrigo Moya (rodrigo@ximian.com) -// Daniel Morgan (danmorg@sc.rr.com) -// Tim Coleman (tim@timcoleman.com) -// -// (C) Ximian, Inc 2002 -// (C) Daniel Morgan 2002 -// Copyright (C) Tim Coleman, 2002 -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.IO; -using System.Text; - -namespace System.Data.SqlClient { - internal sealed class SqlXmlTextReader : TextReader, IDisposable - { - #region Fields - - bool disposed = false; - bool eof = false; - SqlDataReader reader; - string localBuffer = "<results>"; - int position; - - #endregion // Fields - - #region Constructors - - internal SqlXmlTextReader (SqlDataReader reader) - : base () - { - this.reader = reader; - } - - #endregion - - #region Methods - - public override void Close() - { - reader.Close (); - } - - protected override void Dispose (bool disposing) - { - if (!disposed) { - if (disposing) { - Close (); - ((IDisposable) reader).Dispose (); - } - disposed = true; - } - } - - void IDisposable.Dispose () - { - Dispose (true); - GC.SuppressFinalize (this); - } - - private bool GetNextBuffer () - { - if (eof) { - localBuffer = null; - return false; - } - - position = 0; - if (reader.Read ()) - localBuffer = reader.GetString (0); - else if (reader.NextResult () && reader.Read ()) - localBuffer = reader.GetString (0); - else { - eof = true; - localBuffer = "</results>"; - } - return true; - } - - public override int Peek () - { - bool moreResults; - if (localBuffer == null || localBuffer.Length == 0) { - moreResults = GetNextBuffer (); - if (!moreResults) - return -1; - } - if (eof && position >= localBuffer.Length) - return -1; - return (int) localBuffer[position]; - } - - public override int Read () - { - int result = Peek (); - position += 1; - if (!eof && position >= localBuffer.Length) - GetNextBuffer (); - return result; - } - - public override int Read (char[] buffer, int index, int count) - { - bool moreResults = true; - int countRead = 0; - - if (localBuffer == null) - moreResults = GetNextBuffer (); - - while (moreResults && count - countRead > localBuffer.Length - position) { - localBuffer.CopyTo (position, buffer, index + countRead, localBuffer.Length); - countRead += localBuffer.Length; - moreResults = GetNextBuffer (); - } - if (moreResults && countRead < count) { - localBuffer.CopyTo (position, buffer, index + countRead, count - countRead); - position += count - countRead; - } - - return countRead; - } - - public override int ReadBlock (char[] buffer, int index, int count) - { - return Read (buffer, index, count); - } - - public override string ReadLine () - { - bool moreResults = true; - string outBuffer; - if (localBuffer == null) - moreResults = GetNextBuffer (); - if (!moreResults) - return null; - outBuffer = localBuffer; - GetNextBuffer (); - return outBuffer; - } - - public override string ReadToEnd () - { - string outBuffer = String.Empty; - - bool moreResults = true; - if (localBuffer == null) - moreResults = GetNextBuffer (); - while (moreResults) { - outBuffer += localBuffer; - moreResults = GetNextBuffer (); - } - return outBuffer; - } - - #endregion // Methods - } -} diff --git a/mcs/class/System.Data/Test/DataProviderTests/.gitattributes b/mcs/class/System.Data/Test/DataProviderTests/.gitattributes deleted file mode 100644 index 8df5c9f0eae..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -/README -crlf diff --git a/mcs/class/System.Data/Test/DataProviderTests/Makefile b/mcs/class/System.Data/Test/DataProviderTests/Makefile deleted file mode 100644 index a9dc6eb7f53..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -thisdir = class/System.Data/Test/DataProviderTests -SUBDIRS = setup dataadaptertests datareadertests - -include ../../../../build/rules.make - -all-local $(STD_TARGETS:=-local): - @: - -dist-local: dist-default - diff --git a/mcs/class/System.Data/Test/DataProviderTests/README b/mcs/class/System.Data/Test/DataProviderTests/README deleted file mode 100644 index 7b4133c6132..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/README +++ /dev/null @@ -1,276 +0,0 @@ -Test Framework for Ado.NET
-December 23, 2004
-
-
-Table of Contents
-
- 1.0 Overview
- 2.0 Requirements
- 3.0 Design
- 3.1 Various Components
- 3.2 Low Level Design
-
- 4.0 Setup
- 4.1 Database Setup
- 4.2 Configuration
- 4.3 How to add new database / tables / values
-
- 5.0 DataReader tests:
- 5.1 Control Flow
- 5.2 Configuration files
- 5.3 How to add new queries
-
- 6.0 DataAdapter tests
- 6.1 Control Flow
- 6.2 Configuration files
- 6.3 How to add new queries
-
- 7.0 Running the tests
-
- 8.0 ToDo List
-
-
-
-1.0 Overview
-
- This framework aims at testing various database providers
- using a common set of testcases and comparing the results
- with a static list. This framework abstracts
- the connection, table- creation and other user operations.
-
-
-2.0 Requirements
-
- These are the high-level requirements :
-
- * The framework should abstract database, table,
- sql queries and other user operations.
- * The framework should provide for the setup of
- database tables and store procedures required
- before the actual tests start.
- * The framework should provide for comparison of
- results.
- * One should be able to run the tests for any or all
- of the databases
- * Should be extensible for newer databases
-
-
-3.0 Design
-
- 3.1 Various Components:
-
- The various components of the framework are :
-
- a) Setup / Teardown of database Tables / Stored Procedures :
- This component is used to create test database for each of
- the databases to be tested. It will create tables / stored
- procedures /views based on testing requirements. After
- creating tables, it also populates values (including
- negative/border values) in the tables.
-
- b) Tests for DataProvider Code :
- The tests contained in this component try to connect
- to database, create commands, execute them, and retrieve
- results. In this component, the retrieved results are
- placed in a DataReader and are processed from there only.
-
- c) Tests for System.Data Code :
- These tests are similar to tests in (c) , except that the
- results retrieved from the database are populated in a
- DataSet, which represents an in-memory cache of data.
- Changes made to this DataSet are re-conciliated with the
- database.
-
- d) Results comparison:
- This does not exist as a independent component, but is
- an inevitable part of (c) and (d). This involves comparing
- the values retrieved from the database with the actual
- values entered.
-
- 3.2 Low Level Design
-
- Setup/Teardown of database tables/stored procedures :
-
- * All the operations to be performed on the database (like
- creating, dropping, inserting values ) are specified in
- a config file. All the data necessary for carrying out these
- operations (like the connection parameters, table description,
- column values, column types) are also specified in the
- config (XML) file.
-
- * The first column of each table is the serial no and is
- essentially the primary key. This is done to enforce
- ordering while data retrieval.
-
- * If any constraints have to be defined, they also have to be
- added to this config file.
-
- * Generic stored procedures (that are same for all tables,
- e.g. retrieving values from a table) are also described in
- the config file in the form of a template. This template has
- appropriate tags for table names and columns. By replacing these
- tags with actual names, we get the script for a stored
- procedure. These kinds of stored procedures, if defined, are
- created for all the tables described in the config file.
-
- * For stored procedures using two or more tables, appropriate
- tags have to be mentioned in the template. For example,
- the tag [[TAB2]] will have to be replaced by the name of
- the second table, the tag [[TAB2-COL1]] will have to replaced
- by the name of first column of the second table and so on. This
- is yet to be implemented.
-
- * For tests involving DataAdapter, Dataset, the changes that
- need to be done to the dataset and reconciled back to the
- database are also mentioned in the config file.
-
- Data Provider Tests :
-
- There is a base class which defines those members and methods
- that would be common for all databases. This class essentially
- contains members to hold the connection, commands, data readers,
- dataset, data adapter, etc. and has methods to query / update
- the database and compare the retrieved data against the actual
- data entered (as in the config file).
-
- We then derive a class specific to each database from this base
- class. These derived classes have code specific to each database.
-
- 4.0 Setup
-
- 4.1 Database Setup
-
- As mentioned in section 3.2, all the database operations and
- the required data has to be specified in a config file.
- Right now, this framework supports only four databases :
-
- * MySql
- * MsSql
- * Oracle
- * Postgres
-
- 4.2 Configuration
-
- The configuration file is an XML file in which there is a
- configuration section corresponding to each database. Under each
- such section, we have the following data :
-
- 1) User operations : Create/Drop tables or Insert data
-
- 2) Connection parameters : Connection strings (for connecting
- through ODBC and in the normal way)
- 3) Table definition :
- a) Table name
- b) Names and Types of columns
- c) Any other constraints
-
- 4) Data to be inserted into each table :
- a) Table number in which to enter data
- b) number of rows
- c) value to be entered in each column of various rows
-
- 5) StoredProcedures:
- a) Type of stored procedure (only 'generic' type is
- supported as of now)
- b) Name of the stored procedure
- c) Number of statements it has
- d) Template of the stored procedure body
-
-
- 4.3 How to add new database / tables / values
-
- For adding new databases, we will have to add appropriate
- data to the config file. Also we need to add code for connecting
- to the new database using appropriate providers.
-
- Adding a new table to an existing database or additional rows
- to an existing table, is just a config file change. While
- changing the config file, one must make sure that the number
- of tables/columns/rows are consistent with the data.
-
-
- 5.0 DataReader tests:
-
- 5.1 Configuration :
-
- Apart from the configuration parameteres listed in sec 4.2,
- here the config file also contains the queries to be run on
- each table.
-
- 5.2 Control Flow
-
- The control flow goes like this :
- 1) Create a database connection and command
- 2) Run each of the query and retrieve the data using a DataReader
- 3) Parse the query to find out what all columns were selected
- and from which table
- 4) Verify the data in the DataReader against the ones in the
- config file.
-
- 5.3 How to add new queries
-
- Add appropriate entries to the config file.
-
-
- 6.0 DataAdapter tests
-
- 6.1 Configuration files
-
- In addition to the configuration parameters mentioned in sec 5.1,
- we also have a list of changes to be done to each table. These
- are the changes that have to done to a DataSet before updating
- the database.
- A change description contains the row and the column number to
- be changed and the value.
-
- 6.2 Control Flow
-
- The control flow goes like this :
- 1) Create a database connection and command
- 2) Fill a DataSet by running each of the query specified
- in the config file
- 3) Parse the query to find out what all columns were selected
- and from which table
- 4) Verify the data in the DataSet against the ones in the
- config file.
- 5) Select all data from each table.
- 6) Make appropriate changes to the DataSet and update
- the database
- 7) Clear and Fill the DataSet again.
- 8) Verify the data in the DataSet against the ones in the
- config file considering the changes done.
-
- 6.3 How to add new queries
-
- Config file change.
-
- 7.0 Running the tests
-
- The setup and the tests can be done by issuing a
-
- 'make run-test'
-
- under 'System.Data/Test/DataProviderTests' directory. Doing this will
- first do the setup of databases and run tests for data readers and
- data adapters.
-
- Doing a 'make run-test' under any of the subdirectories 'datadaptertests'
- or 'datareadertests' will run the tests for Data Apadters and
- DataReaders only.
-
- To run tests for a specific database, one needs to do a :
-
- 'make DATABASE=<db> run-test'
-
- 8.0 ToDo List
-
- * To make the framework more extensible
- * Right now the framework understands simple queries (like select) only.
- Also querying from only one table is supported as of now. The frameowrk
- should be a able to understand other kinds of queries too.
- * Only generic stored procedures (common for all tables) are supported
- as of now. We might want to extend this to be able to write stored-procedures
- spanning more than one table, etc
- * Integrate with the daily tests
- * Better error reporting
-
diff --git a/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/DataAdapterBaseTest.cs b/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/DataAdapterBaseTest.cs deleted file mode 100644 index 36c5a7acbf9..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/DataAdapterBaseTest.cs +++ /dev/null @@ -1,592 +0,0 @@ -// -// DataAdapterBaseTest.cs : Defines a base class 'BaseAdapter' that provides the common -// functionality of : -// 1) Reading a config file containing the -// database connection parameters, different -// tables and their description, Values that -// the tables are populated with. -// 2) Retrieves data from these tables (Fills a dataset). -// 3) Compares the retrieved values against the ones -// contained in the config file. -// -// A class specific to each database (and ODBC) is derived from this class. -// These classes contain code specific to different databases (like establishing -// a connection, comparing date values, etc). -// -// Author: -// Satya Sudha K (ksathyasudha@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.IO; -using System.Xml; -using System.Xml.XPath; -using System.Data; -using System.Data.Common; -using System.Configuration; -using System.Text.RegularExpressions; - -namespace MonoTests.System.Data { - - public class BaseAdapter { - - public IDbConnection con; - public IDbCommand cmd; - public DbDataAdapter dataAdapter; - public DataSet dataset; - string [,] setOfChanges; - protected XmlNode configDoc; - - public BaseAdapter (string database) - { - con = null; - cmd = null; - dataAdapter = null; - dataset = null; - setOfChanges = null; - configDoc = (XmlNode) ConfigurationSettings.GetConfig (database); - } - - void CreateCommand () - { - if (con == null) - return; - cmd = con.CreateCommand (); - } - - // Method that actually runs the entire test : Connects to a database, - // retrieves values from different tables, and compares them against - // the values that we had entered - public void RunTest () - { - - GetConnection (); - if (con == null) - return; - - CreateCommand (); - if (cmd == null) - return; - - string noOfQueries = null; - string errorMsg = ""; - string query = null; - - try { - noOfQueries = ConfigClass.GetElement (configDoc, "queries", "numQueries"); - int numQueries = Convert.ToInt32 (noOfQueries); - string tableName = null; - int [] columnNos = null; - int tableNum = 0; - Console.WriteLine ("\n**** Testing Data Retrieval using datasets*****\n"); - - for (int i = 1; i <= numQueries; i++) { - errorMsg = ""; - try { - query = ConfigClass.GetElement (configDoc, "queries", "query" + i); - query = FrameQuery (query, ref columnNos, ref tableNum); - tableName = ConfigClass.GetElement (configDoc, "tables", "table" + tableNum, "name"); - } catch (XPathException e) { - Console.WriteLine (e.Message); - continue; // need not return here; try with the next one - } - - try { - PopulateDataSetFromTable (query, tableName); - } catch (Exception e) { - Console.WriteLine ("Table : {0} : Unable to fill the dataset!!!", tableName); - Console.WriteLine ("ERROR : " + e.Message); - Console.WriteLine ("STACKTRACE : " + e.StackTrace); - continue; - } - - CompareData (tableNum, setOfChanges, columnNos); - } - - string [] columnNames = null; - string noOfTables = ConfigClass.GetElement (configDoc, "tables", "numTables"); - int numTables = 0; - if (noOfTables != null) - numTables = Convert.ToInt32 (noOfTables); - - for (int i = 1; i <= numTables; i++) { - - setOfChanges = null; - try { - tableName = ConfigClass.GetElement (configDoc, "tables", "table" + i, "name"); - columnNames = ConfigClass.GetColumnNames (configDoc, i); - } catch (XPathException e) { - Console.WriteLine (e.Message); - continue; // need not return here; try with the next one - } - - try { - query = "Select " + String.Join (",", columnNames) + " from " + tableName; - PopulateDataSetFromTable (query, tableName); - } catch (Exception e) { - Console.WriteLine ("Table : {0} : Unable to fill the dataset after " + - "updating the database!!!", tableName); - Console.WriteLine ("ERROR : " + e.Message); - Console.WriteLine ("STACKTRACE : " + e.StackTrace); - continue; - } - - if (dataset == null) { - Console.WriteLine ("Unable to populate the dataset!!!"); - continue; - } - - MakeChanges (i, ref errorMsg); - - if (dataset.HasChanges() == false) { - Console.WriteLine ("\nTable : {0} : No Changes for this table in the config file", - tableName); - continue; - } else { - if (ReconcileChanges (tableName, ref errorMsg) == false) { - Console.WriteLine ("Table : {0} : Unable to " + - "update the database !!!", tableName); - Console.WriteLine (errorMsg); - continue; - } else { - Console.WriteLine ("\nTable : {0} : Updated " + - "using datasets", tableName); - } - } - - Console.WriteLine ("\nTable : {0} : Refilling the dataset\n", tableName); - // Clear the data in the dataset - dataset.Clear (); - //Fill again from the database - dataAdapter.Fill (dataset, tableName); - CompareData (i, setOfChanges, null); - } - - } catch (Exception e) { - Console.WriteLine ("ERROR : " + e.Message); - Console.WriteLine ("STACKTRACE : " + e.StackTrace); - } finally { - con.Close (); - con = null; - } - - } - - public virtual IDataReader QueryUsingStoredProc (IDbCommand cmd, - string storedProcName, - string paramName) - { - - cmd.CommandType = CommandType.StoredProcedure; - cmd.CommandText = storedProcName; - IDataReader rdr = null; - try { - rdr = cmd.ExecuteReader (); - } catch (Exception e) { - Console.WriteLine ("Could not execute command : " + cmd.CommandText); - Console.WriteLine ("ERROR : " + e.Message); - Console.WriteLine ("STACKTRACE : " + e.StackTrace); - return null; - } - - return rdr; - } - - protected string FrameQuery (string queryStr, - ref int [] columnNos, - ref int tableNum) - { - string regexp = "\\b(Select|select) (?<columnList>(COLUMNS|((COLUMN\\d+,)*(COLUMN\\d+)))) from (?<tableName>TABLE\\d+)( order by (?<OrderBy>COLUMN\\d+))*"; - Match m = Regex.Match (queryStr, regexp, RegexOptions.ExplicitCapture); - - if (!m.Success) { - Console.WriteLine ("Incorrect query format!!!"); - return null; - } - - columnNos = null; - while (m.Success) { - - string tableTag = m.Result ("${tableName}"); - tableNum = Convert.ToInt32 (tableTag.Replace ("TABLE", "")); - string tableName = ConfigClass.GetElement (configDoc, "tables", tableTag.ToLower (), "name"); - queryStr = queryStr.Replace (tableTag, tableName); - - for (int i = 0; i < m.Groups.Count; i++) { - - Group g = m.Groups [i]; - CaptureCollection cc = g.Captures; - - for (int j = 0; j < cc.Count; j++) { - - string matchedVal = cc [j].Value; - - if (matchedVal.Equals ("COLUMNS")) { - string [] columnNames = ConfigClass.GetColumnNames (configDoc, tableNum); - queryStr = queryStr.Replace ("COLUMNS", String.Join (",", columnNames)); - columnNos = new int [columnNames.Length]; - for (int index = 1; index <= columnNos.Length; index++) { - columnNos [index - 1] = index; - } - } else if (matchedVal.StartsWith ("COLUMN")) { - // May be a column name or a comma - // separated list of columns - string [] listOfColumns = matchedVal.Split (','); - - if (columnNos == null) { - - columnNos = new int [listOfColumns.Length]; - int colIndex = 0; - foreach (string str in listOfColumns) { - int columnNo = Convert.ToInt32 (str.Replace ("COLUMN", "")); - columnNos [colIndex++] = columnNo; - } - } - - foreach (string str in listOfColumns) { - string columnName = ConfigClass.GetElement (configDoc, "tables", - tableTag.ToLower (), str.ToLower (), "name"); - queryStr = queryStr.Replace (str, columnName); - } - } - } - } - - m = m.NextMatch (); - } - - return queryStr; - } - - public virtual bool ReconcileChanges (string tableName, ref string errorMsg) - { - return false; - } - - public virtual void PopulateDataSetFromTable (string queryStr, string tableName) - { - return; - } - - public virtual void MakeChanges (int tableNum, ref string errorMsg) - { - string numchanges = null; - try { - numchanges = ConfigClass.GetElement (configDoc, "values", "table" + tableNum, "changes", "numChanges"); - } catch (Exception e) { - return; - } - - int noChanges = Convert.ToInt32 (numchanges); - string tableName = ConfigClass.GetElement (configDoc, "values", "table" + tableNum, "tableName"); - int numRows = Convert.ToInt32 (ConfigClass.GetElement (configDoc, "values", "table" + tableNum, "numRows")); - int numCols = Convert.ToInt32 (ConfigClass.GetElement (configDoc, "values", "table" + tableNum, "numCols")); - setOfChanges = new string [numRows,numCols]; - - for (int x = 0; x < numRows; x++) - for (int y = 0; y < numCols; y++) - setOfChanges [x,y] = null; - - int dbTableNo = -1; - - foreach (DataTable dbTable in dataset.Tables) { - - dbTableNo ++; - if (tableName.Equals (dbTable.TableName)) - break; - } - - for (int index = 1; index <= noChanges; index++) { - - string tagname = "change" + index; - int row = Convert.ToInt32 (ConfigClass.GetElement (configDoc, "values", - "table" + tableNum, "changes", tagname, "row")); - int col = Convert.ToInt32 (ConfigClass.GetElement (configDoc, "values", - "table" + tableNum, "changes", tagname, "col")); - string value = ConfigClass.GetElement (configDoc, "values", - "table" + tableNum, "changes", tagname, "value"); - setOfChanges [row - 1,col - 1] = value; - DataRow drow = dataset.Tables [dbTableNo].Rows [row - 1]; - DataColumn dcol = dataset.Tables [dbTableNo].Columns [col - 1]; - object dataSetValue = drow [dcol]; - try { - drow [dcol] = ConvertToType (dataSetValue.GetType (), value, ref errorMsg); - } catch (Exception e) { - drow [dcol] = DBNull.Value; - } - } - } - - public virtual object ConvertValue (string value, Type type) - { - return Convert.ChangeType (value, type); - } - - void CompareData (int numTable, string [,] setOfChanges, int [] columnNos) - { - int row = 0; - string errorMsg = ""; - string tableName = null; - try { - tableName = ConfigClass.GetElement (configDoc, "tables", "table"+numTable, "name"); - } catch (Exception e) { - Console.WriteLine ("ERROR : " + e.Message ); - Console.WriteLine ("STACKTRACE : " + e.StackTrace ); - return; - } - - foreach (DataTable dbTable in dataset.Tables) { - if (!tableName.Equals (dbTable.TableName)) - continue; - row = 0; - foreach (DataRow datarow in dbTable.Rows) { - row ++; - string columnValue = null; - int column = 0; - foreach (DataColumn datacolumn in dbTable.Columns) { - column ++; - errorMsg = ""; - int columnNo = column; - if (columnNos != null) { - columnNo = columnNos [column - 1]; -} - if ((setOfChanges != null ) && (setOfChanges [row - 1, columnNo - 1] !=null)) { - columnValue = setOfChanges [row - 1, columnNo - 1]; - } else { - try { - columnValue = ConfigClass.GetElement (configDoc, "values", - "table" + numTable, "row" + row, "column" + columnNo); - } catch (Exception e) { - Console.WriteLine ("ERROR : " + e.Message); - Console.WriteLine ("STACKTRACE : " + e.StackTrace); - } - } - - object obj = null; - Console.Write ("Table: {0} : ROW: {1} COL: {2}", tableName, row , columnNo); - try { - obj = datarow [datacolumn]; - } catch (Exception e) { - - Console.WriteLine ("...FAIL"); - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - errorMsg += "\nProbably the 'DataType' property returned a wrong type!!"; - Console.WriteLine (errorMsg); - obj = null; - continue; - } - - if (AreEqual (obj, columnValue, ref errorMsg)) { - Console.WriteLine ("...OK"); - } else { - Console.WriteLine ("...FAIL"); - - if (!errorMsg.Equals ("")) { - // There was some exception - Console.WriteLine (errorMsg); - } else { - // Comparison failed - Console.WriteLine ("Expected : {0} Got: {1}", columnValue, obj); - } - } - } - Console.WriteLine ("======================"); - } - } - } - - public virtual object GetValue (IDataReader rdr, int columnIndex) - { - - object value = null; - - if (rdr.IsDBNull (columnIndex)) - return null; - - Type type = rdr.GetFieldType (columnIndex); - - switch (type.Name.ToLower ()) { - - case "byte" : value = rdr.GetByte (columnIndex); - break; - case "sbyte" : value = rdr.GetInt16 (columnIndex); - break; - case "boolean" : value = rdr.GetBoolean (columnIndex); - break; - case "int16" : value = rdr.GetInt16 (columnIndex); - break; - case "uint16" : - case "int32" : value = rdr.GetInt32 (columnIndex); - break; - case "uint32" : - case "int64" : value = rdr.GetInt64 (columnIndex); - break; - case "single" : value = rdr.GetFloat (columnIndex); - break; - case "double" : value = rdr.GetDouble (columnIndex); - break; - case "uint64" : - case "decimal" : value = rdr.GetDecimal (columnIndex); - break; - case "datetime": value = rdr.GetDateTime (columnIndex); - break; - case "string": value = rdr.GetString (columnIndex); - break; - default : value = rdr.GetValue (columnIndex); - break; - } - - return value; - - } - - public virtual object ConvertToType (Type type, string value, ref string errorMsg) - { - if (value.Equals ("null")) - return DBNull.Value; - - switch (Type.GetTypeCode (type)) { - case TypeCode.Int16 : - return ConvertToInt16 (type, value, ref errorMsg); - case TypeCode.Int32 : - return ConvertToInt32 (type, value, ref errorMsg); - case TypeCode.Int64 : - return ConvertToInt64 (type, value, ref errorMsg); - case TypeCode.String : - return value; - case TypeCode.Boolean : - return ConvertToBoolean (type, value, ref errorMsg); - case TypeCode.Byte : - return ConvertToByte (type, value, ref errorMsg); - case TypeCode.DateTime : - return ConvertToDateTime (type, value, ref errorMsg); - case TypeCode.Decimal : - return ConvertToDecimal (type, value, ref errorMsg); - case TypeCode.Double : - return ConvertToDouble (type, value, ref errorMsg); - case TypeCode.Single : - return ConvertToSingle (type, value, ref errorMsg); - } - - if (type.ToString () == "System.TimeSpan") - return ConvertToTimeSpan (type, value, ref errorMsg); - - return ConvertValue (type, value, ref errorMsg); - } - - public virtual Boolean AreEqual (object obj, string value, ref string errorMsg) - { - - if (obj.Equals (DBNull.Value) || (value.Equals ("null"))) { - if (obj.Equals (DBNull.Value) && value.Equals ("null")) - return true; - return false; - } - Type objType = obj.GetType (); - value = value.Trim ('\''); - value = value.Trim ('\"'); - object valObj = ConvertToType (objType, value, ref errorMsg); - return valObj.Equals (obj); - } - - public virtual object ConvertValue (Type type, string value, ref string errorMsg) - { - - object valObj = null; - - try { - valObj = Convert.ChangeType (value, type); - } catch (InvalidCastException e) { - errorMsg = "Cant convert values!! \n"; - errorMsg += "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return false; - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return false; - } - - return valObj; - - } - - public virtual object ConvertToInt16 (Type type, string value, ref string errorMsg) - { - return ConvertValue (type, value, ref errorMsg); - } - - public virtual object ConvertToInt32 (Type type, string value, ref string errorMsg) - { - return ConvertValue (type, value, ref errorMsg); - } - - public virtual object ConvertToInt64 (Type type, string value, ref string errorMsg) - { - return ConvertValue (type, value, ref errorMsg); - } - - public virtual object ConvertToBoolean (Type type, string value, ref string errorMsg) - { - return ConvertValue (type, value, ref errorMsg); - } - - public virtual object ConvertToByte (Type type, string value, ref string errorMsg) - { - return ConvertValue (type, value, ref errorMsg); - } - - public virtual object ConvertToDateTime (Type type, string value, ref string errorMsg) - { - return ConvertValue (type, value, ref errorMsg); - } - - public virtual object ConvertToDecimal (Type type, string value, ref string errorMsg) - { - return ConvertValue (type, value, ref errorMsg); - } - - public virtual object ConvertToDouble (Type type, string value, ref string errorMsg) - { - return ConvertValue (type, value, ref errorMsg); - } - - public virtual object ConvertToSingle (Type type, string value, ref string errorMsg) - { - return ConvertValue (type, value, ref errorMsg); - } - - public virtual object ConvertToTimeSpan (Type type, string value, ref string errorMsg) - { - return ConvertValue (type, value, ref errorMsg); - } - - public virtual void GetConnection () - { - } - } -} diff --git a/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/DbAdapter.dll.sources b/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/DbAdapter.dll.sources deleted file mode 100644 index 0fc002623be..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/DbAdapter.dll.sources +++ /dev/null @@ -1,5 +0,0 @@ -DataAdapterBaseTest.cs -DbConfig.cs -MsSqlDbAdapterTest.cs -OracleDbAdapterTest.cs -SectionHandler.cs diff --git a/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/DbConfig.cs b/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/DbConfig.cs deleted file mode 100644 index 6b8045cd79a..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/DbConfig.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -// DbConfig.cs : Defines a class 'ConfigClass' that is used to read the config file -// -// Author: -// Satya Sudha K (ksathyasudha@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.IO; -using System.Xml; - -namespace MonoTests.System.Data { - - public class ConfigClass { - - public static string GetElement (XmlNode doc, params string [] args) - { - string element = ""; - - if (args.Length > 0) { - - XmlNode xmlNode = doc.SelectSingleNode (args [0]); - for (int i = 1; i < args.Length; i++) - xmlNode = xmlNode.SelectSingleNode (args [i]); - - element = xmlNode.InnerText.Trim (); - } - - return element; - } - - public static string [] GetColumnNames (XmlNode doc, int tableNum) - { - string tagName = "table" + tableNum; - int numColumns = Convert.ToInt16 (ConfigClass.GetElement (doc, "tables", tagName, "numColumns")); - string [] columns = new string [numColumns]; - - for (int col = 1; col <= numColumns; col++) - columns[col - 1] = ConfigClass.GetElement (doc, "tables", tagName, "column" + col, "name"); - - return columns; - } - - } -} diff --git a/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/Makefile b/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/Makefile deleted file mode 100644 index 5760805c677..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -thisdir=class/System.Data/Test/DataProviderTests/datareadertests - -include ../../../../../build/rules.make - -LIB_MCS_FLAGS = /r:System.Data,System.Data.OracleClient,System,System.Xml - -DATABASE=all - -LIBRARY = DbAdapter.dll -NO_INSTALL=yes -NO_SIGN_ASSEMBLY=yes - -include $(topdir)/build/library.make - -Runtests.exe: $(the_lib) - $(MCS) /r:$(the_lib) Runtests.cs - -DbAdapter.dll: - $(MCS) /r:$(REFERENCES) /target:library /out:DbAdapter.dll @$(SOURCEFILE) - -run-test-local: run-test-db -run-test-db: Runtests.exe - $(TEST_RUNTIME) Runtests.exe $(DATABASE) | tee TestResults.log - -test-local: Runtests.exe - -CLEAN_FILES = *.exe *.dll *.log diff --git a/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/MsSqlDbAdapterTest.cs b/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/MsSqlDbAdapterTest.cs deleted file mode 100644 index 0c0f3442e83..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/MsSqlDbAdapterTest.cs +++ /dev/null @@ -1,182 +0,0 @@ -// -// MsSqlDbAdapterTest.cs :- Defines a class 'MsSqlAdapter' derived from the -// 'BaseAdapter' class -// - Contains code specific to ms sql database -// -// Author: -// Satya Sudha K (ksathyasudha@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.Xml.XPath; -using System.Data; -using System.Data.SqlClient; -using System.Text.RegularExpressions; - - -namespace MonoTests.System.Data { - - public class MsSqlAdapter : BaseAdapter { - - public MsSqlAdapter (string database) : base (database) - { - dataAdapter = new SqlDataAdapter (); - } - - // returns a Open connection - public override void GetConnection () - { - string connectionString = null; - - try { - connectionString = ConfigClass.GetElement (configDoc, "database", "connectionString"); - } catch (XPathException e) { - Console.WriteLine ("Error reading the config file!!!"); - Console.WriteLine (e.Message); - con = null; - return; - } - - con = new SqlConnection (connectionString); - try { - con.Open (); - } catch (SqlException e) { - Console.WriteLine ("Cannot establish connection with the database"); - Console.WriteLine ("Probably the database is down"); - con = null; - } catch (InvalidOperationException e) { - Console.WriteLine ("Cannot open connection "); - Console.WriteLine ("Probably the connection already open"); - con = null; - } catch (Exception e) { - Console.WriteLine ("Cannot open connection "); - con = null; - } - } - - public override object ConvertToBoolean (Type type, string value, ref string errorMsg) - { - short boolValue; - Boolean boolval; - - try { - boolValue = Convert.ToInt16 (value); - boolval = Convert.ToBoolean (boolValue); - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return false; - } - - return boolval; - } - - public override object ConvertToDecimal (Type type, string value, ref string errorMsg) - { - Decimal decVal ; - - try { - decVal = Convert.ToDecimal (value); - } catch (FormatException e) { - // This may be bcoz value is of the form 'd.ddEdd' - Double doubleVal = Convert.ToDouble (value); - decVal = Convert.ToDecimal (doubleVal); - } - - return decVal; - } - - public override object ConvertToDateTime (Type type, string value, ref string errorMsg) - { - - Regex re = new Regex ("\\b(?<month>\\d{1,2})/(?<day>\\d{1,2})/(?<year>\\d{2,4})\\s+(?<hour>\\d{1,2}):(?<min>\\d{1,2})(:(?<sec>\\d{1,2})(\\.(?<msec>\\d{1,3}))*)*"); - - value = value.Trim ('\''); - Match m = re.Match (value); - - int month, day, year, hour, min, sec, msec; - month = day = year = hour = min = sec = msec = 0; - month = Convert.ToInt32 (m.Result ("${month}")); - day = Convert.ToInt32 (m.Result ("${day}")); - year = Convert.ToInt32 (m.Result ("${year}")); - string str = m.Result ("${hour}"); - - if (!str.Equals ("")) - hour = Convert.ToInt32 (str); - str = m.Result ("${min}"); - if (!str.Equals ("")) - min = Convert.ToInt32 (str); - str = m.Result ("${sec}"); - if (!str.Equals ("")) - sec = Convert.ToInt32 (str); - str = m.Result ("${msec}"); - if (!str.Equals ("")) - msec = Convert.ToInt32 (str); - DateTime dateObj; - - try { - if (hour == 0 && min == 0 && sec == 0) - dateObj = new DateTime (year, month, day); - else { - if (msec != 0) { - dateObj = new DateTime (year, month, day, hour, min, sec, msec); - } else { - dateObj = new DateTime (year, month, day, hour, min, sec); - } - } - } catch (Exception e) { - errorMsg = "Invalid DateTime Value\n"; - errorMsg += "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return false; - } - - return dateObj; - - } - - public override void PopulateDataSetFromTable (string queryStr, string tableName) - { - cmd.CommandText = queryStr; - SqlDataAdapter da = (SqlDataAdapter) dataAdapter; - da.SelectCommand = (SqlCommand) cmd; - dataset = new DataSet (); - da.Fill (dataset, tableName); - } - - public override bool ReconcileChanges (string tableName, ref string errorMsg) - { - try { - new SqlCommandBuilder ((SqlDataAdapter) dataAdapter); - dataAdapter.Update (dataset, tableName); - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return false; - } - return true; - } - } -} diff --git a/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/MySqlDbAdapterTest.cs b/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/MySqlDbAdapterTest.cs deleted file mode 100644 index e806bca5030..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/MySqlDbAdapterTest.cs +++ /dev/null @@ -1,187 +0,0 @@ -// -// MySqlDbAdapterTest.cs :- Defines a class 'MySqlAdapter' derived from the -// 'BaseAdapter' class -// - Contains code specific to mysql database -// -// Author: -// Satya Sudha K (ksathyasudha@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.Xml.XPath; -using System.Data; -using System.Data.Common; -using ByteFX.Data.MySqlClient; -using System.Text.RegularExpressions; - -namespace MonoTests.System.Data { - - public class MySqlAdapter : BaseAdapter { - - public MySqlAdapter (string database) : base (database) - { - dataAdapter = new MySqlDataAdapter (); - } - - // returns a Open connection - public override void GetConnection () - { - - string connectionString = null; - try { - connectionString = ConfigClass.GetElement (configDoc, "database", "connectionString"); - } catch (XPathException e) { - Console.WriteLine ("Error reading the config file !!"); - Console.WriteLine (e.Message); - con = null; - return; - } - - con = new MySqlConnection (connectionString); - try { - con.Open (); - } catch (MySqlException e) { - Console.WriteLine ("Cannot establish connection with the database"); - Console.WriteLine ("Probably the Database is down "); - con = null; - } catch (InvalidOperationException e) { - Console.WriteLine ("Cannot open connection "); - Console.WriteLine ("Probably the connection is already open"); - con = null; - } catch (Exception e) { - Console.WriteLine ("Cannot open connection "); - con = null; - } - } - - public override object ConvertToDateTime (Type type, string value, ref string errorMsg) - { - - string dateStr = value.Trim ('\''); - dateStr = dateStr.Trim ('\"'); - int year, month, day, hour, min, sec; - year = month = day = hour = min = sec = 0; - Char [] splChars = {'!','@','#','$','%','^','&','*','-','+','.',','}; - string [] dateParts = dateStr.Split (' '); - - for (int index = 0; index < splChars.Length; index++) { - dateParts [0] = dateParts [0].Replace (splChars [index], '/'); - if (dateParts.Length > 1) - dateParts [1] = dateParts [1].Replace (splChars [index], ':'); - } - - dateStr = String.Join (" ", dateParts); - Regex re = new Regex ("\\b(?<year>\\d{2,4})/(?<month>\\d{1,2})/(?<day>\\d{1,2})(\\s+(?<hour>\\d{1,2}):(?<min>\\d{1,2}):(?<sec>\\d{1,2}))*"); - - Match m = re.Match (dateStr); - - if (!m.Success) { - re = new Regex ("\\b(?<year>\\d{4})(?<month>\\d{2})(?<day>\\d{2})((?<hour>\\d{2})(?<min>\\d{2})(?<sec>\\d{2}))*"); - m = re.Match (dateStr); - } - - string matchedVal = m.Result ("${year}"); - - if (!matchedVal.Equals ("")) - year = Convert.ToInt32 (matchedVal); - matchedVal = m.Result ("${month}"); - if (!matchedVal.Equals ("")) - month = Convert.ToInt32 (matchedVal); - matchedVal = m.Result ("${day}"); - if (!matchedVal.Equals ("")) - day = Convert.ToInt32 (matchedVal); - matchedVal = m.Result ("${hour}"); - if (!matchedVal.Equals ("")) - hour = Convert.ToInt32 (matchedVal); - matchedVal = m.Result ("${min}"); - if (!matchedVal.Equals ("")) - min = Convert.ToInt32 (matchedVal); - matchedVal = m.Result ("${sec}"); - if (!matchedVal.Equals ("")) - sec = Convert.ToInt32 (matchedVal); - - DateTime dateTime; - - try { - dateTime = new DateTime (year, month, day, hour, min, sec); - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return false; - } - - return dateTime; - } - - public override object ConvertToTimeSpan (Type type, string value, ref string errorMsg) - { - - // Format the input string as 'hh:mm:yy' - string dateStr = value.Trim ('\''); - - if (dateStr.IndexOf (':') == -1) { - // String in the form 'hhmmss', insert ':'s in between - dateStr = dateStr.Substring (0, 2) + ":" + - dateStr.Substring (2, 2) + ":" + - dateStr.Substring (4, 2); - } - - TimeSpan timespan; - - try { - timespan = TimeSpan.Parse (dateStr); - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return false; - } - - return timespan; - } - - public override void PopulateDataSetFromTable (string queryStr, string tableName) - { - cmd.CommandText = queryStr; - MySqlDataAdapter da = (MySqlDataAdapter) dataAdapter; - da.SelectCommand = (MySqlCommand) cmd; - dataset = new DataSet (); - da.Fill (dataset, tableName); - } - - public override bool ReconcileChanges (string tableName, ref string errorMsg) - { - try { - new MySqlCommandBuilder ((MySqlDataAdapter) dataAdapter); - dataAdapter.Update (dataset, tableName); - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return false; - } - - return true; - } - } -} diff --git a/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/OracleDbAdapterTest.cs b/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/OracleDbAdapterTest.cs deleted file mode 100644 index fbfe54c1f3e..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/OracleDbAdapterTest.cs +++ /dev/null @@ -1,342 +0,0 @@ -// -// OracleDbAdapterTest.cs :- Defines a class 'OraAdapter' derived from the -// 'BaseAdapter' class. -// - Contains code specific to oracle database -// -// Author: -// Satya Sudha K (ksathyasudha@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.Xml.XPath; -using System.Data; -using System.Data.OracleClient; -using System.Text.RegularExpressions; - -namespace MonoTests.System.Data { - - public class OraAdapter : BaseAdapter { - - public OraAdapter (string database) : base (database) - { - dataAdapter = new OracleDataAdapter (); - } - - // returns a Open connection - public override void GetConnection () - { - string connectionString = null; - try { - connectionString = ConfigClass.GetElement (configDoc, "database", "connectionString"); - } catch (XPathException e) { - Console.WriteLine ("Error reading the config file !!"); - Console.WriteLine (e.Message); - con = null; - return; - } - - con = new OracleConnection (connectionString); - - try { - con.Open (); - } catch (OracleException e) { - Console.WriteLine ("Cannot establish connection with the database"); - Console.WriteLine ("Probably the database is down"); - con = null; - } catch (InvalidOperationException e) { - Console.WriteLine ("Cannot open connection"); - Console.WriteLine("Probably the connection is already open"); - con = null; - } catch (Exception e) { - Console.WriteLine ("Cannot open connection "); - con = null; - } - } - - public override object GetValue (IDataReader reader, int columnIndex) - { - - object value = null; - if (reader.IsDBNull (columnIndex)) { - return null; - } - - OracleDataReader rdr = (OracleDataReader) reader; - - Type type = rdr.GetFieldType (columnIndex); - string datatypeName = rdr.GetDataTypeName (columnIndex); - - if (datatypeName.ToLower ().Equals ("interval year to month")) { - value = rdr.GetOracleMonthSpan (columnIndex); - return value; - } - - switch (type.Name.ToLower ()) { - - case "int32": - value = rdr.GetInt32 (columnIndex); - break; - case "decimal" : - try { - value = rdr.GetDecimal (columnIndex); - } catch (Exception e) { - value = rdr.GetOracleNumber (columnIndex); - } - break; - case "datetime": value = rdr.GetDateTime (columnIndex); - break; - case "string": value = rdr.GetString (columnIndex); - break; - case "timespan" : value = rdr.GetTimeSpan (columnIndex); - break; - default : value = rdr.GetValue (columnIndex); - break; - } - - return value; - } - - public override Boolean AreEqual (object obj, string value, ref string errorMsg) - { - if ((obj == null ) || (value.Equals ("null"))) { - if (obj == null && value.Equals ("null")) - return true; - return false; - } - - if (obj.Equals (DBNull.Value) || (value.Equals ("null"))) { - if (obj.Equals (DBNull.Value) && value.Equals ("null")) - return true; - return false; - } - - Type objType = obj.GetType (); - object valObj = null; - - value = value.Trim ('\''); - value = value.Trim ('\"'); - - switch (objType.ToString ()) { - - case "System.Data.OracleClient.OracleNumber" : - return CompareOracleNumber (obj, value, ref errorMsg); - case "System.Data.OracleClient.OracleMonthSpan" : - valObj = ConvertToOracleMonthSpan (objType, value, ref errorMsg); - return valObj.Equals (obj); - case "System.Decimal" : - valObj = ConvertToDecimal (objType, value, ref errorMsg); - return valObj.Equals (obj); - case "System.String" : - return value.Equals (obj); - case "System.TimeSpan" : - valObj = ConvertToTimeSpan (objType, value, ref errorMsg); - return valObj.Equals (obj); - case "System.DateTime" : - valObj = ConvertToDateTime (objType, value, ref errorMsg); - return valObj.Equals (obj); - case "System.Int32" : - valObj = ConvertToInt32 (objType, value, ref errorMsg); - return valObj.Equals (obj); - - } - - valObj = ConvertValue (objType, value, ref errorMsg); - - if (valObj == null) { - Console.WriteLine ("Unable to convert values!!!"); - Console.WriteLine (errorMsg); - return false; - } - - return valObj.Equals (obj); - } - - public override object ConvertToDecimal (Type type, string value, ref string errorMsg) - { - decimal decimalval; - try { - decimalval = Convert.ToDecimal (value); - } catch (FormatException e) { - // This may be bcoz value is of the form 'd.ddEdd' - Double doubleVal = Convert.ToDouble (value); - decimalval = Convert.ToDecimal (doubleVal); - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return null; - } - - return decimalval; - } - - public override object ConvertToInt32 (Type type, string value, ref string errorMsg) - { - int intval; - - try { - intval = Convert.ToInt32 (value); - } catch (FormatException e) { - // This might be interval year to month - bool isNegative = false; - if (value.StartsWith ("-")) { - isNegative = true; - value = value.Trim ('-'); - } - - string [] intParts = value.Split ('-'); - intval = Convert.ToInt32 (intParts [0]) * 12 + Convert.ToInt32 (intParts [1]); - if (isNegative) - intval *= -1; - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return null; - } - - return intval; - - } - - public override object ConvertToDateTime (Type type, string value, ref string errorMsg) - { - - value = value.ToLower ().Trim (); - string format = null, date = null; - - if (value.StartsWith ("to_date")) { - - value = value.Remove (0, 8); - value = value.Remove (value.Length - 1, 1); - string[] dateParts = value.Split(','); - date = dateParts [0].Trim (); - format = dateParts [1].Trim (); - - date = date.Trim ('\''); - format = format.Trim ('\''); - // Assuming that date will be in yyyy-mm-dd hh24:mi:ss only - format = format.Replace ("yyyy", "(?<yyyy>\\d{4})"); - format = format.Replace ("mm", "(?<mm>\\d{2})"); - format = format.Replace ("dd", "(?<dd>\\d{2})"); - format = format.Replace ("hh24", "(?<hh24>\\d{2})"); - format = format.Replace ("mi", "(?<mi>\\d{2})"); - format = format.Replace ("ss", "(?<ss>\\d{2})"); - - } else if (value.ToLower ().StartsWith ("timestamp")) { - value = value.Remove (0, 9); - value = value.Trim (); - date = value.Trim ('\''); - format = "\\b(?<yyyy>\\d{4})\\-(?<mm>\\d{2})\\-(?<dd>\\d{2}) (?<hh24>\\d{2}):(?<mi>\\d{2}):(?<ss>\\d{2})"; - - } - - Regex re = new Regex (format); - Match m = re.Match (date); - - if (!m.Success) - return false; - - int year = Convert.ToInt32 (m.Result ("${yyyy}")); - int month = Convert.ToInt32 (m.Result ("${mm}")); - int day = Convert.ToInt32 (m.Result ("${dd}")); - int hour = Convert.ToInt32 (m.Result ("${hh24}")); - int min = Convert.ToInt32 (m.Result ("${mi}")); - int sec = Convert.ToInt32 (m.Result ("${ss}")); - - DateTime newDt ; - - try { - newDt = new DateTime (year, month, day, hour, min, sec); - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return false; - } - - return newDt; - } - - Boolean CompareOracleNumber (object obj, string value, ref string errorMsg) - { - return value.Equals (obj.ToString ()); - } - - object ConvertToOracleMonthSpan (Type type, string value, ref string errorMsg) - { - int intervalInMonths = 0; - bool isNegative = false; - - if (value.StartsWith ("-")) { - isNegative = true; - value = value.Trim ('-'); - } - - string [] intParts = value.Split ('-'); - - if (intParts.Length > 0) { - intervalInMonths = Convert.ToInt32 (intParts [0]) * 12; - if (intParts.Length > 1) - intervalInMonths += Convert.ToInt32 (intParts [1]); - } else {// Should not come here - return false; - } - - if (isNegative) - intervalInMonths *= -1; - - return new OracleMonthSpan (intervalInMonths); - } - - public override object ConvertToTimeSpan (Type type, string value, ref string errorMsg) - { - // Input in the form '[-]dd hh:mi:ss' - value = value.Replace (" ", "."); - TimeSpan ts = TimeSpan.Parse (value); - return ts; - } - - public override void PopulateDataSetFromTable (string queryStr, string tableName) - { - cmd.CommandText = queryStr; - OracleDataAdapter da = (OracleDataAdapter) dataAdapter; - da.SelectCommand = (OracleCommand) cmd; - dataset = new DataSet (); - da.Fill (dataset, tableName); - } - - public override bool ReconcileChanges (string tableName, ref string errorMsg) - { - try { - new OracleCommandBuilder ((OracleDataAdapter)dataAdapter); - dataAdapter.Update (dataset, tableName); - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return false; - } - - return true; - } - } -} diff --git a/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/PostgresDbAdapterTest.cs b/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/PostgresDbAdapterTest.cs deleted file mode 100644 index b7b2da0eb21..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/PostgresDbAdapterTest.cs +++ /dev/null @@ -1,172 +0,0 @@ -// -// PostgresDbAdapterTest.cs :- Defines a class 'PostgresAdapter' derived from the -// 'BaseAdapter' class -// - Contains code specific to postgres database -// -// Author: -// Satya Sudha K (ksathyasudha@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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 Npgsql; -using System.Text.RegularExpressions; - -namespace MonoTests.System.Data { - - public class PostgresAdapter : BaseAdapter { - - public PostgresAdapter (string database) : base (database) - { - dataAdapter = new NpgsqlDataAdapter (); - } - - // returns a Open connection - public override void GetConnection () - { - string connectionString = null; - try { - connectionString = ConfigClass.GetElement (configDoc, "database", "connectionString"); - } catch (Exception e) { - Console.WriteLine ("Error reading the config file"); - Console.WriteLine (e.Message); - con = null; - return; - } - - con = new NpgsqlConnection (connectionString); - - try { - con.Open (); - } catch (NpgsqlException e) { - Console.WriteLine ("Cannot establish connection with the database"); - Console.WriteLine ("Probably the Database is down!!"); - con = null; - } catch (InvalidOperationException e) { - Console.WriteLine ("Cannot establish connection with the database"); - Console.WriteLine ("Probably connection is already open"); - con = null; - } catch (Exception e) { - Console.WriteLine ("Cannot open connection "); - con = null; - } - } - - public override object ConvertToDateTime (Type type, string value, ref string errorMsg) - { - - int month, day, year, hour, min, sec; - month = day = year = hour = min = sec = 0; - double msec = 0; - msec = 0; - - Regex re = new Regex ("\\b(?<year>\\d{2,4})\\-(?<month>\\d{1,2})\\-(?<day>\\d{1,2})(\\s+(?<hour>\\d{1,2}):(?<minute>\\d{1,2}):(?<sec>\\d{1,2})(\\.(?<msec>\\d{1,6}))*)*"); - - value = value.Trim ('\''); - value = value.Trim ('\"'); - Match m = re.Match (value); - string matchedVal = null; - - if (m.Success) { - matchedVal = m.Result ("${year}"); - if (!matchedVal.Equals ("")) - year = Convert.ToInt32 (matchedVal); - - matchedVal = m.Result ("${month}"); - if (!matchedVal.Equals ("")) - month = Convert.ToInt32 (matchedVal); - - matchedVal = m.Result ("${day}"); - if (!matchedVal.Equals ("")) - day = Convert.ToInt32 (matchedVal); - } else { - // Only timespan - re = new Regex ("\\b(?<hour>\\d{1,2}):(?<minute>\\d{1,2}):(?<sec>\\d{1,2})(\\.(?<msec>\\d{1,6}))*"); - m = re.Match (value); - } - - try { - - matchedVal = m.Result ("${hour}"); - if (!matchedVal.Equals ("")) - hour = Convert.ToInt32 (matchedVal); - - matchedVal = m.Result ("${minute}"); - if (!matchedVal.Equals ("")) - min = Convert.ToInt32 (matchedVal); - - matchedVal = m.Result ("${sec}"); - if (!matchedVal.Equals ("")) - sec = Convert.ToInt32 (matchedVal); - - matchedVal = m.Result ("${msec}"); - if (!matchedVal.Equals ("")) { - //matchedVal = matchedVal.PadRight(6, '0'); - msec = Convert.ToDouble (matchedVal); - if (msec > 1000) - msec = msec / 1000; - } - - if (day == 0 && month == 0 && year == 0) { - // Time span only - TimeSpan ts =TimeSpan.Parse(value); - return ts; - - } else { - DateTime dateObj = new DateTime (year, month, day, hour, min, sec); - dateObj = dateObj.AddMilliseconds (msec); - return dateObj; - } - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return null; - } - } - - public override void PopulateDataSetFromTable (string queryStr, string tableName) - { - cmd.CommandText = queryStr; - NpgsqlDataAdapter da = (NpgsqlDataAdapter) dataAdapter; - da.SelectCommand = (NpgsqlCommand) cmd; - dataset = new DataSet (); - da.Fill (dataset, tableName); - } - - public override bool ReconcileChanges (string tableName, ref string errorMsg) - { - try { - new NpgsqlCommandBuilder ((NpgsqlDataAdapter) dataAdapter); - dataAdapter.Update (dataset, tableName); - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return false; - } - - return true; - } - } -} diff --git a/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/Runtests.cs b/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/Runtests.cs deleted file mode 100644 index 64a3fe4ad5a..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/Runtests.cs +++ /dev/null @@ -1,80 +0,0 @@ -// -// Runtests.cs : A driver for running the tests for all or specific databases -// -// Author: -// Satya Sudha K (ksathyasudha@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.Configuration; -using MonoTests.System.Data; - -class RunTest { - - public static void Main (string [] args) - { - string [] databases = null; - if (args.Length == 0 || (args.Length == 1 && args [0].Equals ("all"))) { - // Run test for all databases - string listOfDbs = ConfigurationSettings.AppSettings ["Databases"]; - databases = listOfDbs.Split (';'); - } else { - databases = (string []) args.Clone (); - } - - BaseAdapter dbAdapter = null; - - foreach (string str in databases) { - - switch (str) { -/* - case "mysql" : - Console.WriteLine ("\n ****** Running tests for MYSQL ***** \n"); - dbAdapter = new MySqlAdapter ("mysql"); - dbAdapter.RunTest (); - break; -*/ - - case "mssql" : - Console.WriteLine ("\n ****** Running tests for MS SQL ***** \n"); - dbAdapter = new MsSqlAdapter ("mssql"); - dbAdapter.RunTest (); - break; - case "oracle" : - Console.WriteLine ("\n ****** Running tests for ORACLE ***** \n"); - dbAdapter = new OraAdapter ("oracle"); - dbAdapter.RunTest (); - break; -/* - case "postgres" : - Console.WriteLine ("\n ****** Running tests for POSTGRE ***** \n"); - dbAdapter = new PostgresAdapter ("postgres"); - dbAdapter.RunTest (); - break; -*/ - } - } - } -} diff --git a/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/Runtests.exe.config b/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/Runtests.exe.config deleted file mode 100644 index 1500e86db33..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/Runtests.exe.config +++ /dev/null @@ -1,1308 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<configuration> - - <configSections> - <section name="mysql" type="SectionHandlers.SectionHandler, DbRetrieve" allowLocation="true"/> - <section name="mssql" type="SectionHandlers.SectionHandler, DbRetrieve" allowLocation="true"/> - <section name="postgres" type="SectionHandlers.SectionHandler, DbRetrieve" allowLocation="true"/> - <section name="oracle" type="SectionHandlers.SectionHandler, DbRetrieve" allowLocation="true"/> - </configSections> - - <appSettings> - <add key="databases" value="mssql" /> - <add key="deleteTables" value="Y"/> - <add key="createTables" value="Y"/> - <add key="insertData" value="Y"/> - </appSettings> - - <mysql> - <database> - <name> mysql </name> - <connectionString> "Server=164.99.152.215;Database=mysql;User Id=sudha;Password=novell" </connectionString> - <OdbcConnString>DSN=Mysql-Test-DSN;uid=sudha;pwd=novell </OdbcConnString> - </database> - <tables> - <numTables> 3 </numTables> - <table1> - <name>numericTable </name> - <numColumns>15</numColumns> - <column1> - <name> serialNo </name> - <type> TINYINT UNSIGNED</type> - <constraint> PRIMARY KEY</constraint> - </column1> - <column2> - <name> unsigned_tinyInt </name> - <type> TINYINT UNSIGNED</type> - </column2> - <column3> - <name> signed_tinyInt </name> - <type> TINYINT </type> - </column3> - <column4> - <name> bit </name> - <type> BIT </type> - </column4> - <column5> - <name> bool </name> - <type> BOOL </type> - </column5> - <column6> - <name> unsigned_smallint</name> - <type> SMALLINT UNSIGNED</type> - </column6> - <column7> - <name> signed_smallint</name> - <type> SMALLINT </type> - </column7> - <column8> - <name> unsigned_mediumint</name> - <type> MEDIUMINT UNSIGNED</type> - </column8> - <column9> - <name> signed_mediumint</name> - <type> MEDIUMINT </type> - </column9> - <column10> - <name> unsigned_int</name> - <type> INT UNSIGNED</type> - </column10> - <column11> - <name> signed_int</name> - <type> INT </type> - </column11> - <column12> - <name> unsigned_integer</name> - <type> INTEGER UNSIGNED</type> - </column12> - <column13> - <name> signed_integer</name> - <type> INTEGER </type> - </column13> - <column14> - <name> unsigned_bigint</name> - <type> BIGINT UNSIGNED </type> - </column14> - <column15> - <name> signed_bigint</name> - <type> BIGINT </type> - </column15> - </table1> - <table2> - <name>realNoTable </name> - <numColumns>11</numColumns> - <column1> - <name> serialNo </name> - <type> TINYINT UNSIGNED </type> - </column1> - <column2> - <name> unsigned_float </name> - <type> FLOAT(24) UNSIGNED </type> - </column2> - <column3> - <name> signed_float </name> - <type> FLOAT(24) </type> - </column3> - <column4> - <name> unsigned_double_float </name> - <type> FLOAT(25) UNSIGNED</type> - </column4> - <column5> - <name> signed_double_float </name> - <type> FLOAT(53) </type> - </column5> - <column6> - <name> unsigned_double</name> - <type> DOUBLE UNSIGNED </type> - </column6> - <column7> - <name> signed_double</name> - <type> DOUBLE </type> - </column7> - <column8> - <name> unsigned_double_precision</name> - <type> DOUBLE PRECISION UNSIGNED</type> - </column8> - <column9> - <name> signed_real</name> - <type> REAL </type> - </column9> - <column10> - <name> unsigned_decimal</name> - <type> DECIMAL(6,3) UNSIGNED</type> - </column10> - <column11> - <name> signed_numeric</name> - <type> NUMERIC(5,3) </type> - </column11> - </table2> - <table3> - <name>dateTable </name> - <numColumns>6</numColumns> - <column1> - <name> serialNo </name> - <type> TINYINT UNSIGNED </type> - </column1> - <column2> - <name> dateField</name> - <type> DATE </type> - </column2> - <column3> - <name> datetimeField</name> - <type> DATETIME </type> - </column3> - <column4> - <name> timestampField</name> - <type> TIMESTAMP </type> - </column4> - <column5> - <name> timeField</name> - <type> TIME </type> - </column5> - <column6> - <name> yearField</name> - <type> YEAR </type> - </column6> - </table3> - </tables> - <values> - <numTables>3</numTables> - <table1> - <tableName>numericTable</tableName> - <numRows>4</numRows> - <numCols>15</numCols> - <row1> - <column1> 1 </column1> - <column2> 0</column2> - <column3> -128</column3> - <column4> -128</column4> - <column5> -128</column5> - <column6> 0 </column6> - <column7> -32768 </column7> - <column8> 0</column8> - <column9> -8388608 </column9> - <column10> 0 </column10> - <column11> -2147483648 </column11> - <column12> 0 </column12> - <column13> -2147483648 </column13> - <column14> 0 </column14> - <column15> -9223372036854775808 </column15> - </row1> - <row2> - <column1> 2 </column1> - <column2> 100</column2> - <column3> 50 </column3> - <column4> 100 </column4> - <column5> 100 </column5> - <column6> 3000 </column6> - <column7> -300 </column7> - <column8> 500000 </column8> - <column9> -100000 </column9> - <column10> 4000000 </column10> - <column11> 500000 </column11> - <column12> 4000000 </column12> - <column13> 500000 </column13> - <column14> 5000000000 </column14> - <column15> -5000000000 </column15> - </row2> - <row3> - <column1> 3 </column1> - <column2> 255</column2> - <column3> 127</column3> - <column4> 127</column4> - <column5> 127</column5> - <column6> 65535</column6> - <column7> 32767 </column7> - <column8> 16777215 </column8> - <column9> 8388607 </column9> - <column10> 4294967295 </column10> - <column11> 2147483647 </column11> - <column12> 4294967295 </column12> - <column13> 2147483647 </column13> - <column14> 18446744073709551615 </column14> - <column15> 9223372036854775807 </column15> - </row3> - <row4> - <column1> 4 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - <column6> null </column6> - <column7> null </column7> - <column8> null </column8> - <column9> null </column9> - <column10> null </column10> - <column11> null </column11> - <column12> null </column12> - <column13> null </column13> - <column14> null </column14> - <column15> null </column15> - </row4> - <changes> - <numChanges>5</numChanges> - <change1> - <row>1</row> - <col>2</col> - <value>58 </value> - </change1> - <change2> - <row>1</row> - <col>6</col> - <value> 10 </value> - </change2> - <change3> - <row>2</row> - <col>3</col> - <value>27 </value> - </change3> - <change4> - <row>2</row> - <col>6</col> - <value>999 </value> - </change4> - <change5> - <row>1</row> - <col>14</col> - <value>999</value> - </change5> - </changes> - </table1> - <table2> - <tableName>realNoTable</tableName> - <numRows>6</numRows> - <numCols>11</numCols> - <row1> - <column1> 1 </column1> - <column2> 0 </column2> - <column3> 0 </column3> - <column4> 0 </column4> - <column5> 0 </column5> - <column6> 0 </column6> - <column7> 0 </column7> - <column8> 0 </column8> - <column9> 0 </column9> - <column10> 0 </column10> - <column11> 0 </column11> - </row1> - <row2> - <column1> 2 </column1> - <column2> 1.175494351E-38 </column2> - <column3> -3.402823466E+38 </column3> - <column4> 1.175494351E-38 </column4> - <column5> -1.797693134862315E+308 </column5> - <column6> 1.175494351E-38 </column6> - <column7> -1.797693134862315E+308 </column7> - <column8> 1.175494351E-38 </column8> - <column9> -1.797693134862315E+308 </column9> - <column10> 99.999 </column10> - <column11> -23.456 </column11> - </row2> - <row3> - <column1> 3 </column1> - <column2> 3.402823466E+38 </column2> - <column3> -1.175494351E-38 </column3> - <column4> 3.402823466E+38 </column4> - <column5> -2.2250738585072014E-308 </column5> - <column6> 3.402823466E+38 </column6> - <column7> -2.2250738585072014E-308 </column7> - <column8> 3.402823466E+38 </column8> - <column9> -2.2250738585072014E-308 </column9> - <column10> 778.123 </column10> - <column11> -99.999 </column11> - </row3> - <row4> - <column1> 4 </column1> - <column2> 1.2345E+20</column2> - <column3> 1.175494351E-38 </column3> - <column4> 1.2345E+20 </column4> - <column5> 2.2250738585072014E-308 </column5> - <column6> 1.2345E+20 </column6> - <column7> 2.2250738585072014E-308 </column7> - <column8> 1.2345E+20 </column8> - <column9> 2.2250738585072014E-308 </column9> - <column10> 308.90 </column10> - <column11> 12.345 </column11> - </row4> - <row5> - <column1> 5 </column1> - <column2> 3.452E-19</column2> - <column3> 3.402823466E+38 </column3> - <column4> 4.32E-15 </column4> - <column5> 1.797693134862315E+308 </column5> - <column6> 4.32E-15 </column6> - <column7> 1.797693134862315E+308 </column7> - <column8> 4.32E-15 </column8> - <column9> 1.797693134862315E+308 </column9> - <column10> 999.999 </column10> - <column11> 999.999 </column11> - </row5> - <row6> - <column1> 6 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - <column6> null </column6> - <column7> null </column7> - <column8> null </column8> - <column9> null </column9> - <column10> null </column10> - <column11> null </column11> - </row6> - <changes> - <numChanges>1</numChanges> - <change1> - <row>1</row> - <col>2</col> - <value>67.58 </value> - </change1> - <change2> - <row>1</row> - <col>5</col> - <value>1.58E+124 </value> - </change2> - <change3> - <row>2</row> - <col>7</col> - <value>-1.58E-124 </value> - </change3> - <change4> - <row>1</row> - <col>8</col> - <value>1.12238E-62 </value> - </change4> - </changes> - </table2> - <table3> - <tableName>dateTable</tableName> - <numRows>9</numRows> - <numCols>6</numCols> - <row1> - <column1> 1 </column1> - <column2> '1000-01-01' </column2> - <column3> '1000-01-01 00:00:00' </column3> - <column4> '1970-01-02 00:00:00' </column4> - <column5> '-23:59:59' </column5> - <column6> 2004 </column6> - </row1> - <row2> - <column1> 2 </column1> - <column2> '1999-12-17' </column2> - <column3> '1999-12-17 08:00:00' </column3> - <column4> '2000-01-01 04:40:00' </column4> - <column5> '-23:45:56' </column5> - <column6> 1999 </column6> - </row2> - <row3> - <column1> 3 </column1> - <column2> '9999-12-31' </column2> - <column3> '9999-12-31 23:59:59' </column3> - <column4> '2037-12-31 23:59:59' </column4> - <column5> '23:59:59' </column5> - <column6> 2155</column6> - </row3> - <row4> - <column1> 4 </column1> - <column2> '1999@12@31' </column2> - <column3> '1999@12@31 11+30+45' </column3> - <column4> '1999@12@31 11+30+45' </column4> - <column5> '12:23:34' </column5> - <column6> 1901</column6> - </row4> - <row5> - <column1> 5 </column1> - <column2> '9999.11.18' </column2> - <column3> '9999.11.18 11*45*50' </column3> - <column4> '2037.11.18 11*45*50' </column4> - <column5> '23:34:34' </column5> - <column6> 2069 </column6> - </row5> - <row6> - <column1> 6 </column1> - <column2> '9999/11/09' </column2> - <column3> '9999/11/09 12:23:34' </column3> - <column4> '2037/11/09 12:23:34' </column4> - <column5> '09:08:07' </column5> - <column6> 1970</column6> - </row6> - <row7> - <column1> 7 </column1> - <column2> 19980404 </column2> - <column3> 19980404083050 </column3> - <column4> 19980404083050 </column4> - <column5> 083045 </column5> - <column6> 0000</column6> - </row7> - <row8> - <column1> 8 </column1> - <column2> '0000-00-00' </column2> - <column3> '0000-00-00 00:00:00' </column3> - <column4> 00000000000000 </column4> - <column5> '00:00:00'</column5> - <column6> 00</column6> - </row8> - <row9> - <column1> 9 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - <column6> null </column6> - </row9> - <changes> - <numChanges>3</numChanges> - <change1> - <row>1</row> - <col>5</col> - <value>'12:23:34' </value> - </change1> - <change2> - <row>1</row> - <col>3</col> - <value>'2004-12-17 08:00:00' </value> - </change2> - <change3> - <row>1</row> - <col>6</col> - <value> 1980 </value> - </change3> - </changes> - </table3> - </values> - <queries> - <numQueries> 2 </numQueries> - <query1> Select COLUMNS from TABLE1 order by COLUMN1 </query1> - <query2> Select COLUMN1,COLUMN3,COLUMN5 from TABLE2 order by COLUMN1 </query2> - <query3> Select COLUMN2,COLUMN4 from TABLE3 order by COLUMN1 </query3> - </queries> - </mysql> - <mssql> - <database> - <name> mssql </name> - <connectionString> Server=__servername__;Database=__dbname__;User ID=sa;Password=__password__;</connectionString> - <OdbcConnString>DSN=MsSQL-DSN;uid=sa;pwd=novell </OdbcConnString> - </database> - <StoredProcExists> Y </StoredProcExists> - <tables> - <numTables> 5 </numTables> - <table1> - <name>numericTable </name> - <numColumns>6</numColumns> - <column1> - <name> sNo </name> - <type> tinyint </type> - </column1> - <column2> - <name> bigInteger </name> - <type> bigint </type> - </column2> - <column3> - <name> integer </name> - <type>int</type> - </column3> - <column4> - <name> smallInteger </name> - <type> smallint </type> - </column4> - <column5> - <name> tinyInt </name> - <type> tinyint </type> - </column5> - <column6> - <name> bit </name> - <type> bit </type> - </column6> - </table1> - <table2> - <name>dateTimeTable </name> - <numColumns>3</numColumns> - <column1> - <name> sNo </name> - <type> tinyInt </type> - </column1> - <column2> - <name> date</name> - <type> datetime </type> - </column2> - <column3> - <name> smalldate </name> - <type> smalldatetime </type> - </column3> - </table2> - <table3> - <name>realNosTable </name> - <numColumns>5</numColumns> - <column1> - <name> sNo </name> - <type> tinyInt </type> - </column1> - <column2> - <name> decimalCol </name> - <type> decimal(8,4) </type> - </column2> - <column3> - <name> numericCol </name> - <type> numeric(6,4) </type> - </column3> - <column4> - <name> floatCol </name> - <type> float </type> - </column4> - <column5> - <name> realCol </name> - <type> real </type> - </column5> - </table3> - <table4> - <name>moneyTable </name> - <numColumns>3</numColumns> - <column1> - <name> sNo </name> - <type> tinyInt </type> - </column1> - <column2> - <name> money </name> - <type> money </type> - </column2> - <column3> - <name> smallmoney </name> - <type> smallmoney </type> - </column3> - </table4> - <table5> - <name>charTable </name> - <numColumns>5</numColumns> - <column1> - <name> sNo </name> - <type> tinyInt </type> - </column1> - <column2> - <name> characterCol </name> - <type> char(20) </type> - </column2> - <column3> - <name> ncharacterCol </name> - <type> nchar(20) </type> - </column3> - <column4> - <name> varchar </name> - <type> varchar(20) </type> - </column4> - <column5> - <name> nvarchar </name> - <type> nvarchar(20) </type> - </column5> - </table5> - </tables> - <values> - <numTables>5</numTables> - <table1> - <tableName>numericTable</tableName> - <numRows>4</numRows> - <numCols>6</numCols> - <row1> - <column1> 1 </column1> - <column2> -9223372036854775808 </column2> - <column3> -2147483648 </column3> - <column4> -32768 </column4> - <column5> 0</column5> - <column6> 0</column6> - </row1> - <row2> - <column1> 2 </column1> - <column2> 1244 </column2> - <column3> -50 </column3> - <column4> 234 </column4> - <column5> 128 </column5> - <column6> 0</column6> - </row2> - <row3> - <column1> 3 </column1> - <column2> 9223372036854775807 </column2> - <column3> 2147483647 </column3> - <column4> 32767 </column4> - <column5> 255 </column5> - <column6> 1</column6> - </row3> - <row4> - <column1> 4 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - <column6> null </column6> - </row4> - <changes> - <numChanges>5</numChanges> - <change1> - <row>1</row> - <col>2</col> - <value>-5678 </value> - </change1> - <change2> - <row>1</row> - <col>6</col> - <value> 10 </value> - </change2> - <change3> - <row>2</row> - <col>3</col> - <value>234 </value> - </change3> - <change4> - <row>3</row> - <col>5</col> - <value>-345 </value> - </change4> - <change5> - <row>3</row> - <col>2</col> - <value>-999 </value> - </change5> - </changes> - </table1> - <table2> - <tableName> dateTimeTable</tableName> - <numRows>3</numRows> - <numCols>3</numCols> - <row1> - <column1> 1 </column1> - <column2> '1/1/1753 03:04:05.234' </column2> - <column3> '1/1/1970 12:24'</column3> - </row1> - <row2> - <column1> 2 </column1> - <column2> '12/31/9999 00:00:00' </column2> - <column3> '6/6/2079 00:00'</column3> - </row2> - <row3> - <column1> 3 </column1> - <column2> null </column2> - <column3> null </column3> - </row3> - </table2> - <table3> - <tableName> realNosTable</tableName> - <numRows>6</numRows> - <numCols>5</numCols> - <row1> - <column1> 1 </column1> - <column2> -9.99E+3</column2> - <column3> -99 </column3> - <column4> -1.7976931348623157E+308 </column4> - <column5> -3.402823466E+38 </column5> - </row1> - <row2> - <column1> 2 </column1> - <column2> -1.23E3 </column2> - <column3> -12 </column3> - <column4> -2.2250738585072014E-308 </column4> - <column5> -3.4E-38 </column5> - </row2> - <row3> - <column1> 3 </column1> - <column2> 0 </column2> - <column3> 0 </column3> - <column4> 0 </column4> - <column5> 0 </column5> - </row3> - <row4> - <column1> 4 </column1> - <column2> 1.2E1 </column2> - <column3> 12 </column3> - <column4> 2.2250738585072014E-308 </column4> - <column5> 4.56E-3 </column5> - </row4> - <row5> - <column1> 5 </column1> - <column2> 9.999E3 </column2> - <column3> 99 </column3> - <column4> 1.7976931348623157E+308 </column4> - <column5> 3.4E+38 </column5> - </row5> - <row6> - <column1> 6 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - </row6> - <changes> - <numChanges> 1 </numChanges> - <change1> - <row> 6 </row> - <col> 4 </col> - <value> 1.2E34 </value> - </change1> - </changes> - </table3> - <table4> - <tableName> moneyTable</tableName> - <numRows>4</numRows> - <numCols>3</numCols> - <row1> - <column1> 1 </column1> - <column2> -922337203685477.5808 </column2> - <column3> -214748.3648 </column3> - </row1> - <row2> - <column1> 2 </column1> - <column2> 5477.5808 </column2> - <column3> 748.3648 </column3> - </row2> - <row3> - <column1> 3 </column1> - <column2> 922337203685477.5807 </column2> - <column3> 214748.3647 </column3> - </row3> - <row4> - <column1> 4 </column1> - <column2> null </column2> - <column3> null </column3> - </row4> - </table4> - <table5> - <tableName> charTable</tableName> - <numRows>2</numRows> - <numCols>5</numCols> - <row1> - <column1> 1 </column1> - <column2> '12345678901234567890' </column2> - <column3> 'abcdefghijklmnopqrst' </column3> - <column4> 'zyxwvutsrqponmlkjihg' </column4> - <column5> '12345678901234567890' </column5> - </row1> - <row2> - <column1> 2 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - </row2> - </table5> - </values> - <StoredProc> - <NumStoredProc> 1 </NumStoredProc> - <StoredProc1> - <type> generic </type> - <name> Select_{{TABLE}}_proc </name> - <template> - <numStmts> 1 </numStmts> - <stmt1><![CDATA[ - create procedure Select_{{TABLE}}_proc As - BEGIN - Select {{COLUMNS}} from {{TABLE}}; - END]]> - </stmt1> - </template> - </StoredProc1> - </StoredProc> - <queries> - <numQueries> 5 </numQueries> - <query1> Select COLUMNS from TABLE1 order by COLUMN1 </query1> - <query2> Select COLUMN1,COLUMN2,COLUMN3 from TABLE2 order by COLUMN1 </query2> - <query3> Select COLUMN2,COLUMN4 from TABLE3 order by COLUMN1 </query3> - <query4> Select COLUMNS from TABLE4 order by COLUMN1 </query4> - <query5> Select COLUMNS from TABLE5 order by COLUMN1 </query5> - </queries> - </mssql> - - <postgres> - <database> - <name> postgres </name> - <connectionString> Server=164.99.168.144;Database=test;User Id=sudha;Password= </connectionString> - <OdbcConnString>DSN=postgres-DSN;uid=sudha;pwd= </OdbcConnString> - </database> - <tables> - <numTables> 5 </numTables> - <table1> - <name>numericTable </name> - <numColumns> 4 </numColumns> - <column1> - <name> serialNo </name> - <type> smallint </type> - </column1> - <column2> - <name> small_int </name> - <type> smallint </type> - </column2> - <column3> - <name> int </name> - <type> integer </type> - </column3> - <column4> - <name> bigInteger </name> - <type> bigint </type> - </column4> - - </table1> - <table2> - <name>realNoTable </name> - <numColumns> 5 </numColumns> - <column1> - <name> serialNo </name> - <type> smallint </type> - </column1> - <column2> - <name> numeric_column </name> - <type> numeric(10,6) </type> - </column2> - <column3> - <name> numeric_noscale </name> - <type> decimal(10) </type> - </column3> - <column4> - <name> realNo </name> - <type> real </type> - </column4> - <column5> - <name> doubleNo </name> - <type> double precision </type> - </column5> - </table2> - <table3> - <name> charTable </name> - <numColumns> 4 </numColumns> - <column1> - <name> serialNo </name> - <type> smallint </type> - </column1> - <column2> - <name> charColumn </name> - <type> char(20) </type> - </column2> - <column3> - <name> varcharColumn </name> - <type> varchar(20) </type> - </column3> - <column4> - <name> textColumn </name> - <type> text </type> - </column4> - </table3> - <table4> - <name> dateTimeTable </name> - <numColumns> 5 </numColumns> - <column1> - <name> serialNo </name> - <type> smallint </type> - </column1> - <column2> - <name> timestampCol </name> - <type> timestamp </type> - </column2> - <column3> - <name> intervalCol </name> - <type> interval </type> - </column3> - <column4> - <name> dateCol </name> - <type> date </type> - </column4> - <column5> - <name> timeCol </name> - <type> time </type> - </column5> - </table4> - <table5> - <name> booleanTable </name> - <numColumns> 2 </numColumns> - <column1> - <name> serialNo </name> - <type> smallint </type> - </column1> - <column2> - <name> bool </name> - <type> boolean </type> - </column2> - </table5> - </tables> - <values> - <numTables>5</numTables> - <table1> - <tableName>numericTable</tableName> - <numRows>4</numRows> - <numCols>4</numCols> - <row1> - <column1> 1 </column1> - <column2> -32768 </column2> - <column3> -2147483648 </column3> - <column4> -9223372036854775808 </column4> - </row1> - <row2> - <column1> 2 </column1> - <column2> 123 </column2> - <column3> -648 </column3> - <column4> 0 </column4> - </row2> - <row3> - <column1> 3 </column1> - <column2> 32767 </column2> - <column3> 2147483647 </column3> - <column4> 9223372036854775807 </column4> - </row3> - <row4> - <column1> 4 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - </row4> - <changes> - <numChanges> 2 </numChanges> - <change1> - <row> 3 </row> - <col> 2 </col> - <value> 2000 </value> - </change1> - <change2> - <row> 2 </row> - <col> 3 </col> - <value> 2000000 </value> - </change2> - </changes> - </table1> - <table2> - <tableName>realNoTable</tableName> - <numRows>6</numRows> - <numCols>5</numCols> - <row1> - <column1> 1 </column1> - <column2> -9999.999999 </column2> - <column3> -9999999999 </column3> - <column4> -9.99999E-38 </column4> - <column5> -9.999999999999999E-308 </column5> - </row1> - <row2> - <column1> 2 </column1> - <column2> -123.99 </column2> - <column3> -1239 </column3> - <column4> 9.99999E-38 </column4> - <column5> 9.999999999999999E-308 </column5> - </row2> - <row3> - <column1> 3 </column1> - <column2> 0 </column2> - <column3> 0 </column3> - <column4> 0 </column4> - <column5> 0 </column5> - </row3> - <row4> - <column1> 4 </column1> - <column2> 123.99 </column2> - <column3> 123 </column3> - <column4> -9.99999E37 </column4> - <column5> -1.79769313486231E308 </column5> - </row4> - <row5> - <column1> 5 </column1> - <column2> 9999.999999 </column2> - <column3> 9999999999 </column3> - <column4> 9.99999E37 </column4> - <column5> 1.79769313486231E308 </column5> - </row5> - <row6> - <column1> 6 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - </row6> - </table2> - <table3> - <tableName>charTable</tableName> - <numRows>2</numRows> - <numCols>4</numCols> - <row1> - <column1> 1 </column1> - <column2> 'abcdefghijklmnopqrst' </column2> - <column3> '1234567890' </column3> - <column4> 'This is a fixed length text' </column4> - </row1> - <row2> - <column1> 2 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - </row2> - </table3> - <table4> - <tableName>datetimeTable</tableName> - <numRows>4</numRows> - <numCols>5</numCols> - <row1> - <column1> 1 </column1> - <column2> '0001-01-01 00:00:00.000000' </column2> - <column3> '-178000000 years +4 days' </column3> - <column4> '0001-01-01' </column4> - <column5> '12:23:34' </column5> - </row1> - <row2> - <column1> 2 </column1> - <column2> '2004-10-21 11:15:23' </column2> - <column3> '7890 years 5 days 07:30' </column3> - <column4> '2004-01-12' </column4> - <column5> '00:00:00' </column5> - </row2> - <row3> - <column1> 3 </column1> - <column2> '9999-12-31 23:59:59.9999' </column2> - <column3> '178000000 years 00:19:23' </column3> - <column4> '9999-12-31' </column4> - <column5> '23:59:59' </column5> - </row3> - <row4> - <column1> 4 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - </row4> - </table4> - <table5> - <tableName>booleanTable</tableName> - <numRows>3</numRows> - <numCols>2</numCols> - <row1> - <column1> 1 </column1> - <column2> TRUE </column2> - </row1> - <row2> - <column1> 2 </column1> - <column2> FALSE </column2> - </row2> - <row3> - <column1> 3 </column1> - <column2> null </column2> - </row3> - </table5> - </values> - <queries> - <numQueries> 5 </numQueries> - <query1> Select COLUMNS from TABLE1 order by COLUMN1 </query1> - <query2> Select COLUMN1,COLUMN2,COLUMN3 from TABLE2 order by COLUMN1 </query2> - <query3> Select COLUMN2,COLUMN4 from TABLE3 order by COLUMN1 </query3> - <query4> Select COLUMNS from TABLE4 order by COLUMN1 </query4> - <query5> Select COLUMNS from TABLE5 order by COLUMN1 </query5> - </queries> - </postgres> - <oracle> - <database> - <name> oracle </name> - <connectionString> Data Source=testdb.com;User Id=user9i;Password=oracle9i </connectionString> - <OdbcConnString>DSN=Oracle-DSN;uid=user9i;pwd=oracle9i </OdbcConnString> - </database> - <StoredProcExists> Y </StoredProcExists> - <tables> - <numTables> 4 </numTables> - <table1> - <name>numericTable </name> - <numColumns> 3 </numColumns> - <column1> - <name> serialNo </name> - <type> number(1)</type> - </column1> - <column2> - <name> intCol </name> - <type> number(6)</type> - </column2> - <column3> - <name> decimalCol </name> - <type> number(6, 3)</type> - </column3> - </table1> - <table2> - <name> charTable </name> - <numColumns> 5 </numColumns> - <column1> - <name> serialNo </name> - <type> number(1)</type> - </column1> - <column2> - <name> charCol </name> - <type> char(10) </type> - </column2> - <column3> - <name> ncharCol </name> - <type> nchar(10) </type> - </column3> - <column4> - <name> varcharCol </name> - <type> varchar2(10) </type> - </column4> - <column5> - <name> nvarcharCol </name> - <type> nvarchar2(10) </type> - </column5> - </table2> - <table3> - <name> RealNoTable </name> - <numColumns> 2 </numColumns> - <column1> - <name> serialNo </name> - <type> number(1)</type> - </column1> - <column2> - <name> floatCol </name> - <type> float(24) </type> - </column2> - </table3> - <table4> - <name> DateTimeTable </name> - <numColumns> 5 </numColumns> - <column1> - <name> serialNo </name> - <type> number(1)</type> - </column1> - <column2> - <name> dateCol </name> - <type> date </type> - </column2> - <column3> - <name> timestampCol </name> - <type> timestamp </type> - </column3> - <column4> - <name> Int_year </name> - <type> interval Year to month</type> - </column4> - <column5> - <name> int_day </name> - <type> interval day to second </type> - </column5> - </table4> - </tables> - <values> - <numTables>4</numTables> - <table1> - <tableName>numericTable</tableName> - <numRows>4</numRows> - <numCols>3</numCols> - <row1> - <column1> 1 </column1> - <column2> -999999 </column2> - <column3> -999.999 </column3> - </row1> - <row2> - <column1> 2 </column1> - <column2> 1000 </column2> - <column3> 234 </column3> - </row2> - <row3> - <column1> 3 </column1> - <column2> 999999 </column2> - <column3> 999.999 </column3> - </row3> - <row4> - <column1> 4 </column1> - <column2> null </column2> - <column3> null </column3> - </row4> - </table1> - <table2> - <tableName>charTable</tableName> - <numRows>2</numRows> - <numCols>5</numCols> - <row1> - <column1> 1 </column1> - <column2> '0123456789' </column2> - <column3> 'abcdefghij' </column3> - <column4> '0123456789' </column4> - <column5> 'abcdefghij' </column5> - </row1> - <row2> - <column1> 2 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - </row2> - </table2> - <table3> - <tableName>RealNoTable</tableName> - <numRows>6</numRows> - <numCols>2</numCols> - <row1> - <column1> 1 </column1> - <column2> 9.9999999E125 </column2> - </row1> - <row2> - <column1> 2 </column1> - <column2> -9.999999E-126 </column2> - </row2> - <row3> - <column1> 3 </column1> - <column2> 1.23E-15 </column2> - </row3> - <row4> - <column1> 4 </column1> - <column2> -9.999999E-126 </column2> - </row4> - <row5> - <column1> 5 </column1> - <column2> 9.9999999E125 </column2> - </row5> - <row6> - <column1> 6 </column1> - <column2> null </column2> - </row6> - </table3> - <table4> - <tableName>DateTimeTable</tableName> - <numRows>3</numRows> - <numCols>5</numCols> - <row1> - <column1> 1 </column1> - <column2> to_date('0001-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss') </column2> - <column3> TIMESTAMP'0001-01-01 00:00:00' </column3> - <column4> '-99-11' </column4> - <column5> '-99 23:59:59' </column5> - </row1> - <row2> - <column1> 2 </column1> - <column2> to_date('2004-11-23 12:34:45', 'yyyy-mm-dd hh24:mi:ss') </column2> - <column3> TIMESTAMP'2004-11-23 12:34:45' </column3> - <column4> '34-5' </column4> - <column5> '-34 20:50:00' </column5> - </row2> - <row3> - <column1> 3 </column1> - <column2> to_date('9999-12-31 23:59:59', 'yyyy-mm-dd hh24:mi:ss') </column2> - <column3> TIMESTAMP'9999-12-31 23:59:59' </column3> - <column4> '99-11' </column4> - <column5> '00 23:59:59' </column5> - </row3> - </table4> - </values> - <StoredProc> - <NumStoredProc> 1 </NumStoredProc> - <StoredProc1> - <type> generic </type> - <name> {{TABLE}}_pkg.Select_{{TABLE}}_data</name> - <template> - <numStmts> 2 </numStmts> - <stmt1><![CDATA[ - create or replace package {{TABLE}}_pkg As - type {{TABLE}}Cur is ref cursor return {{TABLE}}%rowtype; - procedure Select{{TABLE}}Data (ref_cur out {{TABLE}}Cur); - END {{TABLE}}_pkg;]]> - </stmt1> - <stmt2><![CDATA[ - create or replace package body {{TABLE}}_pkg As - procedure Select{{TABLE}}Data ( ref_cur out {{TABLE}}Cur) is - BEGIN - open ref_cur for select {{COLUMNS}} from {{TABLE}} order by {{COLUMN_1}}; - End Select{{TABLE}}Data; - END {{TABLE}}_pkg;]]></stmt2> - </template> - </StoredProc1> - </StoredProc> - <queries> - <numQueries> 4 </numQueries> - <query1> Select COLUMNS from TABLE1 order by COLUMN1 </query1> - <query2> Select COLUMN1,COLUMN2,COLUMN3 from TABLE2 order by COLUMN1 </query2> - <query3> Select COLUMNS from TABLE3 order by COLUMN1 </query3> - <query4> Select COLUMNS from TABLE4 order by COLUMN1 </query4> - </queries> - </oracle> -</configuration> diff --git a/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/SectionHandler.cs b/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/SectionHandler.cs deleted file mode 100644 index 6908c2323d9..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/dataadaptertests/SectionHandler.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -// SectionHandler.cs -// -// Author: -// Satya Sudha K (ksathyasudha@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.Xml; -using System.Configuration; - -namespace SectionHandlers { - - public class SectionHandler : IConfigurationSectionHandler { - - public SectionHandler () - { - } - - public virtual object Create (object parent, object ConfigContext, XmlNode section) - { - return section; - } - } -} - diff --git a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/DataReaderBaseTest.cs b/mcs/class/System.Data/Test/DataProviderTests/datareadertests/DataReaderBaseTest.cs deleted file mode 100644 index 84aa9fb80b1..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/DataReaderBaseTest.cs +++ /dev/null @@ -1,505 +0,0 @@ -// -// DataProviderBaseTest.cs : A base class that provides the common -// functionality of : -// 1) Reading a config file containing the -// database connection parameters, different -// tables and their description, Values that -// the tables are populated with. -// 2) Retrieves data from these tables; -// 3) Compares the retrieved values against the ones -// contained in the config file. -// -// A class specific to each database (and ODBC) are derived from this class. -// These classes contain code specific to different databases (like establishing -// a connection, comparing date values, etc). -// -// Author: -// Satya Sudha K (ksathyasudha@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.IO; -using System.Xml; -using System.Xml.XPath; -using System.Data; -using System.Configuration; -using System.Text.RegularExpressions; - -namespace MonoTests.System.Data { - - public class BaseRetrieve { - - public IDbConnection con; - public IDbCommand cmd; - public IDataReader rdr; - protected XmlNode configDoc; - - public BaseRetrieve (string database) - { - con = null; - cmd = null; - rdr = null; - configDoc = (XmlNode) ConfigurationSettings.GetConfig (database); - } - - void CreateCommand () - { - if (con == null) - return; - cmd = con.CreateCommand (); - } - - // Method that actually runs the entire test : Connects to a database, - // retrieves values from different tables, and compares them against - // the values that we had entered - public void RunTest () - { - - GetConnection (); - if (con == null) - return; - - CreateCommand (); - if (cmd == null) - return; - - string noOfTables = null; - string tableName = null; - int [] columnNos = null; - - try { - noOfTables = ConfigClass.GetElement (configDoc, "tables", "numTables"); - short numTables = Convert.ToInt16 (noOfTables); - string noOfQueries = ConfigClass.GetElement (configDoc, "queries", "numQueries"); - Console.WriteLine ("**** Running Queries ****"); - - if (noOfQueries != null) { - - int numQueries = Convert.ToInt32 (noOfQueries); - - for (int index = 1; index <= numQueries; index++) { - string queryStr = ConfigClass.GetElement (configDoc, "queries", "query" + index); - int tableNum = 0; - rdr = RunQuery (queryStr, ref columnNos, ref tableNum); - if (rdr == null) - continue; - - CompareData (rdr, configDoc, columnNos, tableNum); - rdr.Close (); - } - } - - string storedProc = null; - try { - storedProc = ConfigClass.GetElement (configDoc, "StoredProcExists"); - } catch (Exception e) { - return; - } - - if (storedProc.Equals ("Y")) { - - Console.WriteLine ("\n**** Running tests for stored procedures *****\n"); - int numStoredProc = Convert.ToInt32 (ConfigClass.GetElement(configDoc, - "StoredProc", "NumStoredProc")); - for (int index = 1; index <= numStoredProc; index++) { - - string storedProcTag = "StoredProc" + index; - string type = ConfigClass.GetElement (configDoc, "StoredProc", - storedProcTag, "type"); - string nameTemplate = ConfigClass.GetElement (configDoc, "StoredProc", - storedProcTag, "name"); - if (type.Equals("generic")) { - - // There is stored proc correspoding to each table - // Run all such stored proc - for (short i = 1; i <= numTables; i++) { - - try { - tableName = ConfigClass.GetElement (configDoc, "tables", - "table"+i, "name"); - } catch (XPathException e) { - Console.WriteLine (e.Message); - continue; // need not return here; try with the next one - } - - string storedProcName = nameTemplate.Replace ("{{TABLE}}", tableName); - rdr = QueryUsingStoredProc (cmd, storedProcName, null); - if (rdr == null) - continue; - - CompareData (rdr, configDoc, null, i); - rdr.Close (); - } - } - } - } - - } catch (Exception e) { - Console.WriteLine ("ERROR : " + e.Message); - Console.WriteLine ("STACKTRACE : " + e.StackTrace); - } finally { - con.Close (); - con = null; - } - - } - - public virtual IDataReader QueryUsingStoredProc (IDbCommand cmd, - string storedProcName, - string paramName) - { - cmd.CommandType = CommandType.StoredProcedure; - cmd.CommandText = storedProcName; - IDataReader rdr = null; - - try { - rdr = cmd.ExecuteReader (); - } catch (Exception e) { - Console.WriteLine ("Could not execute command : " + cmd.CommandText); - Console.WriteLine ("ERROR : " + e.Message); - Console.WriteLine ("STACKTRACE : " + e.StackTrace); - return null; - } - - return rdr; - } - - IDataReader RunQuery (string queryStr, ref int [] columnNos, ref int tableNum) - { - string regexp = "\\b(Select|select) (?<columnList>(COLUMNS|((COLUMN\\d+,)*(COLUMN\\d+)))) from (?<tableName>TABLE\\d+)( order by (?<OrderBy>COLUMN\\d+))*"; - Match m = Regex.Match (queryStr, regexp, RegexOptions.ExplicitCapture); - if (!m.Success) { - Console.WriteLine ("Incorrect query format!!!"); - return null; - } - - columnNos = null; - - while (m.Success) { - - string tableTag = m.Result ("${tableName}"); - tableNum = Convert.ToInt32 (tableTag.Replace ("TABLE", "")); - string tableName = ConfigClass.GetElement (configDoc, "tables", tableTag.ToLower (), "name"); - queryStr = queryStr.Replace (tableTag, tableName); - - for (int i = 0; i<m.Groups.Count; i++) { - - Group g = m.Groups [i]; - CaptureCollection cc = g.Captures; - - for (int j = 0; j < cc.Count; j++) { - - string matchedVal = cc [j].Value; - - if (matchedVal.Equals ("COLUMNS")) { - string [] columnNames = ConfigClass.GetColumnNames (configDoc, tableNum); - queryStr = queryStr.Replace ("COLUMNS", String.Join (",", columnNames)); - columnNos = new int [columnNames.Length]; - for (int index = 1; index <= columnNos.Length; index++) - columnNos [index - 1] = index; - - } else if (matchedVal.StartsWith ("COLUMN")) { - // May be a column name or a comma - // separated list of columns - string [] listOfColumns = matchedVal.Split (','); - if (columnNos == null) { - - columnNos = new int [listOfColumns.Length]; - int colIndex = 0; - foreach (string str in listOfColumns) { - int columnNo = Convert.ToInt32 (str.Replace("COLUMN", "")); - columnNos [colIndex ++] = columnNo; - } - } - - foreach (string str in listOfColumns) { - - string columnName = ConfigClass.GetElement (configDoc, "tables", - tableTag.ToLower (), str.ToLower (), "name"); - queryStr = queryStr.Replace (str, columnName); - } - } - } - } - - m = m.NextMatch (); - } - - IDataReader rdr = null; - cmd.CommandText = queryStr; - try { - rdr = cmd.ExecuteReader (); - } catch (Exception e) { - Console.WriteLine ("ERROR : " + e.Message); - Console.WriteLine ("\nSTACKTRACE : " + e.StackTrace); - return null; - } - - return rdr; - - } - - void CompareData (IDataReader rdr, - XmlNode doc, - int [] columnNos, - int numTable) - { - int rowNum = 0; - string errorMsg = ""; - string tableName = null; - try { - tableName = ConfigClass.GetElement (doc, "tables", "table"+numTable, "name"); - } catch (Exception e) { - Console.WriteLine ("ERROR : " + e.Message ); - Console.WriteLine ("STACKTRACE : " + e.StackTrace ); - return; - } - - while (rdr.Read()) { - rowNum ++; - string columnValue = null; - for (int i = 0; i < rdr.FieldCount; i++) { - errorMsg = ""; - int columnNum = 0; - try { - if (columnNos == null) - columnNum = i+1; - else - columnNum = columnNos [i]; - - columnValue = ConfigClass.GetElement (doc, "values", "table" + numTable, - "row" + rowNum, "column" + columnNum); - } catch (Exception e) { - Console.WriteLine ("ERROR : " + e.Message); - Console.WriteLine ("STACKTRACE : " + e.StackTrace); - } - - object obj = null; - Console.Write ("Table : {0} : ROW: {1} COL: {2}", tableName, rowNum, columnNum); - try { - obj = GetValue (rdr, i); - } catch (Exception e) { - - Console.WriteLine ("...FAIL"); - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - errorMsg += "\nProbably the 'GetFieldType()' method returned a wrong type!!"; - Console.WriteLine (errorMsg); - obj = null; - continue; - } - - if (AreEqual (obj, columnValue, ref errorMsg)) { - Console.WriteLine ("...OK"); - } else { - Console.WriteLine ("...FAIL"); - if (!errorMsg.Equals ("")) { - // There was some exception - Console.WriteLine (errorMsg); - } else { - // Comparison failed - Console.WriteLine ("Expected : "+columnValue+" Got : "+obj); - } - } - } - Console.WriteLine ("======================"); - } - } - - public virtual object GetValue (IDataReader rdr, int columnIndex) - { - - object value = null; - - if (rdr.IsDBNull (columnIndex)) { - return null; - } - - Type type = rdr.GetFieldType (columnIndex); - - switch (type.Name.ToLower ()) { - - case "byte" : value = rdr.GetByte (columnIndex); - break; - case "sbyte" : value = rdr.GetInt16 (columnIndex); - break; - case "boolean" : value = rdr.GetBoolean (columnIndex); - break; - case "int16" : value = rdr.GetInt16 (columnIndex); - break; - case "uint16" : - case "int32" : value = rdr.GetInt32 (columnIndex); - break; - case "uint32" : - case "int64" : value = rdr.GetInt64 (columnIndex); - break; - case "single" : value = rdr.GetFloat (columnIndex); - break; - case "double" : value = rdr.GetDouble (columnIndex); - break; - case "uint64" : - case "decimal" : value = rdr.GetDecimal (columnIndex); - break; - case "datetime": value = rdr.GetDateTime (columnIndex); - break; - case "string": value = rdr.GetString (columnIndex); - break; - default : value = rdr.GetValue (columnIndex); - break; - } - - return value; - - } - - public virtual Boolean AreEqual (object obj, string value, ref string errorMsg) - { - - if ((obj == null) || (value.Equals("null"))) { - if (obj == null && value.Equals ("null")) - return true; - return false; - } - - object valObj = ConvertToValueType (obj.GetType (), value, ref errorMsg); - if (valObj == null) { - errorMsg = "Could not convert values!!\n" + errorMsg; - return false; - } - return valObj.Equals (obj); - } - - public virtual object ConvertToValueType (Type objType, string value, ref string errorMsg) - { - - value = value.Trim ('\''); - value = value.Trim ('\"'); - - switch (Type.GetTypeCode (objType)) { - - case TypeCode.Int16 : - return ConvertToInt16 (objType, value, ref errorMsg); - case TypeCode.Int32 : - return ConvertToInt32 (objType, value, ref errorMsg); - case TypeCode.Int64 : - return ConvertToInt64 (objType, value, ref errorMsg); - case TypeCode.Boolean : - return ConvertToBoolean (objType, value, ref errorMsg); - case TypeCode.Byte : - return ConvertToByte (objType, value, ref errorMsg); - case TypeCode.DateTime : - return ConvertToDateTime (objType, value, ref errorMsg); - case TypeCode.Decimal : - return ConvertToDecimal (objType, value, ref errorMsg); - case TypeCode.Double : - return ConvertToDouble (objType, value, ref errorMsg); - case TypeCode.Single : - return ConvertToSingle (objType, value, ref errorMsg); - - } - - if ( objType.ToString () == "System.TimeSpan") - return ConvertToTimespan (objType, value, ref errorMsg); - - return ConvertValue (objType, value, ref errorMsg); - } - - public virtual object ConvertValue (Type type, string value, ref string errorMsg) - { - object valObj = null; - - try { - valObj = Convert.ChangeType (value, type); - } catch (InvalidCastException e) { - errorMsg = "Cant compare values!! \n"; - errorMsg += "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return false; - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return null; - } - - return valObj; - - } - - public virtual object ConvertToInt16 (Type type, string value, ref string errorMsg) - { - return ConvertValue (type, value, ref errorMsg); - } - - public virtual object ConvertToInt32 (Type type, string value, ref string errorMsg) - { - return ConvertValue (type, value, ref errorMsg); - } - - public virtual object ConvertToInt64 (Type type, string value, ref string errorMsg) - { - return ConvertValue (type, value, ref errorMsg); - } - - public virtual object ConvertToBoolean (Type type, string value, ref string errorMsg) - { - return ConvertValue (type, value, ref errorMsg); - } - - public virtual object ConvertToByte (Type type, string value, ref string errorMsg) - { - return ConvertValue (type, value, ref errorMsg); - } - - public virtual object ConvertToDateTime (Type type, string value, ref string errorMsg) - { - return ConvertValue (type, value, ref errorMsg); - } - - public virtual object ConvertToDecimal (Type type, string value, ref string errorMsg) - { - return ConvertValue (type, value, ref errorMsg); - } - - public virtual object ConvertToDouble (Type type, string value, ref string errorMsg) - { - return ConvertValue (type, value, ref errorMsg); - } - - public virtual object ConvertToSingle (Type type, string value, ref string errorMsg) - { - return ConvertValue (type, value, ref errorMsg); - } - - public virtual object ConvertToTimespan (Type type, string value, ref string errorMsg) - { - return ConvertValue (type, value, ref errorMsg); - } - - public virtual void GetConnection() - { - } - } -} diff --git a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/DbConfig.cs b/mcs/class/System.Data/Test/DataProviderTests/datareadertests/DbConfig.cs deleted file mode 100644 index 2ec9f69dbad..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/DbConfig.cs +++ /dev/null @@ -1,61 +0,0 @@ -// -// DbConfig.cs : Defines a class 'ConfigClass' that is used to read the config file -// -// Author: -// Satya Sudha K (ksathyasudha@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.IO; -using System.Xml; - -namespace MonoTests.System.Data { - - public class ConfigClass { - - public static string GetElement (XmlNode doc, params string [] args) - { - string element = ""; - if (args.Length > 0) { - XmlNode xmlNode = doc.SelectSingleNode (args [0]); - for (int i = 1; i < args.Length; i++) - xmlNode = xmlNode.SelectSingleNode (args [i]); - element = xmlNode.InnerText.Trim (); - } - return element; - } - - public static string [] GetColumnNames (XmlNode doc, int tableNum) - { - string tagName = "table" + tableNum; - int numColumns = Convert.ToInt16 (ConfigClass.GetElement (doc, "tables", tagName, "numColumns")); - string [] columns = new string [numColumns]; - for (int col = 1; col <= numColumns; col++) - columns[col - 1] = ConfigClass.GetElement (doc, "tables", tagName, "column" + col, "name"); - return columns; - } - - } -} diff --git a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/DbRetrieve.dll.sources b/mcs/class/System.Data/Test/DataProviderTests/datareadertests/DbRetrieve.dll.sources deleted file mode 100644 index 6ad9f28ac82..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/DbRetrieve.dll.sources +++ /dev/null @@ -1,6 +0,0 @@ -DataReaderBaseTest.cs -DbConfig.cs -MsSqlDataReaderTest.cs -MsSqlSpecificTest.cs -OracleDataReaderTest.cs -SectionHandler.cs diff --git a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/Makefile b/mcs/class/System.Data/Test/DataProviderTests/datareadertests/Makefile deleted file mode 100644 index 3b8cd622922..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -thisdir=class/System.Data/Test/DataProviderTests/datareadertests - -include ../../../../../build/rules.make - -LIB_MCS_FLAGS = /r:System.Data,System.Data.OracleClient,System,System.Xml - -DATABASE=all - -LIBRARY = DbRetrieve.dll -NO_INSTALL=yes -NO_SIGN_ASSEMBLY=yes - -include $(topdir)/build/library.make - -Runtests.exe: $(the_lib) - $(MCS) /r:$(the_lib) Runtests.cs - -DbRetrieve.dll: - $(MCS) /r:$(REFERENCES) /target:library /out:DbRetrieve.dll @$(SOURCEFILE) - -run-test-local: run-test-db -run-test-db: Runtests.exe - $(TEST_RUNTIME) Runtests.exe $(DATABASE) | tee TestResults.log - -test-local: Runtests.exe - -CLEAN_FILES = *.exe *.dll *.log diff --git a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/MsSqlDataReaderTest.cs b/mcs/class/System.Data/Test/DataProviderTests/datareadertests/MsSqlDataReaderTest.cs deleted file mode 100644 index c1f7c4cf18d..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/MsSqlDataReaderTest.cs +++ /dev/null @@ -1,153 +0,0 @@ -// -// MsSqlDataReaderTest.cs :- A class derived from the 'BaseRetrieve' class -// - Contains code specific to ms sql database -// -// Author: -// Satya Sudha K (ksathyasudha@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.Xml.XPath; -using System.Data; -using System.Data.SqlClient; -using System.Text.RegularExpressions; - - -namespace MonoTests.System.Data { - - public class MsSqlRetrieve : BaseRetrieve { - - public MsSqlRetrieve (string database) : base (database) - { - } - - // returns a Open connection - public override void GetConnection () - { - string connectionString = null; - try { - connectionString = ConfigClass.GetElement (configDoc, "database", "connectionString"); - } catch (XPathException e) { - Console.WriteLine ("Error reading the config file!!!"); - Console.WriteLine (e.Message); - con = null; - return; - } - - con = new SqlConnection (connectionString); - - try { - con.Open (); - } catch (SqlException e) { - Console.WriteLine ("Cannot establish connection with the database " + e); - Console.WriteLine ("Probably the database is down"); - con = null; - } catch (InvalidOperationException e) { - Console.WriteLine ("Cannot open connection "); - Console.WriteLine ("Probably the connection already open"); - con = null; - } catch (Exception e) { - Console.WriteLine ("Cannot open connection "); - con = null; - } - } - - public override object ConvertToBoolean (Type type, string value, ref string errorMsg) - { - short boolValue; - Boolean boolval; - try { - boolValue = Convert.ToInt16 (value); - boolval = Convert.ToBoolean (boolValue); - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return false; - } - - return boolval; - } - - public override object ConvertToDecimal (Type type, string value, ref string errorMsg) - { - Decimal decVal ; - try { - decVal = Convert.ToDecimal (value); - } catch (FormatException e) { - // This may be bcoz value is of the form 'd.ddEdd' - Double doubleVal = Convert.ToDouble (value); - decVal = Convert.ToDecimal (doubleVal); - } - - return decVal; - } - - public override object ConvertToDateTime (Type type, string value, ref string errorMsg) - { - - Regex re = new Regex ("\\b(?<month>\\d{1,2})/(?<day>\\d{1,2})/(?<year>\\d{2,4})\\s+(?<hour>\\d{1,2}):(?<min>\\d{1,2})(:(?<sec>\\d{1,2})(\\.(?<msec>\\d{1,3}))*)*"); - - value = value.Trim ('\''); - Match m = re.Match (value); - - int month, day, year, hour, min, sec, msec; - month = day = year = hour = min = sec = msec = 0; - month = Convert.ToInt32 (m.Result ("${month}")); - day = Convert.ToInt32 (m.Result ("${day}")); - year = Convert.ToInt32 (m.Result ("${year}")); - string str = m.Result ("${hour}"); - if (!str.Equals ("")) - hour = Convert.ToInt32 (str); - str = m.Result ("${min}"); - if (!str.Equals ("")) - min = Convert.ToInt32 (str); - str = m.Result ("${sec}"); - if (!str.Equals ("")) - sec = Convert.ToInt32 (str); - str = m.Result ("${msec}"); - if (!str.Equals ("")) - msec = Convert.ToInt32 (str); - DateTime dateObj; - - try { - if (hour == 0 && min == 0 && sec == 0) - dateObj = new DateTime (year, month, day); - else { - if (msec != 0) - dateObj = new DateTime (year, month, day, hour, min, sec, msec); - else - dateObj = new DateTime (year, month, day, hour, min, sec); - } - } catch (Exception e) { - errorMsg = "Invalid DateTime Value\n"; - errorMsg += "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return null; - } - - return dateObj; - } - } -} diff --git a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/MsSqlSpecificTest.cs b/mcs/class/System.Data/Test/DataProviderTests/datareadertests/MsSqlSpecificTest.cs deleted file mode 100644 index c67cd244900..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/MsSqlSpecificTest.cs +++ /dev/null @@ -1,349 +0,0 @@ -// -// MsSqlSpecificTest.cs :- A class derived from 'BaseRetrieve' class -// - Contains code specific to ms sql database -// (Retrieves data from the database as sql-specific types) -// -// Author: -// Satya Sudha K (ksathyasudha@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.SqlClient; -using System.Data.SqlTypes; -using System.Text.RegularExpressions; - - -namespace MonoTests.System.Data { - - public class SqlRetrieve : BaseRetrieve { - - public SqlRetrieve (string dbConfigFile) : base (dbConfigFile) - { - } - - // returns a Open connection - public override void GetConnection () - { - string connectionString = null; - try { - connectionString = ConfigClass.GetElement (configDoc, "database", "connectionString"); - } catch (Exception e) { - Console.WriteLine ("Error reading the config file"); - Console.WriteLine (e.Message); - con = null; - return; - } - - con = new SqlConnection (connectionString); - try { - con.Open (); - } catch (SqlException e) { - Console.WriteLine ("Cannot establish connection with the database"); - Console.WriteLine ("Probably the database is down"); - con = null; - } catch (InvalidOperationException e) { - Console.WriteLine ("Cannot open connection!! Probably the connection is already open!!"); - con = null; - } catch (Exception e) { - Console.WriteLine ("Cannot open connection "); - con = null; - } - } - - public override object GetValue (IDataReader reader, int columnIndex) - { - - object value = null; - SqlDataReader rdr = (SqlDataReader) reader; - if (rdr.IsDBNull (columnIndex)) - return null; - - if (rdr.GetDataTypeName (columnIndex) == "money") { - value = rdr.GetSqlMoney (columnIndex); - return value; - } - - Type type = rdr.GetFieldType (columnIndex); - - switch (type.Name.ToLower ()) { - - case "byte" : value = rdr.GetSqlByte (columnIndex); - break; - case "sbyte" : value = rdr.GetSqlInt16 (columnIndex); - break; - case "boolean" : value = rdr.GetSqlBoolean (columnIndex); - break; - case "int16" : value = rdr.GetSqlInt16 (columnIndex); - break; - case "uint16" : - case "int32" : value = rdr.GetSqlInt32 (columnIndex); - break; - case "uint32" : - case "int64" : value = rdr.GetSqlInt64 (columnIndex); - break; - case "single" : value = rdr.GetSqlSingle (columnIndex); - break; - case "double" : value = rdr.GetSqlDouble (columnIndex); - break; - case "uint64" : - case "decimal" : value = rdr.GetSqlDecimal (columnIndex); - break; - case "datetime": value = rdr.GetSqlDateTime (columnIndex); - break; - case "string": value = rdr.GetSqlString (columnIndex); - break; - default : value = rdr.GetValue (columnIndex); - break; - } - - return value; - } - - public override object ConvertToByte (Type type, string value, ref string errorMsg) - { - byte byteval; - - try { - byteval = Convert.ToByte (value); - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return null; - } - - return new SqlByte (byteval); - } - - public override object ConvertToBoolean (Type type, string value, ref string errorMsg) - { - bool boolval; - try { - boolval = Convert.ToBoolean (Convert.ToInt16 (value)); - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return null; - } - - return new SqlBoolean (boolval); - } - - public override object ConvertToInt16 (Type type, string value, ref string errorMsg) - { - short shortval; - try { - shortval = Convert.ToInt16 (value); - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return null; - } - - return new SqlInt16 (shortval); - } - - public override object ConvertToInt32 (Type type, string value, ref string errorMsg) - { - int intval; - try { - intval = Convert.ToInt32 (value); - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return null; - } - - return new SqlInt32 (intval); - } - - public override object ConvertToInt64 (Type type, string value, ref string errorMsg) - { - long longval; - try { - longval = Convert.ToInt64 (value); - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return null; - } - - return new SqlInt64 (longval); - } - - public override object ConvertToSingle (Type type, string value, ref string errorMsg) - { - float floatval; - try { - floatval = Convert.ToSingle (value); - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return null; - } - - return new SqlSingle (floatval); - } - - public override object ConvertToDouble (Type type, string value, ref string errorMsg) - { - double doubleval; - try { - doubleval = Convert.ToDouble (value); - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return null; - } - - return new SqlDouble (doubleval); - } - - public object ConvertToMoney (Type type, string value, ref string errorMsg) - { - decimal decimalval; - try { - decimalval = Convert.ToDecimal (value); - } catch (FormatException e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return null; - } - - return new SqlMoney (decimalval); - } - - public override object ConvertToDecimal (Type type, string value, ref string errorMsg) - { - decimal decimalval; - try { - decimalval = Convert.ToDecimal (value); - } catch (FormatException e) { - // This may be bcoz value is of the form 'd.ddEdd' - Double doubleVal = Convert.ToDouble (value); - decimalval = Convert.ToDecimal (doubleVal); - } - - return new SqlDecimal (decimalval); - } - - public override object ConvertToDateTime (Type type, string value, ref string errorMsg) - { - - Regex re = new Regex ("\\b(?<month>\\d{1,2})/(?<day>\\d{1,2})/(?<year>\\d{2,4})\\s+(?<hour>\\d{1,2}):(?<min>\\d{1,2})(:(?<sec>\\d{1,2})(\\.(?<msec>\\d{1,3}))*)*"); - - value = value.Trim ('\''); - Match m = re.Match (value); - - int month, day, year, hour, min, sec, msec; - month = day = year = hour = min = sec = msec = 0; - month = Convert.ToInt32 (m.Result ("${month}")); - day = Convert.ToInt32 (m.Result ("${day}")); - year = Convert.ToInt32 (m.Result ("${year}")); - string str = m.Result ("${hour}"); - if (!str.Equals ("")) - hour = Convert.ToInt32 (str); - str = m.Result ("${min}"); - if (!str.Equals ("")) - min = Convert.ToInt32 (str); - str = m.Result ("${sec}"); - if (!str.Equals ("")) - sec = Convert.ToInt32 (str); - str = m.Result ("${msec}"); - if (!str.Equals ("")) - msec = Convert.ToInt32 (str); - SqlDateTime dateObj; - try { - if (hour == 0 && min == 0 && sec == 0) - dateObj = new SqlDateTime (year, month, day); - else { - if (msec != 0) { - dateObj = new SqlDateTime (year, month, day, hour, min, sec, msec); - } else { - dateObj = new SqlDateTime (year, month, day, hour, min, sec); - } - } - } catch (Exception e) { - errorMsg = "Invalid date time\n"; - errorMsg += "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return null; - } - - return dateObj; - } - - public override Boolean AreEqual (object obj, string value, ref string errorMsg) - { - - if ((obj == null ) || (value.Equals ("null"))) { - if (obj == null && value.Equals ("null")) - return true; - return false; - } - - object valObj = ConvertToValueType (obj.GetType (), value, ref errorMsg); - return obj.Equals (valObj); - } - - public override object ConvertToValueType (Type objType, string value, ref string errorMsg) - { - - value = value.Trim ('\''); - value = value.Trim ('\"'); - - switch (objType.ToString ()) { - case "System.Data.SqlTypes.SqlInt16" : - return ConvertToInt16 (objType, value, ref errorMsg); - case "System.Data.SqlTypes.SqlInt32" : - return ConvertToInt32 (objType, value, ref errorMsg); - case "System.Data.SqlTypes.SqlInt64" : - return ConvertToInt64 (objType, value, ref errorMsg); - case "System.Data.SqlTypes.SqlString" : - return new SqlString (value); - case "System.Data.SqlTypes.SqlBoolean" : - return ConvertToBoolean (objType, value, ref errorMsg); - case "System.Data.SqlTypes.SqlByte" : - return ConvertToByte (objType, value, ref errorMsg); - case "System.Data.SqlTypes.SqlDateTime" : - return ConvertToDateTime (objType, value, ref errorMsg); - case "System.Data.SqlTypes.SqlDecimal" : - return ConvertToDecimal (objType, value, ref errorMsg); - case "System.Data.SqlTypes.SqlDouble" : - return ConvertToDouble (objType, value, ref errorMsg); - case "System.Data.SqlTypes.SqlSingle" : - return ConvertToSingle (objType, value, ref errorMsg); - case "System.Data.SqlTypes.SqlMoney" : - return ConvertToMoney (objType, value, ref errorMsg); - } - - if (objType.ToString () == "System.TimeSpan") - return ConvertToTimespan (objType, value, ref errorMsg); - - return ConvertValue (objType, value, ref errorMsg); - } - - } -} diff --git a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/MySqlDataReaderTest.cs b/mcs/class/System.Data/Test/DataProviderTests/datareadertests/MySqlDataReaderTest.cs deleted file mode 100644 index 8b7c541451e..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/MySqlDataReaderTest.cs +++ /dev/null @@ -1,157 +0,0 @@ -// -// MySqlDataReaderTest.cs :- A class derived from the 'BaseRetrieve' class -// - Contains code specific to mysql database -// -// Author: -// Satya Sudha K (ksathyasudha@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.Xml.XPath; -using System.Data; -using ByteFX.Data.MySqlClient; -using System.Text.RegularExpressions; - -namespace MonoTests.System.Data { - - public class MySqlRetrieve : BaseRetrieve { - - public MySqlRetrieve (string database) : base (database) - { - } - - // returns a Open connection - public override void GetConnection () - { - - string connectionString = null; - try { - connectionString = ConfigClass.GetElement (configDoc, "database", "connectionString"); - } catch (XPathException e) { - Console.WriteLine ("Error reading the config file !!"); - Console.WriteLine (e.Message); - con = null; - return; - } - - con = new MySqlConnection (connectionString); - try { - con.Open (); - } catch (MySqlException e) { - Console.WriteLine ("Cannot establish connection with the database"); - Console.WriteLine ("Probably the Database is down "); - con = null; - } catch (InvalidOperationException e) { - Console.WriteLine ("Cannot open connection "); - Console.WriteLine ("Probably the connection is already open"); - con = null; - } catch (Exception e) { - Console.WriteLine ("Cannot open connection "); - con = null; - } - } - - public override object ConvertToDateTime (Type type, string value, ref string errorMsg) - { - - string dateStr = value.Trim ('\''); - dateStr = dateStr.Trim ('\"'); - int year, month, day, hour, min, sec; - year = month = day = hour = min = sec = 0; - char [] splChars = {'!','@','#','$','%','^','&','*','-','+','.',','}; - string [] dateParts = dateStr.Split (' '); - - for (int index = 0; index < splChars.Length; index++) { - dateParts [0] = dateParts [0].Replace (splChars [index], '/'); - if (dateParts.Length > 1) - dateParts [1] = dateParts [1].Replace (splChars [index], ':'); - } - - dateStr = String.Join (" ", dateParts); - Regex re = new Regex ("\\b(?<year>\\d{2,4})/(?<month>\\d{1,2})/(?<day>\\d{1,2})(\\s+(?<hour>\\d{1,2}):(?<min>\\d{1,2}):(?<sec>\\d{1,2}))*"); - - Match m = re.Match (dateStr); - if (!m.Success) { - re = new Regex("\\b(?<year>\\d{4})(?<month>\\d{2})(?<day>\\d{2})((?<hour>\\d{2})(?<min>\\d{2})(?<sec>\\d{2}))*"); - m = re.Match (dateStr); - } - - string matchedVal = m.Result ("${year}"); - if (!matchedVal.Equals ("")) - year = Convert.ToInt32 (matchedVal); - matchedVal = m.Result ("${month}"); - if (!matchedVal.Equals ("")) - month = Convert.ToInt32 (matchedVal); - matchedVal = m.Result ("${day}"); - if (!matchedVal.Equals ("")) - day = Convert.ToInt32 (matchedVal); - matchedVal = m.Result ("${hour}"); - if (!matchedVal.Equals ("")) - hour = Convert.ToInt32 (matchedVal); - matchedVal = m.Result ("${min}"); - if (!matchedVal.Equals ("")) - min = Convert.ToInt32 (matchedVal); - matchedVal = m.Result ("${sec}"); - if (!matchedVal.Equals ("")) - sec = Convert.ToInt32 (matchedVal); - - DateTime dateTime; - try { - dateTime = new DateTime (year, month, day, hour, min, sec); - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return null; - } - - return dateTime; - } - - public override object ConvertToTimespan (Type type, string value, ref string errorMsg) - { - - // Format the input string as 'hh:mm:yy' - string dateStr = value.Trim ('\''); - - if (dateStr.IndexOf (':') == -1) { - // String in the form 'hhmmss', insert ':'s in between - dateStr = dateStr.Substring (0,2) + ":" + - dateStr.Substring (2,2)+ ":" + - dateStr.Substring (4,2); - } - - TimeSpan timespan; - try { - timespan = TimeSpan.Parse (dateStr); - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return null; - } - - return timespan; - } - } -} diff --git a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/OdbcDataReaderTest.cs b/mcs/class/System.Data/Test/DataProviderTests/datareadertests/OdbcDataReaderTest.cs deleted file mode 100644 index 165f396c97f..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/OdbcDataReaderTest.cs +++ /dev/null @@ -1,149 +0,0 @@ -// -// OdbcDataReaderTest.cs -// -// Author: -// Satya Sudha K (ksathyasudha@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.Odbc; - -namespace MonoTests.System.Data { - - public class MySqlOdbcRetrieve : MySqlRetrieve { - - public MySqlOdbcRetrieve (string database) : base (database) - { - } - - // returns a Open connection - public override void GetConnection () - { - string connectionString = null; - try { - connectionString = ConfigClass.GetElement (configDoc, "database", "OdbcConnString"); - } catch (Exception e) { - Console.WriteLine ("Error reading the config file"); - Console.WriteLine (e.Message); - return; - } - - con = new OdbcConnection (connectionString); - try { - con.Open (); - } catch (Exception e) { - Console.WriteLine ("Cannot establish connection with the database"); - con = null; - } - } - } - - public class MsSqlOdbcRetrieve : MsSqlRetrieve { - - public MsSqlOdbcRetrieve (string database) : base (database) - { - } - - // returns a Open connection - public override void GetConnection () - { - string connectionString = null; - try { - connectionString = ConfigClass.GetElement (configDoc, "database", "OdbcConnString"); - } catch (Exception e) { - Console.WriteLine ("Error reading the config file"); - Console.WriteLine (e.Message); - return; - } - - con = new OdbcConnection (connectionString); - try { - con.Open (); - } catch (Exception e) { - Console.WriteLine ("Cannot establish connection with the database"); - con = null; - } - } - } - - public class OracleOdbcRetrieve : OraRetrieve { - - public OracleOdbcRetrieve (string database) : base (database) - { - } - - // returns a Open connection - public override void GetConnection () - { - string connectionString = null; - try { - connectionString = ConfigClass.GetElement (configDoc, "database", "OdbcConnString"); - } catch (Exception e) { - Console.WriteLine ("Error reading the config file"); - Console.WriteLine (e.Message); - return; - } - - con = new OdbcConnection (connectionString); - - try { - con.Open (); - } catch (Exception e) { - Console.WriteLine ("Cannot establish connection with the database"); - con = null; - } - } - } - - public class PostgreOdbcRetrieve : MySqlRetrieve { - - public PostgreOdbcRetrieve (string database) : base (database) - { - } - - // returns a Open connection - public override void GetConnection () - { - - string connectionString = null; - try { - connectionString = ConfigClass.GetElement (configDoc, "database", "OdbcConnString"); - } catch (Exception e) { - Console.WriteLine ("Error reading the config file"); - Console.WriteLine (e.Message); - return; - } - - con = new OdbcConnection (connectionString); - try { - con.Open (); - } catch (Exception e) { - Console.WriteLine ("Cannot establish connection with the database"); - con = null; - } - } - } -} diff --git a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/OracleDataReaderTest.cs b/mcs/class/System.Data/Test/DataProviderTests/datareadertests/OracleDataReaderTest.cs deleted file mode 100644 index 605ec06c441..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/OracleDataReaderTest.cs +++ /dev/null @@ -1,275 +0,0 @@ -// -// OracleDataReaderTest.cs :- Defines a class OraRetrieve' derived from the -// 'BaseRetrieve' class : -// - Contains code specific to oracle database -// -// Author: -// Satya Sudha K (ksathyasudha@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.Xml.XPath; -using System.Data; -using System.Data.OracleClient; -using System.Text.RegularExpressions; - -namespace MonoTests.System.Data { - - public class OraRetrieve : BaseRetrieve { - - public OraRetrieve (string database) : base (database) - { - } - - // returns a Open connection - public override void GetConnection () - { - string connectionString = null; - try { - connectionString = ConfigClass.GetElement (configDoc, "database", "connectionString"); - } catch (XPathException e) { - Console.WriteLine ("Error reading the config file !!"); - Console.WriteLine (e.Message); - return; - } - - con = new OracleConnection (connectionString); - - try { - con.Open (); - } catch (OracleException e) { - Console.WriteLine ("Cannot establish connection with the database"); - Console.WriteLine ("Probably the database is down"); - con = null; - } catch (InvalidOperationException e) { - Console.WriteLine ("Cannot open connection"); - Console.WriteLine ("Probably the connection is already open"); - con = null; - } catch (Exception e) { - Console.WriteLine ("Cannot open connection"); - con = null; - } - } - - public override object GetValue (IDataReader reader, int columnIndex) - { - - object value = null; - - if (reader.IsDBNull (columnIndex)) - return null; - - OracleDataReader rdr = (OracleDataReader) reader; - Type type = rdr.GetFieldType (columnIndex); - string datatypeName = rdr.GetDataTypeName (columnIndex); - - if (datatypeName.ToLower ().Equals ("interval year to month")) { - value = rdr.GetOracleMonthSpan (columnIndex); - return value; - } - - switch (type.Name.ToLower ()) { - - case "int32": value = rdr.GetInt32 (columnIndex); - break; - case "decimal" : - try { - value = rdr.GetDecimal (columnIndex); - } catch (Exception e) { - value = rdr.GetOracleNumber (columnIndex); - } - break; - case "datetime": value = rdr.GetDateTime (columnIndex); - break; - case "string": value = rdr.GetString (columnIndex); - break; - case "timespan" : value = rdr.GetTimeSpan (columnIndex); - break; - default : value = rdr.GetValue (columnIndex); - break; - } - return value; - } - - public override Boolean AreEqual (object obj, string value, ref string errorMsg) - { - if ((obj == null ) || (value.Equals ("null"))) { - if (obj == null && value.Equals ("null")) - return true; - return false; - } - - object valObj = ConvertToValueType (obj.GetType (), value, ref errorMsg); - return valObj.Equals (obj); - } - - public override object ConvertToValueType (Type objType, string value, ref string errorMsg) - { - - value = value.Trim ('\''); - value = value.Trim ('\"'); - - switch (objType.ToString ()) { - - case "System.Data.OracleClient.OracleNumber" : - return ConvertToOracleNumber (objType, value, ref errorMsg); - case "System.Data.OracleClient.OracleMonthSpan" : - return ConvertToOracleMonthSpan (objType, value, ref errorMsg); - case "System.Decimal" : - return ConvertToDecimal (objType, value, ref errorMsg); - case "System.String" : - return value; - case "System.TimeSpan" : - return ConvertToTimespan (objType, value, ref errorMsg); - case "System.DateTime" : - return ConvertToDateTime (objType, value, ref errorMsg); - } - - return ConvertValue (objType, value, ref errorMsg); - } - - public override object ConvertToDecimal (Type type, string value, ref string errorMsg) - { - decimal decimalval; - try { - decimalval = Convert.ToDecimal (value); - } catch (FormatException e) { - // This may be bcoz value is of the form 'd.ddEdd' - Double doubleVal = Convert.ToDouble (value); - decimalval = Convert.ToDecimal (doubleVal); - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return false; - } - return decimalval; - } - - public override object ConvertToDateTime (Type type, string value, ref string errorMsg) - { - value = value.ToLower ().Trim (); - string format = null, date = null; - if (value.StartsWith ("to_date")) { - value = value.Remove (0, 8); - value = value.Remove (value.Length - 1, 1); - string [] dateParts = value.Split (','); - date = dateParts [0].Trim (); - format = dateParts [1].Trim (); - - date = date.Trim ('\''); - format = format.Trim ('\''); - // Assuming that date will be in yyyy-mm-dd hh24:mi:ss only - format = format.Replace ("yyyy", "(?<yyyy>\\d{4})"); - format = format.Replace ("mm", "(?<mm>\\d{2})"); - format = format.Replace ("dd", "(?<dd>\\d{2})"); - format = format.Replace ("hh24", "(?<hh24>\\d{2})"); - format = format.Replace ("mi", "(?<mi>\\d{2})"); - format = format.Replace ("ss", "(?<ss>\\d{2})"); - } else if (value.ToLower().StartsWith ("timestamp")) { - value = value.Remove (0, 9); - value = value.Trim (); - date = value.Trim ('\''); - format = "\\b(?<yyyy>\\d{4})\\-(?<mm>\\d{2})\\-(?<dd>\\d{2}) (?<hh24>\\d{2}):(?<mi>\\d{2}):(?<ss>\\d{2})"; - - } - - Regex re = new Regex (format); - Match m = re.Match (date); - if (!m.Success) - return false; - int year = Convert.ToInt32 (m.Result ("${yyyy}")); - int month = Convert.ToInt32 (m.Result ("${mm}")); - int day = Convert.ToInt32 (m.Result ("${dd}")); - int hour = Convert.ToInt32 (m.Result ("${hh24}")); - int min = Convert.ToInt32 (m.Result ("${mi}")); - int sec = Convert.ToInt32 (m.Result ("${ss}")); - - DateTime newDt ; - try { - newDt = new DateTime (year, month, day, hour, min, sec); - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return false; - } - return newDt; - } - - object ConvertToOracleNumber (Type type, string value, ref string errorMsg) - { - return OracleNumber.Parse (value); - } - - object ConvertToOracleMonthSpan (Type type, string value, ref string errorMsg) - { - int intervalInMonths = 0; - bool isNegative = false; - if (value.StartsWith ("-")) { - isNegative = true; - value = value.Trim ('-'); - } - string [] intParts = value.Split ('-'); - if (intParts.Length > 0) { - intervalInMonths = Convert.ToInt32 (intParts [0]) * 12; - if (intParts.Length > 1) - intervalInMonths += Convert.ToInt32 (intParts [1]); - } else {// Should not come here - return false; - } - if (isNegative) { - intervalInMonths *= -1; - } - return new OracleMonthSpan (intervalInMonths); - } - - public override object ConvertToTimespan (Type type, string value, ref string errorMsg) - { - // Input in the form '[-]dd hh:mi:ss' - value = value.Replace (" ", "."); - return TimeSpan.Parse (value); - } - - public override IDataReader QueryUsingStoredProc (IDbCommand cmd, - string storedProcName, - string paramName) - { - IDataReader reader = null; - OracleCommand command = (OracleCommand) cmd; - command.CommandText = storedProcName; - command.CommandType = CommandType.StoredProcedure; - OracleParameter pOutput = command.Parameters.Add ("ref_cur", OracleType.Cursor); - pOutput.Direction = ParameterDirection.Output; - try { - reader = cmd.ExecuteReader (); - } catch (Exception e) { - Console.WriteLine (e.Message); - Console.WriteLine (e.StackTrace); - reader = null; - } - command.Parameters.Remove (pOutput); - return reader; - } - } -} diff --git a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/PostgresDataReaderTest.cs b/mcs/class/System.Data/Test/DataProviderTests/datareadertests/PostgresDataReaderTest.cs deleted file mode 100644 index 6fdedfd625b..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/PostgresDataReaderTest.cs +++ /dev/null @@ -1,149 +0,0 @@ -// -// PostgresDataReaderTest.cs :- Defines a class 'PostgresRetrieve' derived from the -// 'BaseRetrieve' class -// - Contains code specific to postgres database -// -// Author: -// Satya Sudha K (ksathyasudha@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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 Npgsql; -using System.Text.RegularExpressions; - - -namespace MonoTests.System.Data { - - public class PostgresRetrieve : BaseRetrieve { - - public PostgresRetrieve (string database) : base (database) - { - } - - // returns a Open connection - public override void GetConnection () - { - string connectionString = null; - try { - connectionString = ConfigClass.GetElement (configDoc, "database", "connectionString"); - } catch (Exception e) { - Console.WriteLine ("Error reading the config file"); - Console.WriteLine (e.Message); - con = null; - return; - } - - con = new NpgsqlConnection (connectionString); - - try { - con.Open (); - } catch (NpgsqlException e) { - Console.WriteLine ("Cannot establish connection with the database"); - Console.WriteLine ("Probably the Database is down!!"); - con = null; - } catch (InvalidOperationException e) { - Console.WriteLine ("Cannot establish connection with the database"); - Console.WriteLine ("Probably connection is already open"); - con = null; - } catch (Exception e) { - Console.WriteLine ("Cannot establish connection with the database"); - con = null; - } - } - - public override object ConvertToDateTime (Type type, string value, ref string errorMsg) - { - - int month, day, year, hour, min, sec; - month = day = year = hour = min = sec = 0; - double msec = 0; - msec = 0; - - Regex re = new Regex ("\\b(?<year>\\d{2,4})\\-(?<month>\\d{1,2})\\-(?<day>\\d{1,2})(\\s+(?<hour>\\d{1,2}):(?<minute>\\d{1,2}):(?<sec>\\d{1,2})(\\.(?<msec>\\d{1,6}))*)*"); - - value = value.Trim ('\''); - value = value.Trim ('\"'); - Match m = re.Match (value); - string matchedVal = null; - - if (m.Success) { - matchedVal = m.Result ("${year}"); - if (!matchedVal.Equals ("")) - year = Convert.ToInt32 (matchedVal); - - matchedVal = m.Result ("${month}"); - if (!matchedVal.Equals ("")) - month = Convert.ToInt32 (matchedVal); - - matchedVal = m.Result ("${day}"); - if (!matchedVal.Equals ("")) - day = Convert.ToInt32 (matchedVal); - } else { - // Only timespan - re = new Regex("\\b(?<hour>\\d{1,2}):(?<minute>\\d{1,2}):(?<sec>\\d{1,2})(\\.(?<msec>\\d{1,6}))*"); - m = re.Match (value); - } - - try { - - matchedVal = m.Result ("${hour}"); - if (!matchedVal.Equals ("")) - hour = Convert.ToInt32 (matchedVal); - - matchedVal = m.Result ("${minute}"); - if (!matchedVal.Equals ("")) - min = Convert.ToInt32 (matchedVal); - - matchedVal = m.Result ("${sec}"); - if (!matchedVal.Equals ("")) - sec = Convert.ToInt32 (matchedVal); - - matchedVal = m.Result ("${msec}"); - if (!matchedVal.Equals ("")) - msec = Convert.ToDouble (matchedVal); - if (msec > 1000) - msec = msec / 1000; - - if (day == 0 && month == 0 && year == 0) { - // Time span only - TimeSpan ts =TimeSpan.Parse(value); - return ts; - - } else { - - DateTime dateObj = new DateTime (year, month, day, hour, min, sec); - dateObj = dateObj.AddMilliseconds (msec); - return dateObj; - } - - } catch (Exception e) { - errorMsg = "ERROR : " + e.Message; - errorMsg += "\nSTACKTRACE : " + e.StackTrace; - return null; - } - } - } -} diff --git a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/Runtests.cs b/mcs/class/System.Data/Test/DataProviderTests/datareadertests/Runtests.cs deleted file mode 100644 index 84a234f9f0d..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/Runtests.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Configuration; -using MonoTests.System.Data; - -class RunTest { - - public static void Main(string [] args) - { - - string [] databases = null; - if (args.Length == 0 || (args.Length == 1 && args [0].Equals ("all"))) { - // Run test for all databases - string listOfDbs = ConfigurationSettings.AppSettings ["Databases"]; - databases = listOfDbs.Split (';'); - } else { - databases = (string []) args.Clone (); - } - - BaseRetrieve dbRetrieve = null; - - foreach (string str in databases) { - - switch (str) { - -/* - case "mysql" : - Console.WriteLine ("\n ****** Running tests for MYSQL ***** \n"); - dbRetrieve = new MySqlRetrieve ("mysql"); - dbRetrieve.RunTest (); - break; -*/ - case "mssql" : - Console.WriteLine ("\n ****** Running tests for MS SQL ***** \n"); - dbRetrieve = new MsSqlRetrieve ("mssql"); - dbRetrieve.RunTest (); - Console.WriteLine ("\n ****** Running MS SQL - specific tests ***** \n"); - dbRetrieve = new SqlRetrieve ("mssql"); - dbRetrieve.RunTest (); - break; - - case "oracle" : - Console.WriteLine ("\n ****** Running tests for ORACLE ***** \n"); - dbRetrieve = new OraRetrieve ("oracle"); - dbRetrieve.RunTest (); - break; -/* - case "postgres" : - Console.WriteLine ("\n ****** Running tests for POSTGRE ***** \n"); - dbRetrieve = new PostgresRetrieve ("postgres"); - dbRetrieve.RunTest (); - break; - - case "mysql-odbc" : - Console.WriteLine ("\n ****** Running tests for MySql (using ODBC) ***** \n"); - dbRetrieve = new MySqlOdbcRetrieve ("mysql"); - dbRetrieve.RunTest (); - break; - - case "mssql-odbc" : - Console.WriteLine ("\n ****** Running tests for MsSql (using ODBC) ***** \n"); - dbRetrieve = new MsSqlOdbcRetrieve ("mssql"); - dbRetrieve.RunTest (); - break; - - case "oracle-odbc" : - Console.WriteLine ("\n ****** Running tests for Oracle (using ODBC) ***** \n"); - dbRetrieve = new OracleOdbcRetrieve ("oracle"); - dbRetrieve.RunTest (); - break; - - case "postgres-odbc" : - Console.WriteLine ("\n ****** Running tests for Postgres (using ODBC) ***** \n"); - dbRetrieve = new PostgreOdbcRetrieve ("postgres"); - dbRetrieve.RunTest (); - break; -*/ - } - } - } -} diff --git a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/Runtests.exe.config b/mcs/class/System.Data/Test/DataProviderTests/datareadertests/Runtests.exe.config deleted file mode 100644 index c996ae0d6b0..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/Runtests.exe.config +++ /dev/null @@ -1,1191 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<configuration> - <configSections> - <section name="mysql" type="SectionHandlers.SectionHandler, DbRetrieve" allowLocation="true"/> - <section name="mssql" type="SectionHandlers.SectionHandler, DbRetrieve" allowLocation="true"/> - <section name="postgres" type="SectionHandlers.SectionHandler, DbRetrieve" allowLocation="true"/> - <section name="oracle" type="SectionHandlers.SectionHandler, DbRetrieve" allowLocation="true"/> - </configSections> - - <appSettings> - <add key="databases" value="mssql" /> - <add key="deleteTables" value="Y"/> - <add key="createTables" value="Y"/> - <add key="insertData" value="Y"/> - </appSettings> - - <mysql> - <database> - <name> mysql </name> - <connectionString> "Server=164.99.152.215;Database=mysql;User Id=sudha;Password=novell" </connectionString> - <OdbcConnString>DSN=Mysql-Test-DSN;uid=sudha;pwd=novell </OdbcConnString> - </database> - <tables> - <numTables> 3 </numTables> - <table1> - <name>numericTable </name> - <numColumns>15</numColumns> - <column1> - <name> serialNo </name> - <type> TINYINT UNSIGNED</type> - <constraint> PRIMARY KEY</constraint> - </column1> - <column2> - <name> unsigned_tinyInt </name> - <type> TINYINT UNSIGNED</type> - </column2> - <column3> - <name> signed_tinyInt </name> - <type> TINYINT </type> - </column3> - <column4> - <name> bit </name> - <type> BIT </type> - </column4> - <column5> - <name> bool </name> - <type> BOOL </type> - </column5> - <column6> - <name> unsigned_smallint</name> - <type> SMALLINT UNSIGNED</type> - </column6> - <column7> - <name> signed_smallint</name> - <type> SMALLINT </type> - </column7> - <column8> - <name> unsigned_mediumint</name> - <type> MEDIUMINT UNSIGNED</type> - </column8> - <column9> - <name> signed_mediumint</name> - <type> MEDIUMINT </type> - </column9> - <column10> - <name> unsigned_int</name> - <type> INT UNSIGNED</type> - </column10> - <column11> - <name> signed_int</name> - <type> INT </type> - </column11> - <column12> - <name> unsigned_integer</name> - <type> INTEGER UNSIGNED</type> - </column12> - <column13> - <name> signed_integer</name> - <type> INTEGER </type> - </column13> - <column14> - <name> unsigned_bigint</name> - <type> BIGINT UNSIGNED </type> - </column14> - <column15> - <name> signed_bigint</name> - <type> BIGINT </type> - </column15> - </table1> - <table2> - <name>realNoTable </name> - <numColumns>11</numColumns> - <column1> - <name> serialNo </name> - <type> TINYINT UNSIGNED </type> - </column1> - <column2> - <name> unsigned_float </name> - <type> FLOAT(24) UNSIGNED </type> - </column2> - <column3> - <name> signed_float </name> - <type> FLOAT(24) </type> - </column3> - <column4> - <name> unsigned_double_float </name> - <type> FLOAT(25) UNSIGNED</type> - </column4> - <column5> - <name> signed_double_float </name> - <type> FLOAT(53) </type> - </column5> - <column6> - <name> unsigned_double</name> - <type> DOUBLE UNSIGNED </type> - </column6> - <column7> - <name> signed_double</name> - <type> DOUBLE </type> - </column7> - <column8> - <name> unsigned_double_precision</name> - <type> DOUBLE PRECISION UNSIGNED</type> - </column8> - <column9> - <name> signed_real</name> - <type> REAL </type> - </column9> - <column10> - <name> unsigned_decimal</name> - <type> DECIMAL(6,3) UNSIGNED</type> - </column10> - <column11> - <name> signed_numeric</name> - <type> NUMERIC(5,3) </type> - </column11> - </table2> - <table3> - <name>dateTable </name> - <numColumns>6</numColumns> - <column1> - <name> serialNo </name> - <type> TINYINT UNSIGNED </type> - </column1> - <column2> - <name> dateField</name> - <type> DATE </type> - </column2> - <column3> - <name> datetimeField</name> - <type> DATETIME </type> - </column3> - <column4> - <name> timestampField</name> - <type> TIMESTAMP </type> - </column4> - <column5> - <name> timeField</name> - <type> TIME </type> - </column5> - <column6> - <name> yearField</name> - <type> YEAR </type> - </column6> - </table3> - </tables> - <values> - <numTables>3</numTables> - <table1> - <tableName>numericTable</tableName> - <numRows>4</numRows> - <numCols>15</numCols> - <row1> - <column1> 1 </column1> - <column2> 0</column2> - <column3> -128</column3> - <column4> -128</column4> - <column5> -128</column5> - <column6> 0 </column6> - <column7> -32768 </column7> - <column8> 0</column8> - <column9> -8388608 </column9> - <column10> 0 </column10> - <column11> -2147483648 </column11> - <column12> 0 </column12> - <column13> -2147483648 </column13> - <column14> 0 </column14> - <column15> -9223372036854775808 </column15> - </row1> - <row2> - <column1> 2 </column1> - <column2> 100</column2> - <column3> 50 </column3> - <column4> 100 </column4> - <column5> 100 </column5> - <column6> 3000 </column6> - <column7> -300 </column7> - <column8> 500000 </column8> - <column9> -100000 </column9> - <column10> 4000000 </column10> - <column11> 500000 </column11> - <column12> 4000000 </column12> - <column13> 500000 </column13> - <column14> 5000000000 </column14> - <column15> -5000000000 </column15> - </row2> - <row3> - <column1> 3 </column1> - <column2> 255</column2> - <column3> 127</column3> - <column4> 127</column4> - <column5> 127</column5> - <column6> 65535</column6> - <column7> 32767 </column7> - <column8> 16777215 </column8> - <column9> 8388607 </column9> - <column10> 4294967295 </column10> - <column11> 2147483647 </column11> - <column12> 4294967295 </column12> - <column13> 2147483647 </column13> - <column14> 18446744073709551615 </column14> - <column15> 9223372036854775807 </column15> - </row3> - <row4> - <column1> 4 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - <column6> null </column6> - <column7> null </column7> - <column8> null </column8> - <column9> null </column9> - <column10> null </column10> - <column11> null </column11> - <column12> null </column12> - <column13> null </column13> - <column14> null </column14> - <column15> null </column15> - </row4> - </table1> - <table2> - <tableName>realNoTable</tableName> - <numRows>6</numRows> - <numCols>11</numCols> - <row1> - <column1> 1 </column1> - <column2> 0 </column2> - <column3> 0 </column3> - <column4> 0 </column4> - <column5> 0 </column5> - <column6> 0 </column6> - <column7> 0 </column7> - <column8> 0 </column8> - <column9> 0 </column9> - <column10> 0 </column10> - <column11> 0 </column11> - </row1> - <row2> - <column1> 2 </column1> - <column2> 1.175494351E-38 </column2> - <column3> -3.402823466E+38 </column3> - <column4> 1.175494351E-38 </column4> - <column5> -1.797693134862315E+308 </column5> - <column6> 1.175494351E-38 </column6> - <column7> -1.797693134862315E+308 </column7> - <column8> 1.175494351E-38 </column8> - <column9> -1.797693134862315E+308 </column9> - <column10> 99.999 </column10> - <column11> -23.456 </column11> - </row2> - <row3> - <column1> 3 </column1> - <column2> 3.402823466E+38 </column2> - <column3> -1.175494351E-38 </column3> - <column4> 3.402823466E+38 </column4> - <column5> -2.2250738585072014E-308 </column5> - <column6> 3.402823466E+38 </column6> - <column7> -2.2250738585072014E-308 </column7> - <column8> 3.402823466E+38 </column8> - <column9> -2.2250738585072014E-308 </column9> - <column10> 778.123 </column10> - <column11> -99.999 </column11> - </row3> - <row4> - <column1> 4 </column1> - <column2> 1.2345E+20</column2> - <column3> 1.175494351E-38 </column3> - <column4> 1.2345E+20 </column4> - <column5> 2.2250738585072014E-308 </column5> - <column6> 1.2345E+20 </column6> - <column7> 2.2250738585072014E-308 </column7> - <column8> 1.2345E+20 </column8> - <column9> 2.2250738585072014E-308 </column9> - <column10> 308.90 </column10> - <column11> 12.345 </column11> - </row4> - <row5> - <column1> 5 </column1> - <column2> 3.452E-19</column2> - <column3> 3.402823466E+38 </column3> - <column4> 4.32E-15 </column4> - <column5> 1.797693134862315E+308 </column5> - <column6> 4.32E-15 </column6> - <column7> 1.797693134862315E+308 </column7> - <column8> 4.32E-15 </column8> - <column9> 1.797693134862315E+308 </column9> - <column10> 999.999 </column10> - <column11> 999.999 </column11> - </row5> - <row6> - <column1> 6 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - <column6> null </column6> - <column7> null </column7> - <column8> null </column8> - <column9> null </column9> - <column10> null </column10> - <column11> null </column11> - </row6> - </table2> - <table3> - <tableName>dateTable</tableName> - <numRows>9</numRows> - <numCols>6</numCols> - <row1> - <column1> 1 </column1> - <column2> '1000-01-01' </column2> - <column3> '1000-01-01 00:00:00' </column3> - <column4> '1970-01-02 00:00:00' </column4> - <column5> '-23:59:59' </column5> - <column6> 2004 </column6> - </row1> - <row2> - <column1> 2 </column1> - <column2> '1999-12-17' </column2> - <column3> '1999-12-17 08:00:00' </column3> - <column4> '2000-01-01 04:40:00' </column4> - <column5> '-23:45:56' </column5> - <column6> 1999 </column6> - </row2> - <row3> - <column1> 3 </column1> - <column2> '9999-12-31' </column2> - <column3> '9999-12-31 23:59:59' </column3> - <column4> '2037-12-31 23:59:59' </column4> - <column5> '23:59:59' </column5> - <column6> 2155</column6> - </row3> - <row4> - <column1> 4 </column1> - <column2> '1999@12@31' </column2> - <column3> '1999@12@31 11+30+45' </column3> - <column4> '1999@12@31 11+30+45' </column4> - <column5> '12:23:34' </column5> - <column6> 1901</column6> - </row4> - <row5> - <column1> 5 </column1> - <column2> '9999.11.18' </column2> - <column3> '9999.11.18 11*45*50' </column3> - <column4> '2037.11.18 11*45*50' </column4> - <column5> '23:34:34' </column5> - <column6> 2069 </column6> - </row5> - <row6> - <column1> 6 </column1> - <column2> '9999/11/09' </column2> - <column3> '9999/11/09 12:23:34' </column3> - <column4> '2037/11/09 12:23:34' </column4> - <column5> '09:08:07' </column5> - <column6> 1970</column6> - </row6> - <row7> - <column1> 7 </column1> - <column2> 19980404 </column2> - <column3> 19980404083050 </column3> - <column4> 19980404083050 </column4> - <column5> 083045 </column5> - <column6> 0000</column6> - </row7> - <row8> - <column1> 8 </column1> - <column2> '0000-00-00' </column2> - <column3> '0000-00-00 00:00:00' </column3> - <column4> 00000000000000 </column4> - <column5> '00:00:00'</column5> - <column6> 00</column6> - </row8> - <row9> - <column1> 9 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - <column6> null </column6> - </row9> - </table3> - </values> - <queries> - <numQueries> 2 </numQueries> - <query1> Select COLUMNS from TABLE1 order by COLUMN1 </query1> - <query2> Select COLUMN1,COLUMN3,COLUMN5 from TABLE2 order by COLUMN1 </query2> - <query3> Select COLUMN2,COLUMN4 from TABLE3 order by COLUMN1 </query3> - </queries> - </mysql> - <mssql> - <database> - <name> mssql </name> - <connectionString> Server=__servername__;Database=__dbname__;User ID=sa;Password=__password__;</connectionString> - <OdbcConnString>DSN=MsSQL-DSN;uid=sa;pwd=fragile </OdbcConnString> - </database> - <StoredProcExists> N </StoredProcExists> - <tables> - <numTables> 5 </numTables> - <table1> - <name>numericTable </name> - <numColumns>6</numColumns> - <column1> - <name> sNo </name> - <type> tinyint </type> - </column1> - <column2> - <name> bigInteger </name> - <type> bigint </type> - </column2> - <column3> - <name> integer </name> - <type>int</type> - </column3> - <column4> - <name> smallInteger </name> - <type> smallint </type> - </column4> - <column5> - <name> tinyInt </name> - <type> tinyint </type> - </column5> - <column6> - <name> bit </name> - <type> bit </type> - </column6> - </table1> - <table2> - <name>dateTimeTable </name> - <numColumns>3</numColumns> - <column1> - <name> sNo </name> - <type> tinyInt </type> - </column1> - <column2> - <name> date</name> - <type> datetime </type> - </column2> - <column3> - <name> smalldate </name> - <type> smalldatetime </type> - </column3> - </table2> - <table3> - <name>realNosTable </name> - <numColumns>5</numColumns> - <column1> - <name> sNo </name> - <type> tinyInt </type> - </column1> - <column2> - <name> decimalCol </name> - <type> decimal(8,4) </type> - </column2> - <column3> - <name> numericCol </name> - <type> numeric(6,4) </type> - </column3> - <column4> - <name> floatCol </name> - <type> float </type> - </column4> - <column5> - <name> realCol </name> - <type> real </type> - </column5> - </table3> - <table4> - <name>moneyTable </name> - <numColumns>3</numColumns> - <column1> - <name> sNo </name> - <type> tinyInt </type> - </column1> - <column2> - <name> money </name> - <type> money </type> - </column2> - <column3> - <name> smallmoney </name> - <type> smallmoney </type> - </column3> - </table4> - <table5> - <name>charTable </name> - <numColumns>5</numColumns> - <column1> - <name> sNo </name> - <type> tinyInt </type> - </column1> - <column2> - <name> characterCol </name> - <type> char(20) </type> - </column2> - <column3> - <name> ncharacterCol </name> - <type> nchar(20) </type> - </column3> - <column4> - <name> varchar </name> - <type> varchar(20) </type> - </column4> - <column5> - <name> nvarchar </name> - <type> nvarchar(20) </type> - </column5> - </table5> - </tables> - <values> - <numTables>5</numTables> - <table1> - <tableName>numericTable</tableName> - <numRows>4</numRows> - <numCols>6</numCols> - <row1> - <column1> 1 </column1> - <column2> -9223372036854775808 </column2> - <column3> -2147483648 </column3> - <column4> -32768 </column4> - <column5> 0</column5> - <column6> 0</column6> - </row1> - <row2> - <column1> 2 </column1> - <column2> 1244 </column2> - <column3> -50 </column3> - <column4> 234 </column4> - <column5> 128 </column5> - <column6> 0</column6> - </row2> - <row3> - <column1> 3 </column1> - <column2> 9223372036854775807 </column2> - <column3> 2147483647 </column3> - <column4> 32767 </column4> - <column5> 255 </column5> - <column6> 1</column6> - </row3> - <row4> - <column1> 4 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - <column6> null </column6> - </row4> - </table1> - <table2> - <tableName> dateTimeTable</tableName> - <numRows>3</numRows> - <numCols>3</numCols> - <row1> - <column1> 1 </column1> - <column2> '1/1/1753 03:04:05.234' </column2> - <column3> '1/1/1970 12:24'</column3> - </row1> - <row2> - <column1> 2 </column1> - <column2> '12/31/9999 00:00:00' </column2> - <column3> '6/6/2079 00:00'</column3> - </row2> - <row3> - <column1> 3 </column1> - <column2> null </column2> - <column3> null </column3> - </row3> - </table2> - <table3> - <tableName> realNosTable</tableName> - <numRows>6</numRows> - <numCols>5</numCols> - <row1> - <column1> 1 </column1> - <column2> -9.99E+3</column2> - <column3> -99 </column3> - <column4> -1.7976931348623157E+308 </column4> - <column5> -3.402823466E+38 </column5> - </row1> - <row2> - <column1> 2 </column1> - <column2> -1.23E3 </column2> - <column3> -12 </column3> - <column4> -2.2250738585072014E-308 </column4> - <column5> -3.4E-38 </column5> - </row2> - <row3> - <column1> 3 </column1> - <column2> 0 </column2> - <column3> 0 </column3> - <column4> 0 </column4> - <column5> 0 </column5> - </row3> - <row4> - <column1> 4 </column1> - <column2> 1.2E1 </column2> - <column3> 12 </column3> - <column4> 2.2250738585072014E-308 </column4> - <column5> 4.56E-3 </column5> - </row4> - <row5> - <column1> 5 </column1> - <column2> 9.999E3 </column2> - <column3> 99 </column3> - <column4> 1.7976931348623157E+308 </column4> - <column5> 3.4E+38 </column5> - </row5> - <row6> - <column1> 6 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - </row6> - </table3> - <table4> - <tableName> moneyTable</tableName> - <numRows>4</numRows> - <numCols>3</numCols> - <row1> - <column1> 1 </column1> - <column2> -922337203685477.5808 </column2> - <column3> -214748.3648 </column3> - </row1> - <row2> - <column1> 2 </column1> - <column2> 5477.5808 </column2> - <column3> 748.3648 </column3> - </row2> - <row3> - <column1> 3 </column1> - <column2> 922337203685477.5807 </column2> - <column3> 214748.3647 </column3> - </row3> - <row4> - <column1> 4 </column1> - <column2> null </column2> - <column3> null </column3> - </row4> - </table4> - <table5> - <tableName> charTable</tableName> - <numRows>2</numRows> - <numCols>5</numCols> - <row1> - <column1> 1 </column1> - <column2> '12345678901234567890' </column2> - <column3> 'abcdefghijklmnopqrst' </column3> - <column4> 'zyxwvutsrqponmlkjihg' </column4> - <column5> '12345678901234567890' </column5> - </row1> - <row2> - <column1> 2 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - </row2> - </table5> - - </values> - <StoredProc> - <NumStoredProc> 1 </NumStoredProc> - <StoredProc1> - <type> generic </type> - <name> Select_{{TABLE}}_proc </name> - <template> - <numStmts> 1 </numStmts> - <stmt1><![CDATA[ - create procedure Select_{{TABLE}}_proc As - BEGIN - Select {{COLUMNS}} from {{TABLE}}; - END]]> - </stmt1> - </template> - </StoredProc1> - </StoredProc> - <queries> - <numQueries> 5 </numQueries> - <query1> Select COLUMNS from TABLE1 order by COLUMN1 </query1> - <query2> Select COLUMN1,COLUMN2,COLUMN3 from TABLE2 order by COLUMN1 </query2> - <query3> Select COLUMN2,COLUMN4 from TABLE3 order by COLUMN1 </query3> - <query4> Select COLUMNS from TABLE4 order by COLUMN1 </query4> - <query5> Select COLUMNS from TABLE5 order by COLUMN1 </query5> - </queries> - </mssql> - - <postgres> - <database> - <name> postgres </name> - <connectionString> Server=164.99.168.144;Database=test;User Id=sudha;Password= </connectionString> - <OdbcConnString>DSN=postgres-DSN;uid=sudha;pwd= </OdbcConnString> - </database> - <tables> - <numTables> 5 </numTables> - <table1> - <name>numericTable </name> - <numColumns> 4 </numColumns> - <column1> - <name> serialNo </name> - <type> smallint </type> - </column1> - <column2> - <name> small_int </name> - <type> smallint </type> - </column2> - <column3> - <name> int </name> - <type> integer </type> - </column3> - <column4> - <name> bigInteger </name> - <type> bigint </type> - </column4> - - </table1> - <table2> - <name>realNoTable </name> - <numColumns> 5 </numColumns> - <column1> - <name> serialNo </name> - <type> smallint </type> - </column1> - <column2> - <name> numeric_column </name> - <type> numeric(10,6) </type> - </column2> - <column3> - <name> numeric_noscale </name> - <type> decimal(10) </type> - </column3> - <column4> - <name> realNo </name> - <type> real </type> - </column4> - <column5> - <name> doubleNo </name> - <type> double precision </type> - </column5> - </table2> - <table3> - <name> charTable </name> - <numColumns> 4 </numColumns> - <column1> - <name> serialNo </name> - <type> smallint </type> - </column1> - <column2> - <name> charColumn </name> - <type> char(20) </type> - </column2> - <column3> - <name> varcharColumn </name> - <type> varchar(20) </type> - </column3> - <column4> - <name> textColumn </name> - <type> text </type> - </column4> - </table3> - <table4> - <name> dateTimeTable </name> - <numColumns> 5 </numColumns> - <column1> - <name> serialNo </name> - <type> smallint </type> - </column1> - <column2> - <name> timestampCol </name> - <type> timestamp </type> - </column2> - <column3> - <name> intervalCol </name> - <type> interval </type> - </column3> - <column4> - <name> dateCol </name> - <type> date </type> - </column4> - <column5> - <name> timeCol </name> - <type> time </type> - </column5> - </table4> - <table5> - <name> booleanTable </name> - <numColumns> 2 </numColumns> - <column1> - <name> serialNo </name> - <type> smallint </type> - </column1> - <column2> - <name> bool </name> - <type> boolean </type> - </column2> - </table5> - </tables> - <values> - <numTables>5</numTables> - <table1> - <tableName>numericTable</tableName> - <numRows>4</numRows> - <numCols>4</numCols> - <row1> - <column1> 1 </column1> - <column2> -32768 </column2> - <column3> -2147483648 </column3> - <column4> -9223372036854775808 </column4> - </row1> - <row2> - <column1> 2 </column1> - <column2> 123 </column2> - <column3> -648 </column3> - <column4> 0 </column4> - </row2> - <row3> - <column1> 3 </column1> - <column2> 32767 </column2> - <column3> 2147483647 </column3> - <column4> 9223372036854775807 </column4> - </row3> - <row4> - <column1> 4 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - </row4> - </table1> - <table2> - <tableName>realNoTable</tableName> - <numRows>6</numRows> - <numCols>5</numCols> - <row1> - <column1> 1 </column1> - <column2> -9999.999999 </column2> - <column3> -9999999999 </column3> - <column4> -9.99999E-38 </column4> - <column5> -9.999999999999999E-308 </column5> - </row1> - <row2> - <column1> 2 </column1> - <column2> -123.99 </column2> - <column3> -1239 </column3> - <column4> 9.99999E-38 </column4> - <column5> 9.999999999999999E-308 </column5> - </row2> - <row3> - <column1> 3 </column1> - <column2> 0 </column2> - <column3> 0 </column3> - <column4> 0 </column4> - <column5> 0 </column5> - </row3> - <row4> - <column1> 4 </column1> - <column2> 123.99 </column2> - <column3> 123 </column3> - <column4> -9.99999E37 </column4> - <column5> -1.79769313486231E308 </column5> - </row4> - <row5> - <column1> 5 </column1> - <column2> 9999.999999 </column2> - <column3> 9999999999 </column3> - <column4> 9.99999E37 </column4> - <column5> 1.79769313486231E308 </column5> - </row5> - <row6> - <column1> 6 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - </row6> - </table2> - <table3> - <tableName>charTable</tableName> - <numRows>2</numRows> - <numCols>4</numCols> - <row1> - <column1> 1 </column1> - <column2> 'abcdefghijklmnopqrst' </column2> - <column3> '1234567890' </column3> - <column4> 'This is a fixed length text' </column4> - </row1> - <row2> - <column1> 2 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - </row2> - </table3> - <table4> - <tableName>datetimeTable</tableName> - <numRows>4</numRows> - <numCols>5</numCols> - <row1> - <column1> 1 </column1> - <column2> '0001-01-01 00:00:00.000000' </column2> - <column3> '-178000000 years +4 days' </column3> - <column4> '0001-01-01' </column4> - <column5> '12:23:34' </column5> - </row1> - <row2> - <column1> 2 </column1> - <column2> '2004-10-21 11:15:23' </column2> - <column3> '7890 years 5 days 07:30' </column3> - <column4> '2004-01-12' </column4> - <column5> '00:00:00' </column5> - </row2> - <row3> - <column1> 3 </column1> - <column2> '9999-12-31 23:59:59.9999' </column2> - <column3> '178000000 years 00:19:23' </column3> - <column4> '9999-12-31' </column4> - <column5> '23:59:59' </column5> - </row3> - <row4> - <column1> 4 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - </row4> - </table4> - <table5> - <tableName>booleanTable</tableName> - <numRows>3</numRows> - <numCols>2</numCols> - <row1> - <column1> 1 </column1> - <column2> TRUE </column2> - </row1> - <row2> - <column1> 2 </column1> - <column2> FALSE </column2> - </row2> - <row3> - <column1> 3 </column1> - <column2> null </column2> - </row3> - </table5> - </values> - <queries> - <numQueries> 5 </numQueries> - <query1> Select COLUMNS from TABLE1 order by COLUMN1 </query1> - <query2> Select COLUMN1,COLUMN2,COLUMN3 from TABLE2 order by COLUMN1 </query2> - <query3> Select COLUMN2,COLUMN4 from TABLE3 order by COLUMN1 </query3> - <query4> Select COLUMNS from TABLE4 order by COLUMN1 </query4> - <query5> Select COLUMNS from TABLE5 order by COLUMN1 </query5> - </queries> - </postgres> - <oracle> - <database> - <name> oracle </name> - <connectionString> Data Source=testdb.com;User Id=user9i;Password=oracle9i </connectionString> - <OdbcConnString>DSN=Oracle-DSN;uid=user9i;pwd=oracle9i </OdbcConnString> - </database> - <StoredProcExists> N </StoredProcExists> - <tables> - <numTables> 4 </numTables> - <table1> - <name>numericTable </name> - <numColumns> 3 </numColumns> - <column1> - <name> serialNo </name> - <type> number(1)</type> - </column1> - <column2> - <name> intCol </name> - <type> number(6)</type> - </column2> - <column3> - <name> decimalCol </name> - <type> number(6, 3)</type> - </column3> - </table1> - <table2> - <name> charTable </name> - <numColumns> 5 </numColumns> - <column1> - <name> serialNo </name> - <type> number(1)</type> - </column1> - <column2> - <name> charCol </name> - <type> char(10) </type> - </column2> - <column3> - <name> ncharCol </name> - <type> nchar(10) </type> - </column3> - <column4> - <name> varcharCol </name> - <type> varchar2(10) </type> - </column4> - <column5> - <name> nvarcharCol </name> - <type> nvarchar2(10) </type> - </column5> - </table2> - <table3> - <name> RealNoTable </name> - <numColumns> 2 </numColumns> - <column1> - <name> serialNo </name> - <type> number(1)</type> - </column1> - <column2> - <name> floatCol </name> - <type> float(24) </type> - </column2> - </table3> - <table4> - <name> DateTimeTable </name> - <numColumns> 5 </numColumns> - <column1> - <name> serialNo </name> - <type> number(1)</type> - </column1> - <column2> - <name> dateCol </name> - <type> date </type> - </column2> - <column3> - <name> timestampCol </name> - <type> timestamp </type> - </column3> - <column4> - <name> Int_year </name> - <type> interval Year to month</type> - </column4> - <column5> - <name> int_day </name> - <type> interval day to second </type> - </column5> - </table4> - - </tables> - <values> - <numTables>4</numTables> - <table1> - <tableName>numericTable</tableName> - <numRows>4</numRows> - <numCols>3</numCols> - <row1> - <column1> 1 </column1> - <column2> -999999 </column2> - <column3> -999.999 </column3> - </row1> - <row2> - <column1> 2 </column1> - <column2> 1000 </column2> - <column3> 234 </column3> - </row2> - <row3> - <column1> 3 </column1> - <column2> 999999 </column2> - <column3> 999.999 </column3> - </row3> - <row4> - <column1> 4 </column1> - <column2> null </column2> - <column3> null </column3> - </row4> - </table1> - <table2> - <tableName>charTable</tableName> - <numRows>2</numRows> - <numCols>5</numCols> - <row1> - <column1> 1 </column1> - <column2> '0123456789' </column2> - <column3> 'abcdefghij' </column3> - <column4> '0123456789' </column4> - <column5> 'abcdefghij' </column5> - </row1> - <row2> - <column1> 2 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - </row2> - </table2> - <table3> - <tableName>RealNoTable</tableName> - <numRows>6</numRows> - <numCols>2</numCols> - <row1> - <column1> 1 </column1> - <column2> 9.9999999E125 </column2> - </row1> - <row2> - <column1> 2 </column1> - <column2> -9.999999E-126 </column2> - </row2> - <row3> - <column1> 3 </column1> - <column2> 1.23E-15 </column2> - </row3> - <row4> - <column1> 4 </column1> - <column2> -9.999999E-126 </column2> - </row4> - <row5> - <column1> 5 </column1> - <column2> 9.9999999E125 </column2> - </row5> - <row6> - <column1> 6 </column1> - <column2> null </column2> - </row6> - </table3> - <table4> - <tableName>DateTimeTable</tableName> - <numRows>3</numRows> - <numCols>5</numCols> - <row1> - <column1> 1 </column1> - <column2> to_date('0001-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss') </column2> - <column3> TIMESTAMP'0001-01-01 00:00:00' </column3> - <column4> '-99-11' </column4> - <column5> '-99 23:59:59' </column5> - </row1> - <row2> - <column1> 2 </column1> - <column2> to_date('2004-11-23 12:34:45', 'yyyy-mm-dd hh24:mi:ss') </column2> - <column3> TIMESTAMP'2004-11-23 12:34:45' </column3> - <column4> '34-5' </column4> - <column5> '-34 20:50:00' </column5> - </row2> - <row3> - <column1> 3 </column1> - <column2> to_date('9999-12-31 23:59:59', 'yyyy-mm-dd hh24:mi:ss') </column2> - <column3> TIMESTAMP'9999-12-31 23:59:59' </column3> - <column4> '99-11' </column4> - <column5> '00 23:59:59' </column5> - </row3> - </table4> - </values> - <StoredProc> - <NumStoredProc> 1 </NumStoredProc> - <StoredProc1> - <type> generic </type> - <name> {{TABLE}}_pkg.Select_{{TABLE}}_data</name> - <template> - <numStmts> 2 </numStmts> - <stmt1><![CDATA[ - create or replace package {{TABLE}}_pkg As - type {{TABLE}}Cur is ref cursor return {{TABLE}}%rowtype; - procedure Select{{TABLE}}Data (ref_cur out {{TABLE}}Cur); - END {{TABLE}}_pkg;]]> - </stmt1> - <stmt2><![CDATA[ - create or replace package body {{TABLE}}_pkg As - procedure Select{{TABLE}}Data ( ref_cur out {{TABLE}}Cur) is - BEGIN - open ref_cur for select {{COLUMNS}} from {{TABLE}} order by {{COLUMN_1}}; - End Select{{TABLE}}Data; - END {{TABLE}}_pkg;]]></stmt2> - </template> - </StoredProc1> - </StoredProc> - <queries> - <numQueries> 4 </numQueries> - <query1> Select COLUMNS from TABLE1 order by COLUMN1 </query1> - <query2> Select COLUMN1,COLUMN2,COLUMN3 from TABLE2 order by COLUMN1 </query2> - <query3> Select COLUMNS from TABLE3 order by COLUMN1 </query3> - <query4> Select COLUMNS from TABLE4 order by COLUMN1 </query4> - </queries> - </oracle> -</configuration> diff --git a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/SectionHandler.cs b/mcs/class/System.Data/Test/DataProviderTests/datareadertests/SectionHandler.cs deleted file mode 100644 index 573d6ff5489..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/datareadertests/SectionHandler.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -// SectionHandler.cs -// -// Author: -// Satya Sudha K (ksathyasudha@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.Xml; -using System.Configuration; - -namespace SectionHandlers { - - public class SectionHandler : IConfigurationSectionHandler { - - public SectionHandler () - { - } - - public virtual object Create (object parent, object ConfigContext, XmlNode section) - { - return section; - } - } -} - diff --git a/mcs/class/System.Data/Test/DataProviderTests/setup/DbConfig.cs b/mcs/class/System.Data/Test/DataProviderTests/setup/DbConfig.cs deleted file mode 100644 index d10071aacf2..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/setup/DbConfig.cs +++ /dev/null @@ -1,68 +0,0 @@ -// -// DbConfig.cs : Defines a class 'ConfigClass' that is used to read the config file -// -// Author: -// Satya Sudha K (ksathyasudha@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.IO; -using System.Xml; - -namespace MonoTests.System.Data { - - public class ConfigClass { - - public static String GetElement(XmlNode doc, params String [] args) - { - String element = ""; - if (args.Length > 0) { - XmlNode xmlNode = doc.SelectSingleNode(args [0]); - for (int i = 1; i < args.Length; i++) - xmlNode = xmlNode.SelectSingleNode(args [i]); - - element = xmlNode.InnerText.Trim (); - } - return element; - } - - public static String [] GetColumnDetails (XmlNode doc, int tableNum, string attr) - { - String tagName = "table" + tableNum; - int numColumns = Convert.ToInt32 (ConfigClass.GetElement (doc, "tables", tagName, "numColumns")); - String [] columns = new String [numColumns]; - - for (int col = 1; col <= numColumns; col++) { - XmlNodeList nodelist = doc.SelectNodes ("//tables/" + tagName + "/column" + col + "/" + attr); - if (nodelist.Count == 0) - columns [col - 1] = ""; - else - columns [col - 1] = nodelist [0].InnerText; - } - return columns; - } - } -} - diff --git a/mcs/class/System.Data/Test/DataProviderTests/setup/Makefile b/mcs/class/System.Data/Test/DataProviderTests/setup/Makefile deleted file mode 100644 index 664ada45023..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/setup/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -thisdir=class/System.Data/Test/DataProviderTests/datareadertests - -include ../../../../../build/rules.make - -LIB_MCS_FLAGS = /r:System.Data,System.Data.OracleClient,System,System.Xml - -DATABASE=all - -LIBRARY = Setup.dll -NO_INSTALL=yes -NO_SIGN_ASSEMBLY=yes - -include $(topdir)/build/library.make - -SetupDb.exe: $(the_lib) - $(MCS) /r:$(the_lib) SetupDb.cs - -Setup.dll: - $(MCS) /r:$(REFERENCES) /target:library /out:Setup.dll @$(SOURCEFILE) - -run-test-local: run-test-db -run-test-db: SetupDb.exe - $(TEST_RUNTIME) SetupDb.exe $(DATABASE) | tee TestResults.log - -test-local: SetupDb.exe - -CLEAN_FILES = *.exe *.dll *.log diff --git a/mcs/class/System.Data/Test/DataProviderTests/setup/SectionHandler.cs b/mcs/class/System.Data/Test/DataProviderTests/setup/SectionHandler.cs deleted file mode 100644 index 87133f04f45..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/setup/SectionHandler.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -// SectionHandler.cs -// -// Author: -// Satya Sudha K (ksathyasudha@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.Xml; -using System.Configuration; - -namespace SectionHandlers { - - public class SectionHandler : IConfigurationSectionHandler { - - public SectionHandler () - { - } - - public virtual object Create (object parent, object ConfigContext, XmlNode section) - { - return section; - } - } -} - diff --git a/mcs/class/System.Data/Test/DataProviderTests/setup/Setup.cs b/mcs/class/System.Data/Test/DataProviderTests/setup/Setup.cs deleted file mode 100644 index 0dba7661925..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/setup/Setup.cs +++ /dev/null @@ -1,321 +0,0 @@ -// -// Setup.cs : Setup class for -// - creating, dropping, insert data into database tables -// - Setup/teardown of stored procedures -// -// -// Author: -// Satya Sudha K (ksathyasudha@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.IO; -using System.Xml; -using System.Data; -using System.Data.OracleClient; -using System.Data.SqlClient; -using System.Configuration; - -namespace MonoTests.System.Data { - - public class Setup { - - string [] databases; - IDbConnection con; - IDbCommand cmd; - XmlNode node; - string curDatabase; - TableInfo [] tabinfo; - string createStoredProc; - string deleteTables; - string createTables; - string insertData; - - public Setup (string [] listOfDbs) - { - - if (listOfDbs.Length == 0) { - string dbList = ConfigurationSettings.AppSettings ["Databases"]; - databases = dbList.Split (';'); - } else - databases = (string []) listOfDbs.Clone (); - - Reset (); - } - - void Reset () - { - if (con != null) - con.Close (); - - con = null; - cmd = null; - node = null; - tabinfo = null; - curDatabase = null; - createStoredProc = null; - deleteTables = null; - createTables = null; - insertData = null; - } - - bool Initialize (string database) - { - - curDatabase = database; - node = (XmlNode) ConfigurationSettings.GetConfig (database); - con = GetConnection (database); - - try { - con.Open (); - } catch (Exception e) { - createStoredProc = deleteTables = createTables = insertData = null; - Console.WriteLine (e.Message); - Reset (); - return false; - } - - cmd = con.CreateCommand (); - - createStoredProc = ConfigClass.GetElement (node, "createStoredProc"); - deleteTables = ConfigClass.GetElement (node, "deleteTables"); - createTables = ConfigClass.GetElement (node, "createTables"); - insertData = ConfigClass.GetElement (node, "insertData"); - string noOfTables = ConfigClass.GetElement (node, "tables", "numTables"); - int numTables = Convert.ToInt32 (noOfTables); - - tabinfo = new TableInfo [numTables]; - - for (int i = 1; i <= numTables; i++) - tabinfo [i - 1].Initialize (node, i); - - return true; - } - - public void SetupDatabase () - { - foreach (string db in databases) { - - bool hasErrors = false; - Console.WriteLine ("\n ******** Doing setup for {0} database ********\n", db); - - if (Initialize (db) != true) { - Console.WriteLine ("Failed to do the initialisation for {0} database", db); - Console.WriteLine ("Skipping setup for " + db); - hasErrors = true; - continue; - } - - Console.WriteLine (" *** Running the following queries ***\n"); - if (deleteTables.Equals ("Y")) { - if (DeleteTables ()!= true) - hasErrors = true; - } - - if (createTables.Equals ("Y")) { - if (CreateTables () != true) - hasErrors = true; - } - - if (insertData.Equals ("Y")) { - if (InsertData () != true) { - hasErrors = true; - } - } - - if (createStoredProc.Equals ("Y")) { - - int numStoredProc = Convert.ToInt32 (ConfigClass.GetElement (node, - "StoredProc", "NumStoredProc")); - for (int i = 1; i <= numStoredProc; i++) { - if (CreateStoredProc (i) != true) - hasErrors = true; - } - - if (hasErrors == true) - Console.WriteLine ("There were errors while setting up the {0} database", db); - else - Console.WriteLine ("Successfully set up the {0} database", db); - } - } - } - - bool CreateTables () - { - - string createQuery; - for (int i = 1; i<= tabinfo.Length; i++) { - string [] constraints = ConfigClass.GetColumnDetails (node, i, "constraint"); - - createQuery = "create table " + tabinfo [i - 1].name; - createQuery += "("; - - for (int col = 1; col <= tabinfo [i - 1].columns.Length; col++) { - - createQuery += tabinfo [i - 1].columns [col - 1]; - createQuery += " " ; - createQuery += tabinfo [i - 1].types [col - 1]; - createQuery += " " + constraints [col - 1]; - createQuery += ","; - } - createQuery = createQuery.Trim (','); - createQuery += ")"; - Console.WriteLine (createQuery); - cmd.CommandText = createQuery; - cmd.ExecuteNonQuery (); - } - return true; - } - - bool InsertData () - { - int numTables = Convert.ToInt32 (ConfigClass.GetElement (node, "values", "numTables")); - string tableName; - - for (int i = 1; i <= numTables; i++) { - - string tableTag = "table" + i; - tableName = ConfigClass.GetElement (node, "values", tableTag, "tableName"); - int numRows = Convert.ToInt32 (ConfigClass.GetElement (node, "values", tableTag, "numRows")); - int numCols = Convert.ToInt32 (ConfigClass.GetElement (node, "values", tableTag, "numCols")); - for (int j = 1; j <= numRows; j++) { - - string rowTag = "row" + j; - string insertQuery = "Insert into " + tableName + " values ("; - - for (int k = 1; k <= numCols; k++) { - string colTag = "column"+k; - insertQuery += ConfigClass.GetElement (node, "values", tableTag, rowTag, colTag); - insertQuery += ","; - } - - insertQuery = insertQuery.Trim (','); - insertQuery += ")"; - Console.WriteLine (insertQuery); - cmd.CommandText = insertQuery; - - try { - cmd.ExecuteNonQuery (); - } catch (Exception e) { - Console.WriteLine ("Failed to insert row into the table:" + - tableName + " " + e.Message); - return false; - } - } - } - - return true; - } - - bool DeleteTables () - { - - string deleteQuery; - bool retval = true; - - for (int i = 1; i <= tabinfo.Length; i++) { - - deleteQuery = "drop table " + tabinfo [i - 1].name; - Console.WriteLine (deleteQuery); - cmd.CommandText = deleteQuery; - - try { - cmd.ExecuteNonQuery (); - } catch (Exception e) { - Console.WriteLine ("Unable to drop table :" + tabinfo [i - 1].name + ":" + e.Message); - retval = false; - } - } - - return retval; - } - - bool CreateStoredProc (int storedProcNum) - { - - string name = ConfigClass.GetElement (node, "StoredProc", "StoredProc" + storedProcNum, "name"); - string type = ConfigClass.GetElement (node, "StoredProc", "StoredProc" + storedProcNum, "type"); - int numStatements = Convert.ToInt32 (ConfigClass.GetElement (node, "StoredProc", - "StoredProc" + storedProcNum, "template", "numStmts")); - - string [] templates = new string [numStatements]; - - for (int i = 1; i <= numStatements; i++) - templates [i - 1] = ConfigClass.GetElement (node, "StoredProc", "StoredProc" + storedProcNum, "template", "stmt"+i); - - if (type.Equals ("generic")) { - // To be created for all tables - for (int tableNum = 0; tableNum < tabinfo.Length; tableNum ++) { - - string storedProcName = name.Replace ("{{TABLE}}", tabinfo [tableNum].name); - Console.WriteLine ("Creating : " + storedProcName); - - for (int index = 1; index <= numStatements; index++) { - - string SPtemplate = templates [index - 1]; - SPtemplate = SPtemplate.Replace ("{{TABLE}}", tabinfo [tableNum].name); - string listOfColumns = String.Join (",", tabinfo [tableNum].columns); - SPtemplate = SPtemplate.Replace ("{{TABLE}}", tabinfo [tableNum].name); - SPtemplate = SPtemplate.Replace ("{{COLUMNS}}", listOfColumns); - int beg = 0; - while ((beg = SPtemplate.IndexOf ("{{COLUMN_")) >= 0) { - int end = SPtemplate.IndexOf ("}}", beg + 9); - string strToBeReplaced = SPtemplate.Substring (beg, end - beg + 2); - beg += 9; - int columnNum = Convert.ToInt32 (SPtemplate.Substring (beg, end - beg)); - SPtemplate = SPtemplate.Replace (strToBeReplaced, - tabinfo [tableNum].columns [columnNum]); - } - - SPtemplate = SPtemplate.Replace ("\r", ""); - cmd.CommandText = SPtemplate; - Console.WriteLine (SPtemplate); - cmd.ExecuteNonQuery (); - } - } - - } else { - // To be implemented - } - - return true; - } - - IDbConnection GetConnection (string database) - { - - IDbConnection con = null; - string connStr = ConfigClass.GetElement (node, "database", "connectionString"); - if (database == "oracle") { - con = new OracleConnection (connStr); - } else if (database == "mssql") { - con = new SqlConnection (connStr); - } - - return con; - } - - } -} diff --git a/mcs/class/System.Data/Test/DataProviderTests/setup/Setup.dll.sources b/mcs/class/System.Data/Test/DataProviderTests/setup/Setup.dll.sources deleted file mode 100644 index d99467190be..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/setup/Setup.dll.sources +++ /dev/null @@ -1,4 +0,0 @@ -DbConfig.cs -SectionHandler.cs -Setup.cs -TableInfo.cs diff --git a/mcs/class/System.Data/Test/DataProviderTests/setup/SetupDb.cs b/mcs/class/System.Data/Test/DataProviderTests/setup/SetupDb.cs deleted file mode 100644 index 628b8e79fdd..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/setup/SetupDb.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// SetupDb.cs : A driver class for setup/teardown of all or specified databases -// -// Author: -// Satya Sudha K (ksathyasudha@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.Configuration; -using MonoTests.System.Data; - -public class RunSetup { - - public static void Main(string [] args) - { - string [] databases = null; - if (args.Length == 0 || (args.Length == 1 && args [0].Equals ("all"))) { - // Run test for all databases - string listOfDbs = ConfigurationSettings.AppSettings ["Databases"]; - - databases = listOfDbs.Split (';'); - } else { - databases = (string []) args.Clone (); - } - - Setup setup = new Setup (databases); - setup.SetupDatabase (); - - } -} - diff --git a/mcs/class/System.Data/Test/DataProviderTests/setup/SetupDb.exe.config b/mcs/class/System.Data/Test/DataProviderTests/setup/SetupDb.exe.config deleted file mode 100644 index 441fa3f7a43..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/setup/SetupDb.exe.config +++ /dev/null @@ -1,1183 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<configuration> - - <configSections> - <section name="mysql" type="SectionHandlers.SectionHandler, Setup" allowLocation="true"/> - <section name="mssql" type="SectionHandlers.SectionHandler, Setup" allowLocation="true"/> - <section name="postgres" type="SectionHandlers.SectionHandler, Setup" allowLocation="true"/> - <section name="oracle" type="SectionHandlers.SectionHandler, Setup" allowLocation="true"/> - </configSections> - - <appSettings> - <add key="databases" value="mysql;mssql;postgres;oracle" /> - </appSettings> - - <mysql> - <database> - <name> mysql </name> - <connectionString> "Server=164.99.152.215;Database=mysql;User Id=sudha;Password=novell" </connectionString> - </database> - <createStoredProc>N</createStoredProc> - <deleteTables>Y</deleteTables> - <createTables>Y</createTables> - <insertData>Y</insertData> - <tables> - <numTables> 3 </numTables> - <table1> - <name>numericTable </name> - <numColumns>15</numColumns> - <column1> - <name> serialNo </name> - <type> TINYINT UNSIGNED</type> - <constraint> primary key </constraint> - </column1> - <column2> - <name> unsigned_tinyInt </name> - <type> TINYINT UNSIGNED</type> - </column2> - <column3> - <name> signed_tinyInt </name> - <type> TINYINT </type> - </column3> - <column4> - <name> bit </name> - <type> BIT </type> - </column4> - <column5> - <name> bool </name> - <type> BOOL </type> - </column5> - <column6> - <name> unsigned_smallint</name> - <type> SMALLINT UNSIGNED</type> - </column6> - <column7> - <name> signed_smallint</name> - <type> SMALLINT </type> - </column7> - <column8> - <name> unsigned_mediumint</name> - <type> MEDIUMINT UNSIGNED</type> - </column8> - <column9> - <name> signed_mediumint</name> - <type> MEDIUMINT </type> - </column9> - <column10> - <name> unsigned_int</name> - <type> INT UNSIGNED</type> - </column10> - <column11> - <name> signed_int</name> - <type> INT </type> - </column11> - <column12> - <name> unsigned_integer</name> - <type> INTEGER UNSIGNED</type> - </column12> - <column13> - <name> signed_integer</name> - <type> INTEGER </type> - </column13> - <column14> - <name> unsigned_bigint</name> - <type> BIGINT UNSIGNED </type> - </column14> - <column15> - <name> signed_bigint</name> - <type> BIGINT </type> - </column15> - </table1> - <table2> - <name>realNoTable </name> - <numColumns>11</numColumns> - <column1> - <name> serialNo </name> - <type> TINYINT UNSIGNED </type> - <constraint> primary key </constraint> - </column1> - <column2> - <name> unsigned_float </name> - <type> FLOAT(24) UNSIGNED </type> - </column2> - <column3> - <name> signed_float </name> - <type> FLOAT(24) </type> - </column3> - <column4> - <name> unsigned_double_float </name> - <type> FLOAT(25) UNSIGNED</type> - </column4> - <column5> - <name> signed_double_float </name> - <type> FLOAT(53) </type> - </column5> - <column6> - <name> unsigned_double</name> - <type> DOUBLE UNSIGNED </type> - </column6> - <column7> - <name> signed_double</name> - <type> DOUBLE </type> - </column7> - <column8> - <name> unsigned_double_precision</name> - <type> DOUBLE PRECISION UNSIGNED</type> - </column8> - <column9> - <name> signed_real</name> - <type> REAL </type> - </column9> - <column10> - <name> unsigned_decimal</name> - <type> DECIMAL(6,3) UNSIGNED</type> - </column10> - <column11> - <name> signed_numeric</name> - <type> NUMERIC(5,3) </type> - </column11> - </table2> - <table3> - <name>dateTable </name> - <numColumns>6</numColumns> - <column1> - <name> serialNo </name> - <type> TINYINT UNSIGNED </type> - <constraint> primary key </constraint> - </column1> - <column2> - <name> dateField</name> - <type> DATE </type> - </column2> - <column3> - <name> datetimeField</name> - <type> DATETIME </type> - </column3> - <column4> - <name> timestampField</name> - <type> TIMESTAMP </type> - </column4> - <column5> - <name> timeField</name> - <type> TIME </type> - </column5> - <column6> - <name> yearField</name> - <type> YEAR </type> - </column6> - </table3> - </tables> - <values> - <numTables>3</numTables> - <table1> - <tableName>numericTable</tableName> - <numRows>4</numRows> - <numCols>15</numCols> - <row1> - <column1> 1 </column1> - <column2> 0</column2> - <column3> -128</column3> - <column4> -128</column4> - <column5> -128</column5> - <column6> 0 </column6> - <column7> -32768 </column7> - <column8> 0</column8> - <column9> -8388608 </column9> - <column10> 0 </column10> - <column11> -2147483648 </column11> - <column12> 0 </column12> - <column13> -2147483648 </column13> - <column14> 0 </column14> - <column15> -9223372036854775808 </column15> - </row1> - <row2> - <column1> 2 </column1> - <column2> 100</column2> - <column3> 50 </column3> - <column4> 100 </column4> - <column5> 100 </column5> - <column6> 3000 </column6> - <column7> -300 </column7> - <column8> 500000 </column8> - <column9> -100000 </column9> - <column10> 4000000 </column10> - <column11> 500000 </column11> - <column12> 4000000 </column12> - <column13> 500000 </column13> - <column14> 5000000000 </column14> - <column15> -5000000000 </column15> - </row2> - <row3> - <column1> 3 </column1> - <column2> 255</column2> - <column3> 127</column3> - <column4> 127</column4> - <column5> 127</column5> - <column6> 65535</column6> - <column7> 32767 </column7> - <column8> 16777215 </column8> - <column9> 8388607 </column9> - <column10> 4294967295 </column10> - <column11> 2147483647 </column11> - <column12> 4294967295 </column12> - <column13> 2147483647 </column13> - <column14> 18446744073709551615 </column14> - <column15> 9223372036854775807 </column15> - </row3> - <row4> - <column1> 4 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - <column6> null </column6> - <column7> null </column7> - <column8> null </column8> - <column9> null </column9> - <column10> null </column10> - <column11> null </column11> - <column12> null </column12> - <column13> null </column13> - <column14> null </column14> - <column15> null </column15> - </row4> - </table1> - <table2> - <tableName>realNoTable</tableName> - <numRows>6</numRows> - <numCols>11</numCols> - <row1> - <column1> 1 </column1> - <column2> 0 </column2> - <column3> 0 </column3> - <column4> 0 </column4> - <column5> 0 </column5> - <column6> 0 </column6> - <column7> 0 </column7> - <column8> 0 </column8> - <column9> 0 </column9> - <column10> 0 </column10> - <column11> 0 </column11> - </row1> - <row2> - <column1> 2 </column1> - <column2> 1.175494351E-38 </column2> - <column3> -3.402823466E+38 </column3> - <column4> 1.175494351E-38 </column4> - <column5> -1.797693134862315E+308 </column5> - <column6> 1.175494351E-38 </column6> - <column7> -1.797693134862315E+308 </column7> - <column8> 1.175494351E-38 </column8> - <column9> -1.797693134862315E+308 </column9> - <column10> 99.999 </column10> - <column11> -23.456 </column11> - </row2> - <row3> - <column1> 3 </column1> - <column2> 3.402823466E+38 </column2> - <column3> -1.175494351E-38 </column3> - <column4> 3.402823466E+38 </column4> - <column5> -2.2250738585072014E-308 </column5> - <column6> 3.402823466E+38 </column6> - <column7> -2.2250738585072014E-308 </column7> - <column8> 3.402823466E+38 </column8> - <column9> -2.2250738585072014E-308 </column9> - <column10> 778.123 </column10> - <column11> -99.999 </column11> - </row3> - <row4> - <column1> 4 </column1> - <column2> 1.2345E+20</column2> - <column3> 1.175494351E-38 </column3> - <column4> 1.2345E+20 </column4> - <column5> 2.2250738585072014E-308 </column5> - <column6> 1.2345E+20 </column6> - <column7> 2.2250738585072014E-308 </column7> - <column8> 1.2345E+20 </column8> - <column9> 2.2250738585072014E-308 </column9> - <column10> 308.90 </column10> - <column11> 12.345 </column11> - </row4> - <row5> - <column1> 5 </column1> - <column2> 3.452E-19</column2> - <column3> 3.402823466E+38 </column3> - <column4> 4.32E-15 </column4> - <column5> 1.797693134862315E+308 </column5> - <column6> 4.32E-15 </column6> - <column7> 1.797693134862315E+308 </column7> - <column8> 4.32E-15 </column8> - <column9> 1.797693134862315E+308 </column9> - <column10> 999.999 </column10> - <column11> 999.999 </column11> - </row5> - <row6> - <column1> 6 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - <column6> null </column6> - <column7> null </column7> - <column8> null </column8> - <column9> null </column9> - <column10> null </column10> - <column11> null </column11> - </row6> - </table2> - <table3> - <tableName>dateTable</tableName> - <numRows>9</numRows> - <numCols>6</numCols> - <row1> - <column1> 1 </column1> - <column2> '1000-01-01' </column2> - <column3> '1000-01-01 00:00:00' </column3> - <column4> '1970-01-02 00:00:00' </column4> - <column5> '-23:59:59' </column5> - <column6> 2004 </column6> - </row1> - <row2> - <column1> 2 </column1> - <column2> '1999-12-17' </column2> - <column3> '1999-12-17 08:00:00' </column3> - <column4> '2000-01-01 04:40:00' </column4> - <column5> '-23:45:56' </column5> - <column6> 1999 </column6> - </row2> - <row3> - <column1> 3 </column1> - <column2> '9999-12-31' </column2> - <column3> '9999-12-31 23:59:59' </column3> - <column4> '2037-12-31 23:59:59' </column4> - <column5> '23:59:59' </column5> - <column6> 2155</column6> - </row3> - <row4> - <column1> 4 </column1> - <column2> '1999@12@31' </column2> - <column3> '1999@12@31 11+30+45' </column3> - <column4> '1999@12@31 11+30+45' </column4> - <column5> '12:23:34' </column5> - <column6> 1901</column6> - </row4> - <row5> - <column1> 5 </column1> - <column2> '9999.11.18' </column2> - <column3> '9999.11.18 11*45*50' </column3> - <column4> '2037.11.18 11*45*50' </column4> - <column5> '23:34:34' </column5> - <column6> 2069 </column6> - </row5> - <row6> - <column1> 6 </column1> - <column2> '9999/11/09' </column2> - <column3> '9999/11/09 12:23:34' </column3> - <column4> '2037/11/09 12:23:34' </column4> - <column5> '09:08:07' </column5> - <column6> 1970</column6> - </row6> - <row7> - <column1> 7 </column1> - <column2> 19980404 </column2> - <column3> 19980404083050 </column3> - <column4> 19980404083050 </column4> - <column5> 083045 </column5> - <column6> 0000</column6> - </row7> - <row8> - <column1> 8 </column1> - <column2> '0000-00-00' </column2> - <column3> '0000-00-00 00:00:00' </column3> - <column4> 00000000000000 </column4> - <column5> '00:00:00'</column5> - <column6> 00</column6> - </row8> - <row9> - <column1> 9 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - <column6> null </column6> - </row9> - </table3> - </values> - </mysql> - <mssql> - <database> - <name> mssql </name> - <connectionString> Server=__servername__;Database=__dbname__;User ID=sa;Password=__password__;</connectionString> - </database> - <createStoredProc>N</createStoredProc> - <deleteTables>Y</deleteTables> - <createTables>Y</createTables> - <insertData>Y</insertData> - <tables> - <numTables> 5 </numTables> - <table1> - <name>numericTable </name> - <numColumns>6</numColumns> - <column1> - <name> sNo </name> - <type> tinyint </type> - <constraint> primary key </constraint> - </column1> - <column2> - <name> bigInteger </name> - <type> bigint </type> - </column2> - <column3> - <name> integer </name> - <type>int</type> - </column3> - <column4> - <name> smallInteger </name> - <type> smallint </type> - </column4> - <column5> - <name> tinyInt </name> - <type> tinyint </type> - </column5> - <column6> - <name> bit </name> - <type> bit </type> - </column6> - </table1> - <table2> - <name>dateTimeTable </name> - <numColumns>3</numColumns> - <column1> - <name> sNo </name> - <type> tinyInt </type> - <constraint> primary key </constraint> - </column1> - <column2> - <name> date</name> - <type> datetime </type> - </column2> - <column3> - <name> smalldate </name> - <type> smalldatetime </type> - </column3> - </table2> - <table3> - <name>realNosTable </name> - <numColumns>5</numColumns> - <column1> - <name> sNo </name> - <type> tinyInt </type> - <constraint> primary key </constraint> - </column1> - <column2> - <name> decimalCol </name> - <type> decimal(8,4) </type> - </column2> - <column3> - <name> numericCol </name> - <type> numeric(6,4) </type> - </column3> - <column4> - <name> floatCol </name> - <type> float </type> - </column4> - <column5> - <name> realCol </name> - <type> real </type> - </column5> - </table3> - <table4> - <name>moneyTable </name> - <numColumns>3</numColumns> - <column1> - <name> sNo </name> - <type> tinyInt </type> - <constraint> primary key </constraint> - </column1> - <column2> - <name> money </name> - <type> money </type> - </column2> - <column3> - <name> smallmoney </name> - <type> smallmoney </type> - </column3> - </table4> - <table5> - <name>charTable </name> - <numColumns>5</numColumns> - <column1> - <name> sNo </name> - <type> tinyInt </type> - <constraint> primary key </constraint> - </column1> - <column2> - <name> characterCol </name> - <type> char(20) </type> - </column2> - <column3> - <name> ncharacterCol </name> - <type> nchar(20) </type> - </column3> - <column4> - <name> varchar </name> - <type> varchar(20) </type> - </column4> - <column5> - <name> nvarchar </name> - <type> nvarchar(20) </type> - </column5> - </table5> - </tables> - <values> - <numTables>5</numTables> - <table1> - <tableName>numericTable</tableName> - <numRows>4</numRows> - <numCols>6</numCols> - <row1> - <column1> 1 </column1> - <column2> -9223372036854775808 </column2> - <column3> -2147483648 </column3> - <column4> -32768 </column4> - <column5> 0</column5> - <column6> 0</column6> - </row1> - <row2> - <column1> 2 </column1> - <column2> 1244 </column2> - <column3> -50 </column3> - <column4> 234 </column4> - <column5> 128 </column5> - <column6> 0</column6> - </row2> - <row3> - <column1> 3 </column1> - <column2> 9223372036854775807 </column2> - <column3> 2147483647 </column3> - <column4> 32767 </column4> - <column5> 255 </column5> - <column6> 1</column6> - </row3> - <row4> - <column1> 4 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - <column6> null </column6> - </row4> - </table1> - <table2> - <tableName> dateTimeTable</tableName> - <numRows>3</numRows> - <numCols>3</numCols> - <row1> - <column1> 1 </column1> - <column2> '1/1/1753 03:04:05.234' </column2> - <column3> '1/1/1970 12:24'</column3> - </row1> - <row2> - <column1> 2 </column1> - <column2> '12/31/9999 00:00:00' </column2> - <column3> '6/6/2079 00:00'</column3> - </row2> - <row3> - <column1> 3 </column1> - <column2> null </column2> - <column3> null </column3> - </row3> - </table2> - <table3> - <tableName> realNosTable</tableName> - <numRows>6</numRows> - <numCols>5</numCols> - <row1> - <column1> 1 </column1> - <column2> -9.99E+3</column2> - <column3> -99 </column3> - <column4> -1.7976931348623157E+308 </column4> - <column5> -3.402823466E+38 </column5> - </row1> - <row2> - <column1> 2 </column1> - <column2> -1.23E3 </column2> - <column3> -12 </column3> - <column4> -2.2250738585072014E-308 </column4> - <column5> -3.4E-38 </column5> - </row2> - <row3> - <column1> 3 </column1> - <column2> 0 </column2> - <column3> 0 </column3> - <column4> 0 </column4> - <column5> 0 </column5> - </row3> - <row4> - <column1> 4 </column1> - <column2> 1.2E1 </column2> - <column3> 12 </column3> - <column4> 2.2250738585072014E-308 </column4> - <column5> 4.56E-3 </column5> - </row4> - <row5> - <column1> 5 </column1> - <column2> 9.999E3 </column2> - <column3> 99 </column3> - <column4> 1.7976931348623157E+308 </column4> - <column5> 3.4E+38 </column5> - </row5> - <row6> - <column1> 6 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - </row6> - </table3> - <table4> - <tableName> moneyTable</tableName> - <numRows>4</numRows> - <numCols>3</numCols> - <row1> - <column1> 1 </column1> - <column2> -922337203685477.5808 </column2> - <column3> -214748.3648 </column3> - </row1> - <row2> - <column1> 2 </column1> - <column2> 5477.5808 </column2> - <column3> 748.3648 </column3> - </row2> - <row3> - <column1> 3 </column1> - <column2> 922337203685477.5807 </column2> - <column3> 214748.3647 </column3> - </row3> - <row4> - <column1> 4 </column1> - <column2> null </column2> - <column3> null </column3> - </row4> - </table4> - <table5> - <tableName> charTable</tableName> - <numRows>2</numRows> - <numCols>5</numCols> - <row1> - <column1> 1 </column1> - <column2> '12345678901234567890' </column2> - <column3> 'abcdefghijklmnopqrst' </column3> - <column4> 'zyxwvutsrqponmlkjihg' </column4> - <column5> '12345678901234567890' </column5> - </row1> - <row2> - <column1> 2 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - </row2> - </table5> - </values> - <StoredProc> - <NumStoredProc> 1 </NumStoredProc> - <StoredProc1> - <type> generic </type> - <name> Select_{{TABLE}}_proc </name> - <template> - <numStmts> 1 </numStmts> - <stmt1><![CDATA[ - create procedure Select_{{TABLE}}_proc As - BEGIN - Select {{COLUMNS}} from {{TABLE}}; - END]]> - </stmt1> - </template> - </StoredProc1> - </StoredProc> - </mssql> - <postgres> - <database> - <name> postgres </name> - <connectionString> Server=164.99.168.144;Database=test;User Id=sudha;Password= </connectionString> - </database> - <createStoredProc>N</createStoredProc> - <deleteTables>Y</deleteTables> - <createTables>Y</createTables> - <insertData>Y</insertData> - <tables> - <numTables> 5 </numTables> - <table1> - <name>numericTable </name> - <numColumns> 4 </numColumns> - <column1> - <name> serialNo </name> - <type> smallint </type> - <constraint> primary key </constraint> - </column1> - <column2> - <name> small_int </name> - <type> smallint </type> - </column2> - <column3> - <name> int </name> - <type> integer </type> - </column3> - <column4> - <name> bigInteger </name> - <type> bigint </type> - </column4> - - </table1> - <table2> - <name>realNoTable </name> - <numColumns> 5 </numColumns> - <column1> - <name> serialNo </name> - <type> smallint </type> - <constraint> primary key </constraint> - </column1> - <column2> - <name> numeric_column </name> - <type> numeric(10,6) </type> - </column2> - <column3> - <name> numeric_noscale </name> - <type> decimal(10) </type> - </column3> - <column4> - <name> realNo </name> - <type> real </type> - </column4> - <column5> - <name> doubleNo </name> - <type> double precision </type> - </column5> - </table2> - <table3> - <name> charTable </name> - <numColumns> 4 </numColumns> - <column1> - <name> serialNo </name> - <type> smallint </type> - <constraint> primary key </constraint> - </column1> - <column2> - <name> charColumn </name> - <type> char(20) </type> - </column2> - <column3> - <name> varcharColumn </name> - <type> varchar(20) </type> - </column3> - <column4> - <name> textColumn </name> - <type> text </type> - </column4> - </table3> - <table4> - <name> dateTimeTable </name> - <numColumns> 5 </numColumns> - <column1> - <name> serialNo </name> - <type> smallint </type> - <constraint> primary key </constraint> - </column1> - <column2> - <name> timestampCol </name> - <type> timestamp </type> - </column2> - <column3> - <name> intervalCol </name> - <type> interval </type> - </column3> - <column4> - <name> dateCol </name> - <type> date </type> - </column4> - <column5> - <name> timeCol </name> - <type> time </type> - </column5> - </table4> - <table5> - <name> booleanTable </name> - <numColumns> 2 </numColumns> - <column1> - <name> serialNo </name> - <type> smallint </type> - <constraint> primary key </constraint> - </column1> - <column2> - <name> bool </name> - <type> boolean </type> - </column2> - </table5> - </tables> - <values> - <numTables>5</numTables> - <table1> - <tableName>numericTable</tableName> - <numRows>4</numRows> - <numCols>4</numCols> - <row1> - <column1> 1 </column1> - <column2> -32768 </column2> - <column3> -2147483648 </column3> - <column4> -9223372036854775808 </column4> - </row1> - <row2> - <column1> 2 </column1> - <column2> 123 </column2> - <column3> -648 </column3> - <column4> 0 </column4> - </row2> - <row3> - <column1> 3 </column1> - <column2> 32767 </column2> - <column3> 2147483647 </column3> - <column4> 9223372036854775807 </column4> - </row3> - <row4> - <column1> 4 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - </row4> - </table1> - <table2> - <tableName>realNoTable</tableName> - <numRows>6</numRows> - <numCols>5</numCols> - <row1> - <column1> 1 </column1> - <column2> -9999.999999 </column2> - <column3> -9999999999 </column3> - <column4> -9.99999E-38 </column4> - <column5> -9.999999999999999E-308 </column5> - </row1> - <row2> - <column1> 2 </column1> - <column2> -123.99 </column2> - <column3> -1239 </column3> - <column4> 9.99999E-38 </column4> - <column5> 9.999999999999999E-308 </column5> - </row2> - <row3> - <column1> 3 </column1> - <column2> 0 </column2> - <column3> 0 </column3> - <column4> 0 </column4> - <column5> 0 </column5> - </row3> - <row4> - <column1> 4 </column1> - <column2> 123.99 </column2> - <column3> 123 </column3> - <column4> -9.99999E37 </column4> - <column5> -1.79769313486231E308 </column5> - </row4> - <row5> - <column1> 5 </column1> - <column2> 9999.999999 </column2> - <column3> 9999999999 </column3> - <column4> 9.99999E37 </column4> - <column5> 1.79769313486231E308 </column5> - </row5> - <row6> - <column1> 6 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - </row6> - </table2> - <table3> - <tableName>charTable</tableName> - <numRows>2</numRows> - <numCols>4</numCols> - <row1> - <column1> 1 </column1> - <column2> 'abcdefghijklmnopqrst' </column2> - <column3> '1234567890' </column3> - <column4> 'This is a fixed length text' </column4> - </row1> - <row2> - <column1> 2 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - </row2> - </table3> - <table4> - <tableName>datetimeTable</tableName> - <numRows>4</numRows> - <numCols>5</numCols> - <row1> - <column1> 1 </column1> - <column2> '0001-01-01 00:00:00.000000' </column2> - <column3> '-178000000 years +4 days' </column3> - <column4> '0001-01-01' </column4> - <column5> '12:23:34' </column5> - </row1> - <row2> - <column1> 2 </column1> - <column2> '2004-10-21 11:15:23' </column2> - <column3> '7890 years 5 days 07:30' </column3> - <column4> '2004-01-12' </column4> - <column5> '00:00:00' </column5> - </row2> - <row3> - <column1> 3 </column1> - <column2> '9999-12-31 23:59:59.9999' </column2> - <column3> '178000000 years 00:19:23' </column3> - <column4> '9999-12-31' </column4> - <column5> '23:59:59' </column5> - </row3> - <row4> - <column1> 4 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - </row4> - </table4> - <table5> - <tableName>booleanTable</tableName> - <numRows>3</numRows> - <numCols>2</numCols> - <row1> - <column1> 1 </column1> - <column2> TRUE </column2> - </row1> - <row2> - <column1> 2 </column1> - <column2> FALSE </column2> - </row2> - <row3> - <column1> 3 </column1> - <column2> null </column2> - </row3> - </table5> - </values> - </postgres> - <oracle> - <database> - <name> oracle </name> - <connectionString> Data Source=testdb.com;User Id=user9i;Password=oracle9i </connectionString> - </database> - <createStoredProc>Y</createStoredProc> - <deleteTables>Y</deleteTables> - <createTables>Y</createTables> - <insertData>Y</insertData> - <tables> - <numTables> 4 </numTables> - <table1> - <name>numericTable </name> - <numColumns> 3 </numColumns> - <column1> - <name> serialNo </name> - <type> number(1)</type> - <constraint> primary key </constraint> - </column1> - <column2> - <name> intCol </name> - <type> number(6)</type> - </column2> - <column3> - <name> decimalCol </name> - <type> number(6, 3)</type> - </column3> - </table1> - <table2> - <name> charTable </name> - <numColumns> 5 </numColumns> - <column1> - <name> serialNo </name> - <type> number(1)</type> - <constraint> primary key </constraint> - </column1> - <column2> - <name> charCol </name> - <type> char(10) </type> - </column2> - <column3> - <name> ncharCol </name> - <type> nchar(10) </type> - </column3> - <column4> - <name> varcharCol </name> - <type> varchar2(10) </type> - </column4> - <column5> - <name> nvarcharCol </name> - <type> nvarchar2(10) </type> - </column5> - </table2> - <table3> - <name> RealNoTable </name> - <numColumns> 2 </numColumns> - <column1> - <name> serialNo </name> - <type> number(1)</type> - <constraint> primary key </constraint> - </column1> - <column2> - <name> floatCol </name> - <type> float(24) </type> - </column2> - </table3> - <table4> - <name> DateTimeTable </name> - <numColumns> 5 </numColumns> - <column1> - <name> serialNo </name> - <type> number(1)</type> - <constraint> primary key </constraint> - </column1> - <column2> - <name> dateCol </name> - <type> date </type> - </column2> - <column3> - <name> timestampCol </name> - <type> timestamp </type> - </column3> - <column4> - <name> Int_year </name> - <type> interval year to month</type> - </column4> - <column5> - <name> int_day </name> - <type> interval day to second </type> - </column5> - </table4> - </tables> - <values> - <numTables>4</numTables> - <table1> - <tableName>numericTable</tableName> - <numRows>4</numRows> - <numCols>3</numCols> - <row1> - <column1> 1 </column1> - <column2> -999999 </column2> - <column3> -999.999 </column3> - </row1> - <row2> - <column1> 2 </column1> - <column2> 1000 </column2> - <column3> 234 </column3> - </row2> - <row3> - <column1> 3 </column1> - <column2> 999999 </column2> - <column3> 999.999 </column3> - </row3> - <row4> - <column1> 4 </column1> - <column2> null </column2> - <column3> null </column3> - </row4> - </table1> - <table2> - <tableName>charTable</tableName> - <numRows>2</numRows> - <numCols>5</numCols> - <row1> - <column1> 1 </column1> - <column2> '0123456789' </column2> - <column3> 'abcdefghij' </column3> - <column4> '0123456789' </column4> - <column5> 'abcdefghij' </column5> - </row1> - <row2> - <column1> 2 </column1> - <column2> null </column2> - <column3> null </column3> - <column4> null </column4> - <column5> null </column5> - </row2> - </table2> - <table3> - <tableName>RealNoTable</tableName> - <numRows>6</numRows> - <numCols>2</numCols> - <row1> - <column1> 1 </column1> - <column2> 9.9999999E125 </column2> - </row1> - <row2> - <column1> 2 </column1> - <column2> -9.999999E-126 </column2> - </row2> - <row3> - <column1> 3 </column1> - <column2> 1.23E-15 </column2> - </row3> - <row4> - <column1> 4 </column1> - <column2> -9.999999E-126 </column2> - </row4> - <row5> - <column1> 5 </column1> - <column2> 9.9999999E125 </column2> - </row5> - <row6> - <column1> 6 </column1> - <column2> null </column2> - </row6> - </table3> - <table4> - <tableName>DateTimeTable</tableName> - <numRows>3</numRows> - <numCols>5</numCols> - <row1> - <column1> 1 </column1> - <column2> to_date('0001-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss') </column2> - <column3> TIMESTAMP'0001-01-01 00:00:00' </column3> - <column4> '-99-11' </column4> - <column5> '-99 23:59:59' </column5> - </row1> - <row2> - <column1> 2 </column1> - <column2> to_date('2004-11-23 12:34:45', 'yyyy-mm-dd hh24:mi:ss') </column2> - <column3> TIMESTAMP'2004-11-23 12:34:45' </column3> - <column4> '34-5' </column4> - <column5> '-34 20:50:00' </column5> - </row2> - <row3> - <column1> 3 </column1> - <column2> to_date('9999-12-31 23:59:59', 'yyyy-mm-dd hh24:mi:ss') </column2> - <column3> TIMESTAMP'9999-12-31 23:59:59' </column3> - <column4> '99-11' </column4> - <column5> '00 23:59:59' </column5> - </row3> - </table4> - </values> - <StoredProc> - <NumStoredProc> 1 </NumStoredProc> - <StoredProc1> - <type> generic </type> - <name> {{TABLE}}_pkg.Select_{{TABLE}}_data</name> - <template> - <numStmts> 2 </numStmts> - <stmt1><![CDATA[ - create or replace package {{TABLE}}_pkg As - type {{TABLE}}Cur is ref cursor return {{TABLE}}%rowtype; - procedure Select_{{TABLE}}_Data (ref_cur out {{TABLE}}Cur); - END {{TABLE}}_pkg;]]> - </stmt1> - <stmt2><![CDATA[ - create or replace package body {{TABLE}}_pkg As - procedure Select_{{TABLE}}_Data ( ref_cur out {{TABLE}}Cur) is - BEGIN - open ref_cur for select {{COLUMNS}} from {{TABLE}} order by {{COLUMN_1}}; - End Select_{{TABLE}}_Data; - END {{TABLE}}_pkg;]]></stmt2> - </template> - </StoredProc1> - </StoredProc> - </oracle> -</configuration> diff --git a/mcs/class/System.Data/Test/DataProviderTests/setup/TableInfo.cs b/mcs/class/System.Data/Test/DataProviderTests/setup/TableInfo.cs deleted file mode 100644 index 7d0e0d0c259..00000000000 --- a/mcs/class/System.Data/Test/DataProviderTests/setup/TableInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -// -// TableInfo.cs : A data structure to hold all information about tables -// -// Author: -// Satya Sudha K (ksathyasudha@novell.com) -// -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// 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.Xml; - -namespace MonoTests.System.Data { - - public struct TableInfo { - - public string name; - public string [] columns; - public string [] types; - - public TableInfo (int n) - { - name = null; - columns = null; - types = null; - } - - public void Initialize (XmlNode doc, int tableNum) - { - string tableTag = "table" + tableNum; - name = ConfigClass.GetElement (doc, "tables", tableTag, "name"); - columns = ConfigClass.GetColumnDetails (doc, tableNum, "name"); - types = ConfigClass.GetColumnDetails (doc, tableNum, "type"); - } - - } - -} diff --git a/mcs/class/System.Data/corefx.common.sources b/mcs/class/System.Data/corefx.common.sources index 850f001e9c5..f53a861c040 100644 --- a/mcs/class/System.Data/corefx.common.sources +++ b/mcs/class/System.Data/corefx.common.sources @@ -8,10 +8,9 @@ Assembly/AssemblyInfo.cs # # corefx doesn't fully cover our API yet, these files fill the gaps: # -ReferenceSources/ThisAssembly.cs +corefx/ThisAssembly.cs System.Data.SqlClient/SqlCredential.cs System.Data.SqlClient/SQLDebugging.cs -ReferenceSources/PoolBlockingPeriod.cs corefx/Odbc/AdapterUtil.cs corefx/Odbc/Res.cs corefx/DbConnection.cs diff --git a/mcs/class/System.Data/corefx/TdsEnums.cs b/mcs/class/System.Data/corefx/TdsEnums.cs index ddc362f7ce4..ee58828fd0d 100644 --- a/mcs/class/System.Data/corefx/TdsEnums.cs +++ b/mcs/class/System.Data/corefx/TdsEnums.cs @@ -30,4 +30,11 @@ namespace System.Data.SqlClient ResultSetOnly, Disabled, } + + public enum PoolBlockingPeriod + { + Auto, + AlwaysBlock, + NeverBlock + } }
\ No newline at end of file diff --git a/mcs/class/System.Data/ReferenceSources/ThisAssembly.cs b/mcs/class/System.Data/corefx/ThisAssembly.cs index a20c4118303..a20c4118303 100644 --- a/mcs/class/System.Data/ReferenceSources/ThisAssembly.cs +++ b/mcs/class/System.Data/corefx/ThisAssembly.cs |