Do i have to open a database connection for each threat? Like

rc = sqlite3_open("file::memory:?cache=shared", &db);


Am 20.09.2017 um 09:16 schrieb Hick Gunter:
Make sure each thread has ist own private connection to the SQLite database 
(see https://sqlite.org/inmemorydb.html)

Prepare the statement once in each reader thread and use the bind functions to 
set the constraint values

The writer thread will need to prepare statements to populate the db too.

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im 
Auftrag von heribert
Gesendet: Mittwoch, 20. September 2017 09:09
An: sqlite-users@mailinglists.sqlite.org
Betreff: [EXTERNAL] Re: [sqlite] sqlite3_stmt limitations

@Clemens: You wrote

"Not very much.  But preparing a statement is very fast; don't try to be too 
clever."

What do you mean with "don't try to be too clever"? Is preparing for reuse not 
really necessary?

The select will be like "SELECT Value FROM RgbValues WHERE Object=? AND 
Property=?".
Will it be better to prepare the sqlite3_stmt and reuse it? Or
ondemand:  prepare, use and close the sqlite3_stmt. Is the time-consuming of 
parsing a statement like above too high, so it will be better to reuse the 
sqlite3_stmt (so i will have thousends prepared)?

Thx
heribert
heribert wrote:
The threads prepares their own sqlite3_stmt's with select statements
to the properties currently needed
A single statement "SELECT Value FROM T WHERE Name = ?" might suffice.

Is their any limitation of sqlite3_stmt bound to a database?
Only memory.

How much memory is used by a sqlite3_stmt?
Not very much.  But preparing a statement is very fast; don't try to be
too clever.


Regards,
Clemens
_______________________________________________
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


___________________________________________
  Gunter Hick
Software Engineer
Scientific Games International GmbH
FN 157284 a, HG Wien
Klitschgasse 2-4, A-1130 Vienna, Austria
Tel: +43 1 80100 0
E-Mail: h...@scigames.at

This communication (including any attachments) is intended for the use of the 
intended recipient(s) only and may contain information that is confidential, 
privileged or legally protected. Any unauthorized use or dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please immediately notify the sender by return e-mail message and 
delete all copies of the original communication. Thank you for your cooperation.


_______________________________________________
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