C# 클래스 Azavea.Open.DAO.SQL.AbstractSqlConnectionDescriptor

This class represents the information needed to establish a connection to a data source that speaks SQL (presumably a database). This class, and any that extend it, should be thread safe.
상속: ConnectionDescriptor
파일 보기 프로젝트 열기: azavea/net-dao 1 사용 예제들

공개 메소드들

메소드 설명
CanUseAliasInOrderClause ( ) : bool

Once we've aliased a function (such as COUNT(*)), can we use that alias in the order by clause or do we need to put the function again?

CaseInsensitiveLikeOperator ( ) : string

The specific operator for doing case insensitive expressions

ColumnAliasPrefix ( ) : string

Some databases want the " AS " keyword, some want the alias in quotes (cough SQLite cough), or square brackets (cough Microsoft cough), or whatever. This provides the database-specific stuff that comes before the alias.

ColumnAliasSuffix ( ) : string

Some databases want the " AS " keyword, some want the alias in quotes (cough SQLite cough), or square brackets (cough Microsoft cough), or whatever. This provides the database-specific stuff that comes after the alias.

CreateDataAccessLayer ( ) : IDaLayer

Returns the appropriate data access layer for this connection. The default implementation returns a normal SQL data access layer, but this may be overridden in particular DB connection descriptors.

CreateNewAdapter ( IDbCommand cmd ) : DbDataAdapter

This method returns a DbDataAdapter that can be used to fill DataSets.

CreateNewConnection ( ) : DbConnection

This method returns a database connection to the database specified by this connection descriptor. This is not meant to be called by client code, only by the utilities in the Azavea.Database assembly.

FullOuterJoinKeyword ( ) : string

Not all databases have the same syntax for full outer joins. Most use "FULL OUTER JOIN" but some do not.

HasCaseInsensitiveLikeOperator ( ) : bool

Not all databases have a case insensitive LIKE operator, such as ILIKE in postgres. Some databases (SQL Server/Access) use LIKE as case insensitive by default.

LowerCaseFunction ( ) : string

UPPER and LOWER are not actually consistent across databases.

MakeBitwiseAndClause ( string columnName ) : SqlClauseWithValue

Returns a 'bitwise and' sql string, something like "columnName & value", except that the syntax is DB-specific. Throws NotImplementedException if not yet supported for a particular type of connection.

MakeCreateIndexCommand ( string indexName, bool isUnique, string tableName, IEnumerable columnNames ) : string

Returns the SQL statement to create an index on a table. There may be database-specific additional keywords required (such as "COMPUTE STATISTICS"). The default implementation returns a simple standard-sql create index statement.

MakeLastAutoGeneratedIdQuery ( string tableName, string idCol ) : string

Gets the last id generated in an ID column for a table. Some databases can do this more efficiently or correctly than the default way ("select max idcol from table").

MakeModulusClause ( string columnName ) : SqlClauseWithValue

Returns a modulus sql string, something like "columnName % value", except that the syntax is DB-specific. Throws NotImplementedException if not yet supported for a particular type of connection.

MakeSequenceValueQuery ( string sequenceName ) : string

Since different databases have different ideas of what a sequence is, this allows the utility class to support sequences across all different DBs.

NeedAsForColumnAliases ( ) : bool

Does the database require the "AS" keyword for aliasing a column? Most do not, but some (MS Access) do.

NeedToAliasColumns ( ) : bool

Does this database require that we alias the columns explicitly if we are aliasing the table name? Most DBs will alias the columns for you (I.E. if you "SELECT ID FROM TABLE1 AS ALIAS1" then the column will be called "ALIAS1.ID", etc). However some require that you alias the columns specifically (cough SQLite, Access cough).

SetParametersOnCommand ( IDbCommand cmd, IEnumerable parameters ) : void

Each driver seems to have its own way of marking parameters ("?", ":param", "@PARAM", etc). So, the database utilities class always uses "?" and relies on the specific descriptor to replace the ? with the appropriate names in the SQL, and also to set the parameters on the command object.

SupportsTruncate ( ) : bool

Nearly every DB in the universe supports truncate, but a few (cough Access cough) do not.

TableAliasPrefix ( ) : string

Some databases want the " AS " keyword, some don't (cough Oracle cough). This provides the database-specific stuff that comes before the alias.

TableAliasSuffix ( ) : string

Some databases want the " AS " keyword, some don't (cough Oracle cough). This provides the database-specific stuff that comes after the alias.

UsePooling ( ) : bool

Depending on the database and connection info, it may not always be appropriate to pool connections. This allows the connection descriptor to decide.

메소드 상세

CanUseAliasInOrderClause() 공개 메소드

Once we've aliased a function (such as COUNT(*)), can we use that alias in the order by clause or do we need to put the function again?
public CanUseAliasInOrderClause ( ) : bool
리턴 bool

CaseInsensitiveLikeOperator() 공개 메소드

The specific operator for doing case insensitive expressions
public CaseInsensitiveLikeOperator ( ) : string
리턴 string

ColumnAliasPrefix() 공개 추상적인 메소드

Some databases want the " AS " keyword, some want the alias in quotes (cough SQLite cough), or square brackets (cough Microsoft cough), or whatever. This provides the database-specific stuff that comes before the alias.
public abstract ColumnAliasPrefix ( ) : string
리턴 string

ColumnAliasSuffix() 공개 추상적인 메소드

Some databases want the " AS " keyword, some want the alias in quotes (cough SQLite cough), or square brackets (cough Microsoft cough), or whatever. This provides the database-specific stuff that comes after the alias.
public abstract ColumnAliasSuffix ( ) : string
리턴 string

