Hi All,

I have two problems, the first one is probably very simple but I could not
find anything online telling me how to fix it. I would like to use the
WITHOUT ROWID statement as my primary key is a string in the format of 6
coordinates.

example:
"0.0 1.0 3.0 1.6 2.4 0.0"

I am using c++, but not using a wrapper even if I try the example given on
the website

char * sql = "CREATE TABLE IF NOT EXISTS wordcount(word TEXT PRIMARY KEY,
cnt INTEGER) WITHOUT ROWID;";

rc = sqlite3_exec(db, sql, callback, 0, &zErrMsg);
if( rc != SQLITE_OK ){
  fprintf(stderr, "SQL error: %s\n", zErrMsg);
  sqlite3_free(zErrMsg);
}else{
  fprintf(stdout, "Table created successfully\n");
}

I get a SQL error near WITHOUT. I have tried going into sqlite3 and
creating the same table there without c++ and it works fine and I have
downloaded the most recent version of the c++ files from the website so I
really have no idea. I have created other tables just fine using the same
method.

My other problem is maybe more a of a methodological problem but I will
throw it out there. I am building a database of approximately 50-100gb of
data per c++ program run, after each round (~500 rounds) in my program I
need to go back and update my sqlite database, most of the data will be new
rows but still many previous rows will need to be updated. I am not sure
how efficiently update a large number of rows at once.

Here is my table definition:

sql = "CREATE TABLE two_way("   \
  "id VARCHAR(50) NOT NULL,"  \
  "names VARCHAR(2000),"      \
  "rs VARCHAR(3000),"  \
  "ds VARCHAR(2000)," \
  "sugs VARCHAR(2000), " \
  "PRIMARY KEY (id));";

When I need to update a row I need to take the previous values from
names,rs,ds and sugs and add the new values I have to the end of the
strings seperated by a ;.

example:
if names is currently "motif_1,motif_2;motif_5,motif6"
and the new data I have is "motif_10,motif_11", after the update i need
names to be:
"motif_1,motif_2;motif_5,motif6;motif_10,motif_11"

This same thing needs to be done for names,rs,ds and sugs.
*So sorry my questions is:*
Is there a way to do this for a large number of rows in a single
transaction, since I am currently doing it for one row per transaction and
its very very slow.

Thanks a lot,
Joe
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to