[sqlite] How to check if connection to main database is still open or closed before new query ?
understood, i will use that way if it is the appropiate though it worked in the previous i mentioned Thanks From: sqlite-users-bounces at mailinglists.sqlite.org on behalf of Andy Ling Sent: Tuesday, March 1, 2016 7:23 PM To: 'SQLite mailing list' Subject: Re: [sqlite] How to check if connectionto main databaseis still open or closed before new query ? I don't think this will work. sqlite3_open and sqlite3_close return a status which, if they worked, is SQLITE_OK. A simpler solution might be to set ppDB to NULL in your code every time you close the database. So add something like sqlite3_close(ppDB); ppDB = NULL ; Then the original test Simon suggested will work. Regards Andy Ling -Original Message- From: sqlite-users-bounces at mailinglists.sqlite.org [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of a a Sent: Tue 01 March 2016 17:13 To: SQLite mailing list Subject: Re: [sqlite] How to check if connection to main database is still open or closed before new query ? Let me explain it better cause i got confused and i am a newbie also. I open a connection like this sqlite3 *ppDB; int dbcon; dbcon = sqlite3_open(databasename, &ppDB); /// i do my code i query the database i do some stuff and i close the database like this dbcon = sqlite3_close(ppDB); I want to check after a while if the connection is allready closed or not for the simple reason not to reopen the database but if is open to run a query or if it is closed to reopen the database and then run the query. so i think the dbcon is the one i have to check not the ppDB :/ it works now maby i didnt understand what ppDB you were reffering to if(dbcon){ //is open }else{ //is closed } :) thanks though it is tested and runs ok From: sqlite-users-bounces at mailinglists.sqlite.org on behalf of Simon Slavin Sent: Tuesday, March 1, 2016 7:01 PM To: SQLite mailing list Subject: Re: [sqlite] How to check if connection to maindatabase is still open or closed before new query ? On 1 Mar 2016, at 4:59pm, a a wrote: > the sqlite3_close() <--- needs one argument if i pass sqlite3_close(NULL) it > actually closes again a closed connection ? No. If you pass it null it realises that the connection is closed and does nothing. Simon. ___ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users --- This email has been scanned for email related threats and delivered safely by Mimecast. For more information please visit http://www.mimecast.com --- ___ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] How to check if connection to main database is still open or closed before new query ?
Let me explain it better cause i got confused and i am a newbie also. I open a connection like this sqlite3 *ppDB; int dbcon; dbcon = sqlite3_open(databasename, &ppDB); /// i do my code i query the database i do some stuff and i close the database like this dbcon = sqlite3_close(ppDB); I want to check after a while if the connection is allready closed or not for the simple reason not to reopen the database but if is open to run a query or if it is closed to reopen the database and then run the query. so i think the dbcon is the one i have to check not the ppDB :/ it works now maby i didnt understand what ppDB you were reffering to if(dbcon){ //is open }else{ //is closed } :) thanks though it is tested and runs ok From: sqlite-users-bounces at mailinglists.sqlite.org on behalf of Simon Slavin Sent: Tuesday, March 1, 2016 7:01 PM To: SQLite mailing list Subject: Re: [sqlite] How to check if connection to maindatabase is still open or closed before new query ? On 1 Mar 2016, at 4:59pm, a a wrote: > the sqlite3_close() <--- needs one argument if i pass sqlite3_close(NULL) it > actually closes again a closed connection ? No. If you pass it null it realises that the connection is closed and does nothing. Simon. ___ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] How to check if connection to main database is still open or closed before new query ?
the sqlite3_close() <--- needs one argument if i pass sqlite3_close(NULL) it actually closes again a closed connection ? I cant find if the certain sqlite3 *ppDB is open or closed :/ if(ppDB){ //is open }else{ //is closed } It returns always that the ppDB is open in the above function From: sqlite-users-bounces at mailinglists.sqlite.org on behalf of Simon Slavin Sent: Tuesday, March 1, 2016 6:50 PM To: SQLite mailing list Subject: Re: [sqlite] How to check if connection to main database is still open or closed before new query ? On 1 Mar 2016, at 4:47pm, a a wrote: > Nope the previous was errored it doesn`t actually check it if the ppDB is > allready closed :/ > It works only if it is open and not closed otherwise if sqlite3_close(ppDB) > was previously called it sees it as open again sqlite3_close() ignores connections which are already closed. If you call it and pass it null, it will return, doing nothing but returning no error message. So it is safe to issue sqlite3_close() on one connection. Simon. ___ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] How to check if connection to main database is still open or closed before new query ?
Nope the previous was errored it doesn`t actually check it if the ppDB is allready closed :/ It works only if it is open and not closed otherwise if sqlite3_close(ppDB) was previously called it sees it as open again :/ Any other way ? From: sqlite-users-bounces at mailinglists.sqlite.org on behalf of Simon Slavin Sent: Tuesday, March 1, 2016 6:33 PM To: SQLite mailing list Subject: Re: [sqlite] How to check if connection to main database isstill open or closed before new query ? On 1 Mar 2016, at 4:31pm, a a wrote: > Thank you Simon indeed what i was looking for Please test it first. I can't test C programs here at work and I can't find documentation that it works. Simon. ___ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] How to check if connection to main database is still open or closed before new query ?
It is if (ppDb != NULL) { // it's open } else { // it's closed } yeap it works correct thank you From: sqlite-users-bounces at mailinglists.sqlite.org on behalf of Simon Slavin Sent: Tuesday, March 1, 2016 6:33 PM To: SQLite mailing list Subject: Re: [sqlite] How to check if connection to main database isstill open or closed before new query ? On 1 Mar 2016, at 4:31pm, a a wrote: > Thank you Simon indeed what i was looking for Please test it first. I can't test C programs here at work and I can't find documentation that it works. Simon. ___ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] How to check if connection to main database is still open or closed before new query ?
Thank you Simon indeed what i was looking for From: sqlite-users-bounces at mailinglists.sqlite.org on behalf of Simon Slavin Sent: Tuesday, March 1, 2016 6:17 PM To: SQLite mailing list Subject: Re: [sqlite] How to check if connection to main database is still open or closed before new query ? On 1 Mar 2016, at 4:02pm, a a wrote: > I am trying to find if there is a return value of true false or anything that > can tell me that a connection to sqlite database is open or close > > Can you tell me which function is appropiate for this reason ? If I understand correctly, SQLite sets the value of a database handle to NULL when it successfully closes the connection. So you should be able to tell if the handle is 'in use' without any other API calls, just by doing if (ppDb) { // it's open } else { // it's closed } Simon. ___ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] How to check if connection to main database is still open or closed before new query ?
I am trying to find if there is a return value of true false or anything that can tell me that a connection to sqlite database is open or close Can you tell me which function is appropiate for this reason ? Thank you in advance
[sqlite] Using My Own Encryption Possible ?
Thank you for your responces, I am looking for a non commercial way to make my own encrypted database file if it can be done and if it can be easy by using any kind of encryption i prefer with my own script I want to be able to enrypt and manage the database encrypted with my own encryption like SEE commercial use .. thats what i am asking if it is possible From: sqlite-users-bounces at mailinglists.sqlite.org on behalf of Simon Slavin Sent: Monday, February 29, 2016 4:02 PM To: SQLite mailing list Subject: Re: [sqlite] Using My Own Encryption Possible ? On 29 Feb 2016, at 1:28pm, Dominique Devienne wrote: > Can an authorizer really be "abused" that way? You're quite right. It's not useful for this. Thanks for the heads-up. Sorry. Simon. ___ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Using My Own Encryption Possible ?
Hello, Is there a possibility to use my own Encryption for enctrypting the database file or i can use it only for my data being stored ? I am wondering if there is way to get the full database encrypted (database schema) and not only my entered values. If it needs to go through a perpetual way mentioned at sqlite.org or i can use my own for enctrypting the file. Thanks in advance
[sqlite] How to enabled PRAGMA options in c++ app ?
Thank you very much, i was spending hours of trying to make it work and yes it works fine :) Maby you could update your Documentation in the first lines of PRAGMA documents for such unknowldged like me :/ cause this PRAGMA is a bit confusing in some cases for newbies Thank you in advance Simon From: sqlite-users-bounces at mailinglists.sqlite.org on behalf of Simon Slavin Sent: Thursday, February 25, 2016 2:34 AM To: SQLite mailing list Subject: Re: [sqlite] How to enabled PRAGMA options in c++ app ? On 25 Feb 2016, at 12:01am, a a wrote: > PRAGMA secure_delete = true; SQLite's PRAGMA commands should be executed as if they were SQL commands. They are not C or C++ code. In other words you can take whatever program structure you would use to execute CREATE TABLE MyTable (a, b) and use it for the PRAGMA command. You'll probably do it using sqlite3_exec() but you may have other ideas. By the way, since you wrote that you're new to C++ I warn you of a problem. Your project is a C++ project but you have included sqlite3.h and sqlite3.c, and they are C files. So make sure that you have set them as C and not C++ in your project. Depending on which compiler you use, if you don't do this you can run into compilation problems. Simon. ___ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] How to enabled PRAGMA options in c++ app ?
Hi to all, I am new to sqlite and c++ also. I have download the latest source code of amalgamation from sqlite.org and i added the two files of the four into my app (sqlite3.h and sqlite3.c) I have manage to connect use and run anything i liked within my app with sqlite3 and its very easy indeed. I have some missknowledge though and i can`t do by my own some small modifications that i need into my c++ app I can`t define or use this PRAGMA option and especially i want for example to enable the PRAGMA secure_delete = true; I don`t know where or what should i do with this line of code cause by entering it as it is in my main.cpp it doesn`t do anything and has errors. I have tried also with different ways such as SQLITE_SECURE_DELETE = true; #define SQLITE_SECURE_DELETE = true; #define SQLITE_SECURE_DELETE secure_delete = true; #pragma SQLITE_SECURE_DELETE secure_delete = true; No matter how i tried it ends up with errors in my main.cpp or with no secure delete to true, the database after deleting values doesn`t replace with 0. Can anyone give me an example on how and where to use it ?
[sqlite] Names of Indexes (CREATE INDEX)
Do index names need to be different from field names? When doing selects on indexed fields, can I use the field name, or must I use the index name? I just want normal indexes, i'm not looking to create indexes for multiple fields. Can I say: CREATE INDEX x ON t (x); ? or does it have to be: CREATE INDEX index_t_x ON t (x); ? assuming the latter, can I say SELECT * FROM t ORDER BY x; or do I have to say ORDER BY index_t_x; to receive the speed benefit of the index. I tried CREATE INDEX x ON t (x); in SQLite3.exe, and no error was reported, but I don't want to assume anything. This is extremely ambiguous and confusing. I've got enough field names, I don't want to have to start dealing with unique index names as well in SELECT/INSERT/UPDATE queries. Thanks for the help. Feeling very frustrated atm. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] network filesystem + multiple readers question
http://www.sqlite.org/faq.html#q7 states, "You should avoid putting SQLite database files on NFS if multiple processes might try to access the file at the same time." Is that recomendation only intended for cases where one of the processes is a "writer"? Should I avoid the case where there are only multiple "reader" processes accessing a .db file from a network filesystem? The "reader" processes only open .db files, exectue SELECT commands, and close .db files. Thank you for your time. Mike - Do you Yahoo!? Yahoo! Search presents - Jib Jab's 'Second Term'
[sqlite] Thread Checker "Errors"
Hi. I ran Intel's Thread Checker program on a program that uses SQLite. The only "Errors" it found were related to the sqlite_search_count and sqlite3_interrupt_count global variables. I looked at the code, and it seems that those variables are only used for testing particular sections of the library. So, I think that this doesn't matter much, but I was wondering if "#ifdef SQLITE_TEST" lines around the declaration and uses of those global varaibles (and maybe the sqlite3_sort_count) would be a good idea. Mike - Do you Yahoo!? The all-new My Yahoo! What will yours do?
[sqlite] SQLite "single writer"
A program that I wrote eventually continues to return SQLITE_BUSY when it tries to insert a new row into a table, even though I'm pretty sure that at each attempted time of insert (at least when it continually returns SQLITE_BUSY), there are no other SQL commands running. I inserted Sleep(500) after each SQLITE_BUSY return and tried the sqlite3_busy_timeout. I'm using the latest CVS verion of SQLite. There is a thread that inserts rows into tables. There is a thread that selects rows from tables and updates rows in those tables. There is a thread that deletes rows from tables. Each of the the commands (insert, select, update, and delete) always uses its own sqlite3* So, I started looking at the documentation and found that according to: http://www.sqlite.org/cvstrac/wiki?p=SqliteVersusDerby "SQLite allows ... a single writer." I have some questions about that statement. I would like to know if the following cases are supported by SQLite. Single SQLite Database File: Multiple processes accessing the same database file: 1) Each process may attempt to modify the file using SQLite. 2) Each process may attempt to modify the same table. 3) Each process may attempt to modify tables that the other processes may not modify Multiple threads accessing the same database file: 4) Each thread may attempt to modify the file using SQLite. 5) Each thread may attempt to modify the same table 6) Each thread may attempt to modify tables that the other threads may not modify Thank you for your time. Mike - Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers!
[sqlite] blob length SUM command
All, Is there a way to sum the blob lengths from a blob column without adding a "blob length" integer column? Would my architecture be more portable if I just added an integer "blob length" column? Mike - Do you Yahoo!? Yahoo! Mail is new and improved - Check it out!