I did this sort of thing in Xperdex (
https://sourceforge.net/projects/xperdex/ ) which is a C# thing, and
enabled easy creation of DataTables similarly auto creating ID and Name by
stripping pluralization from the name.
Was working on a similar thing for JS; but keep getting distracted making
it more of a schema layer for graph databases instead.  (
https://github.com/d3x0r/rdb-dataset )  (singularlize
https://github.com/d3x0r/rdb-dataset/blob/master/rdb-dataset.js#L53  (for
english))

But when I presented the utility of the methods; noone in the group I was
working with could concur on the automated methods; claiming I shouldn't
strip 's' off of 'games' and it should be 'games_id' and 'games_name' ..
and like 'sessions_game_groups_games_id'  *shrug* I just mention this,
because I doubt you'll ever get such a generic utility from sqlite... (or
any other database) but will be a layer you'll have to maintain in your own
libraries...

On Sat, Aug 4, 2018 at 7:00 PM Stephen Chrzanowski <pontia...@gmail.com>
wrote:

> I was right.  I got the tables done before a response.  But still would
> like to know if there's a SQLite method of doing so.
>
> My method was to use a templating application that I wrote at work. I give
> it this variable declaration:
>
> Name=Resource
>
> I then give it this text:
>
> CREATE TABLE [%(Name)s]( [%(Name)ID] INTEGER PRIMARY KEY AUTOINCREMENT,
> [%(Name)Name] CHAR NOT NULL, UNIQUE([%(Name)Name]));
> CREATE UNIQUE INDEX [u%(Name)Name] ON [%(Name)s]([%(Name)Name]);
>
> It then gives me this result:
>
> CREATE TABLE [Resources]( [ResourceID] INTEGER PRIMARY KEY AUTOINCREMENT,
> [ResourceName] CHAR NOT NULL, UNIQUE([ResourceName]));
> CREATE UNIQUE INDEX [uResourceName] ON [Resources]([ResourceName]);
>
> Repeat for each simple table I want, and things were done in just a couple
> of minutes.  Its a very basic template engine (Automatic Search & Replace
> until no keyword strings exist), but it takes big chunks of time off when
> we do upgrades to our 100+ servers around the world.
>
> BUT, if I could have the SQL version be provided a list of names, it goes
> and loops through repeating whatever processes I need based on that name
> for that loop, and creates the structures I'd need later on in life. ;)
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to