Skip to main content

dbgate-class

Represents base class which allows to get DB structure information availble for some connection

public abstract class Korzh.EasyQuery.Db.DbGate
: IDisposable

Assembly: Korzh.EasyQuery.Db.dll

Constructors

NameTypeDescription
DbGate()voidInitializes a new instance of the Korzh.EasyQuery.Db.DbGate class.

Properties

NameTypeDescription
ConnectedboolGets or sets a value indicating whether this DbGate is connected. When this property is assigned to true then the object tries to connect to database.
ConnectionDbConnectionGets the connection.
ConnectionIsInternalSettedbool
ConnectionStringstringGets or sets the connection string.
ConnectionStringBuilderDlgIConnectionStringBuilderDlgGets or sets the connection string builder dialog.
FinalConnectionStringstring
LoginPromptboolGets or sets a value indicating whether Korzh.EasyQuery.Db.DbGate object should ask user for login and password when connect to database.
PasswordstringGets or sets the "Password" parameter of database connection.
ProgressIndicatorIProgressIndicatorGets or sets the progress indicator object.
UserIDstringGets or sets the "User ID" parameter of database connection.
UseViewsboolGets or sets a value indicating whether Korzh.EasyQuery.Db.DbGate will add views in the list of tables returned by Korzh.EasyQuery.Db.DbGate.GetTables(System.String,System.String) method.
VersionstringGets the version of the current Korzh.EasyQuery.Db.DbGate implementation

Events

NameTypeDescription
LoginRequestLoginRequestEventHandlerOccurs when the Korzh.EasyQuery.Db.DbGate objects needs to get Korzh.EasyQuery.Db.DbGate.UserID and Korzh.EasyQuery.Db.DbGate.Password to connect to some database.

Methods

NameTypeDescription
AssembleConnectionString()stringBuilds the final connection string based on the string defined in Korzh.EasyQuery.Db.DbGate.ConnectionString property, current environment variables and the parameters defined in UserID and Password properties.
CheckConnection()voidChecks the connection. Calls CoreCheckConnection() method.
CoreCheckConnection()voidWhen overriden in derived class, performs the actual connection checking
CoreGetDatabases(DbInfoList databases)voidCore implementation of Korzh.EasyQuery.Db.DbGate.GetDatabases method.
CoreGetFields(string dbName, string schemaName, string tableName, DbFieldInfoList fields)voidCore implementation of Korzh.EasyQuery.Db.DbGate.GetFields(System.String,System.String,System.String) method.
CoreGetFieldsBySQL(string sql, DbFieldInfoList fields)voidCore implementation of Korzh.EasyQuery.Db.DbGate.GetFieldsBySQL(System.String) method.
CoreGetLinks(string dbName, string schemaName, DbLinkInfoList links)voidCore implementation of Korzh.EasyQuery.Db.DbGate.GetLinks(System.String,System.String) method.
CoreGetTables(string dbName, string schemaName, DbTableInfoList tables)voidCore implementation of Korzh.EasyQuery.Db.DbGate.GetTables(System.String,System.String) method.
CoreLoadParams(DbParameters dbParams)voidCore implementation of Korzh.EasyQuery.Db.DbGate.LoadParams(Korzh.EasyQuery.Db.DbParameters) method.
CoreSaveParams(DbParameters dbParams)voidCore implementation of Korzh.EasyQuery.Db.DbGate.SaveParams(Korzh.EasyQuery.Db.DbParameters) method.
Dispose(bool disposing)voidReleases unmanaged and - optionally - managed resources.
Dispose()voidReleases unmanaged and - optionally - managed resources.
GetConnected()boolCore implemenation of "get" method of Korzh.EasyQuery.Db.DbGate.Connected property.
GetConnection()DbConnectionWhen overriden in derived class, returns the connection
GetDataAdapter(string sqlText)DbDataAdapterGets the data adapter.
GetDatabases()DbInfoListGets the list of available databases.
GetFields(string dbName, string schemaName, string tableName)DbFieldInfoListGets the fields by table.
GetFieldsBySQL(string sql)DbFieldInfoListGets the fields of result set of some SQL statement execution.
GetFieldsEx(string dbName, string schemaName, string tableName, bool sortByOriginalPosition)DbFieldInfoListGets the fields by table.
GetFormatType()FormatTypeReturns the format type for this DB gate
GetGateId()stringGets the id of Korzh.EasyQuery.Db.DbGate. Must be overrided in inherited classes
GetLinks(string dbName, string schemaName)DbLinkInfoListGets the list of available tables.
GetName()stringGets the name of Korzh.EasyQuery.Db.DbGate. Must be overrided in inherited classes
GetPwdName()stringGets the name of "password" attribute in connection string.
GetSqlDialect()stringGets the name of default SQL dialect. Can be overrided in inherited classes
GetTableFieldsMap(string dbName, string schemaName)Dictionary<string, DbFieldInfoList>Returns all table fields map for the particular DB and schema. Called in Korzh.EasyQuery.Db.DbGate.CoreGetFields(System.String,System.String,System.String,Korzh.EasyQuery.Db.DbFieldInfoList)
GetTables(string dbName, string schemaName)DbTableInfoListGets the list of available tables.
GetUidName()stringGets the name of User ID attribute in connection string
GetVersion()stringCore implemenation of Korzh.EasyQuery.Db.DbGate.Version property. Must be overrided in descendants.
LoadParams(DbParameters dbParams)voidLoads the connection parameters.
LogDebug(string message, Object[] args)voidFormats and writes a debug log message.
LogError(string message, Object[] args)voidFormats and writes an error log message.
LogInfo(string message, Object[] args)voidFormats and writes an informational log message.
OnLoginRequest()voidRaises the LoginRequest event and filled UserID and Password by values returned in event arguments
SaveParams(DbParameters dbParams)voidSaves the connection parameters.
SetConnected(bool connected)voidCore implemenation of "set" method of Korzh.EasyQuery.Db.DbGate.Connected property.
SetConnection(DbConnection value)void
SetLogger(ILogger logger)voidSet a logger
SetProgress(int pos)voidSet the progress to the specified position.
SetProgressMinMax(int min, int max)voidSets the minimum and maximum of progress indicator.
ToString()stringReturns a System.String that represents the current System.Object.

Static Fields

NameTypeDescription
ConnectionTypeTypeGets the type of the connection.
DbGateTypesCollection<Type>The list of all registered DbGate types (descendants of DbGate)

Static Methods

NameTypeDescription
DbTypeByDataType(DataType dt)SqlDbTypeGets SqlDbType object which coressponds to DataType object specified in parameter
Register(Type gateType)voidRegisters the specified gate type.