Example #1
0
 protected override string ParseColumnAlter(TableColumnSchema mColumn, TableColumnSchema eColumn)
 {
     return(string.Format(@" [{0}] {1}{2} ",
                          mColumn.Name,
                          SqliteSchemaLoader.TypeDbsmToSqlite(mColumn),
                          mColumn.Nullable ? string.Empty : @" NOT NULL"));
 }
Example #2
0
        /// <summary>
        /// Создать схему метаданных из исходной базы
        /// </summary>
        /// <param name="connStr"></param>
        public override DBSchema LoadExistingSchema(string connStr)
        {
            var schema = SqliteSchemaLoader.LoadSchema(connStr);
            var keys   = new List <KeySchema>();

            foreach (var table in schema.Tables)
            {
                keys.Clear();
                keys.AddRange(table.Keys.Where(key => key.KeyType != ConstraintType.Default));
                table.Keys = keys.ToArray();
            }
            return(schema);
        }
Example #3
0
        protected override string ParseColumn(TableColumnSchema eColumn)
        {
            var stat = new StringBuilder();

            stat.AppendFormat(@" [" + eColumn.Name + @"] " + SqliteSchemaLoader.TypeDbsmToSqlite(eColumn));

            if (!String.IsNullOrEmpty(eColumn.DefaultValue))
            {
                stat.Append(@" DEFAULT " + eColumn.DefaultValue);
            }

            if (!eColumn.Nullable)
            {
                stat.Append(@" NOT NULL");
            }
            return(stat.ToString());
        }