// Spludlow Software // Copyright © Samuel P. Ludlow 2020 All Rights Reserved // Distributed under the terms of the GNU General Public License version 3 // Distributed WITHOUT ANY WARRANTY; without implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE // https://www.spludlow.co.uk/LICENCE.TXT // The Spludlow logo is a registered trademark of Samuel P. Ludlow and may not be used without permission // v1.14 using System; using System.Collections.Generic; using System.Data; using System.Data.Common; using System.Linq; using System.Text; using System.Threading.Tasks; using IBM.Data.DB2; namespace Spludlow.Data { /// /// DB2 DAL Implimentation - Not very complete, read only at the moment /// /// Must be installed: "IBM Data Server Driver Package (Windows)" (On development machine and final destination hosts) /// The file I used was "ibm_data_server_driver_package_win64_v11.5.exe", good luck finding it on the IBM site. /// Link to this DLL: C:\Program Files\IBM\IBM DATA SERVER DRIVER\bin\netf40\specific\IBM.Data.DB2.11.1.0.dll /// Copy Local: False (No point as loads of other DLL depenancies also, full stack needs installing) /// Specific Version: False /// Note: Get warning about processor architecutre (because mixed assembily wrapper, not pure .net), I doubt it works on x86, waring goes away if Spludlow.Data.DB2 is changed from "Any CPU" to "x64". Will leave "Any CPU" and ignore warning /// /// Client Copy name: IBMDBCL1 /// The highest authority in a database is DBADM, and the highest authority at an instance level is SYSADM. /// public class DALDB2 : Spludlow.Data.IDAL { private DB2Connection Connection; private DB2Transaction Transaction = null; private string ChangedDatabase = null; private string CurrentDatabaseCache = null; private string CacheKeyPrefix; private Dictionary ConvertDataTypes; private string QuoteOpen = "\""; private string QuoteClose = "\""; private List SystemDatabaseNames = new List(new string[] { // "sys", }); public DALDB2() { } public DALDB2(string connectionString) { this.Initialize(connectionString); } public void Initialize(string connectionString) { if (connectionString == null || connectionString.Length == 0) // For use with utility methods return; if (connectionString.StartsWith("@") == true) connectionString = Spludlow.Config.ConnectionString(connectionString.Substring(1)); this.Connection = new DB2Connection(connectionString); this.CacheKeyPrefix = "DALDB2-Schemas-" + this.DataSource() + "-"; this.ConvertDataTypes = new Dictionary(); string[] convertLookups = new string[] { "NUMERIC DECIMAL", "FLOAT DOUBLE", "VARGRAPHIC NVARCHAR", "GRAPHIC NCHAR", }; foreach (string convertLookup in convertLookups) { string[] words = Spludlow.Text.Split(convertLookup, '\t', true, false); this.ConvertDataTypes.Add(words[0], words[1]); } this.ChangeDatabase(null); } public static void ReportDataTypes() { Spludlow.Data.ADO.EnumInt32Report(typeof(DB2Type)); } public static string MakeConnectionString(string dataSource, string database, string userName, string password) { string[] names = new string[] { "Server", "Database", "UserID", "Password" }; string[] values = new string[] { dataSource, database, userName, password }; string connectionString = DALCommon.MakeConnectionString(names, values, ""); // What quotes? return connectionString.ToString(); } public string Quotes(string commandText) { return this.Quotes(commandText, "[", "]"); } public string Quotes(string commandText, string replaceOpen, string replaceClose) { StringBuilder result = new StringBuilder(commandText); result.Replace(replaceOpen, this.QuoteOpen); result.Replace(replaceClose, this.QuoteClose); return result.ToString(); } // // Open Close // private void Open() { this.Connection.Open(); if (this.ChangedDatabase != null) { try { string database = this.ChangedDatabase; if (database == "") database = ""; this.Connection.ChangeDatabase(database); } catch { this.Connection.Close(); throw; } } } private void Close() { this.Connection.Close(); } public string DataSource() { this.Open(); try { return this.Connection.DataSource; } finally { this.Close(); } } public void CommandTimeout(int minutes) { } // // Current // public string CurrentDatabase() { return this.CurrentDatabaseCache; } public void ChangeDatabase(string databaseName) { this.ChangedDatabase = databaseName; this.Open(); try { databaseName = this.Connection.Database; } finally { this.Close(); } this.CurrentDatabaseCache = databaseName; } // // Transactions // public void Begin() { if (this.Transaction != null) throw new ApplicationException("DAL IDM DB2: Begin Transaction already present."); this.Open(); try { this.Transaction = this.Connection.BeginTransaction(); } catch { this.Close(); throw; } } public void Commit() { if (this.Transaction == null) throw new ApplicationException("DAL IDM DB2: Commit Transaction not present."); try { this.Transaction.Commit(); this.Transaction = null; } finally { this.Close(); } } public void Rollback() { if (this.Transaction == null) throw new ApplicationException("DAL IDM DB2: Rollback Transaction not present."); try { this.Transaction.Rollback(); this.Transaction = null; } finally { this.Close(); } } // // Schema // public DataSet Schema(string tableName) { return this.Schema(new string[] { tableName }); } public DataSet Schema(string[] tableNames) { DataSet fullSchema = this.Schema(); DataSet partSchema = new DataSet(); foreach (string tableName in tableNames) { foreach (string suffix in new string[] { "_Columns", "_Keys" }) partSchema.Tables.Add(fullSchema.Tables[tableName + suffix].Copy()); } return partSchema; } public DataSet Schema() { string databaseName = this.CurrentDatabase(); if (databaseName == null) throw new ApplicationException("DAL IDM DB2; To get the schema you must have a current database"); string key = this.CacheKeyPrefix + databaseName; DataSet schema = (DataSet)Spludlow.Caching.Get(key); if (schema != null) return schema; schema = new DataSet(); DataSet schemaReader = this.SchemaReader(); DataSet schemaNative = this.SchemaNative(); DataSet schemaStandard = this.SchemaConnection(); List aliasTableName = this.AliasTableList(); foreach (string tableName in this.TableList()) { this.SchemaColumns(schema, tableName, schemaReader, schemaNative, schemaStandard); this.SchemaKeys(schema, tableName, schemaReader, schemaNative, schemaStandard, aliasTableName); } Spludlow.Caching.Set(key, schema); return schema; } private void SchemaColumns(DataSet schema, string tableName, DataSet schemaReader, DataSet schemaNative, DataSet schemaStandard) { DataTable schemaTable = Spludlow.Data.Schemas.NewSchemaColumnsTable(tableName); foreach (DataRow readerRow in schemaReader.Tables[tableName].Rows) { string columnName = (string)readerRow["ColumnName"]; int columnSize = (int)readerRow["ColumnSize"]; DataRow standardRow = schemaStandard.Tables["Columns"].Rows.Find(new object[] { tableName, columnName }); if (standardRow == null) throw new ApplicationException("DAL IDM DB2 Schema; Can not find standard Schema row for column: " + tableName + "." + columnName); string typeName = (string)standardRow["DATA_TYPE_NAME"]; if (this.ConvertDataTypes.ContainsKey(typeName) == true) typeName = this.ConvertDataTypes[typeName]; DataRow schemaRow = schemaTable.NewRow(); schemaRow["ColumnName"] = columnName; schemaRow["Ordinal"] = (int)readerRow["ColumnOrdinal"]; schemaRow["DataTypeId"] = Spludlow.Data.Schemas.NativeToCommon(typeName, "DB2"); schemaRow["MaxLength"] = columnSize; schemaRow["Precision"] = (Int16)readerRow["NumericPrecision"]; schemaRow["Scale"] = (Int16)readerRow["NumericScale"]; schemaRow["PrimaryKey"] = (bool)readerRow["IsKey"]; schemaRow["AllowDBNull"] = (bool)readerRow["AllowDBNull"]; schemaRow["AutoIncrement"] = (bool)readerRow["IsAutoIncrement"]; schemaRow["Longest"] = 0; schemaTable.Rows.Add(schemaRow); } Spludlow.Data.Schemas.TidySchemaTable(schemaTable); schema.Tables.Add(schemaTable); } private void SchemaKeys(DataSet schema, string tableName, DataSet schemaReader, DataSet schemaNative, DataSet schemaStandard, List aliasTableName) { SysTables.SchemaKeysDataTable keysTable = Spludlow.Data.Schemas.NewSchemaKeysTable(tableName); // DESC ? // PK List primaryKeyNames = new List(); foreach (DataRow keyRow in schemaStandard.Tables["PrimaryKeys"].Select("TABLE_NAME = '" + tableName + "'")) { string name = (string)keyRow["PK_NAME"]; if (primaryKeyNames.Contains(name) == false) primaryKeyNames.Add(name); } foreach (string keyName in primaryKeyNames) { DataRow[] keyRows = schemaStandard.Tables["PrimaryKeys"].Select("TABLE_NAME = '" + tableName + "' AND PK_NAME = '" + keyName + "'", "KEY_SEQ"); foreach (DataRow keyRow in keyRows) { string columnName = (string)keyRow["COLUMN_NAME"]; int ordinal = (Int16)keyRow["KEY_SEQ"]; //DataRow indexRow = this.FindIndexRow(schemaStandard, tableName, columnName, keyName); //bool descending = false; //if ((string)indexRow["ASC_OR_DESC"] != "A") // descending = true; keysTable.Rows.Add(new object[] { tableName + "_" + keyName, "P", ordinal, false, columnName, null, null }); } } // FK List keyNames = new List(); foreach (DataRow keyRow in schemaStandard.Tables["ForeignKeys"].Select("FKTABLE_NAME = '" + tableName + "'")) { string foriegnTableName = (string)keyRow["PKTABLE_NAME"]; if (aliasTableName.Contains(foriegnTableName) == true) continue; string name = (string)keyRow["FK_NAME"]; if (keyNames.Contains(name) == false) keyNames.Add(name); } foreach (string keyName in keyNames) { DataRow[] keyRows = schemaStandard.Tables["ForeignKeys"].Select("FKTABLE_NAME = '" + tableName + "' AND FK_NAME = '" + keyName + "'", "KEY_SEQ"); foreach (DataRow keyRow in keyRows) { string columnName = (string)keyRow["FKCOLUMN_NAME"]; int ordinal = (Int16)keyRow["KEY_SEQ"]; string foriegnTableName = (string)keyRow["PKTABLE_NAME"]; string foriegnColumnName = (string)keyRow["PKCOLUMN_NAME"]; if (aliasTableName.Contains(foriegnTableName) == true) continue; keysTable.Rows.Add(new object[] { tableName + "_" + keyName, "F", ordinal, false, columnName, foriegnTableName, foriegnColumnName }); } } // I & U Indexes List indexNames = new List(); foreach (DataRow keyRow in schemaStandard.Tables["Indexes"].Select("TABLE_NAME = '" + tableName + "' AND INDEX_NAME IS NOT NULL")) { string name = (string)keyRow["INDEX_NAME"]; if (primaryKeyNames.Contains(name) == true) continue; if (indexNames.Contains(name) == false) indexNames.Add(name); } foreach (string indexName in indexNames) { DataRow[] keyRows = schemaStandard.Tables["Indexes"].Select("TABLE_NAME = '" + tableName + "' AND INDEX_NAME = '" + indexName + "'", "ORDINAL_POSITION"); foreach (DataRow keyRow in keyRows) { string columnName = (string)keyRow["COLUMN_NAME"]; int ordinal = (Int16)keyRow["ORDINAL_POSITION"]; string keyType = "I"; if ((Int16)keyRow["NON_UNIQUE"] == 0) keyType = "U"; bool descending = false; if ((string)keyRow["ASC_OR_DESC"] != "A") descending = true; keysTable.Rows.Add(new object[] { tableName + "_" + indexName, keyType, ordinal, descending, columnName, null, null }); } } schema.Tables.Add(keysTable); } private DataRow FindIndexRow(DataSet schemaStandard, string tableName, string columnName, string indexName) { StringBuilder commandText = new StringBuilder("TABLE_NAME = '@TABLE_NAME' AND COLUMN_NAME = '@COLUMN_NAME' AND INDEX_NAME = '@INDEX_NAME'"); commandText.Replace("@TABLE_NAME", tableName); commandText.Replace("@COLUMN_NAME", columnName); commandText.Replace("@INDEX_NAME", indexName); DataRow[] rows = schemaStandard.Tables["Indexes"].Select(commandText.ToString()); if (rows.Length != 1) throw new ApplicationException("DAL IDM DB2 FindIndexRow; Can not find Index row for key: " + indexName + ", table:" + tableName + "." + columnName + ", rows: " + rows.Length); return rows[0]; } public DataSet SchemaNative() { string databaseName = this.CurrentDatabase(); if (databaseName == null) throw new ApplicationException("DAL IDM DB2; To get the Native schema you must have a current database"); DataSet dataSet = new DataSet(); string currentSchema = (string)this.ExecuteScalar("values current schema"); string[] names = new string[] { //"ATTRIBUTES", "DBAUTH", "CHECKS", //"COLAUTH", "COLUMNS TABSCHEMA", "COLCHECKS", "KEYCOLUSE", "CONSTDEP", "DATATYPES", "INDEXAUTH", "INDEXCOLUSE INDSCHEMA", "INDEXDEP", "INDEXES INDSCHEMA", //"PACKAGES", //"PACKAGEAUTH", //"PACKAGEDEP", "PROCPARMS PROCSCHEMA", "REFERENCES", "SCHEMATA", "SEQUENCES", "PROCEDURES PROCSCHEMA", "TABCONST TABSCHEMA", "TABAUTH TABSCHEMA", "TABLES TABSCHEMA", "TABLESPACES", "TRIGDEP TRIGSCHEMA", "TRIGGERS TRIGSCHEMA", "FUNCTIONS FUNCSCHEMA", "VIEWS VIEWSCHEMA", }; foreach (string nameParts in names) { string[] words = Spludlow.Text.Split(nameParts, '\t', true); string name = words[0]; string commandText = "SELECT * FROM SYSCAT." + name; if (words.Length > 1) commandText += " WHERE (" + words[1] + " = '" + currentSchema + "')"; this.Fill(dataSet, commandText); Spludlow.Data.ADO.NameLastTable(dataSet, name); } return dataSet; } public DataSet SchemaReader() { string[] tableNames = this.TableList(); DataSet schema; if (this.Transaction == null) this.Open(); try { schema = Spludlow.Data.DALCommon.SchemaReader(this.Connection, this.Transaction, tableNames, this.QuoteOpen, this.QuoteClose); } finally { if (this.Transaction == null) this.Close(); } return schema; } public DataSet SchemaConnection() { string databaseName = this.CurrentDatabase(); if (databaseName == null) throw new ApplicationException("DAL IDM DB2; To get the Standard schema you must have a current database"); string currentSchema = (string)this.ExecuteScalar("values current schema"); DataSet schema; if (this.Transaction == null) this.Open(); try { schema = Spludlow.Data.DALCommon.SchemaConnection(this.Connection, "SCHEMA_NAME", currentSchema); } finally { if (this.Transaction == null) this.Close(); } DataTable table; table = schema.Tables["Columns"]; table.PrimaryKey = new DataColumn[] { table.Columns["TABLE_NAME"], table.Columns["COLUMN_NAME"] }; //table = schema.Tables["Indexes"]; //table.PrimaryKey = new DataColumn[] { table.Columns["TABLE_NAME"], table.Columns["INDEX_NAME"], table.Columns["COLUMN_NAME"] }; //table = schema.Tables["PrimaryKeys"]; //table.PrimaryKey = new DataColumn[] { table.Columns["CONSTRAINT_NAME"] }; //table = schema.Tables["UniqueKeys"]; //table.PrimaryKey = new DataColumn[] { table.Columns["INDEX_NAME"] }; return schema; } public void SchemaRefresh() { string databaseName = this.CurrentDatabase(); if (databaseName == null) throw new ApplicationException("DAL IDM DB2; To Refresh the schema you must have a current database"); string key = this.CacheKeyPrefix + databaseName; Spludlow.Caching.Remove(key); } private List AliasTableList() { string currentSchema = (string)this.ExecuteScalar("values current schema"); DataTable table = this.Select("select TABNAME from SYSCAT.TABLES where (TYPE = 'A' AND TABSCHEMA = '" + currentSchema + "')"); List tableNames = new List(); foreach (DataRow row in table.Rows) tableNames.Add((string)row[0]); return tableNames; } // // Tables // public string[] TableList() { string database = this.CurrentDatabase(); if (database == null) throw new ApplicationException("DAL IDM DB2; To list tables you must have a current database"); string currentSchema = (string)this.ExecuteScalar("values current schema"); DataTable table = this.Select("select TABNAME from SYSCAT.TABLES where (TYPE = 'T' AND TABSCHEMA = '" + currentSchema + "')"); List tableNames = new List(); foreach (DataRow row in table.Rows) tableNames.Add((string)row[0]); return tableNames.ToArray(); } // // Command // private void SetDataType(DAL.CommandInfo info, DataRow columnRow, int index) { string dataTypeId = (string)columnRow["DataTypeId"]; string nativeType = Spludlow.Data.Schemas.CommonToNative(dataTypeId, "DB2Type"); DB2Type dbType = (DB2Type)Enum.Parse(typeof(DB2Type), nativeType); info.ParameterTypes[index] = (int)dbType; info.ParameterMaxLengths[index] = (int)columnRow["MaxLength"]; } public DAL.CommandInfo MakeCommandInfo(string commandText) { return MakeCommandInfo(commandText, DALCommon.ExtractParameterNames(commandText)); } public DAL.CommandInfo MakeCommandInfo(string commandText, string[] parameterNames) { return Spludlow.Data.DALCommon.MakeCommandInfo(commandText, parameterNames, this.Schema(), this.SetDataType); } private DB2Command MakeCommandNative(string commandText) { DB2Command command = new DB2Command(commandText, this.Connection, this.Transaction); // The time in seconds to wait for the command to execute. The default is 30 seconds. //command.CommandTimeout = 20 * 60; return command; } public DbCommand MakeCommand(string commandText) { return this.MakeCommandNative(commandText); } public DbCommand MakeCommand(string commandText, object[] parameterValues) { DAL.CommandInfo commandInfo = this.MakeCommandInfo(commandText); return this.MakeCommand(commandInfo, parameterValues); } public DbCommand MakeCommand(string commandText, string[] parameterNames, object[] parameterValues) { DAL.CommandInfo commandInfo = this.MakeCommandInfo(commandText, parameterNames); return this.MakeCommand(commandInfo, parameterValues); } public DbCommand MakeCommand(DAL.CommandInfo commandInfo, object[] parameterValues) { if (commandInfo.ParameterNames.Length != parameterValues.Length) throw new ApplicationException("Making Command with different parameterNames and parameterValues counts: " + commandInfo.ParameterNames.Length + ", " + parameterValues.Length); DB2Command command = this.MakeCommandNative(commandInfo.CommandText); for (int index = 0; index < commandInfo.ParameterNames.Length; ++index) { string paramterName = commandInfo.ParameterNames[index]; DB2Type dbType = (DB2Type)commandInfo.ParameterTypes[index]; int maxLength = commandInfo.ParameterMaxLengths[index]; DB2Parameter parameter = command.CreateParameter(); parameter.ParameterName = paramterName; if ((int)dbType != -1) parameter.DB2Type = dbType; // seems to make slightly slower ???????????????????????????????? try differnt DALs //if (maxLength > 0) // parameter.Size = maxLength; // using Size seems to slow things down big time on Insert DAL Test using dummpy Logs and bodies. Maybe becasue using max size? Do more tests !!!!!!!!!!!!!! parameter.Value = parameterValues[index]; command.Parameters.Add(parameter); } return command; } // // ExecuteScalar // public object ExecuteScalar(string commandText) { using (DB2Command command = (DB2Command)this.MakeCommand(commandText)) return this.ExecuteScalar(command); } public object ExecuteScalar(string commandText, object[] parameterValues) { using (DB2Command command = (DB2Command)this.MakeCommand(commandText, parameterValues)) return this.ExecuteScalar(command); } public object ExecuteScalar(string commandText, string[] parameterNames, object[] parameterValues) { using (DB2Command command = (DB2Command)this.MakeCommand(commandText, parameterNames, parameterValues)) return this.ExecuteScalar(command); } public object ExecuteScalar(DAL.CommandInfo commandInfo, object[] parameterValues) { using (DB2Command command = (DB2Command)this.MakeCommand(commandInfo, parameterValues)) return this.ExecuteScalar(command); } public object ExecuteScalar(DbCommand command) { return this.ExecuteScalar((DB2Command)command); } private object ExecuteScalar(DB2Command command) { if (this.Transaction != null) return command.ExecuteScalar(); this.Open(); try { return command.ExecuteScalar(); } finally { this.Close(); } } // // ExecuteNonQuery // public int ExecuteNonQuery(string commandText) { using (DB2Command command = (DB2Command)this.MakeCommand(commandText)) return this.ExecuteNonQuery(command); } public int ExecuteNonQuery(string commandText, object[] parameterValues) { using (DB2Command command = (DB2Command)this.MakeCommand(commandText, parameterValues)) return this.ExecuteNonQuery(command); } public int ExecuteNonQuery(string commandText, string[] parameterNames, object[] parameterValues) { using (DB2Command command = (DB2Command)this.MakeCommand(commandText, parameterNames, parameterValues)) return this.ExecuteNonQuery(command); } public int ExecuteNonQuery(DAL.CommandInfo commandInfo, object[] parameterValues) { using (DB2Command command = (DB2Command)this.MakeCommand(commandInfo, parameterValues)) return this.ExecuteNonQuery(command); } public int ExecuteNonQuery(DbCommand command) { return this.ExecuteNonQuery((DB2Command)command); } private int ExecuteNonQuery(DB2Command command) { if (this.Transaction != null) return command.ExecuteNonQuery(); this.Open(); try { return command.ExecuteNonQuery(); } finally { this.Close(); } } // // Fill // private void ExecuteAdapter(DB2Command command, DataSet dataSet, DataTable table) { if (this.Transaction == null) this.Open(); try { using (DB2DataAdapter adapter = new DB2DataAdapter(command)) { if (dataSet != null) adapter.Fill(dataSet); if (table != null) adapter.Fill(table); } } finally { if (this.Transaction == null) this.Close(); } } public void Fill(DataSet dataSet, string commandText) { using (DB2Command command = (DB2Command)this.MakeCommand(commandText)) this.Fill(dataSet, command); } public void Fill(DataSet dataSet, string commandText, object[] parameterValues) { using (DB2Command command = (DB2Command)this.MakeCommand(commandText, parameterValues)) this.Fill(dataSet, command); } public void Fill(DataSet dataSet, string commandText, string[] parameterNames, object[] parameterValues) { using (DB2Command command = (DB2Command)this.MakeCommand(commandText, parameterNames, parameterValues)) this.Fill(dataSet, command); } public void Fill(DataSet dataSet, DAL.CommandInfo commandInfo, object[] parameterValues) { using (DB2Command command = (DB2Command)this.MakeCommand(commandInfo, parameterValues)) this.Fill(dataSet, command); } public void Fill(DataSet dataSet, DbCommand command) { this.Fill(dataSet, (DB2Command)command); } private void Fill(DataSet dataSet, DB2Command command) { this.ExecuteAdapter(command, dataSet, null); } public void Fill(DataTable table, string commandText) { using (DB2Command command = (DB2Command)this.MakeCommand(commandText)) this.Fill(table, command); } public void Fill(DataTable table, string commandText, object[] parameterValues) { using (DB2Command command = (DB2Command)this.MakeCommand(commandText, parameterValues)) this.Fill(table, command); } public void Fill(DataTable table, string commandText, string[] parameterNames, object[] parameterValues) { using (DB2Command command = (DB2Command)this.MakeCommand(commandText, parameterNames, parameterValues)) this.Fill(table, command); } public void Fill(DataTable table, DAL.CommandInfo commandInfo, object[] parameterValues) { using (DB2Command command = (DB2Command)this.MakeCommand(commandInfo, parameterValues)) this.Fill(table, command); } public void Fill(DataTable table, DbCommand command) { this.Fill(table, (DB2Command)command); } private void Fill(DataTable table, DB2Command command) { this.ExecuteAdapter(command, null, table); } // // Select // public DataTable Select(string commandText) { using (DB2Command command = (DB2Command)this.MakeCommand(commandText)) return this.Select(command); } public DataTable Select(string commandText, object[] parameterValues) { using (DB2Command command = (DB2Command)this.MakeCommand(commandText, parameterValues)) return this.Select(command); } public DataTable Select(string commandText, string[] parameterNames, object[] parameterValues) { using (DB2Command command = (DB2Command)this.MakeCommand(commandText, parameterNames, parameterValues)) return this.Select(command); } public DataTable Select(DAL.CommandInfo commandInfo, object[] parameterValues) { using (DB2Command command = (DB2Command)this.MakeCommand(commandInfo, parameterValues)) return this.Select(command); } public DataTable Select(DbCommand command) { return this.Select((DB2Command)command); } private DataTable Select(DB2Command command) { DataSet dataSet = this.SelectDS(command); DataTable table = dataSet.Tables[0]; dataSet.Tables.Remove(table); return table; } public DataSet SelectDS(string commandText) { using (DB2Command command = (DB2Command)this.MakeCommand(commandText)) return this.SelectDS(command); } public DataSet SelectDS(string commandText, object[] parameterValues) { using (DB2Command command = (DB2Command)this.MakeCommand(commandText, parameterValues)) return this.SelectDS(command); } public DataSet SelectDS(string commandText, string[] parameterNames, object[] parameterValues) { using (DB2Command command = (DB2Command)this.MakeCommand(commandText, parameterNames, parameterValues)) return this.SelectDS(command); } public DataSet SelectDS(DAL.CommandInfo commandInfo, object[] parameterValues) { using (DB2Command command = (DB2Command)this.MakeCommand(commandInfo, parameterValues)) return this.SelectDS(command); } public DataSet SelectDS(DbCommand command) { return this.SelectDS((DB2Command)command); } private DataSet SelectDS(DB2Command command) { DataSet dataSet = new DataSet(); this.ExecuteAdapter(command, dataSet, null); return dataSet; } public void Backup(string serverFilename) { throw new NotImplementedException(); } public void DatabaseCreate(string databaseName) { throw new NotImplementedException(); } public void DatabaseDelete(string databaseName) { throw new NotImplementedException(); } public bool DatabaseExists(string databaseName) { throw new NotImplementedException(); } public string[] DatabaseList() { throw new NotImplementedException(); } public long Insert(DataRow row) { throw new NotImplementedException(); } public long Insert(string tableName, object[] row) { throw new NotImplementedException(); } public long Insert(DAL.CommandInfo insertInfo, object[] row) { throw new NotImplementedException(); } public long Insert(DAL.CommandInfo insertInfo, DataRow row) { throw new NotImplementedException(); } public long Insert(string tableName, DataRow row) { throw new NotImplementedException(); } public long InsertOrUpdate(DataRow row) { throw new NotImplementedException(); } public long InsertOrUpdate(string tableName, DataRow row) { throw new NotImplementedException(); } public void LoginCreate(string loginName, bool administrator) { throw new NotImplementedException(); } public void LoginCreate(string loginName, string password, bool administrator) { throw new NotImplementedException(); } public void LoginDelete(string loginName) { throw new NotImplementedException(); } public bool LoginExists(string loginName) { throw new NotImplementedException(); } public string[] LoginList() { throw new NotImplementedException(); } public DAL.CommandInfo MakeInserter(string tableName) { throw new NotImplementedException(); } public DAL.CommandInfo MakeUpdater(string tableName) { throw new NotImplementedException(); } public DAL.CommandInfo MakeUpdater(string tableName, string[] updateColumns) { throw new NotImplementedException(); } public void Operation(string details) { throw new NotImplementedException(); } public string PageCommandText(string commandText, int pageIndex, int pageSize) { throw new NotImplementedException(); } public void Restore(string serverFilename) { throw new NotImplementedException(); } public string RunScript(string localFilename, string server, string database) { throw new NotImplementedException(); } public string RunScript(string localFilename, string server, string database, string userName, string password) { throw new NotImplementedException(); } public void TableAddKeys(DataSet schema, string keyTypesPUIF) { throw new NotImplementedException(); } public void TableAddKeys(string[] tableNames, DataSet schema, string keyTypesPUIF) { throw new NotImplementedException(); } public void TableAddKeys(string tableName, DataSet schema, string keyTypesPUIF) { throw new NotImplementedException(); } public void TableClear(string tableName) { throw new NotImplementedException(); } public void TableCreate(string tableName, DataSet schema) { throw new NotImplementedException(); } public void TableCreate(string tableName, DataTable schemaColumns, DataTable schemaKeys) { throw new NotImplementedException(); } public void TableDelete(string tableName) { throw new NotImplementedException(); } public bool TableExists(string tableName) { throw new NotImplementedException(); } public int Update(DataRow row) { throw new NotImplementedException(); } public int Update(DAL.CommandInfo info, object[] row) { throw new NotImplementedException(); } public int Update(DAL.CommandInfo info, DataRow row) { throw new NotImplementedException(); } public int Update(string tableName, object[] row) { throw new NotImplementedException(); } public int Update(string tableName, DataRow row) { throw new NotImplementedException(); } public int Update(string tableName, string[] columns, object[] row) { throw new NotImplementedException(); } public int Update(string tableName, string[] columns, DataRow row) { throw new NotImplementedException(); } public void UserCreate(string userName, string loginName, bool administrator) { throw new NotImplementedException(); } public void UserDelete(string userName) { throw new NotImplementedException(); } public bool UserExists(string userName) { throw new NotImplementedException(); } public string[] UserList() { throw new NotImplementedException(); } public void BulkInsert(DataTable table, string tableName, string tempDirectory) { throw new NotImplementedException(); } public DataSet SchemaANSI() { throw new NotImplementedException(); } public void DatabaseCreate(string databaseName, DataSet schema) { throw new NotImplementedException(); } } }