Closed peter-mw closed 9 years ago
hello any info for table prefix support
We have no intention to add this feature. Why not just use constant instead?
I need to have multiple db tables by prefix and use them as alias to other tables.
Maybe you can combine it with #97
Maybe like that
$database = new medoo(); $database->alias('account', 'my_prefix_account'); // Enjoy $database->insert('account', [ 'user_name' => 'foo' 'email' => 'foo@bar.com', 'age' => 25, 'lang' => ['en', 'fr', 'jp', 'cn'] ]);
It would be useful to automatically add a prefix to the tables like that maybe :
$database = new medoo();
$database->prefix('prefix_');
$database->insert('account', [ // => prefix_account
'user_name' => 'foo'
'email' => 'foo@bar.com',
'age' => 25,
'lang' => ['en', 'fr', 'jp', 'cn']
]);
Can you add this feature ?
$database = new medoo();
// If you want to add this feature here
$database->alias('account', 'my_prefix_account');
// So good for this
$database->insert('account', [
'user_name' => 'foo'
'email' => 'foo@bar.com',
'age' => 25,
'lang' => ['en', 'fr', 'jp', 'cn']
]);
// But what if I want to fetch date from other table without prefix for special reason?!
$database->select('another_account', 'user_name');
prefix is nice feature ,if added
Added this feature finally :)
$database = new medoo([
'database_type' => 'mysql',
...
'charset' => 'utf8',
'prefix' => 'PREFIX_'
]);
Is it possible to add table prefix from the config?