C# Класс Azavea.Open.DAO.SQL.SqlDaDdlLayer

Base class for SQL-based data access layers that support DDL commands.
Наследование: SqlDaJoinableLayer, IDaDdlLayer
Показать файл Открыть проект

Открытые методы

Метод Описание
CreateIndex ( string name, ClassMapping mapping, ICollection propertyNames ) : void

Indexes the data for faster queries. Some data sources may not support indexes (such as CSV files), in which case this should throw a NotSupportedException. If the data source supports indexes, but support for creating them is not yet implemented, this should throw a NotImplementedException.

CreateSequence ( string name ) : void

Sequences are things that automatically generate unique, usually incrementing, numbers. Some data sources may not support sequences, in which case this should throw a NotSupportedException. If the data source supports sequences, but support for creating them is not yet implemented, this should throw a NotImplementedException.

CreateStoreHouse ( ) : void

Creates the store house specified in the connection descriptor. If this data source doesn't use a store house, this method should be a no-op. If this data source DOES use store houses, but support for adding them is not implemented yet, this should throw a NotImplementedException. Store house typically corresponds to "database".

CreateStoreRoom ( ClassMapping mapping ) : void

Creates the store room specified in the connection descriptor. If this data source doesn't use a store room, this method should be a no-op. If this data source DOES use store rooms, but support for adding them is not implemented yet, this should throw a NotImplementedException. Store room typically corresponds to "table".

DeleteIndex ( string name, ClassMapping mapping ) : void

Removes an index on the data for slower queries (but usually faster inserts/updates/deletes). Some data sources may not support indexes (such as CSV files), in which case this method should be a no-op. If the data source supports indexes, but support for deleting them is not yet implemented, this should throw a NotImplementedException. If there is no index with the given name, this should be a no-op.

DeleteSequence ( string name ) : void

Removes a sequence. Some data sources may not support sequences, in which case this method should be a no-op. If the data source supports sequences, but support for deleting them is not yet implemented, this should throw a NotImplementedException. If there is no sequence with the given name, this should be a no-op.

DeleteStoreHouse ( ) : void

Deletes the store house specified in the connection descriptor. If this data source doesn't use a store house, this method should be a no-op. If this data source DOES use store houses, but support for dropping them is not implemented yet, this should throw a NotImplementedException. Store house typically corresponds to "database". If there is no store house with the given name, this should be a no-op.

DeleteStoreRoom ( ClassMapping mapping ) : void

Deletes the store room specified in the connection descriptor. If this data source doesn't use a store room, this method should be a no-op. If this data source DOES use store rooms, but support for adding them is not implemented yet, this should throw a NotImplementedException. Store room typically corresponds to "table". If there is no store room with the given name, this should be a no-op.

GenerateClassMappingFromStoreRoom ( string storeRoomName, IComparer columnSorter ) : ClassMapping

Uses some form of introspection to determine what data is stored in this data store, and generates a ClassMapping that can be immediately used with a DictionaryDAO. As much data as practical will be populated on the ClassMapping, at a bare minimum the Table (typically set to the storeRoomName passed in, or the more correct or fully qualified version of that name), the TypeName (set to the storeRoomName, since we have no .NET type), and the "data cols" and "obj attrs" will be the list of attributes / columns in the data source, mapped to themselves.

IndexExists ( string name, ClassMapping mapping ) : bool

Returns whether an index with this name exists or not. NOTE: This does NOT verify what properties the index is on, merely whether an index with this name is already present.

SequenceExists ( string name ) : bool

Returns whether a sequence with this name exists or not.

StoreHouseMissing ( ) : bool

Returns true if you need to call "CreateStoreHouse" before storing any data. This method is "Missing" not "Exists" because implementations that do not use a store house (I.E. single-file-based data access layers) can return "false" from this method without breaking either a user's app or the spirit of the method. Store house typically corresponds to "database".

StoreRoomMissing ( ClassMapping mapping ) : bool

Returns true if you need to call "CreateStoreRoom" before storing any data. This method is "Missing" not "Exists" because implementations that do not use a store room can return "false" from this method without breaking either a user's app or the spirit of the method. Store room typically corresponds to "table".

Защищенные методы

Метод Описание
AddColDefinition ( StringBuilder sb, string col, ClassMapping mapping, string separator, ICollection extraStatements ) : bool

Add the definition for the given column to the create table statement.

GetAsciiStringType ( ) : string

Returns the SQL type used to store an ascii string in the DB.

GetAutoType ( Type baseType ) : string

Returns the DDL for the type of an automatically incrementing column. Some databases only store autonums in one col type so baseType may be ignored.

GetBooleanType ( ) : string

Returns the SQL type used to store a boolean in the DB.

GetByteArrayType ( ) : string

Returns the SQL type used to store a byte array in the DB.

GetByteType ( ) : string

Returns the SQL type used to store a byte in the DB.

GetCharType ( ) : string

