Method | Description | |
---|---|---|
CreateIndex ( |
Creates an index on a database table.
|
|
CreateIndex ( |
Creates a non-unique index on a database table.
|
|
DropIndex ( |
Drops the specified index.
|
|
GenerateMappingFromSchema ( |
Generates a simplistic classmapping (without changing any column/field names) from a table's schema. Intended for times when you are transferring data without really using it, for example from a DB to a CSV. Will most likely only be useful for a DictionaryDAO since there is no defined .NET class to map to. All column names will be returned in caps.
|
|
GenerateMappingFromSchema ( |
Generates a simplistic classmapping (without changing any column/field names) from a table's schema. Intended for times when you are transferring data without really using it, for example from a DB to a CSV. Will most likely only be useful for a DictionaryDAO since there is no defined .NET class to map to. All column names will be returned in caps.
|
|
GetSchema ( |
Similar to DbConnection.GetSchema, except this keeps the connection handling logic here in the utility class.
|
|
GetSchema ( |
Similar to DbConnection.GetSchema, except this keeps the connection handling logic here in the utility class.
|
|
QueryForDataSet ( |
Queries for data and populates the specified dataset. If you already have a dataset, use the QueryIntoDataSet method.
|
|
QueryIntoDataSet ( |
Queries for data and populates the specified dataset. If you do not have a dataset already, call QueryForDataSet instead.
|
|
TestConnection ( |
Attempts to determine if a connection can be made using the specified connection string.
|
|
TruncateTable ( |
Truncates a table if supported by the DB, otherwise deletes all rows (which is effectively the same, but potentially a lot slower).
|
|
XSafeBoolQuery ( |
Similar to the "XSafeQuery" method, except this executes a query that returns a single boolean.
|
|
XSafeBoolQuery ( |
Similar to the "XSafeQuery" method, except this executes a query that returns a single boolean.
|
|
XSafeCommand ( |
Similar to the "XSafeQuery" method, except this executes a non-query type SQL statement.
|
|
XSafeCommand ( |
Similar to the "XSafeQuery" method, except this executes a non-query type SQL statement.
|
|
XSafeDateQuery ( |
Similar to the "XSafeQuery" method, except this executes a query that returns a single DateTime (such as SELECT MAX(DateField)).
|
|
XSafeDateQuery ( |
Similar to the "XSafeQuery" method, except this executes a query that returns a single DateTime (such as SELECT MAX(DateField)).
|
|
XSafeDoubleQuery ( |
Similar to the "XSafeQuery" method, except this executes a query that returns a single floating-point number (such as SELECT SUM(...)).
|
|
XSafeDoubleQuery ( |
Similar to the "XSafeQuery" method, except this executes a query that returns a single floating-point number (such as SELECT SUM(...)).
|
|
XSafeIntListQuery ( |
Similar to the other XSafe methods, except this one returns a list of integers (for example, SELECT AGE FROM EMPLOYEES).
|
|
XSafeIntListQuery ( |
Similar to the other XSafe methods, except this one returns a list of integers (for example, SELECT AGE FROM EMPLOYEES).
|
|
XSafeIntQuery ( |
Similar to the "XSafeQuery" method, except this executes a query that returns a single integer (such as SELECT COUNT).
|
|
XSafeIntQuery ( |
Similar to the "XSafeQuery" method, except this executes a query that returns a single integer (such as SELECT COUNT).
|
|
XSafeQuery ( |
This provides a way to query the DB and do something with the results without having to copy the "try, open, try, execute, finally, close, finally, close" type logic in a bunch of places. This method correctly closes the objects used in the DB access in the event of an exception.
|
|
XSafeQuery ( |
This provides a way to query the DB and do something with the results without having to copy the "try, open, try, execute, finally, close, finally, close" type logic in a bunch of places. This method correctly closes the objects used in the DB access in the event of an exception.
|
|
XSafeStringListQuery ( |
Similar to the other XSafe methods, except this one returns a list of strings (for example, SELECT NAME FROM EMPLOYEES).
|
|
XSafeStringListQuery ( |
Similar to the other XSafe methods, except this one returns a list of strings (for example, SELECT NAME FROM EMPLOYEES).
|
|
XSafeStringQuery ( |
Similar to the "XSafeQuery" method, except this executes a query that returns a single string.
|
|
XSafeStringQuery ( |
Similar to the "XSafeQuery" method, except this executes a query that returns a single string.
|
Method | Description | |
---|---|---|
ReadIntsFromQuery ( |
Just reads the results, Convert.ToInt32's 'em, and puts them into the parameters hashtable as a list called 'results'. Nulls are ignored!
|
|
ReadStringsFromQuery ( |
Just reads the results, ToString's 'em, and puts them into the parameters hashtable as a list called 'results'.
|
|
SetSQLOnCommand ( |
Helper to set up a command with sql and parameters and other misc stuff.
|
|
XSafeScalarQuery ( |
Similar to the "XSafeQuery" method, except this executes a query that returns a single result.
|
public static CreateIndex ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
indexName | string | Name of the index to create. |
isUnique | bool | Is this a unique index? |
tableName | string | What table to create the index on. |
columnNames | IEnumerable |
The columns included in the index. |
return | void |
public static CreateIndex ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
indexName | string | Name of the index to create. |
tableName | string | What table to create the index on. |
columnNames | IEnumerable |
The columns included in the index. |
return | void |
public static DropIndex ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
indexName | string | The name of the index to remove. |
return | bool |
public static GenerateMappingFromSchema ( |
||
connDesc | Connection descriptor for the database. | |
tableName | string | Name of the table to generate a mapping for. |
return | ClassMapping |
public static GenerateMappingFromSchema ( |
||
connDesc | Connection descriptor for the database. | |
tableName | string | Name of the table to generate a mapping for. |
columnSorter | IComparer |
Since auto-generated column mappings are likely used for /// purposes such as exporting to a CSV, if you wish the columns /// to be sorted in some sort of order, you may provide an /// IComparer to do so. May be null. |
return | ClassMapping |
public static GetSchema ( |
||
connDesc | Connection descriptor for the database. | |
return |
public static GetSchema ( |
||
connDesc | Connection descriptor for the database. | |
name | string | The name of the type of object you want schema info on. /// For example, "Columns" to get info on the columns. |
restrictions | string | A magic string array that means something to /// DbConnection.GetSchema. Should be a string array /// of the following restrictions: /// [0] = Catalog /// [1] = Owner /// [2] = Table /// [3] = TableType /// Any/all may be null. |
return |
public static QueryForDataSet ( |
||
connDesc | The database connection descriptor. This will be /// used to get the database connection. | |
dataTableName | string | The name of the DataTable to put data into in the DataSet. /// May be null if you wish to use the default given by the DataAdapter. |
sql | string | The parameterized SQL query (?'s for values). |
sqlParams | IEnumerable | A list of objects to use as parameters /// to the SQL statement. The list may be /// null if there are no parameters. |
return |
public static QueryIntoDataSet ( |
||
connDesc | The database connection descriptor. This will be /// used to get the database connection. | |
dataTableName | string | The name of the DataTable to put data into in the DataSet. /// May be null if you wish to use the default given by the DataAdapter. |
sql | string | The parameterized SQL query (?'s for values). |
sqlParams | IEnumerable | A list of objects to use as parameters /// to the SQL statement. The list may be /// null if there are no parameters. |
fillMe | The dataset to put data into. Must not be null. | |
return | void |
public static TestConnection ( |
||
connDesc | Connection descriptor to test. | |
return | bool |
public static TruncateTable ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
tableName | string | What table we want to blow away the contents of. |
return | void |
public static XSafeBoolQuery ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
transaction | SqlTransaction | The transaction to do this as part of. |
sql | string | The SQL query to execute. |
sqlParams | IEnumerable | A list of objects to use as parameters /// to the SQL statement. The list may be /// null if there are no parameters. |
return | bool |
public static XSafeBoolQuery ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
sql | string | The SQL query to execute. |
sqlParams | IEnumerable | A list of objects to use as parameters /// to the SQL statement. The list may be /// null if there are no parameters. |
return | bool |
public static XSafeCommand ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
transaction | SqlTransaction | The transaction to do this as part of. |
sql | string | The SQL statement to execute. |
sqlParams | IEnumerable | A list of objects to use as parameters /// to the SQL statement. The list may be /// null if there are no parameters. |
return | int |
public static XSafeCommand ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
sql | string | The SQL statement to execute. |
sqlParams | IEnumerable | A list of objects to use as parameters /// to the SQL statement. The list may be /// null if there are no parameters. |
return | int |
public static XSafeDateQuery ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
transaction | SqlTransaction | The transaction to do this as part of. |
sql | string | The SQL query to execute. |
sqlParams | IEnumerable | A list of objects to use as parameters /// to the SQL statement. The list may be /// null if there are no parameters. |
return | System.DateTime |
public static XSafeDateQuery ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
sql | string | The SQL query to execute. |
sqlParams | IEnumerable | A list of objects to use as parameters /// to the SQL statement. The list may be /// null if there are no parameters. |
return | System.DateTime |
public static XSafeDoubleQuery ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
transaction | SqlTransaction | The transaction to do this as part of. |
sql | string | The SQL query to execute. |
sqlParams | IEnumerable | A list of objects to use as parameters /// to the SQL statement. The list may be /// null if there are no parameters. |
return | double |
public static XSafeDoubleQuery ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
sql | string | The SQL query to execute. |
sqlParams | IEnumerable | A list of objects to use as parameters /// to the SQL statement. The list may be /// null if there are no parameters. |
return | double |
public static XSafeIntListQuery ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
transaction | SqlTransaction | The transaction to do this as part of. |
sql | string | The SQL query to execute. |
sqlParams | IEnumerable | A list of objects to use as parameters /// to the SQL statement. The list may be /// null if there are no parameters. |
return | IList |
public static XSafeIntListQuery ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
sql | string | The SQL query to execute. |
sqlParams | IEnumerable | A list of objects to use as parameters /// to the SQL statement. The list may be /// null if there are no parameters. |
return | IList |
public static XSafeIntQuery ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
transaction | SqlTransaction | The transaction to do this as part of. |
sql | string | The SQL query to execute. |
sqlParams | IEnumerable | A list of objects to use as parameters /// to the SQL statement. The list may be /// null if there are no parameters. |
return | int |
public static XSafeIntQuery ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
sql | string | The SQL query to execute. |
sqlParams | IEnumerable | A list of objects to use as parameters /// to the SQL statement. The list may be /// null if there are no parameters. |
return | int |
public static XSafeQuery ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
transaction | SqlTransaction | The transaction to do this as part of. |
sql | string | The SQL statement to execute. |
sqlParams | IEnumerable | A list of objects to use as parameters /// to the SQL statement. The list may be /// null if there are no parameters. |
invokeMe | DataReaderDelegate | The method to delegate to. If null, nothing is /// done with the data reader and it is just closed. |
parameters | The other parameters to the delegate, in whatever /// form makes sense for that delegate method. | |
return | void |
public static XSafeQuery ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
sql | string | The SQL statement to execute. |
sqlParams | IEnumerable | A list of objects to use as parameters /// to the SQL statement. The list may be /// null if there are no parameters. |
invokeMe | DataReaderDelegate | The method to delegate to. If null, nothing is /// done with the data reader and it is just closed. |
parameters | The other parameters to the delegate, in whatever /// form makes sense for that delegate method. | |
return | void |
public static XSafeStringListQuery ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
transaction | SqlTransaction | The transaction to do this as part of. |
sql | string | The SQL query to execute. |
sqlParams | IEnumerable | A list of objects to use as parameters /// to the SQL statement. The list may be /// null if there are no parameters. |
return | IList |
public static XSafeStringListQuery ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
sql | string | The SQL query to execute. |
sqlParams | IEnumerable | A list of objects to use as parameters /// to the SQL statement. The list may be /// null if there are no parameters. |
return | IList |
public static XSafeStringQuery ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
transaction | SqlTransaction | The transaction to do this as part of. |
sql | string | The SQL query to execute. |
sqlParams | IEnumerable | A list of objects to use as parameters /// to the SQL statement. The list may be /// null if there are no parameters. |
return | string |
public static XSafeStringQuery ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
sql | string | The SQL query to execute. |
sqlParams | IEnumerable | A list of objects to use as parameters /// to the SQL statement. The list may be /// null if there are no parameters. |
return | string |