예제 #1
0
        public BuffManager(IDbConnection db)
        {
            IQueryBuilder sqliteQueryCreator;

            this.database = db;
            SqlColumn[] sqlColumn  = new SqlColumn[2];
            SqlColumn   sqlColumn1 = new SqlColumn("BuffID", MySqlDbType.Int32, new int?(50));

            sqlColumn1.Primary = true;
            sqlColumn[0]       = sqlColumn1;
            sqlColumn[1]       = new SqlColumn("AllowedGroups", MySqlDbType.Text);
            SqlTable      sqlTable     = new SqlTable("BuffBans", sqlColumn);
            IDbConnection dbConnection = db;

            if (DbExt.GetSqlType(db) == SqlType.Sqlite)
            {
                sqliteQueryCreator = new SqliteQueryCreator();
            }
            else
            {
                sqliteQueryCreator = new MysqlQueryCreator();
            }
            (new SqlTableCreator(dbConnection, sqliteQueryCreator)).EnsureTableStructure(sqlTable);
            this.UpdateBuffBans();
        }
예제 #2
0
        public static void SetupDb(IDbConnection db)
        {
            IQueryBuilder provider;

            if (db.GetSqlType() != SqlType.Sqlite)
            {
                IQueryBuilder queryBuilder = new MysqlQueryCreator();
                provider = queryBuilder;
            }
            else
            {
                IQueryBuilder queryBuilder = new SqliteQueryCreator();
                provider = queryBuilder;
            }

            SqlTableCreator sqlTableCreator = new SqlTableCreator(db, provider);
            SqlTable        table           =
                new SqlTable("TempGroup", new SqlColumn("Indx", MySqlDbType.Int32)
            {
                Unique = true, AutoIncrement = true
            },
                             new SqlColumn("Nick", MySqlDbType.Text),
                             new SqlColumn("primaryGroup", MySqlDbType.Text),
                             new SqlColumn("actualGroup", MySqlDbType.Text),
                             new SqlColumn("expireDate", MySqlDbType.Text)
                             );

            sqlTableCreator.EnsureTableStructure(table);
        }
예제 #3
0
        public static void SetupDb(IDbConnection db)
        {
            IQueryBuilder provider;

            if (db.GetSqlType() != SqlType.Sqlite)
            {
                IQueryBuilder queryBuilder = new MysqlQueryCreator();
                provider = queryBuilder;
            }
            else
            {
                IQueryBuilder queryBuilder = new SqliteQueryCreator();
                provider = queryBuilder;
            }
            SqlTableCreator sqlTableCreator = new SqlTableCreator(db, provider);
            SqlTable        table           = new SqlTable("Economy_Players", new SqlColumn("ID", (MySqlDbType)3)
            {
                Unique = true
            }, new SqlColumn("Nick", (MySqlDbType)254)
            {
                Unique = true
            }, new SqlColumn("Money", (MySqlDbType)3));

            sqlTableCreator.EnsureTableStructure(table);
            SqlTable table2 = new SqlTable("Economy_Daily", new SqlColumn("ID", (MySqlDbType)3)
            {
                Unique = true
            }, new SqlColumn("Nick", (MySqlDbType)254)
            {
                Unique = true
            }, new SqlColumn("Time", (MySqlDbType)254));

            sqlTableCreator.EnsureTableStructure(table2);
            SqlTable table3 = new SqlTable("Shop_Products", new SqlColumn("Index", (MySqlDbType)254)
            {
                Primary = true
            }, new SqlColumn("Name", (MySqlDbType)254), new SqlColumn("ID", (MySqlDbType)3), new SqlColumn("Buy", (MySqlDbType)3), new SqlColumn("Sell", (MySqlDbType)3));

            sqlTableCreator.EnsureTableStructure(table3);
        }
예제 #4
0
파일: DB.cs 프로젝트: Megghy/PowerfulSign
 public static void TryCreateTable()
 {
     try
     {
         SqlTable sqlTable = new SqlTable("PowerfulSign", new SqlColumn[]
         {
             new SqlColumn("SignID", MySql.Data.MySqlClient.MySqlDbType.Int32)
             {
                 Primary       = true,
                 AutoIncrement = true
             },
             new SqlColumn("Owner", MySql.Data.MySqlClient.MySqlDbType.Int32),
             new SqlColumn("Friends", MySql.Data.MySqlClient.MySqlDbType.Text),
             new SqlColumn("Text", MySql.Data.MySqlClient.MySqlDbType.Text),
             new SqlColumn("CanEdit", MySql.Data.MySqlClient.MySqlDbType.Int32)
             {
                 DefaultValue = "1"
             },                                                                                       //0为true, 1为false
             new SqlColumn("X", MySql.Data.MySqlClient.MySqlDbType.Int32),
             new SqlColumn("Y", MySql.Data.MySqlClient.MySqlDbType.Int32),
             new SqlColumn("WorldID", MySql.Data.MySqlClient.MySqlDbType.Int32)
         });
         IDbConnection db = TShock.DB;
         IQueryBuilder queryBuilder2;
         if (DbExt.GetSqlType(TShock.DB) != SqlType.Sqlite)
         {
             IQueryBuilder queryBuilder = new MysqlQueryCreator();
             queryBuilder2 = queryBuilder;
         }
         else
         {
             IQueryBuilder queryBuilder = new SqliteQueryCreator();
             queryBuilder2 = queryBuilder;
         }
         new SqlTableCreator(db, queryBuilder2).EnsureTableStructure(sqlTable);
         CheckSignImport();
     }
     catch (Exception ex) { TShock.Log.Error(ex.Message); }
     //Main.sign = new Sign[1000];
 }
예제 #5
0
            public Database(IDbConnection db)
            {
                this.database = db;
                SqlTable table = new SqlTable("ToWarps", new SqlColumn[]
                {
                    new SqlColumn("WarpName", MySqlDbType.String),
                    new SqlColumn("Command", MySqlDbType.String)
                });
                IQueryBuilder provider;

                if (db.GetSqlType() != SqlType.Sqlite)
                {
                    IQueryBuilder queryBuilder = new MysqlQueryCreator();
                    provider = queryBuilder;
                }
                else
                {
                    IQueryBuilder queryBuilder = new SqliteQueryCreator();
                    provider = queryBuilder;
                }
                new SqlTableCreator(db, provider).EnsureTableStructure(table);
            }
예제 #6
0
        public static void SetupDb(IDbConnection db)
        {
            IQueryBuilder provider;

            if (db.GetSqlType() != SqlType.Sqlite)
            {
                IQueryBuilder queryBuilder = new MysqlQueryCreator();
                provider = queryBuilder;
            }
            else
            {
                IQueryBuilder queryBuilder = new SqliteQueryCreator();
                provider = queryBuilder;
            }
            SqlTableCreator sqlTableCreator = new SqlTableCreator(db, provider);
            SqlTable        table           = new SqlTable("CommandRegions", new SqlColumn("Indx", (MySqlDbType)3)
            {
                Unique        = true,
                AutoIncrement = true
            }, new SqlColumn("X", (MySqlDbType)3), new SqlColumn("Y", (MySqlDbType)3), new SqlColumn("Height", (MySqlDbType)3), new SqlColumn("Width", (MySqlDbType)3), new SqlColumn("Name", (MySqlDbType)752), new SqlColumn("Command", (MySqlDbType)752), new SqlColumn("WorldID", (MySqlDbType)752));

            sqlTableCreator.EnsureTableStructure(table);
        }