cycle / database

Database Abstraction Layer, Schema Introspection, Schema Generation, Query Builders
MIT License
54 stars 22 forks source link

Columns use quote parsing to cause SQL error #77

Open zaishui15 opened 1 year ago

zaishui15 commented 1 year ago

No duplicates 🥲.

Database

MySQL

What happened?

I have the query columns a bug happened!

$result = $database
    ->select([
        'table1.id as t.id'
    ])
    ->from('table1')
    ->fetchAll();

I need this result

select `table1`.`id` as `t.id` from `table1`;

The actual result is

select `table1`.`id` as `t`.`id` from `table1`;

Result in query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use

Version

database 2.0
PHP 8.1