C# Class Rsdn.Janus.DBSchemaDriverBase

Inheritance: IDBSchemaDriver
Mostra file Open project: rsdn/janus

Public Methods

Method Description
BeginTableLoad ( IDbConnection connection, TableSchema table ) : void
CompareDbsc ( DBSchema mbDbsc, string targetConnStr ) : void

Сравнение схемы с эталонной и выдача во внутреннюю хеш таблицу DDL комманд, выполнение общих для всех движков действий.

ConvertToDbParameter ( Rsdn.Janus.TableColumnSchema column, IDbDataParameter parameter ) : IDbDataParameter
CreateConnection ( string connStr ) : IDbConnection
CreateDatabase ( string constr ) : void
EndTableLoad ( IDbConnection connection, TableSchema table ) : void
LoadExistingSchema ( string connStr ) : DBSchema

Создать схему метаданных из исходной базы

MakeInsert ( TableSchema table ) : string
MakeSelect ( TableSchema table, bool orderedByPK ) : string
Prepare ( string connStr ) : void
PrepareToSqlFile ( string path ) : void

Protected Methods

Method Description
AddDdlCommand ( int priority, [ name, [ type, [ statement ) : void

Добавить DDL команду.

AfterSchemaComparision ( DBSchema existingSchema, DBSchema targetSchema ) : void

Препроцесинг схем, детали для разных движков

CheckIndexTypeForRecreate ( IndexSchema eIndex ) : bool

Проверка необходимости пересоздания связанных Foreign Key при удалении индекса

CheckKeyTypeForRecreate ( KeySchema eKey ) : bool

Проверка необходимости пересоздания связанных Foreign Key при удаление констрента

DBSchemaDriverBase ( ) : System
DbscCopyPrepare ( DBSchema schema ) : DBSchema

Так как схема - референс тип, создание его глубокой копии. Которая при приведение к искомому движку бедет правиться. И приведение её к исходному движку

DeleteDdlCommandsByFilter ( [ filter ) : void

Удалить DDL команды по заданному фильтру.

ExecuteDdlCommands ( IEnumerable commands, string connStr ) : void

Выполнить набор DDL команд.

MakeDdlColumnAlter ( Rsdn.Janus.TableColumnSchema mColumn, Rsdn.Janus.TableColumnSchema eColumn, TableSchema table ) : string
MakeDdlColumnDrop ( Rsdn.Janus.TableColumnSchema column, TableSchema table ) : string
MakeDdlDefaultCreate ( KeySchema key, TableSchema table ) : string
MakeDdlDefaultDrop ( KeySchema key, TableSchema table ) : string
MakeDdlElementName ( string name ) : string
MakeDdlIndexCreate ( IndexSchema index, TableSchema table ) : string
MakeDdlIndexDrop ( IndexSchema index, TableSchema table ) : string
MakeDdlKeyCreateByAlter ( KeySchema key, TableSchema table ) : string
MakeDdlKeyDrop ( KeySchema key, TableSchema table ) : string
MakeDdlTableCopy ( TableSchema toTable, TableSchema fromTable ) : string
MakeDdlTableCreate ( TableSchema table, bool withConstraint ) : string
MakeDdlTableDrop ( TableSchema table ) : string
MakeDdlTableRename ( TableSchema table, string newName ) : string
MakeParameterName ( Rsdn.Janus.TableColumnSchema column ) : string
ParseColumn ( Rsdn.Janus.TableColumnSchema column ) : string
ParseColumnAlter ( Rsdn.Janus.TableColumnSchema mColumn, Rsdn.Janus.TableColumnSchema eColumn ) : string
ParseColumnListIndex ( string iclist ) : IEnumerable
ParseKey ( KeySchema key ) : string
WriteDdlCommands ( TextWriter wr, IEnumerable commands ) : void

Записать набор DDL команд с помощью писателя.

Private Methods

Method Description
GetFilteredDdlStatements ( [ filter, [ sort ) : IEnumerable

Получить набор DDL операторов по заданному фильтру.

HelperTableCreate ( TableSchema mTable, int i ) : void
HelperTableDrop ( TableSchema eTable, IEnumerable eTables, int i ) : void
MakeDdlColumnCreate ( Rsdn.Janus.TableColumnSchema column, TableSchema table ) : string
ParseColumnListIndexClear ( string iclist, IndexClearType ctype ) : IEnumerable

ParseColumnListIndexClear ( string cList ) : string
Reparse ( ) : List

Метод ресортирует операторы DDL из кучи в соответствии с логикой и очередностью их выполнения. Очень важный момент!

Method Details

AddDdlCommand() protected method

Добавить DDL команду.
protected AddDdlCommand ( int priority, [ name, [ type, [ statement ) : void
priority int
name [
type [
statement [
return void

AfterSchemaComparision() protected method

Препроцесинг схем, детали для разных движков
protected AfterSchemaComparision ( DBSchema existingSchema, DBSchema targetSchema ) : void
existingSchema DBSchema Существующая схема
targetSchema DBSchema Эталоная схема
return void

BeginTableLoad() public method

public BeginTableLoad ( IDbConnection connection, TableSchema table ) : void
connection IDbConnection
table TableSchema
return void

CheckIndexTypeForRecreate() protected abstract method

Проверка необходимости пересоздания связанных Foreign Key при удалении индекса
protected abstract CheckIndexTypeForRecreate ( IndexSchema eIndex ) : bool
eIndex IndexSchema
return bool

CheckKeyTypeForRecreate() protected abstract method

Проверка необходимости пересоздания связанных Foreign Key при удаление констрента
protected abstract CheckKeyTypeForRecreate ( KeySchema eKey ) : bool
eKey KeySchema
return bool

CompareDbsc() public method

Сравнение схемы с эталонной и выдача во внутреннюю хеш таблицу DDL комманд, выполнение общих для всех движков действий.
public CompareDbsc ( DBSchema mbDbsc, string targetConnStr ) : void
mbDbsc DBSchema
targetConnStr string
return void

ConvertToDbParameter() public method

public ConvertToDbParameter ( Rsdn.Janus.TableColumnSchema column, IDbDataParameter parameter ) : IDbDataParameter
column Rsdn.Janus.TableColumnSchema
parameter IDbDataParameter
return IDbDataParameter

CreateConnection() public abstract method

public abstract CreateConnection ( string connStr ) : IDbConnection
connStr string
return IDbConnection

CreateDatabase() public abstract method

public abstract CreateDatabase ( string constr ) : void
constr string
return void

DBSchemaDriverBase() protected method

protected DBSchemaDriverBase ( ) : System
return System

DbscCopyPrepare() protected abstract method

Так как схема - референс тип, создание его глубокой копии. Которая при приведение к искомому движку бедет правиться. И приведение её к исходному движку
protected abstract DbscCopyPrepare ( DBSchema schema ) : DBSchema
schema DBSchema Эталоная схема
return DBSchema

DeleteDdlCommandsByFilter() protected method

Удалить DDL команды по заданному фильтру.
protected DeleteDdlCommandsByFilter ( [ filter ) : void
filter [ фильтр
return void

EndTableLoad() public method

public EndTableLoad ( IDbConnection connection, TableSchema table ) : void
connection IDbConnection
table TableSchema
return void

ExecuteDdlCommands() protected abstract method

Выполнить набор DDL команд.
protected abstract ExecuteDdlCommands ( IEnumerable commands, string connStr ) : void
commands IEnumerable набор DDL команд
connStr string
return void

LoadExistingSchema() public abstract method

Создать схему метаданных из исходной базы
public abstract LoadExistingSchema ( string connStr ) : DBSchema
connStr string
return DBSchema

MakeDdlColumnAlter() protected method

protected MakeDdlColumnAlter ( Rsdn.Janus.TableColumnSchema mColumn, Rsdn.Janus.TableColumnSchema eColumn, TableSchema table ) : string
mColumn Rsdn.Janus.TableColumnSchema
eColumn Rsdn.Janus.TableColumnSchema
table TableSchema
return string

MakeDdlColumnDrop() protected method

protected MakeDdlColumnDrop ( Rsdn.Janus.TableColumnSchema column, TableSchema table ) : string
column Rsdn.Janus.TableColumnSchema
table TableSchema
return string

MakeDdlDefaultCreate() protected method

protected MakeDdlDefaultCreate ( KeySchema key, TableSchema table ) : string
key KeySchema
table TableSchema
return string

MakeDdlDefaultDrop() protected method

protected MakeDdlDefaultDrop ( KeySchema key, TableSchema table ) : string
key KeySchema
table TableSchema
return string

MakeDdlElementName() protected method

protected MakeDdlElementName ( string name ) : string
name string
return string

MakeDdlIndexCreate() protected abstract method

protected abstract MakeDdlIndexCreate ( IndexSchema index, TableSchema table ) : string
index IndexSchema
table TableSchema
return string

MakeDdlIndexDrop() protected method

protected MakeDdlIndexDrop ( IndexSchema index, TableSchema table ) : string
index IndexSchema
table TableSchema
return string

MakeDdlKeyCreateByAlter() protected method

protected MakeDdlKeyCreateByAlter ( KeySchema key, TableSchema table ) : string
key KeySchema
table TableSchema
return string

MakeDdlKeyDrop() protected method

protected MakeDdlKeyDrop ( KeySchema key, TableSchema table ) : string
key KeySchema
table TableSchema
return string

MakeDdlTableCopy() protected method

protected MakeDdlTableCopy ( TableSchema toTable, TableSchema fromTable ) : string
toTable TableSchema
fromTable TableSchema
return string

MakeDdlTableCreate() protected method

protected MakeDdlTableCreate ( TableSchema table, bool withConstraint ) : string
table TableSchema
withConstraint bool
return string

MakeDdlTableDrop() protected method

protected MakeDdlTableDrop ( TableSchema table ) : string
table TableSchema
return string

MakeDdlTableRename() protected method

protected MakeDdlTableRename ( TableSchema table, string newName ) : string
table TableSchema
newName string
return string

MakeInsert() public method

public MakeInsert ( TableSchema table ) : string
table TableSchema
return string

MakeParameterName() protected method

protected MakeParameterName ( Rsdn.Janus.TableColumnSchema column ) : string
column Rsdn.Janus.TableColumnSchema
return string

MakeSelect() public method

public MakeSelect ( TableSchema table, bool orderedByPK ) : string
table TableSchema
orderedByPK bool
return string

ParseColumn() protected abstract method

protected abstract ParseColumn ( Rsdn.Janus.TableColumnSchema column ) : string
column Rsdn.Janus.TableColumnSchema
return string

ParseColumnAlter() protected abstract method

protected abstract ParseColumnAlter ( Rsdn.Janus.TableColumnSchema mColumn, Rsdn.Janus.TableColumnSchema eColumn ) : string
mColumn Rsdn.Janus.TableColumnSchema
eColumn Rsdn.Janus.TableColumnSchema
return string

ParseColumnListIndex() protected method

protected ParseColumnListIndex ( string iclist ) : IEnumerable
iclist string
return IEnumerable

ParseKey() protected method

protected ParseKey ( KeySchema key ) : string
key KeySchema
return string

Prepare() public method

public Prepare ( string connStr ) : void
connStr string
return void

PrepareToSqlFile() public method

public PrepareToSqlFile ( string path ) : void
path string
return void

WriteDdlCommands() protected abstract method

Записать набор DDL команд с помощью писателя.
protected abstract WriteDdlCommands ( TextWriter wr, IEnumerable commands ) : void
wr System.IO.TextWriter писатель
commands IEnumerable набор DDL команд
return void