2using System.Collections.Generic;
4using System.Data.Common;
6using System.Threading.Tasks;
18 private readonly Dictionary<string, OdbcStoredProcedure> procedures =
new Dictionary<string, OdbcStoredProcedure>();
20 private OdbcConnection connection;
29 this.connection = Connection;
37 this.connection?.Close();
38 this.connection?.Dispose();
39 this.connection =
null;
49 using (OdbcCommand Command = this.connection.CreateCommand())
51 Command.CommandType = CommandType.Text;
52 Command.CommandText = Statement;
53 DbDataReader Reader = await Command.ExecuteReaderAsync();
55 return await Reader.ParseAndClose();
65 public override Task<IElement>
GetSchema(
string Name)
67 DataTable Table = this.connection.GetSchema(Name);
68 return Task.FromResult<
IElement>(Table.ToMatrix());
76 public override async Task<ILambdaExpression>
GetProcedure(
string Name)
78 await this.synchObject.BeginWrite();
84 OdbcCommand Command = this.connection.CreateCommand();
85 Command.CommandType = CommandType.StoredProcedure;
86 Command.CommandText = this.connection.Database +
"." + Name;
88 OdbcCommandBuilder.DeriveParameters(Command);
91 this.procedures[Name] = Result;
97 await this.synchObject.EndWrite();
Represents an object that allows single concurrent writers but multiple concurrent readers....
Abstract base class for external databases
Manages an ODBC SQL connection
override async Task< IElement > ExecuteSqlStatement(string Statement)
Executes an SQL Statement on the database.
override Task< IElement > GetSchema(string Name)
Gets a Schema table, given its collection name. For a list of collections: https://mysqlconnector....
OdbcDatabase(OdbcConnection Connection)
Manages an ODBC SQL connection
override async Task< ILambdaExpression > GetProcedure(string Name)
Creates a lambda expression for accessing a stored procedure.
override void Dispose()
IDisposable.Dispose
Represents a stored precedure in an ODBC Database.
Basic interface for all types of elements.