catfan / Medoo

The lightweight PHP database framework to accelerate the development.
https://medoo.in
MIT License
4.84k stars 1.15k forks source link

InvalidArgumentException: Incorrect table name "information_schema.tables" #951

Closed dydx-git closed 3 years ago

dydx-git commented 3 years ago

Describe the bug Calling methods with 'information_schema.tables' as the table name gives the following error:

InvalidArgumentException: Incorrect table name "information_schema.tables"

Information

Detail Code

$this->database->debug()->select(
            'information_schema.tables',
            'UPDATE_TIME',
            [
                'TABLE_SCHEMA' => DatabaseConnector::$databaseName,
                'TABLE_NAME' => 'design'
            ]
);

Expected output Expected it to translate to this query: SELECT UPDATE_TIME FROM information_schema.tables WHERE TABLE_SCHEMA = 'your_dbname' AND TABLE_NAME = 'your_tablename'

catfan commented 3 years ago

You cannot select table from schema directly. Just simply change information_schema.tables to tables instead.

LethalIndustry commented 1 year ago

What happend if my MSSQL DB contains a few schemas like cat.employee, fun.tickets and i have to make joins?

I'm trying this but not korking

$db->select("fun.boletos(b)", [ "[>]cat.empleados(e)" => ["idempleado" => "id"] ], [ "b.id", "e.nombre" ],[ "e.id[<=]" => 20 ]);