Re: [sqlite] yet another Unable to open database erro
On Thu, Dec 2, 2010 at 2:28 PM, Puneet Kishorwrote: > > > jason d wrote: >> Hello everyone, >> I have search the web and the mailing list as much as I can for this >> error. Now I come to you for help like always >> >> In my case I am using shell with Sqlite2 and I have double...triple >> checked permissions. >> all other DB files open but there is one that just doesnt anymore. > > "just doesnt anymore" what? What exactly are you doing, and what exactly > is the error? (the emphasis is on "exactly" here). > #sqlite /path/to/dbfile.db Unable to open database dbfile.db > Above you say you tried using "shell with Sqlite2" by which I am > assuming you are referring to the sqlite shell binary. But, below you > mention "php script." Can the db be opened by one and not the other? > Which one what? I mention what the db was used for. please read my initial post again. I tried to use shell from two different system to open the same file to figure out if its a script failure or database. Both are linux 2.6 32 bit systems. First attempt was on the same system as the original php script. I copied the directories+files over using tar->wget->untar ->check permissions on another host. Still the same problem. > > What operating system are you? > > When you type `sqlite ` on the command line, what > is the response? > >> It was working perfectly fine and was used by a php script to store >> session data and user data for a small website. >> I have tried copying the file to other directories, renaming it etc >> and it just won't work. >> >> i have both Sqlite2 and sqlite3 binaries installed on two different >> systems. So I am pretty sure I didn't use the wrong >> sqlite binary to try and access the db file. I mean everythign worked >> just fine until one fine morning ... >> >> What can I do? >> >> thanks >> jason. >> ___ >> 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 > thanks for your help. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] yet another Unable to open database erro
jason d wrote: > Hello everyone, > I have search the web and the mailing list as much as I can for this > error. Now I come to you for help like always > > In my case I am using shell with Sqlite2 and I have double...triple > checked permissions. > all other DB files open but there is one that just doesnt anymore. "just doesnt anymore" what? What exactly are you doing, and what exactly is the error? (the emphasis is on "exactly" here). Above you say you tried using "shell with Sqlite2" by which I am assuming you are referring to the sqlite shell binary. But, below you mention "php script." Can the db be opened by one and not the other? Which one what? What operating system are you? When you type `sqlite ` on the command line, what is the response? > It was working perfectly fine and was used by a php script to store > session data and user data for a small website. > I have tried copying the file to other directories, renaming it etc > and it just won't work. > > i have both Sqlite2 and sqlite3 binaries installed on two different > systems. So I am pretty sure I didn't use the wrong > sqlite binary to try and access the db file. I mean everythign worked > just fine until one fine morning ... > > What can I do? > > thanks > jason. > ___ > 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] yet another Unable to open database erro
Hello everyone, I have search the web and the mailing list as much as I can for this error. Now I come to you for help like always In my case I am using shell with Sqlite2 and I have double...triple checked permissions. all other DB files open but there is one that just doesnt anymore. It was working perfectly fine and was used by a php script to store session data and user data for a small website. I have tried copying the file to other directories, renaming it etc and it just won't work. i have both Sqlite2 and sqlite3 binaries installed on two different systems. So I am pretty sure I didn't use the wrong sqlite binary to try and access the db file. I mean everythign worked just fine until one fine morning ... What can I do? thanks jason. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Select fails even though data is in the table.
It is hard to debug using debugger because the process is reading from a message queue and if I stop at a break point, the message queue will fill up and the process writing to the queue will start having problems. This is a in-memory database so I cannot query from the command line. I tried to create database on the disk but the I/O to disk cannot keep up with the input. Hemant Shah E-mail: hj...@yahoo.com --- On Wed, 12/1/10, Black, Michael (IS)wrote: > From: Black, Michael (IS) > Subject: Re: [sqlite] Select fails even though data is in the table. > To: "General Discussion of SQLite Database" > Date: Wednesday, December 1, 2010, 10:37 AM > To debug set your breakpoint on your > error statement. > Then examine col4 and build the SQL statement yourself > while still at the breakpoint. > Then run the command line shell and execute the SQL and see > what you get. > Theoretically you should see the same problem. > > In order to prove it you may need to build your SQL string > in your program and execute it by itself instead of using > prepared statements -- then you would defintely be comparing > apples-to-apples. You can't really see what the > prepared statement looks like. Then you can print out > the SQL statement that fails and perhaps see what's going > on. > > > > Michael D. Black > Senior Scientist > Advanced Analytics Directorate > Northrop Grumman Information Systems > > > > > From: sqlite-users-boun...@sqlite.org > on behalf of Hemant Shah > Sent: Wed 12/1/2010 10:24 AM > To: General Discussion of SQLite Database > Subject: EXTERNAL:Re: [sqlite] Select fails even though > data is in the table. > > > > This is a single thread/process. No other thread or process > is accessing the data. > > This is a single process that reads data from message queue > and dumps into database to look for duplicate rows. > > The problem occurs for some rows only (about 3 to 5 an > hour). > > > Hemant Shah > E-mail: hj...@yahoo.com > > > --- On Wed, 12/1/10, Jim Morris > wrote: > > > From: Jim Morris > > Subject: Re: [sqlite] Select fails even though data is > in the table. > > To: sqlite-users@sqlite.org > > Date: Wednesday, December 1, 2010, 10:15 AM > > If you have another thread running > > that deletes or modifies the table, > > then move the commit to after the select for duplicate > to > > ensure > > transactional integrity. > > > > On 12/1/2010 8:10 AM, Black, Michael (IS) wrote: > > > The problem is probably in the bind calls that > you are > > not showing. > > > If you care to share them we may be able to > help. > > > > > > Michael D. Black > > > Senior Scientist > > > Advanced Analytics Directorate > > > Northrop Grumman Information Systems > > > > > > > > > > > > > > > From: sqlite-users-boun...@sqlite.org > > on behalf of Hemant Shah > > > Sent: Wed 12/1/2010 10:08 AM > > > To: General Discussion of SQLite Database > > > Subject: EXTERNAL:Re: [sqlite] Select fails even > > though data is in the table. > > > > > > > > > > > > The unique key is col3 and col4 (SeqNum and > MD5Sum). > > > > > > If the insert fails for this unique key then > col4 > > should be the same. > > > It should find the row for the even if I select > for > > col4 only. > > > > > > Hemant Shah > > > E-mail: hj...@yahoo.com > > > > > > > > > > > > > > > > > > > > > ___ > > > 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 > > > > -Inline Attachment Follows- > > ___ > 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
Re: [sqlite] Select fails even though data is in the table.
Duplicate row is because of uniqueness of col3 and col4. I will try to change the code to select for col3 and col4, but I am not sure it would make any difference. Hemant Shah E-mail: hj...@yahoo.com --- On Wed, 12/1/10, Jim Morriswrote: > From: Jim Morris > Subject: Re: [sqlite] Select fails even though data is in the table. > To: sqlite-users@sqlite.org > Date: Wednesday, December 1, 2010, 10:29 AM > I still think you should use the same > columns for searching for the > duplicate that cause the collision. Using > col4 seem problematic. Can > you change the code to use col2 and col3? > > On 12/1/2010 8:24 AM, Hemant Shah wrote: > > This is a single thread/process. No other thread or > process is accessing the data. > > > > This is a single process that reads data from message > queue and dumps into database to look for duplicate rows. > > > > The problem occurs for some rows only (about 3 to 5 an > hour). > > > > > > Hemant Shah > > E-mail: hj...@yahoo.com > > > > > > --- On Wed, 12/1/10, Jim Morris > wrote: > > > >> From: Jim Morris > >> Subject: Re: [sqlite] Select fails even though > data is in the table. > >> To: sqlite-users@sqlite.org > >> Date: Wednesday, December 1, 2010, 10:15 AM > >> If you have another thread running > >> that deletes or modifies the table, > >> then move the commit to after the select for > duplicate to > >> ensure > >> transactional integrity. > >> > >> On 12/1/2010 8:10 AM, Black, Michael (IS) wrote: > >>> The problem is probably in the bind calls that > you are > >> not showing. > >>> If you care to share them we may be able to > help. > >>> > >>> Michael D. Black > >>> Senior Scientist > >>> Advanced Analytics Directorate > >>> Northrop Grumman Information Systems > >>> > >>> > >>> > >>> > >>> From: sqlite-users-boun...@sqlite.org > >> on behalf of Hemant Shah > >>> Sent: Wed 12/1/2010 10:08 AM > >>> To: General Discussion of SQLite Database > >>> Subject: EXTERNAL:Re: [sqlite] Select fails > even > >> though data is in the table. > >>> > >>> > >>> The unique key is col3 and col4 (SeqNum and > MD5Sum). > >>> > >>> If the insert fails for this unique key then > col4 > >> should be the same. > >>> It should find the row for the even if I > select for > >> col4 only. > >>> Hemant Shah > >>> E-mail: hj...@yahoo.com > >>> > >>> > >>> > >>> > >>> > >>> > >>> > ___ > >>> 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 > > > ___ > 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
Re: [sqlite] Select fails even though data is in the table.
Here is the snippet of the code: int InsertIntoDatabase(char *TimeStamp, int Source, u_int32_t SeqNum, char *MD5Sum) { int ReturnCode; sqlite3_stmt *InsertStmtHandle; strcpy(SqlString, "INSERT INTO mytable(TimeStamp, col2, col3, col4) VALUES (?,?,?,?)"); ReturnCode = sqlite3_prepare_v2(DbHandle, SqlString, -1, , NULL); if (ReturnCode != SQLITE_OK || InsertStmtHandle == NULL) { sqlite3_reset(InsertStmtHandle); printf("Cannot prepare insert statement. %s\n", sqlite3_errmsg(DbHandle)); return(2); } ReturnCode = sqlite3_bind_text(InsertStmtHandle, 1, TimeStamp, -1, SQLITE_TRANSIENT); if (ReturnCode != SQLITE_OK) { sqlite3_reset(InsertStmtHandle); printf("Error binding insert statement 1. ReturnCode: %d, Error Message:%s, Error Code: %d\n", ReturnCode, sqlite3_errmsg(DbHandle), sqlite3_errcode(DbHandle)); return(2); } ReturnCode = sqlite3_bind_int(InsertStmtHandle, 2, Source); if (ReturnCode != SQLITE_OK) { sqlite3_reset(InsertStmtHandle); printf("Error binding insert statement 2. ReturnCode: %d, Error Message:%s, Error Code: %d\n", ReturnCode, sqlite3_errmsg(DbHandle), sqlite3_errcode(DbHandle)); return(2); } ReturnCode = sqlite3_bind_int(InsertStmtHandle, 3, SeqNum); if (ReturnCode != SQLITE_OK) { sqlite3_reset(InsertStmtHandle); printf("Error binding insert statement 3. ReturnCode: %d, Error Message:%s, Error Code: %d\n", ReturnCode, sqlite3_errmsg(DbHandle), sqlite3_errcode(DbHandle)); return(2); } ReturnCode = sqlite3_bind_text(InsertStmtHandle, 4, MD5Sum, -1, SQLITE_TRANSIENT); if (ReturnCode != SQLITE_OK) { sqlite3_reset(InsertStmtHandle); printf("Error binding insert statement 4. ReturnCode: %d, Error Message:%s, Error Code: %d\n", ReturnCode, sqlite3_errmsg(DbHandle), sqlite3_errcode(DbHandle)); return(2); } ReturnCode = sqlite3_step(InsertStmtHandle); if (ReturnCode != SQLITE_DONE) { sqlite3_reset(InsertStmtHandle); if (sqlite3_errcode(DbHandle) == SQLITE_CONSTRAINT) { /* * Duplicate row. */ sqlite3_finalize(InsertStmtHandle); sqlite3_exec(DbHandle, "COMMIT", NULL, NULL, NULL); return(1); } else { /* * Other error. */ printf("Cannot insert into database. %s\n", sqlite3_errmsg(DbHandle)); sqlite3_finalize(InsertStmtHandle); sqlite3_exec(DbHandle, "COMMIT", NULL, NULL, NULL); return(2); } } sqlite3_finalize(InsertStmtHandle); sqlite3_exec(DbHandle, "COMMIT", NULL, NULL, NULL); return(0); } int GetMessageFromDB(char *MD5Sum, struct ReceiveNode *FromDb) { int ReturnCode; sqlite3_stmt *SelectStmtHandle; strcpy(SqlString, "SELECT TimeStamp, col2, col3, col4 FROM mytable WHERE col4 = ?"); ReturnCode = sqlite3_prepare_v2(DbHandle, SqlString, -1, , NULL); if (ReturnCode != SQLITE_OK || SelectStmtHandle == NULL) { sqlite3_reset(SelectStmtHandle); printf("Cannot prepare select statement. %s\n", sqlite3_errmsg(DbHandle)); return(2); } ReturnCode = sqlite3_bind_text(SelectStmtHandle, 1, MD5Sum, -1, SQLITE_TRANSIENT); if (ReturnCode != SQLITE_OK) { sqlite3_reset(SelectStmtHandle); printf("Error binding select statement. ReturnCode: %d, Error Message:%s, Error Code: %d\n", ReturnCode, sqlite3_errmsg(DbHandle), sqlite3_errcode(DbHandle)); return(2); } ReturnCode = sqlite3_step(SelectStmtHandle); if (ReturnCode != SQLITE_ROW) { sqlite3_reset(SelectStmtHandle); printf("Row not found. ReturnCode: %d, Error Message:%s, Error Code: %d\n", ReturnCode, sqlite3_errmsg(DbHandle), sqlite3_errcode(DbHandle)); return(2); } /* Copy data to FromDb structure) */ sqlite3_finalize(SelectStmtHandle); return(1); } /* Main */ if (InsertIntoDatabase(TimeStamp, Source, SeqNum, MD5Sum) == 1) { if (GetMessageFromDB(MD5Sum, ) == 1) { /* print message */ } else { /* print error message */ } } Hemant Shah E-mail: hj...@yahoo.com --- On Wed, 12/1/10, Black, Michael (IS)wrote: > From: Black, Michael (IS) > Subject: Re: [sqlite] Select fails even though data is in the table. > To: "General Discussion of SQLite Database" > Date: Wednesday, December 1, 2010, 10:23 AM > If you bind the wrong thing the wrong > way the return code doesn't matter. > > Any particular reason you can't just show us the whole code > section? > > Michael D. Black > Senior Scientist > Advanced Analytics Directorate > Northrop Grumman Information Systems > > > > > From: sqlite-users-boun...@sqlite.org > on behalf of Hemant Shah > Sent: Wed 12/1/2010 10:21 AM >
Re: [sqlite] Just compiled SQLite in Visual Studio
Hello Bob, "In general, I guess that C++ is essentially the C language with a whole lot added. " If you ignore the silly minutia then this is true. My application is a mix of C and C++ all compiled with VC10. C for legacy code, C++ for the stuff I write. Most of the time I have my C code partitioned into it's own library so, I can change the build environment specifically for that libary. C Wednesday, December 1, 2010, 11:26:39 AM, you wrote: BK> Igor, BK> BK> You seemed to say that the only difference between C and C++ was BK> the ending (.c versus whatever C++ uses), but that understanding BK> of what you said was more a result of my ignorance of C and C++. BK> Someone pointed out that, if I've gotten this right, in Visual BK> Studio the ending controls how the written program is compiled. BK> BK> In general, I guess that C++ is essentially the C language with a BK> whole lot added. I'm probably wrong on that interpretation of what BK> was said, but at least I do now understand that C and C++ are not BK> the same. Am I still misinterpreting this whole thread? BK> BK> Bob Keeland BK> Forest Dynamics, Inc. BK> --- On Tue, 11/30/10, Igor Tandetnikwrote: BK> From: Igor Tandetnik BK> Subject: Re: [sqlite] Just compiled SQLite in Visual Studio BK> To: sqlite-users@sqlite.org BK> Date: Tuesday, November 30, 2010, 8:06 PM BK> Bob Keeland wrote: >> Oh, from the various replies I see that C++ is a more capable extension of >> C. Igor was only using a figure of speech, kind of. BK> Everything I said in this thread so far, I meant quite literally. BK> Which expression of mine do you take as a figure of speech? -- Best regards, Tegmailto:t...@djii.com ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Cross-compiling SQLite for Blackfin+uClinux?
I don't think you need to do the LDFLAGS thing... gcc -O2 -fpic -shared -Wl,-soname,sqlite3.so -o sqlite3.so sqlite3.c Works fine for me. Though I'm not using the Blackfin compiler... Michael D. Black Senior Scientist Advanced Analytics Directorate Northrop Grumman Information Systems From: sqlite-users-boun...@sqlite.org on behalf of Gilles Ganault Sent: Wed 12/1/2010 10:57 AM To: sqlite-users@sqlite.org Subject: EXTERNAL:Re: [sqlite] Cross-compiling SQLite for Blackfin+uClinux? On Wed, 01 Dec 2010 17:28:29 +0100, Gilles Ganaultwrote: >Any help appreciated on cross-compiling SQLite using the Autoconf >tool. Without necessarily knowing what I'm doing, the following does compile without errors: CC="/opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/bin/gcc" CFLAGS="-pedantic -Wall -O2 -fpic" LDFLAGS="-shared -fpic -Wl,-soname,sqlite3.so" ./configure --host=bfin --disable-readline However, while .libs/libsqlite3.a (508.402 bytes) and ./sqlite3 (603.161 bytes) look nice, ./sqlite3.so is only 9308 bytes. There's something fishy :-/ ___ 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
Re: [sqlite] Cross-compiling SQLite for Blackfin+uClinux?
On Wed, 01 Dec 2010 17:28:29 +0100, Gilles Ganaultwrote: >Any help appreciated on cross-compiling SQLite using the Autoconf >tool. Without necessarily knowing what I'm doing, the following does compile without errors: CC="/opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/bin/gcc" CFLAGS="-pedantic -Wall -O2 -fpic" LDFLAGS="-shared -fpic -Wl,-soname,sqlite3.so" ./configure --host=bfin --disable-readline However, while .libs/libsqlite3.a (508.402 bytes) and ./sqlite3 (603.161 bytes) look nice, ./sqlite3.so is only 9308 bytes. There's something fishy :-/ ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Select fails even though data is in the table.
To debug set your breakpoint on your error statement. Then examine col4 and build the SQL statement yourself while still at the breakpoint. Then run the command line shell and execute the SQL and see what you get. Theoretically you should see the same problem. In order to prove it you may need to build your SQL string in your program and execute it by itself instead of using prepared statements -- then you would defintely be comparing apples-to-apples. You can't really see what the prepared statement looks like. Then you can print out the SQL statement that fails and perhaps see what's going on. Michael D. Black Senior Scientist Advanced Analytics Directorate Northrop Grumman Information Systems From: sqlite-users-boun...@sqlite.org on behalf of Hemant Shah Sent: Wed 12/1/2010 10:24 AM To: General Discussion of SQLite Database Subject: EXTERNAL:Re: [sqlite] Select fails even though data is in the table. This is a single thread/process. No other thread or process is accessing the data. This is a single process that reads data from message queue and dumps into database to look for duplicate rows. The problem occurs for some rows only (about 3 to 5 an hour). Hemant Shah E-mail: hj...@yahoo.com --- On Wed, 12/1/10, Jim Morriswrote: > From: Jim Morris > Subject: Re: [sqlite] Select fails even though data is in the table. > To: sqlite-users@sqlite.org > Date: Wednesday, December 1, 2010, 10:15 AM > If you have another thread running > that deletes or modifies the table, > then move the commit to after the select for duplicate to > ensure > transactional integrity. > > On 12/1/2010 8:10 AM, Black, Michael (IS) wrote: > > The problem is probably in the bind calls that you are > not showing. > > If you care to share them we may be able to help. > > > > Michael D. Black > > Senior Scientist > > Advanced Analytics Directorate > > Northrop Grumman Information Systems > > > > > > > > > > From: sqlite-users-boun...@sqlite.org > on behalf of Hemant Shah > > Sent: Wed 12/1/2010 10:08 AM > > To: General Discussion of SQLite Database > > Subject: EXTERNAL:Re: [sqlite] Select fails even > though data is in the table. > > > > > > > > The unique key is col3 and col4 (SeqNum and MD5Sum). > > > > If the insert fails for this unique key then col4 > should be the same. > > It should find the row for the even if I select for > col4 only. > > > > Hemant Shah > > E-mail: hj...@yahoo.com > > > > > > > > > > > > > > ___ > > 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 ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Select fails even though data is in the table.
I still think you should use the same columns for searching for the duplicate that cause the collision. Using col4 seem problematic. Can you change the code to use col2 and col3? On 12/1/2010 8:24 AM, Hemant Shah wrote: > This is a single thread/process. No other thread or process is accessing the > data. > > This is a single process that reads data from message queue and dumps into > database to look for duplicate rows. > > The problem occurs for some rows only (about 3 to 5 an hour). > > > Hemant Shah > E-mail: hj...@yahoo.com > > > --- On Wed, 12/1/10, Jim Morriswrote: > >> From: Jim Morris >> Subject: Re: [sqlite] Select fails even though data is in the table. >> To: sqlite-users@sqlite.org >> Date: Wednesday, December 1, 2010, 10:15 AM >> If you have another thread running >> that deletes or modifies the table, >> then move the commit to after the select for duplicate to >> ensure >> transactional integrity. >> >> On 12/1/2010 8:10 AM, Black, Michael (IS) wrote: >>> The problem is probably in the bind calls that you are >> not showing. >>> If you care to share them we may be able to help. >>> >>> Michael D. Black >>> Senior Scientist >>> Advanced Analytics Directorate >>> Northrop Grumman Information Systems >>> >>> >>> >>> >>> From: sqlite-users-boun...@sqlite.org >> on behalf of Hemant Shah >>> Sent: Wed 12/1/2010 10:08 AM >>> To: General Discussion of SQLite Database >>> Subject: EXTERNAL:Re: [sqlite] Select fails even >> though data is in the table. >>> >>> >>> The unique key is col3 and col4 (SeqNum and MD5Sum). >>> >>> If the insert fails for this unique key then col4 >> should be the same. >>> It should find the row for the even if I select for >> col4 only. >>> Hemant Shah >>> E-mail: hj...@yahoo.com >>> >>> >>> >>> >>> >>> >>> ___ >>> 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 > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Cross-compiling SQLite for Blackfin+uClinux?
Hello I need to cross-compile SQLite on an x86 Ubuntu host for a device using the Blackfin CPU and the uClinux distribution. I downloaded sqlite-amalgamation-3.7.3.tar.gz, since it's "the recommended source distribution for all Unix and Unix-like platforms". Then, I read the README and INSTALL, but am a bit lost at wether to use both the --build and --host variables, and what to use as settings. "config.sub" contains a reference to "bfin". Likewise, I don't really know what variables to pass to ./configure. Any help appreciated on cross-compiling SQLite using the Autoconf tool. Thank you. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Just compiled SQLite in Visual Studio
Igor, You seemed to say that the only difference between C and C++ was the ending (.c versus whatever C++ uses), but that understanding of what you said was more a result of my ignorance of C and C++. Someone pointed out that, if I've gotten this right, in Visual Studio the ending controls how the written program is compiled. In general, I guess that C++ is essentially the C language with a whole lot added. I'm probably wrong on that interpretation of what was said, but at least I do now understand that C and C++ are not the same. Am I still misinterpreting this whole thread? Bob Keeland Forest Dynamics, Inc. --- On Tue, 11/30/10, Igor Tandetnikwrote: From: Igor Tandetnik Subject: Re: [sqlite] Just compiled SQLite in Visual Studio To: sqlite-users@sqlite.org Date: Tuesday, November 30, 2010, 8:06 PM Bob Keeland wrote: > Oh, from the various replies I see that C++ is a more capable extension of C. > Igor was only using a figure of speech, kind of. Everything I said in this thread so far, I meant quite literally. Which expression of mine do you take as a figure of speech? -- Igor Tandetnik ___ 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
Re: [sqlite] Select fails even though data is in the table.
This is a single thread/process. No other thread or process is accessing the data. This is a single process that reads data from message queue and dumps into database to look for duplicate rows. The problem occurs for some rows only (about 3 to 5 an hour). Hemant Shah E-mail: hj...@yahoo.com --- On Wed, 12/1/10, Jim Morriswrote: > From: Jim Morris > Subject: Re: [sqlite] Select fails even though data is in the table. > To: sqlite-users@sqlite.org > Date: Wednesday, December 1, 2010, 10:15 AM > If you have another thread running > that deletes or modifies the table, > then move the commit to after the select for duplicate to > ensure > transactional integrity. > > On 12/1/2010 8:10 AM, Black, Michael (IS) wrote: > > The problem is probably in the bind calls that you are > not showing. > > If you care to share them we may be able to help. > > > > Michael D. Black > > Senior Scientist > > Advanced Analytics Directorate > > Northrop Grumman Information Systems > > > > > > > > > > From: sqlite-users-boun...@sqlite.org > on behalf of Hemant Shah > > Sent: Wed 12/1/2010 10:08 AM > > To: General Discussion of SQLite Database > > Subject: EXTERNAL:Re: [sqlite] Select fails even > though data is in the table. > > > > > > > > The unique key is col3 and col4 (SeqNum and MD5Sum). > > > > If the insert fails for this unique key then col4 > should be the same. > > It should find the row for the even if I select for > col4 only. > > > > Hemant Shah > > E-mail: hj...@yahoo.com > > > > > > > > > > > > > > ___ > > 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
Re: [sqlite] Select fails even though data is in the table.
If you bind the wrong thing the wrong way the return code doesn't matter. Any particular reason you can't just show us the whole code section? Michael D. Black Senior Scientist Advanced Analytics Directorate Northrop Grumman Information Systems From: sqlite-users-boun...@sqlite.org on behalf of Hemant Shah Sent: Wed 12/1/2010 10:21 AM To: General Discussion of SQLite Database Subject: EXTERNAL:Re: [sqlite] Select fails even though data is in the table. I check for the return code after each bind call and if it is not SQLITE_OK then I return with error. So I do not think it is a bind problem. Hemant Shah E-mail: hj...@yahoo.com ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Select fails even though data is in the table.
I check for the return code after each bind call and if it is not SQLITE_OK then I return with error. So I do not think it is a bind problem. Hemant Shah E-mail: hj...@yahoo.com --- On Wed, 12/1/10, Black, Michael (IS)wrote: > From: Black, Michael (IS) > Subject: Re: [sqlite] Select fails even though data is in the table. > To: "General Discussion of SQLite Database" > Date: Wednesday, December 1, 2010, 10:10 AM > The problem is probably in the bind > calls that you are not showing. > If you care to share them we may be able to help. > > Michael D. Black > Senior Scientist > Advanced Analytics Directorate > Northrop Grumman Information Systems > > > > > From: sqlite-users-boun...@sqlite.org > on behalf of Hemant Shah > Sent: Wed 12/1/2010 10:08 AM > To: General Discussion of SQLite Database > Subject: EXTERNAL:Re: [sqlite] Select fails even though > data is in the table. > > > > The unique key is col3 and col4 (SeqNum and MD5Sum). > > If the insert fails for this unique key then col4 should be > the same. > It should find the row for the even if I select for col4 > only. > > Hemant Shah > E-mail: hj...@yahoo.com > > > > > > -Inline Attachment Follows- > > ___ > 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
Re: [sqlite] Select fails even though data is in the table.
If you have another thread running that deletes or modifies the table, then move the commit to after the select for duplicate to ensure transactional integrity. On 12/1/2010 8:10 AM, Black, Michael (IS) wrote: > The problem is probably in the bind calls that you are not showing. > If you care to share them we may be able to help. > > Michael D. Black > Senior Scientist > Advanced Analytics Directorate > Northrop Grumman Information Systems > > > > > From: sqlite-users-boun...@sqlite.org on behalf of Hemant Shah > Sent: Wed 12/1/2010 10:08 AM > To: General Discussion of SQLite Database > Subject: EXTERNAL:Re: [sqlite] Select fails even though data is in the table. > > > > The unique key is col3 and col4 (SeqNum and MD5Sum). > > If the insert fails for this unique key then col4 should be the same. > It should find the row for the even if I select for col4 only. > > Hemant Shah > E-mail: hj...@yahoo.com > > > > > > > ___ > 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
Re: [sqlite] Select fails even though data is in the table.
The problem is probably in the bind calls that you are not showing. If you care to share them we may be able to help. Michael D. Black Senior Scientist Advanced Analytics Directorate Northrop Grumman Information Systems From: sqlite-users-boun...@sqlite.org on behalf of Hemant Shah Sent: Wed 12/1/2010 10:08 AM To: General Discussion of SQLite Database Subject: EXTERNAL:Re: [sqlite] Select fails even though data is in the table. The unique key is col3 and col4 (SeqNum and MD5Sum). If the insert fails for this unique key then col4 should be the same. It should find the row for the even if I select for col4 only. Hemant Shah E-mail: hj...@yahoo.com ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Select fails even though data is in the table.
The unique key is col3 and col4 (SeqNum and MD5Sum). If the insert fails for this unique key then col4 should be the same. It should find the row for the even if I select for col4 only. Hemant Shah E-mail: hj...@yahoo.com --- On Wed, 12/1/10, Jim Morriswrote: > From: Jim Morris > Subject: Re: [sqlite] Select fails even though data is in the table. > To: sqlite-users@sqlite.org > Date: Wednesday, December 1, 2010, 9:38 AM > Why are you looking for a duplicate > with col4 instead of the unique key, > col2, col3 that caused the collision? > > On 12/1/2010 7:29 AM, Hemant Shah wrote: > > Folks, > > > > My C program creates a in-memory database. It creates > a table and a unique index on two columns. If the insert > fails due to unique index, it prints old row and new row. > Sometimes it cannot find the old row even though the insert > failed. > > > > Here is the pseudo code: > > > > CreateStmt = “create table mytable (TimeStamp > char[50], col2 [char 10], col3 int, col4 char[33]”; > > sqlite3_exec(CreateStmt) > > > > IndexStmt = “create unique index myidx (col3 asc, > col4 asc)”; > > sqlite3_exec(IndexStmt); > > > > InsertStmt = “insert into mytable (TimeStamp, col2, > col3, col4) values (?,?,?,?)”; > > sqlite3_prepare_v2(InsertStmt) > > sqlite3_bind calls for each column > > ReturnCode = sqlite3_step(InsertStmtHandle); > > if (ReturnCode != SQLITE_DONE) > > { > > > sqlite3_reset(InsertStmtHandle); > > if (sqlite3_errcode(DbHandle) > == SQLITE_CONSTRAINT) > > { > > /* duplicate row */ > > > sqlite3_finalize(InsertStmtHandle); > > sqlite3_exec(DbHandle, > "COMMIT", NULL, NULL, NULL); > > > > > > SelectStmt = “select > TimeStamp, col2, col3, col4 from mytable where col4 = ?”; > > > sqlite3_prepare_v2(SelectStmt) > > sqlite3_bind calls > > ReturnCode = > sqlite3_step(SelectStmtHandle); > > if (ReturnCode != > SQLITE_ROW) > > { > > > sqlite3_reset(SelectStmtHandle); > > > printf("Row not found. ReturnCode: %d, > Error Message:%s, Error Code: %d\n", ReturnCode, > sqlite3_errmsg(DbHandle), sqlite3_errcode(DbHandle)); > > } > > else > > { > > /* print > row */ > > } > > } > > else > > { > > /* other error > > } > > } > > > > > > The program prints ReturnCode as 101 which is > SQLITE_DONE and error messages is “No error message”, > errcode is 0. > > > > If the insert statement failed because of duplicate > row, then why did it not find the old row? > > > > This only happens for some of the rows. > > > > I am inserting rows at very high rate (about every 50 > microseconds) and only keep one minute worth of data in the > table. > > > > How do I debug/fix this problem? > > > > Thanks. > > > > > > > > Hemant Shah > > E-mail: hj...@yahoo.com > > > > > > > > ___ > > 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
Re: [sqlite] Just compiled SQLite in Visual Studio
Igor Tandetnik wrote: > Chris Wolfwrote: > >> It depends on your definition of "object". I hate to nit-pick, but for >> me, "object" may >> contain data or code or both data and code. So with this definition, C >> implements objects >> without code. >> > > Is there really a fundamental difference between > > struct X { > int data; > void DoSomething(); > }; > X x; > x.DoSomething(); > > and > > struct X { > int data; > }; > void X_DoSomething(X* pThis); > X x; > X_DoSomething(); > > I bet both fragmens would produce nearly identical machine code. In this very > simple case, even syntactical sugar sprinkled over the first fragment doesn't > seem to make a huge difference. Of course, once you get into virtual > functions and multiple inheritance and so on, simulating equivalent behavior > in C gets progressively more unwieldly With GNU, you can investigate via "g++/gcc -O0 -no-dead-strip -S foo.c", but unless you use the structure, the compiler won't instantiate an instance even with -O0 and -no-dead-strip. In any case, even without virtual functions, at the machine code level, there's still name mangling and calling convention differences. > (but still possible: in fact, compilers exist that take C++ code and produce > equivalent C code). > Yes, I dabbled with one called CFront from AT on Sun-3 back in the 80's. -Chris ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Just compiled SQLite in Visual Studio
On Wed, Dec 01, 2010 at 03:49:40AM -0500, Chris Wolf scratched on the wall: > It depends on your definition of "object". I hate to nit-pick, but for > me, "object" may contain data or code or both data and code. So with > this definition, C implements objects without code. C++ classes don't "contain" code any more than structs do. The language has syntax that allows the method declarations (but not definitions) to be linked, but it isn't like a class instance has compiled code inside of it. The function definitions aren't even within the class definition... class methods are defined as stand-alone top-level functions with the linker taking care of all the details. Besides, it is easy enough to put function pointers into a struct. Plenty of us were doing that for years, long before C++ started to gain ground. This is more or less how virtual methods are implemented anyways. Yes, you have to initialize the pointers manually, but the same is true of the data values in a struct-- or classes for that matter. The only difference is that you have to remember to manually call your init function in C. Using function pointers also allows redefinition of methods on the fly without re-instancing an object, essentially giving the ability to morph an object from one class type to another type in-place. It is unfortunate that the C/C++ function pointer syntax is so odd. It scares a lot of people away from a very powerful tool that can be used for all kinds of generic programming. It's also worth pointing out that, while objects are core to the C++ language, I don't think anyone with wide experience in high-level object oriented languages would consider C++ to be a particularly representational OO language. If C++ is your primary exposure to an OO language, you are likely to have a somewhat twisted view of what OO is all about. In many ways, C++ is to OO as SQL is to the Relational Model. Close, but not quite, in so many small but important ways. [And with that reference, this post has something to do with databases!] -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Select fails even though data is in the table.
Why are you looking for a duplicate with col4 instead of the unique key, col2, col3 that caused the collision? On 12/1/2010 7:29 AM, Hemant Shah wrote: > Folks, > > My C program creates a in-memory database. It creates a table and a unique > index on two columns. If the insert fails due to unique index, it prints old > row and new row. Sometimes it cannot find the old row even though the insert > failed. > > Here is the pseudo code: > > CreateStmt = “create table mytable (TimeStamp char[50], col2 [char 10], col3 > int, col4 char[33]”; > sqlite3_exec(CreateStmt) > > IndexStmt = “create unique index myidx (col3 asc, col4 asc)”; > sqlite3_exec(IndexStmt); > > InsertStmt = “insert into mytable (TimeStamp, col2, col3, col4) values > (?,?,?,?)”; > sqlite3_prepare_v2(InsertStmt) > sqlite3_bind calls for each column > ReturnCode = sqlite3_step(InsertStmtHandle); > if (ReturnCode != SQLITE_DONE) > { > sqlite3_reset(InsertStmtHandle); > if (sqlite3_errcode(DbHandle) == SQLITE_CONSTRAINT) > { >/* duplicate row */ >sqlite3_finalize(InsertStmtHandle); >sqlite3_exec(DbHandle, "COMMIT", NULL, NULL, NULL); > > >SelectStmt = “select TimeStamp, col2, col3, col4 from mytable where > col4 = ?”; >sqlite3_prepare_v2(SelectStmt) >sqlite3_bind calls >ReturnCode = sqlite3_step(SelectStmtHandle); >if (ReturnCode != SQLITE_ROW) >{ > sqlite3_reset(SelectStmtHandle); > printf("Row not found. ReturnCode: %d, Error Message:%s, Error > Code: %d\n", ReturnCode, sqlite3_errmsg(DbHandle), sqlite3_errcode(DbHandle)); >} >else >{ > /* print row */ >} > } > else > { >/* other error > } > } > > > The program prints ReturnCode as 101 which is SQLITE_DONE and error messages > is “No error message”, errcode is 0. > > If the insert statement failed because of duplicate row, then why did it not > find the old row? > > This only happens for some of the rows. > > I am inserting rows at very high rate (about every 50 microseconds) and only > keep one minute worth of data in the table. > > How do I debug/fix this problem? > > Thanks. > > > > Hemant Shah > E-mail: hj...@yahoo.com > > > > ___ > 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] Select fails even though data is in the table.
Folks, My C program creates a in-memory database. It creates a table and a unique index on two columns. If the insert fails due to unique index, it prints old row and new row. Sometimes it cannot find the old row even though the insert failed. Here is the pseudo code: CreateStmt = “create table mytable (TimeStamp char[50], col2 [char 10], col3 int, col4 char[33]”; sqlite3_exec(CreateStmt) IndexStmt = “create unique index myidx (col3 asc, col4 asc)”; sqlite3_exec(IndexStmt); InsertStmt = “insert into mytable (TimeStamp, col2, col3, col4) values (?,?,?,?)”; sqlite3_prepare_v2(InsertStmt) sqlite3_bind calls for each column ReturnCode = sqlite3_step(InsertStmtHandle); if (ReturnCode != SQLITE_DONE) { sqlite3_reset(InsertStmtHandle); if (sqlite3_errcode(DbHandle) == SQLITE_CONSTRAINT) { /* duplicate row */ sqlite3_finalize(InsertStmtHandle); sqlite3_exec(DbHandle, "COMMIT", NULL, NULL, NULL); SelectStmt = “select TimeStamp, col2, col3, col4 from mytable where col4 = ?”; sqlite3_prepare_v2(SelectStmt) sqlite3_bind calls ReturnCode = sqlite3_step(SelectStmtHandle); if (ReturnCode != SQLITE_ROW) { sqlite3_reset(SelectStmtHandle); printf("Row not found. ReturnCode: %d, Error Message:%s, Error Code: %d\n", ReturnCode, sqlite3_errmsg(DbHandle), sqlite3_errcode(DbHandle)); } else { /* print row */ } } else { /* other error } } The program prints ReturnCode as 101 which is SQLITE_DONE and error messages is “No error message”, errcode is 0. If the insert statement failed because of duplicate row, then why did it not find the old row? This only happens for some of the rows. I am inserting rows at very high rate (about every 50 microseconds) and only keep one minute worth of data in the table. How do I debug/fix this problem? Thanks. Hemant Shah E-mail: hj...@yahoo.com ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Just compiled SQLite in Visual Studio
Chris Wolfwrote: > It depends on your definition of "object". I hate to nit-pick, but for > me, "object" may > contain data or code or both data and code. So with this definition, C > implements objects > without code. Is there really a fundamental difference between struct X { int data; void DoSomething(); }; X x; x.DoSomething(); and struct X { int data; }; void X_DoSomething(X* pThis); X x; X_DoSomething(); I bet both fragmens would produce nearly identical machine code. In this very simple case, even syntactical sugar sprinkled over the first fragment doesn't seem to make a huge difference. Of course, once you get into virtual functions and multiple inheritance and so on, simulating equivalent behavior in C gets progressively more unwieldly (but still possible: in fact, compilers exist that take C++ code and produce equivalent C code). -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Fwd: [sqlite-dev] SQLIte 64bit precompiled libraries for Windows
On 1 Dec 2010, at 5:15am, Saar Carmi wrote: > Is there anyone publishing stable version of precompiled binaries of sqlite > for Windows 64-bit ? > I understand from the below sqlite.org doesn't, but there maybe another > site? SQLite comprises .c and .h files to be compiled into your own applications. There's no standalone application, or a stand-alone library to be made. So there are no pre-compiled binaries /per se/. However, there's a command-line tool, and a bunch of Windows users might decide on some standard library (dynamic or not) format for using SQLite. There's nothing to stop you doing that, it's just not part of the design. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Just compiled SQLite in Visual Studio
>From: john darnell>Date: Mon, 29 Nov 2010 17:10:04 -0600 > >I just added it to a Visual Studio 8 project, turned off the use of >precompiled >headers (the project is a C++ project) and compiled the SQLite.c >file without >any errors. Is it really that easy, or am I about ready to be hit by a Mac >truck filled with bugaboos? I believe it is that easy. I have been using SQLite 3.6.23 and now 3.7.3 with VS2008 and VS2010 in both 32 and 64 bit applications for a while now with no issues. I have a number of use case with multiple applications (on same machine) in same db file with no issue as long as writer is not too fast. I understand there is a test suite that you can run to test your build of sqlite. I have never run it. I only test the feature functionality of my applications with the assumption that SQLite will work correctly. It hasn't let me down yet. Jeff ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Just compiled SQLite in Visual Studio
Doug wrote: > Igore didn't mean there is no difference between C and C++. He was just > saying a 'project' isn't C or C++. In other words, C and C++ have different > (though similar) compiler rules, syntax, etc. By default, the compiler will > compile a '.c' file using the C rules, and a '.cpp' file with the C++ rules. > And you can mix .c and .cpp files in the same project. > > As for what the difference is? That's a big question. Objects exist in > C++, and they don't in C. That's the tip of the iceberg. > Doug > It depends on your definition of "object". I hate to nit-pick, but for me, "object" may contain data or code or both data and code. So with this definition, C implements objects without code. For example, in C, a "struct" is a template used to instantiate objects which only implement data, whereas in C++, a "struct" is a template used to instantiate objects which implements both data and code. You can just replace the "class" keyword with "struct": Compiles only with C++: struct foo { int a; void m() {int b=0; b++;} }; Compiles with both C and C++ compilers: struct foo { int a; /*void m() {int b=0; b++;}*/ }; Of course, in addition to template classes, C++ has (generic) class templates and many other features, as you stated. -Chris > -Original Message- > From: sqlite-users-boun...@sqlite.org > [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Bob Keeland > Sent: Tuesday, November 30, 2010 5:02 PM > To: General Discussion of SQLite Database > Subject: Re: [sqlite] Just compiled SQLite in Visual Studio > > OK then I have a newbee question that is actually out of the scope of > SQLite. If the only difference between C and C++ is the file extension, then > what is the difference between C and C++? I'm thinking of adding a language > other than the Visual Basic that I kind of know and would like to know the > difference. I've been thinking about Java, but am not sure yet. > Bob Keeland > > --- On Tue, 11/30/10, john darnellwrote: > > > From: john darnell > Subject: Re: [sqlite] Just compiled SQLite in Visual Studio > To: "General Discussion of SQLite Database" > Date: Tuesday, November 30, 2010, 10:25 AM > > > Thanks Igor. > > -Original Message- > From: sqlite-users-boun...@sqlite.org > [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Igor Tandetnik > Sent: Monday, November 29, 2010 7:11 PM > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] Just compiled SQLite in Visual Studio > > john darnell wrote: > >> I just added it to a Visual Studio 8 project, turned off the use of >> precompiled headers (the project is a C++ project) and compiled the >> > SQLite.c file without any errors. > > There is no such thing as a C++ project. A project in Visual Studio can > happily contain both C and C++ files. By default, file extension determines > whether the file is compiled with C or C++ compiler (.c would indicate C), > and this could also be overridden in project settings on a per-file basis. > -- > Igor Tandetnik > > ___ > 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 > > __ Information from ESET NOD32 Antivirus, version of virus signature > database 5662 (20101130) __ > > The message was checked by ESET NOD32 Antivirus. > > http://www.eset.com > > > > > > ___ > 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