Example #1
0
        internal static void CreateTables(SQLiteConnection connection)
        {
            VariablesTable.CreateTable(connection);

            TypeModel.CreateTable(connection);
            CollectionsTable.CreateTable(connection);
        }
Example #2
0
        internal IsabelDb(SQLiteConnection connection,
                          string fileName,
                          IEnumerable <Type> supportedTypes,
                          bool disposeConnection,
                          bool isReadOnly)
        {
            _connection        = connection;
            _fileName          = fileName;
            _disposeConnection = disposeConnection;

            _variables   = new VariablesTable(connection);
            _collections = new CollectionsTable(connection, supportedTypes.ToList(), isReadOnly);
        }
Example #3
0
 internal static void EnsureTableSchema(SQLiteConnection connection)
 {
     if (!VariablesTable.DoesTableExist(connection))
     {
         throw new IncompatibleDatabaseSchemaException(string.Format("The database is missing the '{0}' table. It may have been created with an early vesion of IsabelDb or it may not even be an IsabelDb file. Are you sure the path is correct?", VariablesTable.TableName));
     }
     if (!TypeModel.DoesTypeTableExist(connection))
     {
         throw new IncompatibleDatabaseSchemaException(string.Format("The database is missing the '{0}' table. The table may have been deleted or this may not even be an IsabelDb file. Are you sure the path is correct?", TypeModel.TypeTableName));
     }
     if (!CollectionsTable.DoesTableExist(connection))
     {
         throw new IncompatibleDatabaseSchemaException(string.Format("The database is missing the '{0}' table. The table may have been deleted or this may not even be an IsabelDb file. Are you sure the path is correct?", CollectionsTable.TableName));
     }
 }
Example #4
0
        private static void CreateTablesIfNecessary(SQLiteConnection connection)
        {
            var hasTypesTable  = TypeModel.DoesTypeTableExist(connection);
            var hasStoresTable = CollectionsTable.DoesTableExist(connection);

            if (hasTypesTable && hasStoresTable)
            {
                return;
            }
            if (hasTypesTable != hasStoresTable)
            {
                throw new NotImplementedException("Something something incompatible");
            }

            CreateTables(connection);
        }