dg / dibi

Dibi - smart database abstraction layer
https://dibiphp.com
Other
487 stars 136 forks source link

DROP DATABASE %n generates wrong result for database name containing period #329

Closed zraly closed 5 years ago

zraly commented 5 years ago

Version: 4.0.2

Bug Description

I have a database called my.database (contains period in its name). Unfortunately

DROP DATABASE %n

generates

DROP DATABASE `my`.`database`

And

DROP DATABASE %s

generates

DROP DATABASE 'my.database'

Steps To Reproduce

dibi::test("DROP DATABASE %n", "my.database");

Expected Behavior

Should generate

DROP DATABASE `my.database`
milo commented 5 years ago

PostgreSQL (and SQLServer and Oracle) has schemas and "my"."database" is correct, because my is schema name.

Try modifier %N.

zraly commented 5 years ago

Thanks, %N works, but I can't be found in any documentation. Should I create PR? But I am not sure if my explanation in documentation would be the best.

dg commented 5 years ago

@medhi It will definitely be better than none.

zraly commented 5 years ago

OK, but what I am able to read from the source code, %N is not supposed for database names, but for aliases. %n AS %N. But it probably works with database names because of the same syntax, is that right?

dg commented 5 years ago

I think the only difference is in meaning of the dot.