Appearance
ISqlGenerator Interface
Definition
Interfaces describing support for generating SQL Statements
- Namespace:
JASE.Database - Assembly:
JASE.Database.dll
Properties
| Name | Description |
|---|---|
BulkParamNames | List or Bulk parameter names for the current connection type |
ConnectionCollation | Current connection collation name when connected to a database |
DefaultSchemaName | Default schema name for database type |
Delimiters | Provides methods for formatting database object names using database sepcific delimiters |
MaxIdentifierLength | Dialect maximum identifier length (63 UTF-8 bytes on PostgreSQL, 128 characters on SQL Server). |
Type | Type of Datatype this Generator is for |
Methods
| Name | Description |
|---|---|
ISqlStatement AcquireDatabaseLock(string resource, DatabaseLockMode mode, DatabaseLockOwner owner) | Generates a non-blocking attempt to acquire a database-backed application lock. The scalar result is 1 when acquired, 0 when contended, or a negative provider error code. |
string AlterTable(ITableInfo table, TableDifferences differences) | Generate an ALTER TABLE statement based on derived TableDifferences |
bool CheckIsMethod(string word) | Check is provided value is a known method name |
bool CheckKeyword(string keyword, string value) | Checks if keyword is defined to the value for this SQL Generator |
TableDifferences CompareTable(ITableInfo current, ITableInfo future, NamingStrategy namingStrategy, bool cloneConstraintsAndIndexes, bool dropOrphanIndexes = null) | Compares a Table and current/future ColumnInfo data and generates differences |
bool CompareValuesAsDefault(IColumnInfo thisColumn, IColumnInfo thatColumn) | Compare two values for database default equality |
SelectStatement Count(ISelectable selectable, IPredicateNode query = null, IEnumerable<IJoin> joins = null) | Generates SQL statement for obtaining a COUNT of records matching the query predicates |
string CreateConstraint(Constraint constraint) | Generate SQL for replicating an existing CONSTRAINT |
string CreateForeignKeys(ITableInfo table) | Generate SQL that adds all valid foreign-key constraints on table. Returns null when the table has no foreign keys to emit. |
string CreateForeignKeys(TableDifferences differences) | Generate SQL that applies foreign-key changes from a compare result (drops then adds). Returns null when there is no FK work. |
string CreateIndex(IndexInformation index, bool noLock) | Generate SQL for creating an INDEX from an IndexInformation definition. |
string CreateIndexes(ITableInfo table, bool noLock = null) | Generate SQL that creates all non-primary-key indexes on table. Returns null when there are no indexes to emit. |
string CreateIndexes(TableDifferences differences, bool noLock = null) | Generate SQL that applies index changes from a compare result (drops then adds). Returns null when there is no index work. |
string CreateTable(ITableInfo table) | Generates SQL for creating a new table |
string CreateView(string schema, string name, string selectSql) | Generates SQL for creating or replacing a view whose body is selectSql. |
DeleteStatement Delete(ITableInfo tableInfo) | Generates a DELETE statement scoped to the table primary key. |
DeleteStatement Delete(ITableInfo tableInfo, IPredicateNode query, bool allowUnfiltered = null) | Generates a DELETE statement for rows matching the supplied predicate. |
DeleteStatement DeleteList(ITableInfo tableInfo, int valueCount) | Generates a DELETE statement removing rows whose primary keys are in the parameter list. |
string DescribeSchemaTables(string schema, ref List<Parameter> parameters) | Generates SQL for describing all table objects within a schema |
string DescribeTable(ITableInfo tableInfo, out List<Parameter> parameters) | Generates SQL for describing a table object, generally used to obtain IColumnInfo data about a table |
string DescribeTable(string table, string schema, out List<Parameter> parameters) | Generates SQL for describing a table object, generally used to obtain IColumnInfo data about a table |
string DropConstraint(Constraint constraint) | Returns SQL for dropping a constraint from a table |
string DropIndex(IndexInformation index) | Generates SQL to drop the requested index |
string DropTable(TableInfo tableInfo) | Generate SQL for dropping a table by using TableInfo data |
string DropTable(string name) | Generate SQL for dropping a table by name |
string DropTables(IEnumerable<string> tables) | Returns SQL Statement formatted for deleting multiple tables at once |
string DropView(string schema, string name) | Generates SQL for dropping a view. |
void EnsureIdentifier(string name) | Throws if name would not fit in the dialect identifier limit. |
bool FitsIdentifier(string name) | Returns whether name would fit in the dialect identifier limit without truncation. |
ulong GetCacheKey() | FNV-1a Cache key based on generator type |
Collation GetCollation(string name) | Returns Collation details for Name |
string GetConstraints() | Returns SQL for retrieveing the CONSTRAINTS for a table object |
string GetDbColumnType(IColumnInfo info) | Resolves the database-specific column type for a given column. |
string GetIndexes() | Return SQL to get all defined index in the database |
string GetIndexes(string schema) | Return SQL to get all defined index in the database |
string GetIndexesByTable(ITableInfo table) | Return SQL to get indexes for a specific table |
void GetTableAndSchema(ISelectable selectable, out string table, out string schema, bool applyNamingStrategy) | Parse ISelectable to extract schema and table name |
void GetTableAndSchema(string input, out string table, out string schema) | Parse input string to extract schema and table name |
TypeMapDefinition GetTypeMap(Type type) | Returns the database TypeMapEntry for the input Clr Type |
TypeMapDefinition GetTypeMap(string datatype) | Returns the database TypeMapEntry based on the input database datatype |
bool HasKeyword(string keyword) | Checks if keyword is defined for this SQL Generator |
bool HasKeyword(string keyword, out string resolvedValue) | Checks if keyword is defined for this SQL Generator |
InsertStatement Insert(ITableInfo tableInfo) | Generates statement for INSERTing a row into the database table |
InsertStatement Insert(ITableInfo tableInfo, IEnumerable<IParameter> parameters) | Generates statement for INSERTing a row into the database table |
bool IsCharacterDatatype(string datatype) | Returns true if the datatype is known to be a character type for the underlying database |
bool IsDateDatatype(string datatype) | Returns true if the datatype is known to be a date/time type for the underlying database |
bool IsNumericDatatype(string datatype) | Returns true if the datatype is known to be a numeric type for the underlying database |
bool IsValidAutoIncrement(Type type) | Returns true if the Type is supported as an AutoIncrementing datatype in the underlying database |
string PhysicalIdentifier(string name) | Returns the identifier the server would store, truncating to the dialect limit if needed. Use only to match leftover truncated catalog names; never to emit DDL. |
string Reindex(IndexInformation index, bool noLock) | Generates SQL to drop the requested index |
string Reindex(string tableName, bool noLock) | Generate SQL for performing a REINDEX on all indexes for a table |
string Reindex(string tableName, string indexName, bool noLock) | Generate SQL for performing a REINDEX on an existing table index |
ISqlStatement ReleaseDatabaseLock(string resource, DatabaseLockMode mode, DatabaseLockOwner owner) | Generates a command that releases one acquisition of a database-backed application lock. |
string RenameConstraint(string constraint, string newName) | Generates SQL for performing a RENAME on a table object |
string RenameIndex(string tableName, string newName) | Generate SQL for renaming an existing Primary Key |
string RenameTable(string tableName, string newName) | Generate SQL for Renaming an existing table in the database |
string Reorganize(string tableName, string indexName) | Generate SQL for performing a REORGANIZE on an existing table index, VACCUM for PostgreSQL |
SelectColumns ResolveColumnList(IEnumerable<IColumn> columns, string tableAlias, IEnumerable<IJoin> joins) | Resolves a list of columns to what they will be called in the SELECT statement |
string ResolveKeyword(string keyword) | Resolves keyword to value understood by the underlying database |
Type ResolvePropertyType(string datatype) | Resolves a database datatype to a runtime Property Type |
SelectStatement Select(ISelectable selectable, IEnumerable<string> columns, IPredicateNode query = null, IEnumerable<OrderBy> orderBy = null, int limit = null, int offset = null, bool distinct = null, IEnumerable<IJoin> joins = null, string rootAlias = null) | Generates SELECT statement for retrieving rows matching the Query |
string Select(ISelectable selectable, IEnumerable<string> columns, out List<IParameter> parameters, IPredicateNode query = null, IEnumerable<OrderBy> orderBy = null, int limit = null, int offset = null, bool distinct = null, IEnumerable<IJoin> joins = null, string rootAlias = null) | Generates SELECT statement for retrieving rows matching the Query |
string SetColumnComment(ITableInfo table, IColumnInfo column) | Generates SQL to set or replace the comment on a column. |
string SetIndexComment(IndexInformation index) | Generates SQL to set or replace the comment on an index. |
string SetTableComment(ITableInfo table) | Generates SQL to set or replace the comment on a table. |
string Truncate(ITableInfo tableinfo) | Generate SQL for truncating the data within an existing table |
UpdateStatement Update(ITableInfo tableInfo) | Generates statement to UPDATE a row into the database table setting ALL mutable columns and querying by the Primary Key |
UpdateStatement Update(ITableInfo tableInfo, IEnumerable<IParameter> parameters, int index = null) | Generate SQL statement to UPDATE a row of data based on primary key |
UpdateStatement Update(ITableInfo tableInfo, IEnumerable<UpdateAssignment> assignments, IPredicateNode query = null, bool allowUnfiltered = null) | Generate SQL statement that UPDATE rows matching the Query to the requested assignments |
UpsertStatement Upsert(ITableInfo tableInfo, IEnumerable<IParameter> parameters, int index = null, UpsertConflictAction conflictAction = null) | Generate SQL command to UPDATE or INSERT based on primary key |
UpsertStatement Upsert(ITableInfo tableInfo, UpsertConflictAction conflictAction = null) | Generates statement to UPSERT a row into the database table setting INSERT all columns On conflict UPDATE all mutable columns and querying by the Primary Key |