44
55use ezsql \ezSchema ;
66use ezsql \ezQueryInterface ;
7- use function ezsql \functions \column ;
7+ use function ezsql \functions \{ column , getVendor } ;
88
99class ezQuery implements ezQueryInterface
1010{
@@ -19,14 +19,16 @@ class ezQuery implements ezQueryInterface
1919 protected $ insertId = null ;
2020
2121 /**
22- * The table `name` to use on calls to `selecting` method.
22+ * The table `name` to use on calls to `ing` ending
23+ * `CRUD` methods/functions.
2324 *
2425 * @var string
2526 */
2627 protected $ table = '' ;
2728
2829 /**
29- * A `prefix` to append to `table` on calls to `selecting` method.
30+ * A `prefix` to append to `table` on calls to `ing` ending
31+ * `CRUD` methods/functions.
3032 *
3133 * @var string
3234 */
@@ -894,7 +896,7 @@ private function create_schema(array ...$columnDataOptions)
894896
895897 public function create (string $ table = null , ...$ schemas )
896898 {
897- $ vendor = ezSchema:: vendor ();
899+ $ vendor = getVendor ();
898900 if (empty ($ table ) || empty ($ schemas ) || empty ($ vendor ))
899901 return false ;
900902
@@ -955,24 +957,6 @@ public function create(string $table = null, ...$schemas)
955957 return false ;
956958 }
957959
958- /**
959- * Modify columns in an existing database table, by either:
960- *```js
961- * - array( column_name, datatype, ...value/options arguments ) // calls create_schema()
962- * - addColumn( column_name, datatype, ...value/options arguments ) // returns string
963- * - dropColumn( column_name ) // returns string
964- * - changingColumn( column_name, datatype, ...value/options arguments ) // returns string
965- *```
966- * @param string $table The name of the db table that you wish to alter
967- * @param array ...$alteringSchema An array of:
968- *
969- * - @param string `$name,` - column name
970- * - @param string `$type,` - data type for the column
971- * - @param mixed `$size,` | `$value,`
972- * - @param mixed `...$anyOtherArgs`
973- *
974- * @return mixed results of query() call
975- */
976960 public function alter (string $ table = null , ...$ alteringSchema )
977961 {
978962 if (empty ($ table ) || empty ($ alteringSchema ))
@@ -1056,8 +1040,14 @@ public function dropping()
10561040 return ($ table === false ) ? false : $ this ->drop ($ table );
10571041 }
10581042
1043+ public function altering (...$ alteringSchema )
1044+ {
1045+ $ table = $ this ->table_prefix ();
1046+ return ($ table === false ) ? false : $ this ->alter ($ table , ...$ alteringSchema );
1047+ }
1048+
10591049 /**
1060- * Check and return the stored **global** database `table` preset with any `prefix`.
1050+ * Check and return the stored database `table` preset with any `prefix`.
10611051 *
10621052 * @return boolean|string `false` if no preset.
10631053 */
@@ -1066,7 +1056,7 @@ protected function table_prefix()
10661056 if (empty ($ this ->table ) || !\is_string ($ this ->table ))
10671057 return $ this ->clearPrepare ();
10681058
1069- $ table = (!empty ($ this ->prefix ) || \is_string ($ this ->prefix ))
1059+ $ table = (!empty ($ this ->prefix ) && \is_string ($ this ->prefix ))
10701060 ? $ this ->prefix . $ this ->table
10711061 : $ this ->table ;
10721062
0 commit comments