Please see clarifications below:
----- Original Message -----
From: "Pavel Ivanov" <paiva...@gmail.com>
To: "General Discussion of SQLite Database" <sqlite-users@sqlite.org>
Sent: Tuesday, September 15, 2009 4:36:19 PM GMT -06:00 US/Canada Central
Subject: Re: [sqlite] Schema and database layout

> 1) dont see a way to reuse schemas. In other words, I have say 10 tables with 
> the same schema. How would I prevent doing 10 CREATE table commands ?

Create 1 table with 1 additional column "schema" which will contain
numbers from 1 to 10.

KR: The 10 tables contain different data, but instead of doing this statement 
(example below) over
and over, I want to just pass this table "type" because all my tables look 
exactly
like table "TypeNumbers", but they have different data, depending on the 
entity-id.

strcpy(sqlStr,"CREATE TABLE TypeNumbers (");
       strcat(sqlStr,"ID INTEGER PRIMARY KEY AUTOINCREMENT,");
       strcat(sqlStr,"MainID INTEGER,");
       strcat(sqlStr,"Type INTEGER,");
       strcat(sqlStr,"CurrentNumber INTEGER);");

> Would there be a way I can pass the schema as well as data into SQLite ?

Elaborate please what do you want to do, where do you want to pass
"schema" (do you mean table name here?) and data?

KR: The above should answer this question.

> 2)Also, do you reccomend a different .db file for each schema so that 
> multiple threads can easily operate at the same time ?

It depends on how your threads will operate, how often they will issue
sql statements, what type of sql statements and all other details
about your application functionality.

KR: Different threads are going to access different tables of the same table 
type.
Maybe I need to think this through, even as I write this:-)

Thanks, Pavel!


On Tue, Sep 15, 2009 at 5:27 PM, Kavita Raghunathan
<kavita.raghunat...@skyfiber.com> wrote:
> All,
> I have a couple of questions:
>
> I've been studying the C/C++ interface, and
> 1) dont see a way to reuse schemas. In other words, I have say 10 tables with 
> the same schema. How would I prevent doing 10 CREATE table commands ? Would 
> there be a way I can pass the schema as well as data into SQLite ?
>
> 2)Also, do you reccomend a different .db file for each schema so that 
> multiple threads can easily operate at the same time ?
>
> I apologise in advance if I missed it in the documentation.
>
> Thanks again to this group for your awesome support. I've got a lot of ideas 
> from you all.
>
> Regards,
> Kavita
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to