nette / database

💾 A database layer with a familiar PDO-like API but much more powerful. Building queries, advanced joins, drivers for MySQL, PostgreSQL, SQLite, MS SQL Server and Oracle.
https://doc.nette.org/database
Other
513 stars 108 forks source link

Support for use tablename acquired as regclass at previous query in PostgreSQL (prevent to "delimite" two times) #263

Open Vlczech opened 4 years ago

Vlczech commented 4 years ago

If data contains special char, table is named with quotation marks also. Thus regclass returns name with quotes and for example operation ->table() delimites such delimited regclass name obtained from SELECT for the second time. So for example $tbl='someschema."some-table"' is in $db->table() delimited to "someschema"."""some-table""".

Note: Tested for PostgreSQL only.

dg commented 4 years ago

Does this feature apply only to Postgresql, or any other databases?

Vlczech commented 4 years ago

@dg: I tried to code it to be universal as well for other databases for reverse operation to delimite(), but don't know if any other database has some feature like regclass in postgresql. I don't like to have this feature in ResultSet if it's usable for something specific only (in this case PostgreSQL), so i decided to put it at the driver level :-)