Closed ricomariani closed 1 year ago
`abc def`
is escaped to X_abcX20def
for use in C/Lua. This transformation is reversable. In principle it can collide with user names but this is not a new thing for CQL. Note that `abc`
will map to just abc
. This means if you are doing this just to avoid reserved word collisions then output quality does not suffer. In short anything that isn't an alphanumeric is hex encoded in the C/Lua. This really only happens for fields in cursors. The C code doesn't include table names that are not in strings.
To see progress on this item check out https://github.com/ricomariani/CG-SQL-author/pull/53
This is not going to be a five-minute fix by any means...
Further progress: https://github.com/ricomariani/CG-SQL-author/commit/dba95f4717320faf31d19b004812f1f05b16d809
What's left is a lot more fringe at this point. With query plan, upgrade, and JSON plus the main codegen supporting these it's quite usable.
Test helpers should be very straightforward, that will be next.
Test helpers are done and it was less straightforward than I expected because test helpers force the issue of:
quoted names
in typed names which was already a thing reallyquoted names
in attributes so you can name your dummy test columnsThere are not that many things left that can't have an exotic name.
I'm not aware of any missing cases now. I may do another exploration pass just to make sure but I think everything that needs to be done is done at this point. I will open separate issues for anything non-trivial that I discover while I play with it.
e.g. a database with a table named [x y]and a column named [a b] is fundamentally not usable by CQL today.
The idea here to add basic support for this:
`x y`
as a valid quoted name formatinsert
,update
,select
,delete
formscreate table
(table and column names and constraints)create index
create view
create trigger
drop
[all the above]These names leak into the algebra... these areas have to be enlightened.
DONE
`x y`
in dot expressions e.g.`x y`.a
,`x y`.`a b`
[x y].[a b]
etc.*
andT.*
expansiondeclare C cursor LIKE `abc def`
and other shape referencesFROM C
LIKE C(-`x y`)
`x y`
in cursors, soC.`x y`
has to workproc foo(LIKE table_name)
locals can have exotic namesX like `foo bar`
where`foo bar`
might have`a column`
a column
integer,another column
real)quoted id
in misc attributesquoted names
in generated exports output@recreate
update case, column pattern matching might need to be generalized (this might be a no-op) (OSS version of CQL doesn't support rebuild so this is a no-op, this was a Meta internal only feature)PENDING nothing