Returns the SQL type used to store a char in the DB.

GetDateTimeType ( ) : string

Returns the SQL type used to store a DateTime in the DB.

GetDoubleType ( ) : string

Returns the SQL type used to store a double in the DB.

GetFloatType ( ) : string

Returns the SQL type used to store a float in the DB.

GetGeneratorType ( string col, ClassMapping mapping ) : GeneratorType

For a column, returns the type of generator used for it.

GetIntType ( ) : string

Returns the SQL type used to store an integer in the DB.

GetLongType ( ) : string

Returns the SQL type used to store a long in the DB.

GetShortType ( ) : string

Returns the SQL type used to store a short in the DB.

GetStringType ( ) : string

Returns the SQL type used to store a "normal" (unicode) string in the DB.

SqlDaDdlLayer ( AbstractSqlConnectionDescriptor connDesc, bool supportsNumRecords ) : System

Instantiates the data access layer with the connection descriptor for the DB.

Описание методов

AddColDefinition() защищенный Метод

Add the definition for the given column to the create table statement.
protected AddColDefinition ( StringBuilder sb, string col, ClassMapping mapping, string separator, ICollection extraStatements ) : bool
sb StringBuilder Current create table statement to append to.
col string Name of the column to add a definition for.
mapping ClassMapping Classmap for the class we're generating columns for.
separator string Separator to use before appending to sb.
extraStatements ICollection If adding this column requires any additional /// SQL statements to be run afterwards, put them here.
Результат bool

CreateIndex() публичный Метод

Indexes the data for faster queries. Some data sources may not support indexes (such as CSV files), in which case this should throw a NotSupportedException. If the data source supports indexes, but support for creating them is not yet implemented, this should throw a NotImplementedException.
public CreateIndex ( string name, ClassMapping mapping, ICollection propertyNames ) : void
name string Name of the index. Some data sources require names for indexes, /// and even if not this is required so the index can be deleted if desired.
mapping ClassMapping ClassMapping for the data that is being indexed.
propertyNames ICollection Names of the data properties to include in the index (in order).
Результат void

CreateSequence() публичный Метод

Sequences are things that automatically generate unique, usually incrementing, numbers. Some data sources may not support sequences, in which case this should throw a NotSupportedException. If the data source supports sequences, but support for creating them is not yet implemented, this should throw a NotImplementedException.
public CreateSequence ( string name ) : void
name string Name of the new sequence to create.
Результат void

CreateStoreHouse() публичный Метод

Creates the store house specified in the connection descriptor. If this data source doesn't use a store house, this method should be a no-op. If this data source DOES use store houses, but support for adding them is not implemented yet, this should throw a NotImplementedException. Store house typically corresponds to "database".
public CreateStoreHouse ( ) : void
Результат void

CreateStoreRoom() публичный Метод

Creates the store room specified in the connection descriptor. If this data source doesn't use a store room, this method should be a no-op. If this data source DOES use store rooms, but support for adding them is not implemented yet, this should throw a NotImplementedException. Store room typically corresponds to "table".
public CreateStoreRoom ( ClassMapping mapping ) : void
mapping ClassMapping ClassMapping for the data that will be stored in this room.
Результат void

DeleteIndex() публичный Метод

Removes an index on the data for slower queries (but usually faster inserts/updates/deletes). Some data sources may not support indexes (such as CSV files), in which case this method should be a no-op. If the data source supports indexes, but support for deleting them is not yet implemented, this should throw a NotImplementedException. If there is no index with the given name, this should be a no-op.
public DeleteIndex ( string name, ClassMapping mapping ) : void
name string Name of the index to delete.
mapping ClassMapping ClassMapping for the data that was being indexed.
Результат void

DeleteSequence() публичный Метод

Removes a sequence. Some data sources may not support sequences, in which case this method should be a no-op. If the data source supports sequences, but support for deleting them is not yet implemented, this should throw a NotImplementedException. If there is no sequence with the given name, this should be a no-op.
public DeleteSequence ( string name ) : void
name string Name of the sequence to delete.
Результат void

DeleteStoreHouse() публичный Метод

Deletes the store house specified in the connection descriptor. If this data source doesn't use a store house, this method should be a no-op. If this data source DOES use store houses, but support for dropping them is not implemented yet, this should throw a NotImplementedException. Store house typically corresponds to "database". If there is no store house with the given name, this should be a no-op.
public DeleteStoreHouse ( ) : void
Результат void

DeleteStoreRoom() публичный Метод

Deletes the store room specified in the connection descriptor. If this data source doesn't use a store room, this method should be a no-op. If this data source DOES use store rooms, but support for adding them is not implemented yet, this should throw a NotImplementedException. Store room typically corresponds to "table". If there is no store room with the given name, this should be a no-op.
public DeleteStoreRoom ( ClassMapping mapping ) : void
mapping ClassMapping ClassMapping for the data that was stored in this room.
Результат void

