C# Class Azavea.Open.DAO.OleDb.OleDbDescriptor

This class represents the info necessary to connect to an OleDb data source.
Inheritance: Azavea.Open.DAO.SQL.AbstractSqlConnectionDescriptor, ITransactionalConnectionDescriptor
ファイルを表示 Open project: azavea/net-dao-oledb Class Usage Examples

Public Properties

Property Type Description
ConnectTimeout int?
Database string
Password string
Provider string
Server string
Type DatabaseType
User string

Protected Properties

Property Type Description
_cleanConnStr string
_connectionStr string

Public Methods

Method Description
BeginTransaction ( ) : ITransaction

Begins the transaction. Returns a NEW ConnectionDescriptor that you should use for operations you wish to be part of the transaction. NOTE: You MUST call Commit or Rollback on the returned ITransaction when you are done.

CanUseAliasInOrderClause ( ) : bool
CaseInsensitiveLikeOperator ( ) : string
ColumnAliasPrefix ( ) : string
ColumnAliasSuffix ( ) : string
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
CreateNewConnection ( ) : DbConnection
FullOuterJoinKeyword ( ) : string
GuessTypeFromProvider ( string provider ) : DatabaseType

Attempts to parse the provider string and determine what database type we're connecting to.

HasCaseInsensitiveLikeOperator ( ) : bool
LowerCaseFunction ( ) : string
MakeBitwiseAndClause ( string columnName ) : SqlClauseWithValue
MakeConnectionString ( DatabaseType providerType, string server, string database, string user, string password, int connectionTimeout ) : string

Assembles a OLEDB connection string that can be used to get a database connection. All the parameters are optional for the purposes of this method, although obviously it would be possible to create a useless connection string if you leave out important parameters.

MakeConnectionString ( string provider, string server, string database, string user, string password, int connectionTimeout ) : string

Assembles a OLEDB connection string that can be used to get a database connection. All the parameters are optional for the purposes of this method, although obviously it would be possible to create a useless connection string if you leave out important parameters.

MakeCreateIndexCommand ( string indexName, bool isUnique, string tableName, IEnumerable columnNames ) : string
MakeModulusClause ( string fieldName ) : SqlClauseWithValue
MakeSequenceValueQuery ( string sequenceName ) : string
NeedAsForColumnAliases ( ) : bool
NeedToAliasColumns ( ) : bool
OleDbDescriptor ( Config config, string component, ConnectionInfoDecryptionDelegate decryptionDelegate ) : System

This constructor reads all the appropriate values from a config file.

OleDbDescriptor ( DatabaseType type, string server, string database, string user, string password, int timeout ) : System

Constructor that lets you pass everything as parameters rather than requiring a config.

OleDbDescriptor ( DatabaseType type, string provider, string server, string database, string user, string password, int timeout ) : System

Constructor that lets you pass everything as parameters rather than requiring a config.

OleDbDescriptor ( string provider, string server, string database, string user, string password, int timeout ) : System

Constructor that lets you pass everything as parameters rather than requiring a config.

SetParametersOnCommand ( IDbCommand cmd, IEnumerable parameters ) : void
SupportsTruncate ( ) : bool
TableAliasPrefix ( ) : string
TableAliasSuffix ( ) : string
ToCleanString ( ) : string
ToCompleteString ( ) : string
UsePooling ( ) : bool

Private Methods

Method Description
GetTypeFromConfig ( Config config, string component ) : DatabaseType

Gets the type based on a couple optional parameters in the DB config file.

Method Details

BeginTransaction() public method

Begins the transaction. Returns a NEW ConnectionDescriptor that you should use for operations you wish to be part of the transaction. NOTE: You MUST call Commit or Rollback on the returned ITransaction when you are done.
public BeginTransaction ( ) : ITransaction
return ITransaction

CanUseAliasInOrderClause() public method

public CanUseAliasInOrderClause ( ) : bool
return bool

CaseInsensitiveLikeOperator() public method

public CaseInsensitiveLikeOperator ( ) : string
return string

ColumnAliasPrefix() public method

public ColumnAliasPrefix ( ) : string
return string

ColumnAliasSuffix() public method

public ColumnAliasSuffix ( ) : string
return string

CreateDataAccessLayer() public method

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
return IDaLayer

CreateNewAdapter() public method

public CreateNewAdapter ( IDbCommand cmd ) : DbDataAdapter
cmd IDbCommand
return System.Data.Common.DbDataAdapter

CreateNewConnection() public method

public CreateNewConnection ( ) : DbConnection
return System.Data.Common.DbConnection

FullOuterJoinKeyword() public method

public FullOuterJoinKeyword ( ) : string
return string

GuessTypeFromProvider() public static method

Attempts to parse the provider string and determine what database type we're connecting to.
public static GuessTypeFromProvider ( string provider ) : DatabaseType
provider string OleDB "provider" piece of the connection string.
return DatabaseType

HasCaseInsensitiveLikeOperator() public method

public HasCaseInsensitiveLikeOperator ( ) : bool
return bool

LowerCaseFunction() public method

public LowerCaseFunction ( ) : string
return string

MakeBitwiseAndClause() public method

public MakeBitwiseAndClause ( string columnName ) : SqlClauseWithValue
columnName string
return Azavea.Open.DAO.SQL.SqlClauseWithValue

MakeConnectionString() public static method

