sqlpp11 icon indicating copy to clipboard operation
sqlpp11 copied to clipboard

Handling Schemas

Open ghost opened this issue 3 years ago • 3 comments

I'm new to all this database stuff, so I might just be missing something obvious. I've managed to get sqlpp11 functioning in my project, but I didn't find it easy.

One of the main problems I've had seems to be because I've been creating all my tables in a schema, something like this: CREATE TABLE device.gps (...)

The ddl2cpp script ignores them. When I put it in quotes (CREATE TABLE "device.gps" (...)) then it will generate something. But, it will have periods in namespaces, which obviously isn't allowed.

In the end I've resorted to omitting the schema (CREATE TABLE gps (...)), then editing the output of ddl2cpp to add the schema back in to each table's "_literal" parameter (... _literal[] = "device.gps";).

Is there a better way of handling this?

ghost avatar Jun 03 '22 05:06 ghost

Most use cases I know just stay within one schema.

But it might be relatively easy to adjust the ddl2cpp script to understand schema. in CREATE TABLE (and set the literal as you did). Maybe there should be nested namespace, too?

Do you want to give it a try?

rbock avatar Jun 03 '22 17:06 rbock

Do you want to give it a try?

I do, but if I'm honest I just don't think I'll have time. Maybe later if this becomes a bigger part of my work.

ghost avatar Jun 06 '22 00:06 ghost

I played with this a while today: https://github.com/rbock/sqlpp11/tree/support_schema Can you give it a try?

rbock avatar Jul 03 '22 06:07 rbock