CreateDataAccessLayer() 공개 메소드

Returns the appropriate data access layer for this connection. The default implementation returns a normal SQL data access layer, but this may be overridden in particular DB connection descriptors.
public CreateDataAccessLayer ( ) : IDaLayer
리턴 IDaLayer

CreateNewAdapter() 공개 추상적인 메소드

This method returns a DbDataAdapter that can be used to fill DataSets.
public abstract CreateNewAdapter ( IDbCommand cmd ) : DbDataAdapter
cmd IDbCommand The command that the adapter will be executing.
리턴 System.Data.Common.DbDataAdapter

CreateNewConnection() 공개 추상적인 메소드

This method returns a database connection to the database specified by this connection descriptor. This is not meant to be called by client code, only by the utilities in the Azavea.Database assembly.
public abstract CreateNewConnection ( ) : DbConnection
리턴 System.Data.Common.DbConnection

FullOuterJoinKeyword() 공개 메소드

Not all databases have the same syntax for full outer joins. Most use "FULL OUTER JOIN" but some do not.
public FullOuterJoinKeyword ( ) : string
리턴 string

HasCaseInsensitiveLikeOperator() 공개 메소드

Not all databases have a case insensitive LIKE operator, such as ILIKE in postgres. Some databases (SQL Server/Access) use LIKE as case insensitive by default.
public HasCaseInsensitiveLikeOperator ( ) : bool
리턴 bool

LowerCaseFunction() 공개 메소드

UPPER and LOWER are not actually consistent across databases.
public LowerCaseFunction ( ) : string
리턴 string

MakeBitwiseAndClause() 공개 메소드

Returns a 'bitwise and' sql string, something like "columnName & value", except that the syntax is DB-specific. Throws NotImplementedException if not yet supported for a particular type of connection.
public MakeBitwiseAndClause ( string columnName ) : SqlClauseWithValue
columnName string The column used in the clause.
리턴 SqlClauseWithValue

MakeCreateIndexCommand() 공개 메소드

Returns the SQL statement to create an index on a table. There may be database-specific additional keywords required (such as "COMPUTE STATISTICS"). The default implementation returns a simple standard-sql create index statement.
public MakeCreateIndexCommand ( string indexName, bool isUnique, string tableName, IEnumerable columnNames ) : string
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.
리턴 string

MakeLastAutoGeneratedIdQuery() 공개 메소드

Gets the last id generated in an ID column for a table. Some databases can do this more efficiently or correctly than the default way ("select max idcol from table").
public MakeLastAutoGeneratedIdQuery ( string tableName, string idCol ) : string
tableName string The table the ID column belongs to.
idCol string The ID column for which to get the last generated ID value.
리턴 string

MakeModulusClause() 공개 메소드

Returns a modulus sql string, something like "columnName % value", except that the syntax is DB-specific. Throws NotImplementedException if not yet supported for a particular type of connection.
public MakeModulusClause ( string columnName ) : SqlClauseWithValue
columnName string The column used in the clause.
리턴 SqlClauseWithValue

MakeSequenceValueQuery() 공개 메소드

Since different databases have different ideas of what a sequence is, this allows the utility class to support sequences across all different DBs.
public MakeSequenceValueQuery ( string sequenceName ) : string
sequenceName string The name of the sequence we're getting an ID from.
리턴 string

NeedAsForColumnAliases() 공개 추상적인 메소드

Does the database require the "AS" keyword for aliasing a column? Most do not, but some (MS Access) do.
public abstract NeedAsForColumnAliases ( ) : bool
리턴 bool

NeedToAliasColumns() 공개 추상적인 메소드

Does this database require that we alias the columns explicitly if we are aliasing the table name? Most DBs will alias the columns for you (I.E. if you "SELECT ID FROM TABLE1 AS ALIAS1" then the column will be called "ALIAS1.ID", etc). However some require that you alias the columns specifically (cough SQLite, Access cough).
public abstract NeedToAliasColumns ( ) : bool
리턴 bool

SetParametersOnCommand() 공개 추상적인 메소드

Each driver seems to have its own way of marking parameters ("?", ":param", "@PARAM", etc). So, the database utilities class always uses "?" and relies on the specific descriptor to replace the ? with the appropriate names in the SQL, and also to set the parameters on the command object.
public abstract SetParametersOnCommand ( IDbCommand cmd, IEnumerable parameters ) : void
cmd IDbCommand Database command (with .Text already populated with sql) that needs /// the parameters set on it.
parameters IEnumerable The parameter values, in the order that the ?'s appear in the /// command's text. This collection should not be null.
리턴 void

SupportsTruncate() 공개 메소드

Nearly every DB in the universe supports truncate, but a few (cough Access cough) do not.
public SupportsTruncate ( ) : bool
리턴 bool

TableAliasPrefix() 공개 추상적인 메소드

Some databases want the " AS " keyword, some don't (cough Oracle cough). This provides the database-specific stuff that comes before the alias.
public abstract TableAliasPrefix ( ) : string
리턴 string

TableAliasSuffix() 공개 추상적인 메소드

Some databases want the " AS " keyword, some don't (cough Oracle cough). This provides the database-specific stuff that comes after the alias.
public abstract TableAliasSuffix ( ) : string
리턴 string

UsePooling() 공개 추상적인 메소드

Depending on the database and connection info, it may not always be appropriate to pool connections. This allows the connection descriptor to decide.
public abstract UsePooling ( ) : bool
리턴 bool