Assembles a OLEDB connection string that can be used to get a database connection. All the parameters are optional for the purposes of this method, although obviously it would be possible to create a useless connection string if you leave out important parameters.
public static MakeConnectionString ( DatabaseType providerType, string server, string database, string user, string password, int connectionTimeout ) : string
providerType DatabaseType Database type, will be used to determine provider string.
server string Server name that is hosting the database
database string Database name, if necessary to specify
user string User name to use when accessing the db
password string Password for above user.
connectionTimeout int How long to wait before giving up on a command, in seconds.
return string

MakeConnectionString() public static method

Assembles a OLEDB connection string that can be used to get a database connection. All the parameters are optional for the purposes of this method, although obviously it would be possible to create a useless connection string if you leave out important parameters.
public static MakeConnectionString ( string provider, string server, string database, string user, string password, int connectionTimeout ) : string
provider string Database driver/type/something, for example "SQLOLEDB"
server string Server name that is hosting the database
database string Database name, if necessary to specify
user string User name to use when accessing the db
password string Password for above user.
connectionTimeout int How long to wait before giving up on a command, in seconds.
return string

MakeCreateIndexCommand() public method

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

MakeModulusClause() public method

public MakeModulusClause ( string fieldName ) : SqlClauseWithValue
fieldName string
return Azavea.Open.DAO.SQL.SqlClauseWithValue

MakeSequenceValueQuery() public method

public MakeSequenceValueQuery ( string sequenceName ) : string
sequenceName string
return string

NeedAsForColumnAliases() public method

public NeedAsForColumnAliases ( ) : bool
return bool

NeedToAliasColumns() public method

public NeedToAliasColumns ( ) : bool
return bool

OleDbDescriptor() public method

This constructor reads all the appropriate values from a config file.
public OleDbDescriptor ( Config config, string component, ConnectionInfoDecryptionDelegate decryptionDelegate ) : System
config Azavea.Open.Common.Config Config to get params from.
component string Section of the config XML to look in for db params.
decryptionDelegate ConnectionInfoDecryptionDelegate Delegate to call to decrypt password fields. /// May be null if passwords are in plain text.
return System

OleDbDescriptor() public method

Constructor that lets you pass everything as parameters rather than requiring a config.
public OleDbDescriptor ( DatabaseType type, string server, string database, string user, string password, int timeout ) : System
type DatabaseType Type of database to connect to. May not be null. This parameter /// will be used to determine what OleDb provider to use.
server string Server (or in the case of access, .mdb file) May be null, but you /// probably won't be able to connect to anything.
database string database name on that server, if applicable. May be null.
user string Database user name, may be null.
password string Password for the user. May be null.
timeout int Connection timeout, in seconds. May be null.
return System

OleDbDescriptor() public method

Constructor that lets you pass everything as parameters rather than requiring a config.
public OleDbDescriptor ( DatabaseType type, string provider, string server, string database, string user, string password, int timeout ) : System
type DatabaseType Type of database to connect to. May not be null. This parameter /// will be used to determine what OleDb provider to use.
provider string Database provider string. May be null. If null, we will use a /// provider value based on the type, if not null, we will use this /// provider.
server string Server (or in the case of access, .mdb file) May be null, but you /// probably won't be able to connect to anything.
database string database name on that server, if applicable. May be null.
user string Database user name, may be null.
password string Password for the user. May be null.
timeout int Connection timeout, in seconds. May be null.
return System

OleDbDescriptor() public method

Constructor that lets you pass everything as parameters rather than requiring a config.
public OleDbDescriptor ( string provider, string server, string database, string user, string password, int timeout ) : System
provider string Database provider string. May not be null.
server string Server (or in the case of access, .mdb file) May be null, but you /// probably won't be able to connect to anything.
database string database name on that server, if applicable. May be null.
user string Database user name, may be null.
password string Password for the user. May be null.
timeout int Connection timeout, in seconds. May be null.
return System

SetParametersOnCommand() public method

public SetParametersOnCommand ( IDbCommand cmd, IEnumerable parameters ) : void
cmd IDbCommand
parameters IEnumerable
return void

SupportsTruncate() public method

public SupportsTruncate ( ) : bool
return bool

TableAliasPrefix() public method

public TableAliasPrefix ( ) : string
return string

TableAliasSuffix() public method

public TableAliasSuffix ( ) : string
return string

ToCleanString() public method

public ToCleanString ( ) : string
return string

ToCompleteString() public method

public ToCompleteString ( ) : string
return string

UsePooling() public method

public UsePooling ( ) : bool
return bool

Property Details

ConnectTimeout public_oe property

The connection timeout, in seconds. May be null, meaning use the default.
public int? ConnectTimeout
return int?

Database public_oe property

The database name, meaningful for some databases (Access (filename), SQL Server) but not others (Oracle). May be null depending on the database.
public string Database
return string

Password public_oe property

The password for the User. May be null.
public string Password
return string

Provider public_oe property

The "Provider", meaning the value for the provider field in the OleDB connection string.
public string Provider
return string

Server public_oe property

The server name, meaningful for some databases (Oracle, SQL Server) but not others (Access). May be null depending on the database.
public string Server
return string

Type public_oe property

The type of database (Oracle, SQL Server, etc).
public DatabaseType Type
return DatabaseType

User public_oe property

The user name, if necessary to log into the database. May be null.
public string User
return string

_cleanConnStr protected_oe property

protected string _cleanConnStr
return string

_connectionStr protected_oe property

protected string _connectionStr
return string