@@ -26,9 +26,10 @@ abstract class Database extends DB_ORM
2626 *
2727 * @param string $db_name The name of the database to be created.
2828 */
29- protected static function createDB ($ db_name )
29+ protected static function createDB ($ db_name )
3030 {
31- try {
31+ try
32+ {
3233 // Initialize database connection
3334 Connection::init ();
3435
@@ -39,11 +40,14 @@ protected static function createDB($db_name)
3940 );
4041
4142 // If the database does not exist, create it
42- if (empty ($ query )) {
43- DB ::query ("CREATE DATABASE $ db_name " );
43+ if (empty ($ query ))
44+ {
45+ DB ::query ("CREATE DATABASE %b " , $ db_name );
4446 static ::log ('INFO ' , "Created Database ` $ db_name` " );
4547 }
46- } catch (\Exception $ e ) {
48+ }
49+ catch ( \Exception $ e )
50+ {
4751 // Log any exceptions that occur during the database creation
4852 static ::log (
4953 'ERROR ' ,
@@ -60,9 +64,10 @@ protected static function createDB($db_name)
6064 *
6165 * @param string $db_name The name of the database to be dropped.
6266 */
63- protected static function dropDB ($ db_name )
67+ protected static function dropDB ($ db_name )
6468 {
65- try {
69+ try
70+ {
6671 // Initialize database connection
6772 Connection::init ();
6873
@@ -73,7 +78,8 @@ protected static function dropDB($db_name)
7378 );
7479
7580 // If the database does not exist, log a warning
76- if (empty ($ query )) {
81+ if (empty ($ query ))
82+ {
7783 static ::log (
7884 'WARNING ' ,
7985 "Cannot drop unexisting database ` $ db_name` "
@@ -82,9 +88,11 @@ protected static function dropDB($db_name)
8288 }
8389
8490 // Drop the database
85- DB ::query ("DROP DATABASE $ db_name" );
91+ DB ::query ("DROP DATABASE %b " , $ db_name );
8692 static ::log ('INFO ' , "Dropped Database ` $ db_name`. " );
87- } catch (\Exception $ e ) {
93+ }
94+ catch ( \Exception $ e )
95+ {
8896 // Log any exceptions that occur during the database drop
8997 static ::log (
9098 'ERROR ' ,
@@ -102,9 +110,10 @@ protected static function dropDB($db_name)
102110 * @param string $db_name The name of the database containing the table.
103111 * @param string $db_table The name of the table to be dropped.
104112 */
105- protected static function dropTable ($ db_name , $ db_table )
113+ protected static function dropTable ($ db_name , $ db_table )
106114 {
107- try {
115+ try
116+ {
108117 // Initialize database connection
109118 Connection::init ();
110119
@@ -116,7 +125,8 @@ protected static function dropTable($db_name, $db_table)
116125 );
117126
118127 // If the table does not exist, log a warning
119- if (empty ($ query )) {
128+ if (empty ($ query ))
129+ {
120130 static ::log (
121131 'WARNING ' ,
122132 "Cannot drop unexisting table ` $ db_table` in ` $ db_name` Database "
@@ -125,12 +135,14 @@ protected static function dropTable($db_name, $db_table)
125135 }
126136
127137 // Drop the table
128- DB ::query ("DROP TABLE $ db_table" );
138+ DB ::query ("DROP TABLE %b.%b " , $ db_name , $ db_table );
129139 static ::log (
130140 'INFO ' ,
131141 "Dropped Table ` $ db_table` in ` $ db_name` Database. "
132142 );
133- } catch (\Exception $ e ) {
143+ }
144+ catch ( \Exception $ e )
145+ {
134146 // Log any exceptions that occur during the table drop
135147 static ::log (
136148 'ERROR ' ,
0 commit comments