Class GPALDatabase
Class to define database usage. Currently only used for input from a table, sql or stored procedure.
Instantiated with GPAL.Database
Inheritance
System.Object
GPALDatabase
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Assembly: GPAL.dll
Syntax
public class GPALDatabase : IGPALDatabase, IAllowColumnLength, IAllowPrecsionScaleAndSettings, IAllowDatabaseSettings, IAllowColumnPrecision, IAllowColumnScale, IAllowParametersAndActions, IAllowDatabaseActions, IAllowParametersAndUsing, IAllowDatabaseUsing, IAllowParametersAndInto, IAllowParameters, IAllowDatabaseInto, IAllowDatabaseExecute, IAllowToGPALObject<IGPALDatabase>
Properties
BeginTransaction
Declaration
public IAllowParametersAndActions BeginTransaction { get; }
Property Value
ClearParameters
If you have already defined parameter objectss on a GPAL.Database, you can clear them and add new parameter objects;
Declaration
public IAllowParameters ClearParameters { get; }
Property Value
Commit
Declaration
public IAllowDatabaseActions Commit { get; }
Property Value
Create
Declaration
public IAllowParametersAndUsing Create { get; }
Property Value
Delete
Declaration
public IAllowParametersAndUsing Delete { get; }
Property Value
Read
Declaration
public IAllowParametersAndInto Read { get; }
Property Value
Rollback
Declaration
public IAllowDatabaseActions Rollback { get; }
Property Value
Tokens
The rows/columns returned from the database.
Tokens are loaded upon calling any [Append/FillIn/Insert]FromDatabase method.
Intended for debugging only.
Declaration
public IGPALGrid<string> Tokens { get; }
Property Value
| Type |
Description |
| IGPALGrid<System.String> |
A GPALGrid of tokens
|
Update
Declaration
public IAllowParametersAndUsing Update { get; }
Property Value
Methods
Execute(out Int32)
Declaration
public IAllowParametersAndActions Execute(out int rowCount)
Parameters
| Type |
Name |
Description |
| System.Int32 |
rowCount |
|
Returns
IntoDataTable(out DataTable)
Declaration
public IAllowDatabaseExecute IntoDataTable(out DataTable dataTable)
Parameters
| Type |
Name |
Description |
| System.Data.DataTable |
dataTable |
|
Returns
IntoGrid(out IGPALGrid<String>)
Declaration
public IAllowDatabaseExecute IntoGrid(out IGPALGrid<string> dataGrid)
Parameters
| Type |
Name |
Description |
| IGPALGrid<System.String> |
dataGrid |
|
Returns
ToGPALObject()
Declaration
public IGPALDatabase ToGPALObject()
Returns
Using(IGPALGrid<String>)
Declaration
public IAllowDatabaseExecute Using(IGPALGrid<string> parametersGrid)
Parameters
| Type |
Name |
Description |
| IGPALGrid<System.String> |
parametersGrid |
|
Returns
Using(DataTable)
Declaration
public IAllowDatabaseExecute Using(DataTable dataTable)
Parameters
| Type |
Name |
Description |
| System.Data.DataTable |
dataTable |
|
Returns
WithCharColumn(String)
Declaration
public IAllowColumnLength WithCharColumn(string columnName)
Parameters
| Type |
Name |
Description |
| System.String |
columnName |
The column name
|
Returns
WithColumnLength(Int32)
Declaration
public IAllowDatabaseSettings WithColumnLength(int length)
Parameters
| Type |
Name |
Description |
| System.Int32 |
length |
|
Returns
WithColumnPrecision(Int32)
Declaration
public IAllowPrecsionScaleAndSettings WithColumnPrecision(int columnPrecision)
Parameters
| Type |
Name |
Description |
| System.Int32 |
columnPrecision |
|
Returns
WithColumnScale(Int32)
Declaration
public IAllowPrecsionScaleAndSettings WithColumnScale(int columnScale)
Parameters
| Type |
Name |
Description |
| System.Int32 |
columnScale |
|
Returns
WithConnectionString(String)
Set the connectrion string used to connect to the database.
If no connection string is provided, GPAL will construct one from the server and database name, and if supplied, username and password.
Declaration
public IAllowDatabaseSettings WithConnectionString(string connectionString)
Parameters
| Type |
Name |
Description |
| System.String |
connectionString |
The connection string
|
Returns
Examples
Database database = (Database)GPAL.Database
.WithServerName(@"HORNET\SqlServer")
.WithDatabaseName("GPAL")
.WithTableName("TestInput")
.WithRowCount(4);
WithCreateAs(String)
Declaration
public IAllowDatabaseSettings WithCreateAs(string sqlCommand)
Parameters
| Type |
Name |
Description |
| System.String |
sqlCommand |
|
Returns
WithDatabaseName(String)
Set the database instance name.
Used with database servername and [optional] usename/password to construct a connection string.
Declaration
public IAllowDatabaseSettings WithDatabaseName(string databaseName)
Parameters
| Type |
Name |
Description |
| System.String |
databaseName |
|
Returns
Examples
// Open database GPAL on server HORNET\SqlServer using integrated security, query 4 rows from the top of table TestInput
Database database = (Database)GPAL.Database
.WithServerName(@"HORNET\SqlServer")
.WithDatabaseName("GPAL")
.WithTableName("TestInput")
.WithRowCount(4);
WithDatabaseType(Enums.DatabaseType)
Set the type of database GPAL is interacting with.
Currently only SQL Server is supported. (Do not need to specify)
Declaration
public IAllowDatabaseSettings WithDatabaseType(Enums.DatabaseType databaseType)
Parameters
| Type |
Name |
Description |
| Enums.DatabaseType |
databaseType |
The database type, MySql, PostGres, SqlServer [default]
|
Returns
Examples
// Open database GPAL on server HORNET\SqlServer using integrated security, query 4 rows from the top of table TestInput
Database database = (Database)GPAL.Database
.WithServerName(@"HORNET\SqlServer")
.WithDatabaseName("GPAL")
.WithDatabaseType(DatabaseType.MySql)
.WithTableName("TestInput")
.WithRowCount(4);
WithDatetimeColumn(String)
Declaration
public IAllowDatabaseSettings WithDatetimeColumn(string columnName)
Parameters
| Type |
Name |
Description |
| System.String |
columnName |
The column name
|
Returns
WithDecimalColumn(String)
Declaration
public IAllowPrecsionScaleAndSettings WithDecimalColumn(string columnName)
Parameters
| Type |
Name |
Description |
| System.String |
columnName |
The column name
|
Returns
WithDeleteAs(String)
Declaration
public IAllowDatabaseSettings WithDeleteAs(string sqlCommand)
Parameters
| Type |
Name |
Description |
| System.String |
sqlCommand |
|
Returns
WithErrorCallback(GPALDatabase.CallOnError)
Declaration
public IAllowDatabaseSettings WithErrorCallback(GPALDatabase.CallOnError callOnError)
Parameters
Returns
WithFloatColumn(String)
Define a Float column [Double/Real]
Declaration
public IAllowDatabaseSettings WithFloatColumn(string columnName)
Parameters
| Type |
Name |
Description |
| System.String |
columnName |
The column name
|
Returns
WithImageColumn(String)
Declaration
public IAllowDatabaseSettings WithImageColumn(string columnName)
Parameters
| Type |
Name |
Description |
| System.String |
columnName |
The column name
|
Returns
WithIntegerColumn(String)
Declaration
public IAllowDatabaseSettings WithIntegerColumn(string columnName)
Parameters
| Type |
Name |
Description |
| System.String |
columnName |
The column name
|
Returns
WithMoneyColumn(String)
Declaration
public IAllowDatabaseSettings WithMoneyColumn(string columnName)
Parameters
| Type |
Name |
Description |
| System.String |
columnName |
The column name
|
Returns
WithNCharColumn(String)
Declaration
public IAllowColumnLength WithNCharColumn(string columnName)
Parameters
| Type |
Name |
Description |
| System.String |
columnName |
The column name
|
Returns
WithNTextColumn(String)
Declaration
public IAllowColumnLength WithNTextColumn(string columnName)
Parameters
| Type |
Name |
Description |
| System.String |
columnName |
The column name
|
Returns
WithNVarCharColumn(String)
Define an NVarChar column
Declaration
public IAllowColumnLength WithNVarCharColumn(string columnName)
Parameters
| Type |
Name |
Description |
| System.String |
columnName |
The column name
|
Returns
WithParameter(String)
Add a parameter to the parameters list.
Declaration
public IAllowParametersAndActions WithParameter(string parameter)
Parameters
| Type |
Name |
Description |
| System.String |
parameter |
The stored procedure parameter
|
Returns
WithParameterGrid(IGPALGrid<String>)
Add a parameter to the parameters list.
Declaration
public IAllowParametersAndActions WithParameterGrid(IGPALGrid<string> parametersGrid)
Parameters
| Type |
Name |
Description |
| IGPALGrid<System.String> |
parametersGrid |
|
Returns
WithParameterName(String)
Add a parameter name to the parameter names list.
CAVEAT: we need to know the type of parameter, this gets as tedious as the columns
Declaration
public IAllowDatabaseSettings WithParameterName(string parameterName)
Parameters
| Type |
Name |
Description |
| System.String |
parameterName |
The stored procedure parameter
|
Returns
WithPassword(String)
Set the password used to connect to the database.
If no connection string is provided, GPAL will construct one from the server and database name, and if supplied, username and password.
Declaration
public IAllowDatabaseSettings WithPassword(string password)
Parameters
| Type |
Name |
Description |
| System.String |
password |
|
Returns
WithReadAs(String)
Declaration
public IAllowDatabaseSettings WithReadAs(string sqlCommand)
Parameters
| Type |
Name |
Description |
| System.String |
sqlCommand |
|
Returns
WithRowCount(Int32)
Set the numbers of rows to select from the table.
Declaration
public IAllowDatabaseSettings WithRowCount(int rowCount)
Parameters
| Type |
Name |
Description |
| System.Int32 |
rowCount |
|
Returns
Examples
// Open database GPAL on server HORNET\SqlServer using integrated security, query 4 rows from the top of table TestInput
Database database = (Database)GPAL.Database
.WithServerName(@"HORNET\SqlServer")
.WithDatabaseName("GPAL")
.WithTableName("TestInput")
.WithRowCount(4);
WithServerName(String)
Set the database servername.
Used with databasename and [optional] usename/password to construct a connection string.
Declaration
public IAllowDatabaseSettings WithServerName(string serverName)
Parameters
| Type |
Name |
Description |
| System.String |
serverName |
The server name
|
Returns
Examples
// Open database GPAL on server HORNET\SqlServer using integrated security, query 4 rows from the top of table TestInput
Database database = (Database)GPAL.Database
.WithServerName(@"HORNET\SqlServer")
.WithDatabaseName("GPAL")
.WithTableName("TestInput")
.WithRowCount(4);
WithSQLCommand(String)
The SQL command to execute for the input data grid (tokens)
Declaration
public IAllowDatabaseSettings WithSQLCommand(string sqlCommand)
Parameters
| Type |
Name |
Description |
| System.String |
sqlCommand |
The SQL command to run
|
Returns
WithStoredProcedure(String)
The stored procedure to execute for the input data grid (tokens)
Declaration
public IAllowDatabaseSettings WithStoredProcedure(string storedProcedure)
Parameters
| Type |
Name |
Description |
| System.String |
storedProcedure |
|
Returns
WithTableColumn(String)
Declaration
public IAllowDatabaseSettings WithTableColumn(string columnName)
Parameters
| Type |
Name |
Description |
| System.String |
columnName |
|
Returns
WithTableName(String)
Set the table name to query for input.
If no SQL command or stored procedure is defined, then GPAL will query the table supplied to get input data.
Use .WithRowCount to set the number of rows to select.
Declaration
public IAllowDatabaseSettings WithTableName(string tableName)
Parameters
| Type |
Name |
Description |
| System.String |
tableName |
The table name
|
Returns
Examples
// Open database GPAL on server HORNET\SqlServer using integrated security, query 4 rows from the top of table TestInput
Database database = (Database)GPAL.Database
.WithServerName(@"HORNET\SqlServer")
.WithDatabaseName("GPAL")
.WithTableName("TestInput")
.WithRowCount(4);
WithTextColumn(String)
Declaration
public IAllowColumnLength WithTextColumn(string columnName)
Parameters
| Type |
Name |
Description |
| System.String |
columnName |
The column name
|
Returns
WithTimeColumn(String)
Declaration
public IAllowDatabaseSettings WithTimeColumn(string columnName)
Parameters
| Type |
Name |
Description |
| System.String |
columnName |
The column name
|
Returns
WithTimestampColumn(String)
Define a Timestamp column
Declaration
public IAllowDatabaseSettings WithTimestampColumn(string columnName)
Parameters
| Type |
Name |
Description |
| System.String |
columnName |
The column name
|
Returns
WithUDTTName(String)
Declaration
public IAllowDatabaseSettings WithUDTTName(string typeName)
Parameters
| Type |
Name |
Description |
| System.String |
typeName |
|
Returns
WithUpdateAs(String)
Declaration
public IAllowDatabaseSettings WithUpdateAs(string sqlCommand)
Parameters
| Type |
Name |
Description |
| System.String |
sqlCommand |
|
Returns
WithUsername(String)
Set the username used to connect to the database.
If no connection string is provided, GPAL will construct one from the server and database name, and if supplied, username and password.
Declaration
public IAllowDatabaseSettings WithUsername(string username)
Parameters
| Type |
Name |
Description |
| System.String |
username |
|
Returns
WithVarCharColumn(String)
Declaration
public IAllowColumnLength WithVarCharColumn(string columnName)
Parameters
| Type |
Name |
Description |
| System.String |
columnName |
The column name
|
Returns
Implements