GenerateClassMappingFromStoreRoom() публичный Метод

Uses some form of introspection to determine what data is stored in this data store, and generates a ClassMapping that can be immediately used with a DictionaryDAO. As much data as practical will be populated on the ClassMapping, at a bare minimum the Table (typically set to the storeRoomName passed in, or the more correct or fully qualified version of that name), the TypeName (set to the storeRoomName, since we have no .NET type), and the "data cols" and "obj attrs" will be the list of attributes / columns in the data source, mapped to themselves.
public GenerateClassMappingFromStoreRoom ( string storeRoomName, IComparer columnSorter ) : ClassMapping
storeRoomName string The name of the storeroom (I.E. table). May be null /// if this data source does not use store rooms.
columnSorter IComparer If you wish the columns / attributes to be in a particular /// order, supply this optional parameter. May be null.
Результат ClassMapping

GetAsciiStringType() защищенный Метод

Returns the SQL type used to store an ascii string in the DB.
protected GetAsciiStringType ( ) : string
Результат string

GetAutoType() защищенный абстрактный Метод

Returns the DDL for the type of an automatically incrementing column. Some databases only store autonums in one col type so baseType may be ignored.
protected abstract GetAutoType ( Type baseType ) : string
baseType System.Type The data type of the column (nominally).
Результат string

GetBooleanType() защищенный Метод

Returns the SQL type used to store a boolean in the DB.
protected GetBooleanType ( ) : string
Результат string

GetByteArrayType() защищенный абстрактный Метод

Returns the SQL type used to store a byte array in the DB.
protected abstract GetByteArrayType ( ) : string
Результат string

GetByteType() защищенный Метод

Returns the SQL type used to store a byte in the DB.
protected GetByteType ( ) : string
Результат string

GetCharType() защищенный Метод

Returns the SQL type used to store a char in the DB.
protected GetCharType ( ) : string
Результат string

GetDateTimeType() защищенный Метод

Returns the SQL type used to store a DateTime in the DB.
protected GetDateTimeType ( ) : string
Результат string

GetDoubleType() защищенный Метод

Returns the SQL type used to store a double in the DB.
protected GetDoubleType ( ) : string
Результат string

GetFloatType() защищенный Метод

Returns the SQL type used to store a float in the DB.
protected GetFloatType ( ) : string
Результат string

GetGeneratorType() защищенный Метод

For a column, returns the type of generator used for it.
protected GetGeneratorType ( string col, ClassMapping mapping ) : GeneratorType
col string Column to look up.
mapping ClassMapping Mapping for the class we're creating a table for.
Результат GeneratorType

GetIntType() защищенный Метод

Returns the SQL type used to store an integer in the DB.
protected GetIntType ( ) : string
Результат string

GetLongType() защищенный абстрактный Метод

Returns the SQL type used to store a long in the DB.
protected abstract GetLongType ( ) : string
Результат string

GetShortType() защищенный Метод

Returns the SQL type used to store a short in the DB.
protected GetShortType ( ) : string
Результат string

GetStringType() защищенный Метод

Returns the SQL type used to store a "normal" (unicode) string in the DB.
protected GetStringType ( ) : string
Результат string

IndexExists() публичный Метод

Returns whether an index with this name exists or not. NOTE: This does NOT verify what properties the index is on, merely whether an index with this name is already present.
public IndexExists ( string name, ClassMapping mapping ) : bool
name string Name of the index to check for.
mapping ClassMapping ClassMapping for the data that may be indexed.
Результат bool

SequenceExists() публичный Метод

Returns whether a sequence with this name exists or not.
public SequenceExists ( string name ) : bool
name string Name of the sequence to check for.
Результат bool

SqlDaDdlLayer() защищенный Метод

Instantiates the data access layer with the connection descriptor for the DB.
protected SqlDaDdlLayer ( AbstractSqlConnectionDescriptor connDesc, bool supportsNumRecords ) : System
connDesc AbstractSqlConnectionDescriptor The connection descriptor that is being used by this FastDaoLayer.
supportsNumRecords bool If true, methods that return numbers of records affected will be /// returning accurate numbers. If false, they will probably return /// FastDAO.UNKNOWN_NUM_ROWS.
Результат System

StoreHouseMissing() публичный Метод

Returns true if you need to call "CreateStoreHouse" before storing any data. This method is "Missing" not "Exists" because implementations that do not use a store house (I.E. single-file-based data access layers) can return "false" from this method without breaking either a user's app or the spirit of the method. Store house typically corresponds to "database".
public StoreHouseMissing ( ) : bool
Результат bool

StoreRoomMissing() публичный Метод

Returns true if you need to call "CreateStoreRoom" before storing any data. This method is "Missing" not "Exists" because implementations that do not use a store room can return "false" from this method without breaking either a user's app or the spirit of the method. Store room typically corresponds to "table".
public StoreRoomMissing ( ClassMapping mapping ) : bool
mapping ClassMapping
Результат bool