catfan / Medoo

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

Medoo trims out table names that begin with a numerical prefix #1022

Closed blessedjasonmwanza closed 3 years ago

blessedjasonmwanza commented 3 years ago

Information

Describe the Problem I have noticed that whenever I supply a numerical prefix to a table name and run debug(), Medoo trims/removes the table name prefix. Currently, it seems like Medoo does not support in-conditions number prefixes on table joins. Kindly see the detailed code below I had to add the table prefix manually, because as of the moment, Medoo seems not to auto-detect table prefixes even when I add <table_name>.<column_name>

Detail Code

$column_name = '1_address;
$db->select('users', ['[>]address' => 'user_id'], "*", [
"`$column_name`.<id>" => null
]);

Expected debug output

SELECT * FROM users LEFT JOIN address WHERE `1_address`.`id`  IS NULL

Current returned debug output

SELECT * FROM users LEFT JOIN address WHERE `_address`.`id`  IS NULL

As you can notice, the returned output is missing a 1. Kindly help as this is urgent, I am patching it in a live platform.

blessedjasonmwanza commented 3 years ago

@catfan and the awesome Medoo family, kindly assist me regarding this issue.

blessedjasonmwanza commented 3 years ago

Seems like I personally did not enclose the table names in <> as guided by the Documentation