C# Class Azavea.Open.DAO.SQL.SqlDaDdlLayer

Base class for SQL-based data access layers that support DDL commands.
Inheritance: SqlDaJoinableLayer, IDaDdlLayer
Afficher le fichier Open project: azavea/net-dao

Méthodes publiques

Méthode Description
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".

Méthodes protégées

Méthode Description
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.

Method Details

AddColDefinition() protected méthode

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.
Résultat bool

CreateIndex() public méthode

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).
Résultat void

CreateSequence() public méthode

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.
Résultat void

CreateStoreHouse() public méthode

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
Résultat void

CreateStoreRoom() public méthode

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.
Résultat void

DeleteIndex() public méthode

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.
Résultat void

DeleteSequence() public méthode

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.
Résultat void

DeleteStoreHouse() public méthode

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
Résultat void

DeleteStoreRoom() public méthode

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.
Résultat void

GenerateClassMappingFromStoreRoom() public méthode

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.
Résultat ClassMapping

GetAsciiStringType() protected méthode

Returns the SQL type used to store an ascii string in the DB.
protected GetAsciiStringType ( ) : string
Résultat string

GetAutoType() protected abstract méthode

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).
Résultat string

GetBooleanType() protected méthode

Returns the SQL type used to store a boolean in the DB.
protected GetBooleanType ( ) : string
Résultat string

GetByteArrayType() protected abstract méthode

Returns the SQL type used to store a byte array in the DB.
protected abstract GetByteArrayType ( ) : string
Résultat string

GetByteType() protected méthode

Returns the SQL type used to store a byte in the DB.
protected GetByteType ( ) : string
Résultat string

GetCharType() protected méthode

Returns the SQL type used to store a char in the DB.
protected GetCharType ( ) : string
Résultat string

GetDateTimeType() protected méthode

Returns the SQL type used to store a DateTime in the DB.
protected GetDateTimeType ( ) : string
Résultat string

GetDoubleType() protected méthode

Returns the SQL type used to store a double in the DB.
protected GetDoubleType ( ) : string
Résultat string

GetFloatType() protected méthode

Returns the SQL type used to store a float in the DB.
protected GetFloatType ( ) : string
Résultat string

GetGeneratorType() protected méthode

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.
Résultat GeneratorType

GetIntType() protected méthode

Returns the SQL type used to store an integer in the DB.
protected GetIntType ( ) : string
Résultat string

GetLongType() protected abstract méthode

Returns the SQL type used to store a long in the DB.
protected abstract GetLongType ( ) : string
Résultat string

GetShortType() protected méthode

Returns the SQL type used to store a short in the DB.
protected GetShortType ( ) : string
Résultat string

GetStringType() protected méthode

Returns the SQL type used to store a "normal" (unicode) string in the DB.
protected GetStringType ( ) : string
Résultat string

IndexExists() public méthode

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.
Résultat bool

SequenceExists() public méthode

Returns whether a sequence with this name exists or not.
public SequenceExists ( string name ) : bool
name string Name of the sequence to check for.
Résultat bool

SqlDaDdlLayer() protected méthode

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.
Résultat System

StoreHouseMissing() public méthode

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
Résultat bool

StoreRoomMissing() public méthode

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
Résultat bool