@@ -3638,48 +3638,46 @@ row_drop_table_for_mysql(
3638
3638
3639
3639
pars_info_add_str_literal (info, " table_name" , name);
3640
3640
3641
- std::basic_string<char , std::char_traits<char >,
3642
- ut_allocator<char > > sql;
3643
- sql.reserve (2000 );
3644
-
3645
- sql = " PROCEDURE DROP_TABLE_PROC () IS\n "
3641
+ err = que_eval_sql (
3642
+ info,
3643
+ " PROCEDURE DROP_TABLE_PROC () IS\n "
3646
3644
" sys_foreign_id CHAR;\n "
3647
3645
" table_id CHAR;\n "
3648
3646
" index_id CHAR;\n "
3649
3647
" foreign_id CHAR;\n "
3650
3648
" space_id INT;\n "
3651
- " found INT;\n " ;
3649
+ " found INT;\n "
3652
3650
3653
- sql += " DECLARE CURSOR cur_fk IS\n "
3651
+ " DECLARE CURSOR cur_fk IS\n "
3654
3652
" SELECT ID FROM SYS_FOREIGN\n "
3655
3653
" WHERE FOR_NAME = :table_name\n "
3656
3654
" AND TO_BINARY(FOR_NAME)\n "
3657
3655
" = TO_BINARY(:table_name)\n "
3658
- " LOCK IN SHARE MODE;\n " ;
3656
+ " LOCK IN SHARE MODE;\n "
3659
3657
3660
- sql += " DECLARE CURSOR cur_idx IS\n "
3658
+ " DECLARE CURSOR cur_idx IS\n "
3661
3659
" SELECT ID FROM SYS_INDEXES\n "
3662
3660
" WHERE TABLE_ID = table_id\n "
3663
- " LOCK IN SHARE MODE;\n " ;
3661
+ " LOCK IN SHARE MODE;\n "
3664
3662
3665
- sql += " BEGIN\n " ;
3663
+ " BEGIN\n "
3666
3664
3667
- sql += " SELECT ID INTO table_id\n "
3665
+ " SELECT ID INTO table_id\n "
3668
3666
" FROM SYS_TABLES\n "
3669
3667
" WHERE NAME = :table_name\n "
3670
3668
" LOCK IN SHARE MODE;\n "
3671
3669
" IF (SQL % NOTFOUND) THEN\n "
3672
3670
" RETURN;\n "
3673
- " END IF;\n " ;
3671
+ " END IF;\n "
3674
3672
3675
- sql += " SELECT SPACE INTO space_id\n "
3673
+ " SELECT SPACE INTO space_id\n "
3676
3674
" FROM SYS_TABLES\n "
3677
3675
" WHERE NAME = :table_name;\n "
3678
3676
" IF (SQL % NOTFOUND) THEN\n "
3679
3677
" RETURN;\n "
3680
- " END IF;\n " ;
3678
+ " END IF;\n "
3681
3679
3682
- sql += " found := 1;\n "
3680
+ " found := 1;\n "
3683
3681
" SELECT ID INTO sys_foreign_id\n "
3684
3682
" FROM SYS_TABLES\n "
3685
3683
" WHERE NAME = 'SYS_FOREIGN'\n "
@@ -3693,9 +3691,9 @@ row_drop_table_for_mysql(
3693
3691
" IF (:table_name = 'SYS_FOREIGN_COLS') \n "
3694
3692
" THEN\n "
3695
3693
" found := 0;\n "
3696
- " END IF;\n " ;
3694
+ " END IF;\n "
3697
3695
3698
- sql += " OPEN cur_fk;\n "
3696
+ " OPEN cur_fk;\n "
3699
3697
" WHILE found = 1 LOOP\n "
3700
3698
" FETCH cur_fk INTO foreign_id;\n "
3701
3699
" IF (SQL % NOTFOUND) THEN\n "
@@ -3708,9 +3706,9 @@ row_drop_table_for_mysql(
3708
3706
" WHERE ID = foreign_id;\n "
3709
3707
" END IF;\n "
3710
3708
" END LOOP;\n "
3711
- " CLOSE cur_fk;\n " ;
3709
+ " CLOSE cur_fk;\n "
3712
3710
3713
- sql += " found := 1;\n "
3711
+ " found := 1;\n "
3714
3712
" OPEN cur_idx;\n "
3715
3713
" WHILE found = 1 LOOP\n "
3716
3714
" FETCH cur_idx INTO index_id;\n "
@@ -3724,26 +3722,22 @@ row_drop_table_for_mysql(
3724
3722
" AND TABLE_ID = table_id;\n "
3725
3723
" END IF;\n "
3726
3724
" END LOOP;\n "
3727
- " CLOSE cur_idx;\n " ;
3725
+ " CLOSE cur_idx;\n "
3728
3726
3729
- sql += " DELETE FROM SYS_COLUMNS\n "
3727
+ " DELETE FROM SYS_COLUMNS\n "
3730
3728
" WHERE TABLE_ID = table_id;\n "
3731
3729
" DELETE FROM SYS_TABLES\n "
3732
- " WHERE NAME = :table_name;\n " ;
3733
-
3734
- if (dict_table_is_file_per_table (table)) {
3735
- sql += " DELETE FROM SYS_TABLESPACES\n "
3736
- " WHERE SPACE = space_id;\n "
3737
- " DELETE FROM SYS_DATAFILES\n "
3738
- " WHERE SPACE = space_id;\n " ;
3739
- }
3740
-
3741
- sql += " DELETE FROM SYS_VIRTUAL\n "
3742
- " WHERE TABLE_ID = table_id;\n " ;
3730
+ " WHERE NAME = :table_name;\n "
3743
3731
3744
- sql += " END;\n " ;
3732
+ " DELETE FROM SYS_TABLESPACES\n "
3733
+ " WHERE SPACE = space_id;\n "
3734
+ " DELETE FROM SYS_DATAFILES\n "
3735
+ " WHERE SPACE = space_id;\n "
3745
3736
3746
- err = que_eval_sql (info, sql.c_str (), FALSE , trx);
3737
+ " DELETE FROM SYS_VIRTUAL\n "
3738
+ " WHERE TABLE_ID = table_id;\n "
3739
+ " END;\n " ,
3740
+ FALSE , trx);
3747
3741
} else {
3748
3742
page_no = page_nos;
3749
3743
for (dict_index_t * index = dict_table_get_first_index (table);
0 commit comments