示例#1
0
        public void BAlterTableIfExists()
        {
            var dataProvider = new MySqlDataDriver("*****@*****.**");
            var query        = IGNQueriable.Begin("*****@*****.**", dataProvider).
                               Alter().
                               Table("ignusers").
                               IfExists().
                               Add().
                               Column(TableColumnConfiguration.FromConfig("test1", typeof(string), 25, false, false, false, string.Empty)).
                               IfNotExists().
                               Add().
                               Column(TableColumnConfiguration.FromConfig("test2", typeof(string), 25, false, false, false, string.Empty)).
                               IfNotExists().
                               Go();

            dataProvider.Execute(query);
            query = IGNQueriable.Begin("*****@*****.**", dataProvider).
                    Alter().
                    Table("ignusers").
                    IfExists().
                    Alter().
                    Column(TableColumnConfiguration.FromConfig("test1", typeof(string), 50, false, false, false, string.Empty)).
                    IfExists().
                    Go();
            dataProvider.Execute(query);
            query = IGNQueriable.Begin("*****@*****.**", dataProvider).
                    Alter().
                    Table("ignusers").
                    IfExists().
                    Drop("test1").
                    IfExists().
                    Drop("test2").
                    IfExists().
                    Go();
            dataProvider.Execute(query);
            var dataDriver = new MySqlDataDriver("*****@*****.**");
            var column     = TableColumnConfiguration.FromConfig("createdOn", typeof(DateTime), 0, false, true, false, string.Empty);
            var altquery   = IGNQueriable.Begin("*****@*****.**", dataDriver).
                             Alter().
                             Table("ignusers").
                             IfExists().
                             Add().
                             Column(column).
                             IfNotExists().
                             Go();

            dataDriver.Execute(altquery);
        }
示例#2
0
        public void ADeleteAllUsers()
        {
            var dataProvider = new MySqlDataDriver("*****@*****.**");
            var query        = IGNQueriable.Begin("*****@*****.**", dataProvider).
                               Delete().
                               From("ignusers").
                               Go();

            dataProvider.Execute(query);
        }
示例#3
0
        public void CDeleteTable()
        {
            var dataProvider = new MySqlDataDriver("*****@*****.**");
            var query        = IGNQueriable.Begin("*****@*****.**", dataProvider).
                               Drop().
                               Table("ignusers").
                               IfExists().
                               Go();

            dataProvider.Execute(query);
        }
示例#4
0
        public void BCreateStoredProcedureIfNotExists()
        {
            var dataProvider = new MySqlDataDriver("*****@*****.**");
            var query        = IGNQueriable.Begin("*****@*****.**", dataProvider).
                               Drop().
                               StoredProcedure("testProc").
                               IfExists().
                               Go();

            dataProvider.Execute(query);
            var spQuery = IGNQueriable.Begin("*****@*****.**", dataProvider).
                          Select().
                          From("ignusers").
                          IfExists().
                          Go();

            query = IGNQueriable.Begin("*****@*****.**", dataProvider).
                    Create().
                    StoredProcedure("testProc", spQuery).
                    IfNotExists().
                    Go();

            dataProvider.Execute(query);
        }
示例#5
0
        public void ACreateTableIfNotExists()
        {
            var dataProvider = new MySqlDataDriver("*****@*****.**");
            var paramList    = new List <TableColumnConfiguration>()
            {
                TableColumnConfiguration.FromConfig("id", typeof(long), 0, true, true, true, string.Empty),
                TableColumnConfiguration.FromConfig("userId", typeof(long), 0, true, false, false, null),
                TableColumnConfiguration.FromConfig("mail", typeof(string), 254, true, false, false, string.Empty),
                TableColumnConfiguration.FromConfig("active", typeof(bool), 0, true, false, false, true)
            };
            var query = IGNQueriable.Begin("*****@*****.**", dataProvider).
                        Create().
                        Table("ignusers", paramList).
                        IfNotExists().
                        Go();

            dataProvider.Execute(query);
        }