C# Class Azavea.NijPredictivePolicing.Common.DB.DataClient

Generic helper class for managing database connections and objects
Afficher le fichier Open project: azavea/acs-alchemist

Méthodes publiques

Méthode Description
GenerateTableSQLFromFields ( string tablename, List columns ) : string

Convenience function to generate SQL to create a table matching the provided fields

GetDefaultClient ( string hostname ) : IDataClient

Get an instance of the default overridding database type

GetMagicAdapter ( DbConnection conn, IDataClient client, string sql ) : DbDataAdapter

Uses a select statement and the ADO.NET CommandBuilder to generate Insert,Update, and Delete statements, and load them onto an adapter

GetMagicTable ( DbConnection conn, IDataClient client, string sql ) : DataTable

'Magically' populates a DataTable object with the contents of your sql query

HasColumn ( string columnname, string tablename, DbConnection conn, IDataClient client ) : bool

Returns true if a particular table has a particular column

HasTable ( DbConnection conn, IDataClient client, string tablename ) : bool

Checks the schema of the database to see if the given table is present

RowCount ( DbConnection conn, IDataClient client, string tablename ) : int

Method Details

GenerateTableSQLFromFields() public static méthode

Convenience function to generate SQL to create a table matching the provided fields
public static GenerateTableSQLFromFields ( string tablename, List columns ) : string
tablename string the name for the new table
columns List a collection of FixedWidthField objects
Résultat string

GetDefaultClient() public static méthode

Get an instance of the default overridding database type
public static GetDefaultClient ( string hostname ) : IDataClient
hostname string
Résultat IDataClient

GetMagicAdapter() public static méthode

Uses a select statement and the ADO.NET CommandBuilder to generate Insert,Update, and Delete statements, and load them onto an adapter
public static GetMagicAdapter ( DbConnection conn, IDataClient client, string sql ) : DbDataAdapter
conn System.Data.Common.DbConnection
client IDataClient
sql string
Résultat System.Data.Common.DbDataAdapter

GetMagicTable() public static méthode

'Magically' populates a DataTable object with the contents of your sql query
public static GetMagicTable ( DbConnection conn, IDataClient client, string sql ) : DataTable
conn System.Data.Common.DbConnection
client IDataClient
sql string
Résultat System.Data.DataTable

HasColumn() public static méthode

Returns true if a particular table has a particular column
public static HasColumn ( string columnname, string tablename, DbConnection conn, IDataClient client ) : bool
columnname string
tablename string
conn System.Data.Common.DbConnection
client IDataClient
Résultat bool

HasTable() public static méthode

Checks the schema of the database to see if the given table is present
public static HasTable ( DbConnection conn, IDataClient client, string tablename ) : bool
conn System.Data.Common.DbConnection
client IDataClient
tablename string
Résultat bool

RowCount() public static méthode

public static RowCount ( DbConnection conn, IDataClient client, string tablename ) : int
conn System.Data.Common.DbConnection
client IDataClient
tablename string
Résultat int