// 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.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Data;
using System.Data.Common;
using Oracle.ManagedDataAccess.Client;
namespace Spludlow.Data
{
///
/// Oracle DAL Implimentation - Not very complete, read only at the moment
///
/// http://www.oracle.com/technetwork/topics/dotnet/downloads/index.html
/// ODP.NET_Managed
///
/// "System.Data.OracleClient" is obsolete
///
///
public class DALOracle : Spludlow.Data.IDAL
{
private OracleConnection Connection;
private OracleTransaction Transaction = null;
private string ChangedDatabase = null;
private string CurrentDatabaseCache = null;
private string CacheKeyPrefix;
private Dictionary ConvertDataTypes;
private List SystemDatabaseNames = new List(new string[]
{
//"information_schema",
//"mysql",
//"performance_schema",
//"sys",
});
private string QuoteOpen = "\"";
private string QuoteClose = "\"";
public DALOracle()
{
}
public DALOracle(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 OracleConnection(connectionString);
this.CacheKeyPrefix = "DALOracle-Schemas-" + this.DataSource() + "-";
this.ConvertDataTypes = new Dictionary();
string[] convertLookups = new string[]
{
"FLOAT BINARY_FLOAT",
};
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 string MakeConnectionString(string host, string database)
{
return MakeConnectionString(host, database, null, null);
}
public static string MakeConnectionString(string host, string database, string userName, string password)
{
StringBuilder connectionString = new StringBuilder();
connectionString.Append("(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=@Host)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=@ServiceName)))");
connectionString.Replace("@Host", host);
connectionString.Replace("@ServiceName", database);
string dataSource = connectionString.ToString();
dataSource = host + "/" + database; // Short version does work !!!!
string[] names = new string[] { "Data Source", "User Id", "Password" };
string[] values = new string[] { dataSource, userName, password };
connectionString.Length = 0;
for (int index = 0; index < values.Length; ++index)
{
string value = values[index];
if (value == null)
continue;
connectionString.Append(names[index]);
connectionString.Append("="); // No quotes?? was breaking login
connectionString.Append(value);
connectionString.Append(";");
}
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 = "SYSTEM";
this.Connection.ChangeDatabase(database); // Not suported !!!!!!!!!!!!!!!!!!!!!!!!!
}
catch
{
this.Connection.Close();
throw;
}
}
}
private void Close()
{
this.Connection.Close();
}
public string DataSource()
{
return this.Connection.DataSource;
}
public void CommandTimeout(int minutes)
{
}
//
// Current
//
public string CurrentDatabase()
{
return this.CurrentDatabaseCache;
}
public void ChangeDatabase(string databaseName)
{
this.ChangedDatabase = databaseName;
object result = this.ExecuteScalar("SELECT sys_context('USERENV', 'CURRENT_SCHEMA') FROM DUAL");
if (result == null || result is DBNull)
databaseName = null;
else
databaseName = (string)result;
if (databaseName == "SYSTEM")
databaseName = null;
// Zero length ? test
this.CurrentDatabaseCache = databaseName;
}
//
// Transactions
//
public void Begin()
{
if (this.Transaction != null)
throw new ApplicationException("DALOracle: 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("DALOracle: Commit Transaction not present.");
try
{
this.Transaction.Commit();
this.Transaction = null;
}
finally
{
this.Close();
}
}
public void Rollback()
{
if (this.Transaction == null)
throw new ApplicationException("DALOracle: Rollback Transaction not present.");
try
{
this.Transaction.Rollback();
this.Transaction = null;
}
finally
{
this.Close();
}
}
//
// Schama
//
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("DALOracle; 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();
foreach (string tableName in this.TableList())
{
this.SchemaColumns(schema, tableName, schemaReader, schemaNative, schemaStandard);
this.SchemaKeys(schema, tableName, schemaReader, schemaNative, schemaStandard);
}
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 nativeRow = schemaNative.Tables["ALL_TAB_COLUMNS"].Rows.Find(new object[] { tableName, columnName });
if (nativeRow == null)
throw new ApplicationException("DALOracle Schema; Can not find native Schema row for column: " + tableName + "." + columnName);
string typeName = (string)nativeRow["DATA_TYPE"];
int scale = 0;
if (readerRow.IsNull("NumericScale") == false)
{
scale = (Int16)readerRow["NumericScale"];
if (scale == 127)
scale = 0;
}
int precision = 0;
if (readerRow.IsNull("NumericPrecision") == false)
precision = (Int16)readerRow["NumericPrecision"];
if (typeName == "NUMBER" && scale == 0 && precision < 20) // It's mapped to an Int type
{
if (precision < 10)
{
if (precision >= 1 && precision <= 2)
typeName = "NUMBER(3, 0)";
if (precision >= 3 && precision <= 4)
typeName = "NUMBER(5, 0)";
if (precision >= 5 && precision <= 7)
typeName = "NUMBER(8, 0)";
if (precision >= 8 && precision <= 9)
typeName = "NUMBER(10, 0)";
}
else
{
typeName = "NUMBER(20, 0)";
}
}
DataRow schemaRow = schemaTable.NewRow();
schemaRow["ColumnName"] = columnName;
schemaRow["Ordinal"] = (int)readerRow["ColumnOrdinal"];
schemaRow["DataTypeId"] = Spludlow.Data.Schemas.NativeToCommon(typeName, "Oracle");
schemaRow["MaxLength"] = columnSize;
schemaRow["Precision"] = precision;
schemaRow["Scale"] = scale;
schemaRow["PrimaryKey"] = (bool)readerRow["IsKey"];
schemaRow["AllowDBNull"] = (bool)readerRow["AllowDBNull"];
schemaRow["AutoIncrement"] = false;
if (schemaTable.Columns.Contains("IsAutoIncrement") == true) // Oracle introduced in version 12c ? Don't think this works at all?
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)
{
DataTable keysTable = Spludlow.Data.Schemas.NewSchemaKeysTable(tableName);
foreach (DataRow indexRow in schemaStandard.Tables["Indexes"].Select("TABLE_NAME = '" + tableName + "'"))
{
string indexName = (string)indexRow["INDEX_NAME"];
DataRow row;
string keyType = "I";
row = schemaStandard.Tables["PrimaryKeys"].Rows.Find(indexName);
if (row != null)
{
keyType = "P";
}
else
{
row = schemaStandard.Tables["UniqueKeys"].Rows.Find(indexName);
if (row != null)
keyType = "U";
}
foreach (DataRow indexColumnRow in schemaStandard.Tables["IndexColumns"].Select("TABLE_NAME = '" + tableName + "' AND INDEX_NAME = '" + indexName + "'", "COLUMN_POSITION"))
{
string columnName = (string)indexColumnRow["COLUMN_NAME"];
int ordinal = (int)((decimal)indexColumnRow["COLUMN_POSITION"]);
bool descending = false;
if ((string)indexColumnRow["DESCEND"] != "ASC")
descending = true;
keysTable.Rows.Add(new object[] { indexName, keyType, ordinal, descending, columnName, null, null });
}
}
foreach (DataRow foreignKeyRow in schemaStandard.Tables["ForeignKeys"].Select("FOREIGN_KEY_TABLE_NAME = '" + tableName + "'"))
{
string indexName = (string)foreignKeyRow["FOREIGN_KEY_CONSTRAINT_NAME"];
string parentTable = (string)foreignKeyRow["PRIMARY_KEY_TABLE_NAME"];
string parentPrimaryKeyIndexName = (string)foreignKeyRow["PRIMARY_KEY_CONSTRAINT_NAME"];
foreach (DataRow foreignKeyColumnRow in schemaStandard.Tables["ForeignKeyColumns"].Select("TABLE_NAME = '" + tableName + "' AND CONSTRAINT_NAME = '" + indexName + "'"))
{
string columnName = (string)foreignKeyColumnRow["COLUMN_NAME"];
int ordinal = (int)((decimal)foreignKeyColumnRow["POSITION"]);
DataRow[] parentPrimaryKeyColumnRows = schemaStandard.Tables["IndexColumns"].Select("TABLE_NAME = '" + parentTable + "' AND INDEX_NAME = '" + parentPrimaryKeyIndexName + "' AND COLUMN_POSITION = " + ordinal);
if (parentPrimaryKeyColumnRows.Length != 1)
throw new ApplicationException("DALOracle; Schema Foriegn key can not find parent primary column, index Name: " + indexName + ", parent primary key name: " + parentPrimaryKeyIndexName);
string parentColumnName = (string)parentPrimaryKeyColumnRows[0]["COLUMN_NAME"];
keysTable.Rows.Add(new object[] { indexName, "F", ordinal, false, columnName, parentTable, parentColumnName });
}
}
schema.Tables.Add(keysTable);
}
public DataSet SchemaNative()
{
string databaseName = this.CurrentDatabase();
if (databaseName == null)
throw new ApplicationException("DALOracle; To get the Native schema you must have a current database");
string[] systemTables = new string[]
{
"ALL_ARGUMENTS",
"ALL_CATALOG",
"ALL_COL_COMMENTS",
"ALL_CONSTRAINTS",
"ALL_CONS_COLUMNS",
"ALL_DB_LINKS",
"ALL_ERRORS",
"ALL_INDEXES",
"#ALL_IND_COLUMNS",
"ALL_LOBS",
"ALL_OBJECTS",
"ALL_OBJECT_TABLES",
"#ALL_SEQUENCES",
"ALL_SNAPSHOTS",
"ALL_SOURCE",
"ALL_SYNONYMS",
"ALL_TABLES",
"ALL_TAB_COLUMNS",
"ALL_TAB_COL_STATISTICS",
"ALL_TAB_COMMENTS",
"ALL_TRIGGERS",
"#ALL_TRIGGER_COLS",
"ALL_TYPES",
"ALL_UPDATABLE_COLUMNS",
"#ALL_USERS",
"ALL_VIEWS",
};
DataSet dataSet = new DataSet();
foreach (string rawTableName in systemTables)
{
string commandText;
string tableName = rawTableName;
if (rawTableName.StartsWith("#") == true)
{
tableName = rawTableName.Substring(1);
commandText = "SELECT * FROM " + tableName;
}
else
{
commandText = "SELECT * FROM " + tableName + " WHERE (OWNER = '" + databaseName + "')";
}
this.Fill(dataSet, commandText);
Spludlow.Data.ADO.NameLastTable(dataSet, tableName);
}
DataTable table;
//table = dataSet.Tables["TABLES"];PrimaryKeys
//table.PrimaryKey = new DataColumn[] { table.Columns["TABLE_NAME"] };
table = dataSet.Tables["ALL_TAB_COLUMNS"];
table.PrimaryKey = new DataColumn[] { table.Columns["TABLE_NAME"], table.Columns["COLUMN_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, "\"", "\"");
}
finally
{
if (this.Transaction == null)
this.Close();
}
// ProviderType is OracleDbType, this dataset may be running where the oracle assembly is not present
DataSet resultSchema = new DataSet();
foreach (DataTable table in schema.Tables)
resultSchema.Tables.Add(Spludlow.Data.ADO.FixEnumColumns(table));
return resultSchema;
}
public DataSet SchemaConnection() // Rather slow large datasets until filter on OWNER
{
string databaseName = this.CurrentDatabase();
if (databaseName == null)
throw new ApplicationException("DALOracle; To get the Standard schema you must have a current database");
DataSet schema;
if (this.Transaction == null)
this.Open();
try
{
schema = Spludlow.Data.DALCommon.SchemaConnection(this.Connection, "OWNER", databaseName);
}
finally
{
if (this.Transaction == null)
this.Close();
}
//foreach (DataTable schemaTable in schema.Tables) // Are other column names also but this gives an acceptable dataset
//{
// if (schemaTable.Columns.Contains("OWNER") == false)
// continue;
// DataTable copyTable = schemaTable.Copy();
// schemaTable.Clear();
// foreach (DataRow row in copyTable.Rows)
// {
// if (row.IsNull("OWNER") == false && (string)row["OWNER"] == databaseName)
// schemaTable.ImportRow(row);
// }
//}
DataTable table;
table = schema.Tables["Columns"];
table.PrimaryKey = new DataColumn[] { table.Columns["TABLE_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("DALOracle; To Refresh the schema you must have a current database");
string key = this.CacheKeyPrefix + databaseName;
Spludlow.Caching.Remove(key);
}
//
// Databases
//
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();
}
//
// Tables
//
public string[] TableList()
{
string database = this.CurrentDatabase();
if (database == null)
throw new ApplicationException("DALOracle; To list tables you must have a current database");
DataTable table = this.Select("SELECT table_name FROM user_tables");
List tableNames = new List();
foreach (DataRow row in table.Rows)
tableNames.Add((string)row[0]);
return tableNames.ToArray();
}
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 void ForeignKeys(DataSet schema)
{
throw new NotImplementedException();
}
public void ForeignKeys(string tableName, DataSet schema)
{
throw new NotImplementedException();
}
public void ForeignKeys(string[] tableNames, DataSet schema)
{
throw new NotImplementedException();
}
public void TableAddKeys(DataSet schema, string keyTypesPUIF)
{
throw new NotImplementedException();
}
public void TableAddKeys(string tableName, DataSet schema, string keyTypesPUIF)
{
throw new NotImplementedException();
}
public void TableAddKeys(string[] tableNames, DataSet schema, string keyTypesPUIF)
{
throw new NotImplementedException();
}
//
// Command
//
private void SetDataType(DAL.CommandInfo info, DataRow columnRow, int index)
{
string dataTypeId = (string)columnRow["DataTypeId"];
string nativeType = Spludlow.Data.Schemas.CommonToNative(dataTypeId, "OracleDbType");
OracleDbType dbType = (OracleDbType)Enum.Parse(typeof(OracleDbType), 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);
}
public DbCommand MakeCommand(string commandText)
{
OracleCommand command = new OracleCommand(commandText, this.Connection);
command.Transaction = this.Transaction;
return command;
}
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);
OracleCommand command = new OracleCommand(commandInfo.CommandText, this.Connection);
command.Transaction = this.Transaction;
for (int index = 0; index < commandInfo.ParameterNames.Length; ++index)
{
string paramterName = commandInfo.ParameterNames[index];
OracleDbType dbType = (OracleDbType)commandInfo.ParameterTypes[index];
int maxLength = commandInfo.ParameterMaxLengths[index];
OracleParameter parameter = command.CreateParameter();
parameter.ParameterName = paramterName;
if ((int)dbType != -1)
parameter.OracleDbType = 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 (OracleCommand command = (OracleCommand)this.MakeCommand(commandText))
return this.ExecuteScalar(command);
}
public object ExecuteScalar(string commandText, object[] parameterValues)
{
using (OracleCommand command = (OracleCommand)this.MakeCommand(commandText, parameterValues))
return this.ExecuteScalar(command);
}
public object ExecuteScalar(string commandText, string[] parameterNames, object[] parameterValues)
{
using (OracleCommand command = (OracleCommand)this.MakeCommand(commandText, parameterNames, parameterValues))
return this.ExecuteScalar(command);
}
public object ExecuteScalar(DAL.CommandInfo commandInfo, object[] parameterValues)
{
using (OracleCommand command = (OracleCommand)this.MakeCommand(commandInfo, parameterValues))
return this.ExecuteScalar(command);
}
public object ExecuteScalar(DbCommand command)
{
return this.ExecuteScalar((OracleCommand)command);
}
private object ExecuteScalar(OracleCommand command)
{
if (this.Transaction != null)
return command.ExecuteScalar();
this.Open();
try
{
return command.ExecuteScalar();
}
finally
{
this.Close();
}
}
//
// ExecuteNonQuery
//
public int ExecuteNonQuery(string commandText)
{
using (OracleCommand command = (OracleCommand)this.MakeCommand(commandText))
return this.ExecuteNonQuery(command);
}
public int ExecuteNonQuery(string commandText, object[] parameterValues)
{
using (OracleCommand command = (OracleCommand)this.MakeCommand(commandText, parameterValues))
return this.ExecuteNonQuery(command);
}
public int ExecuteNonQuery(string commandText, string[] parameterNames, object[] parameterValues)
{
using (OracleCommand command = (OracleCommand)this.MakeCommand(commandText, parameterNames, parameterValues))
return this.ExecuteNonQuery(command);
}
public int ExecuteNonQuery(DAL.CommandInfo commandInfo, object[] parameterValues)
{
using (OracleCommand command = (OracleCommand)this.MakeCommand(commandInfo, parameterValues))
return this.ExecuteNonQuery(command);
}
public int ExecuteNonQuery(DbCommand command)
{
return this.ExecuteNonQuery((OracleCommand)command);
}
private int ExecuteNonQuery(OracleCommand command)
{
if (this.Transaction != null)
return command.ExecuteNonQuery();
this.Open();
try
{
return command.ExecuteNonQuery();
}
finally
{
this.Close();
}
}
//
// Fill
//
private void ExecuteAdapter(OracleCommand command, DataSet dataSet, DataTable table)
{
if (this.Transaction == null)
this.Open();
try
{
using (OracleDataAdapter adapter = new OracleDataAdapter(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 (OracleCommand command = (OracleCommand)this.MakeCommand(commandText))
this.Fill(dataSet, command);
}
public void Fill(DataSet dataSet, string commandText, object[] parameterValues)
{
using (OracleCommand command = (OracleCommand)this.MakeCommand(commandText, parameterValues))
this.Fill(dataSet, command);
}
public void Fill(DataSet dataSet, string commandText, string[] parameterNames, object[] parameterValues)
{
using (OracleCommand command = (OracleCommand)this.MakeCommand(commandText, parameterNames, parameterValues))
this.Fill(dataSet, command);
}
public void Fill(DataSet dataSet, DAL.CommandInfo commandInfo, object[] parameterValues)
{
using (OracleCommand command = (OracleCommand)this.MakeCommand(commandInfo, parameterValues))
this.Fill(dataSet, command);
}
public void Fill(DataSet dataSet, DbCommand command)
{
this.Fill(dataSet, (OracleCommand)command);
}
private void Fill(DataSet dataSet, OracleCommand command)
{
this.ExecuteAdapter(command, dataSet, null);
}
public void Fill(DataTable table, string commandText)
{
using (OracleCommand command = (OracleCommand)this.MakeCommand(commandText))
this.Fill(table, command);
}
public void Fill(DataTable table, string commandText, object[] parameterValues)
{
using (OracleCommand command = (OracleCommand)this.MakeCommand(commandText, parameterValues))
this.Fill(table, command);
}
public void Fill(DataTable table, string commandText, string[] parameterNames, object[] parameterValues)
{
using (OracleCommand command = (OracleCommand)this.MakeCommand(commandText, parameterNames, parameterValues))
this.Fill(table, command);
}
public void Fill(DataTable table, DAL.CommandInfo commandInfo, object[] parameterValues)
{
using (OracleCommand command = (OracleCommand)this.MakeCommand(commandInfo, parameterValues))
this.Fill(table, command);
}
public void Fill(DataTable table, DbCommand command)
{
this.Fill(table, (OracleCommand)command);
}
private void Fill(DataTable table, OracleCommand command)
{
this.ExecuteAdapter(command, null, table);
}
//
// Select
//
public DataTable Select(string commandText)
{
using (OracleCommand command = (OracleCommand)this.MakeCommand(commandText))
return this.Select(command);
}
public DataTable Select(string commandText, object[] parameterValues)
{
using (OracleCommand command = (OracleCommand)this.MakeCommand(commandText, parameterValues))
return this.Select(command);
}
public DataTable Select(string commandText, string[] parameterNames, object[] parameterValues)
{
using (OracleCommand command = (OracleCommand)this.MakeCommand(commandText, parameterNames, parameterValues))
return this.Select(command);
}
public DataTable Select(DAL.CommandInfo commandInfo, object[] parameterValues)
{
using (OracleCommand command = (OracleCommand)this.MakeCommand(commandInfo, parameterValues))
return this.Select(command);
}
public DataTable Select(DbCommand command)
{
return this.Select((OracleCommand)command);
}
private DataTable Select(OracleCommand command)
{
DataSet dataSet = this.SelectDS(command);
DataTable table = dataSet.Tables[0];
dataSet.Tables.Remove(table);
return table;
}
public DataSet SelectDS(string commandText)
{
using (OracleCommand command = (OracleCommand)this.MakeCommand(commandText))
return this.SelectDS(command);
}
public DataSet SelectDS(string commandText, object[] parameterValues)
{
using (OracleCommand command = (OracleCommand)this.MakeCommand(commandText, parameterValues))
return this.SelectDS(command);
}
public DataSet SelectDS(string commandText, string[] parameterNames, object[] parameterValues)
{
using (OracleCommand command = (OracleCommand)this.MakeCommand(commandText, parameterNames, parameterValues))
return this.SelectDS(command);
}
public DataSet SelectDS(DAL.CommandInfo commandInfo, object[] parameterValues)
{
using (OracleCommand command = (OracleCommand)this.MakeCommand(commandInfo, parameterValues))
return this.SelectDS(command);
}
public DataSet SelectDS(DbCommand command)
{
return this.SelectDS((OracleCommand)command);
}
private DataSet SelectDS(OracleCommand command)
{
DataSet dataSet = new DataSet();
this.ExecuteAdapter(command, dataSet, null);
return dataSet;
}
public void Backup(string serverFilename)
{
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 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();
}
}
}