Re: [sqlite] Peculiar activity in an SQLite-using InDesign plug-in on the Macintosh
Not that I think they're the problem, but just for completeness, do some error reporting on _initialize and _open and _prepare too. Simon. Sigh. I removed the error checking from the email because I am of the same opinion, and because I wanted to provide as simple a piece of code as I could. Thanks for what help you gave. It pointed me in the right direction, I think. John ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Peculiar activity in an SQLite-using InDesign plug-in on the Macintosh
Thanks for what help you gave. It pointed me in the right direction, I think. Simon: The problem is resolved. It turns out that I was calling a function to save data to a child table. That function had a prepare statement that had never been finalized. Though it's embarrassing to admit my dumb mistakes, I kinda feel like you deserve to know since you provided so much assistance. Thanks again, and if you are ever in Brookfield, MO, lunch is on me. R, John ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Peculiar activity in an SQLite-using InDesign plug-in on the Macintosh
Hello people. I apologize for the vagueness of this email, but all I can really hope for is some ideas to pursue, I think. I have an InDesign plug-in that scans numerous InDesign documents (there are no limits, but a common number would be around 100) for certain names and stores that information plus the page number in an SQLite table. Each record is stored as it is found so there is no massive storage even at the end of a block or anything. The name of the DB file I use is IndexData.db. On certain versions (but not all versions) of the plugin, during the processing, an IndexData.db-Journal file is created. It is always empty at the end of a run. I have had several instances where I scan several documents and build up, say, 1000 records in my SQLite table. I then select several more documents for scanning and the number of records are halved in my SQLite table. This is always associated with the advent of a system File Open dialog that is empty of all files in the folder I am working, when it should have between 60 and 100 files. Has anyone working a Mac ever experienced something like this? John A.M. Darnell Senior Programmer john.darn...@walsworth.com 660.258.2104 ext.4108 OFFICE www.walsworth.com ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Peculiar activity in an SQLite-using InDesign plug-in on the Macintosh
I'm not sure where you close your database handle, and what you mean by 'end of a run', but when you have used sqlite3_close() to close all handles to a SQLite database that file should no longer exist. If you still have a file with that name on your disk, something has gone wrong, and you should figure out why. Can you make absolutely sure sqlite3_close() has been called correctly and does not return an error ? My apologies for my lack of clarity. What I mean by end of a run is simply when I exit InDesign (and all plugins attached thereto). I close the database frequently--at the end of the module where it is opened. The documentation says that when I close a database transactions in progress are rolled back, but I cannot find a way of testing for whether a transaction is completed. Is that the role of the finalize call? Here's the sequence of events I use when I use sqlite3_close: Result = sqlite3_step(ResultStmt); if(Result != SQLITE_DONE) { Do some error/loop stuff as appropriate } sqlite3_finalize(ResultStmt); sqlite3_close(db_ptr); sqlite3_shutdown(); If there is a better/safer method, please let me know. R, John ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Peculiar activity in an SQLite-using InDesign plug-in on the Macintosh
Can you make absolutely sure sqlite3_close() has been called correctly and does not return an error ? As a matter of fact, Simon, for some reason, whenever I call it in this particular function (and I call this function a lot), it returns an error. The error is (both surprisingly and unsurprisingly) unable to close due to unfinalized statements. Here's the code, as simplified as I know how to make it (you will see that the one prepared statement is finalized): int Result; std::string InsertStatement = Insert into blah blah blah; // The Insert statement works whenever I can get a connection, which is the first 523 attempts. Result = sqlite3_initialize(); sqlite3 *db_ptr; Result = 0; Result = sqlite3_open_v2(DBEnginePath, db_ptr, SQLITE_OPEN_READWRITE, NULL); sqlite3_stmt *ResultStmt; Result = sqlite3_prepare_v2(db_ptr, InsertStatement.c_str(), -1, ResultStmt, NULL); Result = sqlite3_step(ResultStmt); if((Result != SQLITE_DONE) (Result != SQLITE_ROW)) { Do some error stuff } sqlite3_reset( ResultStmt); // based on your comments earlier, the tests were added as you see here. Result = sqlite3_finalize(ResultStmt); if(Result != SQLITE_OK) { fprintf(stderr, Did not finalize): // Never saw this } sqlite3_close( db_ptr); if(Result != SQLITE_OK) { fprintf(stderr, failed to close sqlite db ptr): // As far as I can tell, this msg showed up with the processing of every record. } I'm not sure where I've gone wrong. R, John ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Opening a database on a Mac
Sorry to send this twice, but I realized that my first transmission did not include a subject line. _ From: john darnell Sent: Friday, June 17, 2011 1:56 PM To: 'General Discussion of SQLite Database' Subject: I am attempting to open an SQLite database on the Mac (OSX Snow Leopard) and am getting an error. This is the code I am using: char DBEnginePath[1000]; strcpy(DBEnginePath, Macintosh HD:Applications:Adobe InDesign CS5:Plug-Ins:WPC_ID:IndexData.db); fprintf(stderr, %s\n, DBEnginePath); // Sends correct path to stderr for verification. Result = sqlite3_open_v2(DBEnginePath, db_ptr, SQLITE_OPEN_READONLY, NULL); // Errors out here. const char *msg = sqlite3_errmsg(db_ptr); fprintf(stderr, Here's the SQLite error message: %s\n, msg); // Sent to stderr: Unable to open database file. I have verified that the file exists on the path described above. What am I doing wrong? TIA! R, John A.M. Darnell Senior Programmer Walsworth Publishing Company Brookfield, MO John may also be reached at johnamdarn...@gmail.commailto:johnamdarn...@gmail.com Trivia question Trivia question: In The Lord of the Rings,Leglolas was a prince among the Silvan Elves. What was the name of his father the King? For extra credit, what was his surname? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] (no subject)
I am attempting to open an SQLite database on the Mac (OSX Snow Leopard) and am getting an error. This is the code I am using: char DBEnginePath[1000]; strcpy(DBEnginePath, Macintosh HD:Applications:Adobe InDesign CS5:Plug-Ins:WPC_ID:IndexData.db); fprintf(stderr, %s\n, DBEnginePath); // Sends correct path to stderr for verification. Result = sqlite3_open_v2(DBEnginePath, db_ptr, SQLITE_OPEN_READONLY, NULL); // Errors out here. const char *msg = sqlite3_errmsg(db_ptr); fprintf(stderr, Here's the SQLite error message: %s\n, msg); // Sent to stderr: Unable to open database file. I have verified that the file exists on the path described above. What am I doing wrong? TIA! R, John A.M. Darnell Senior Programmer Walsworth Publishing Company Brookfield, MO John may also be reached at johnamdarn...@gmail.commailto:johnamdarn...@gmail.com Trivia question Trivia question: In The Lord of the Rings,Leglolas was a prince among the Silvan Elves. What was the name of his father the King? For extra credit, what was his surname? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Opening a database on a Mac
Thanks Pavel. That worked. R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Pavel Ivanov Sent: Friday, June 17, 2011 2:23 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Opening a database on a Mac strcpy(DBEnginePath, Macintosh HD:Applications:Adobe InDesign CS5:Plug- Ins:WPC_ID:IndexData.db); Try to change path here to /Applications/Adobe InDesign CS5/Plug-Ins/WPC_ID/IndexData.db. Pavel On Fri, Jun 17, 2011 at 3:08 PM, john darnell john.darn...@walsworth.com wrote: Sorry to send this twice, but I realized that my first transmission did not include a subject line. _ From: john darnell Sent: Friday, June 17, 2011 1:56 PM To: 'General Discussion of SQLite Database' Subject: I am attempting to open an SQLite database on the Mac (OSX Snow Leopard) and am getting an error. This is the code I am using: char DBEnginePath[1000]; strcpy(DBEnginePath, Macintosh HD:Applications:Adobe InDesign CS5:Plug- Ins:WPC_ID:IndexData.db); fprintf(stderr, %s\n, DBEnginePath); // Sends correct path to stderr for verification. Result = sqlite3_open_v2(DBEnginePath, db_ptr, SQLITE_OPEN_READONLY, NULL); // Errors out here. const char *msg = sqlite3_errmsg(db_ptr); fprintf(stderr, Here's the SQLite error message: %s\n, msg); // Sent to stderr: Unable to open database file. I have verified that the file exists on the path described above. What am I doing wrong? TIA! R, John A.M. Darnell Senior Programmer Walsworth Publishing Company Brookfield, MO John may also be reached at johnamdarn...@gmail.commailto:johnamdarn...@gmail.com Trivia question Trivia question: In The Lord of the Rings,Leglolas was a prince among the Silvan Elves. What was the name of his father the King? For extra credit, what was his surname? ___ 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] OSX path
Thanks Doug. I appreciate you pointing this out to me. I checked two references and neither one of them mentioned this teensy little requirement. I guess they must've thought it wasn't important. R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Doug Currie Sent: Friday, June 17, 2011 4:07 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] OSX path On Jun 17, 2011, at 2:56 PM, john darnell wrote: I am attempting to open an SQLite database on the Mac (OSX Snow Leopard) and am getting an error. This is the code I am using: char DBEnginePath[1000]; strcpy(DBEnginePath, Macintosh HD:Applications:Adobe InDesign CS5:Plug- Ins:WPC_ID:IndexData.db); fprintf(stderr, %s\n, DBEnginePath); // Sends correct path to stderr for verification. Result = sqlite3_open_v2(DBEnginePath, db_ptr, SQLITE_OPEN_READONLY, NULL); // Errors out here. Your path has colons instead of slashes for separators. Open a Terminal window, and drag the database file into the window. The terminal.app will display the path name on the command line. You can copy and paste from there. It's probably something like: /Applications/Adobe\ InDesign\ CS5/Plug-Ins/WPC_ID/IndexData.db e ___ 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] OSX path
Simon: First of all, let me apologize for my whine. We all have our bumps in the road and if we don't then we're probably not doing our jobs (as one venerable Navy Chief once pointed out to a hapless, naïve ensign many years ago). I should have just shut up and moved on. I am essentially a Windows programmer so I will have to take your word on the use of HFS-style paths vs posix/Unix style paths on Mac platforms. I will have to say, however, that at least the InDesign SDK, which is my chief habitat when it comes to writing Mac code, encourages the use of colon-laden paths--or at least does not greatly discourage it, while not encouraging at all the use of the posix/Unix style of path presentation. They have a few functions scattered here and there for HFS-to-URL/Posix conversion, but rarely are they mentioned in their docs, or used not at all in their examples. Say what you will about Adobe and InDesign, but their tools for writing Apple, ah, supplemental code, are not insubstantial or trivial. IMHO, it is understandable when that is my major environment for writing code that I might not know the more current practice. Okay, it's an excuse (grin), but it's all I've got. Take care, and honest, thanks! John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Simon Slavin Sent: Friday, June 17, 2011 5:18 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] OSX path On 17 Jun 2011, at 10:09pm, john darnell wrote: I checked two references and neither one of them mentioned this teensy little requirement. I guess they must've thought it wasn't important. The use of colons for file paths is purely an old-fashioned Mac thing and never worked cross-platform. So from the SQLite and sides, the programmers would never think to mention the colon format and might never have known about it (although as it happens DRH is a Mac user and doubtless does). From the Mac side, since OS X began (twelve years ago) you've been able to use standard Unix slash format for file paths, and the colon format has pretty-much diminished into misuse. So only pre-OS X Mac programmers like us would know about it. Sorry about that. But I'm keeping my copy of _Inside Mac_ because I'm convinced it's a classic. Simon. ___ 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] OSX path
Um, what's top-posting? And of course I always strive to be wise. Simon (or for that matter, the rest of the list), if you thought I was being a wiseass, then again, my apologies. R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Warren Young Sent: Friday, June 17, 2011 7:00 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] OSX path On 6/17/2011 4:50 PM, john darnell wrote: I am essentially a Windows programmer Is that also your excuse for top-posting? :) I will have to take your word on the use of HFS-style paths vs posix/Unix style paths on Mac platforms. That would be wise, because Simon is correct. I will have to say, however, that at least the InDesign SDK, which is my chief habitat when it comes to writing Mac code, encourages the use of colon-laden paths--or at least does not greatly discourage it, That's because all Adobe software created before about 2006[*] was built on top of the Carbon SDK, which interprets colon-delimited paths for backwards compatibility with Classic Mac OS. OS X's native POSIX/Mach/Cocoa APIs understand only slash-based paths. SQLite is built on top of the POSIX layer of OS X, so it only understands POSIX paths. As more Mac programs move to 64-bit, they must move from Carbon to Cocoa, and thus will require POSIX paths, unless they've built in their own portability layer. I can see Adobe doing that, to preserve legacy compatibility. [*] Lightroom was the first Cocoa-based Adobe app. Its first public beta came out in 2006. ___ 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] OSX path
Thanks for your kind words, Simon. As for myself, I really do strive for civility, though I don't always get there. I'll keep working at it if you promise to be patient with me. As for top-posting, In the corporate culture I come from, it is considered the only way to do things (or at least one faction who has the ear of the ops boss, believes this). I actually got counseled for cutting out a goodly chunk of what I thought was unnecessary old message. It was a gentle admonishment, nevertheless, I got the message. In fact, I shudder as I read your message and find out I am *expected* to cut out the stuff that is no longer needed (grin). -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] Yep. Adobe totally explains why you're still thinking in terms of colon paths. InDesigns is a terrific program (I've never developed for it) but Adobe hasn't ported it to more recent API layers. Adobe's habit of lagging several years behind Apple in this way is a terrible handicap and hits it each time Apple stops supporting old (in this case 11 years old) sets of API. It's going to happen again in OS X 10.7 because OS X 10.7 does not support the PowerPC compatibility layer. Gulp. Another sleepless three months for us InDesign Plugin programmers as we figure out how to cope... Take care. R, John ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Unlocking the database
Hello folks. This time I have (I hope) a much simpler question. While debugging my code, I managed to lock the database for all time. The only way I was able to unlock the database was by retrieving a copy of the database I had tucked away for just such contingencies. I looked in Jay Kreibich's very fine book, Using SQLite, but found no function that would unlock a database. Is there a function, method or process whereby I can unlock the database when it gets locked? It seems a terrible waste to have to recreate the db if it has a bunch of data already in it when a bug has caused it to lock. R, John A.M. Darnell Senior Programmer Walsworth Publishing Company Brookfield, MO John may also be reached at johnamdarn...@gmail.commailto:johnamdarn...@gmail.com Trivia question Trivia question: In The Lord of the Rings,Leglolas was a prince among the Silvan Elves. What was the name of his father the King? For extra credit, what was his surname? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Unlocking the database
I understand the need for integrity when locking a database, but in this case I knew that the problem was caused by a (in all honesty, my) bug. I tried rebooting the machine and it did not unlock the table. So I guess that means that the answer is no. R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Roger Binns Sent: Saturday, May 28, 2011 11:21 AM To: sqlite-users@sqlite.org Subject: Re: [sqlite] Unlocking the database -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/28/2011 09:02 AM, john darnell wrote: Is there a function, method or process whereby I can unlock the database when it gets locked? It is locked by another connection or process and you can't ask them to give up locks using the SQLite API. The point of locking is to ensure the integrity of the database. Killing the processes or rebooting your machine will get them to relinquish their locks. Roger -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk3hIMoACgkQmOOfHg372QQQpQCffw7BQCU9QcdoGEcvcd9 mzlQJ ev8An0ZsjWk5UtyhU1qvdoTmoJzBqGLS =EE7V -END PGP SIGNATURE- ___ 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] Unlocking the database
I was/am using Windows XP SP3. Sorry, but the company is extremely conservative in upgrade policies. Hmmm After the reboot, I tried opening the database in my program as well as SQLite Manager (the Firefox plugin). Neither worked, I got the SQLITE_BUSY return code from the SQLite call (I believe it was sqlite3_prepare_v2), and a long and cryptic error message from SQLite Manager. It could be that I did something stupid. Wouldn't be the first time. I think that it would probably be best if we let this time drop and the next time I find myself suffering through this problem I will contact the list immediately instead of waiting a day. Thanks everyone. I appreciate your help. R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Richard Hipp Sent: Saturday, May 28, 2011 11:29 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] Unlocking the database On Sat, May 28, 2011 at 12:25 PM, john darnell john.darn...@walsworth.comwrote: I tried rebooting the machine and it did not unlock the table. That sounds unlikely. What OS are you using? Are you using a non-standard VFS such as unix-dotfile? Or are you using a network filesystem of some kind? -- D. Richard Hipp d...@sqlite.org ___ 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] Unlocking the database
Thanks for the tip. I have done as you suggested. -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Danny Sent: Saturday, May 28, 2011 12:46 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Unlocking the database John, I've had nothing but trouble with the Firefox plugin. Download and install the SQLite Expert Personal 3 GUI (free) and see if that does anything for you, or at least gives you better diagnostics. --- On Sat, 5/28/11, Simon Slavin slav...@bigfraud.org wrote: From: Simon Slavin slav...@bigfraud.org Subject: Re: [sqlite] Unlocking the database To: General Discussion of SQLite Database sqlite-users@sqlite.org Date: Saturday, May 28, 2011, 1:02 PM On 28 May 2011, at 5:39pm, john darnell wrote: After the reboot, I tried opening the database in my program as well as SQLite Manager (the Firefox plugin). Neither worked, I got the SQLITE_BUSY return code from the SQLite call (I believe it was sqlite3_prepare_v2), and a long and cryptic error message from SQLite Manager. Something is weird with that. I'm not a SQLite dev but I don't think anything inside SQLite can do that. Perhaps SQLite Manager does it. Simon. ___ 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] SQLite in Xcode
Tom: Thanks for the information and I will be looking at the slideshow soon. This project was an InDesign plugin project, which, by agreement when I use the SDK, is a C++ project. I could probably fit in all of the Objective-C code you suggest, but (okay, this is a whine) the InDesign SDK is already immensely complex. I will say that I tried using the SQLite3.dylib that comes native with the OS, though I didn't attempt any of the steps you suggest. I got some fascinating results at link time. Two symbols were identified as not being found in three functions (both symbols went missing in all three functions). What makes it interesting is that both functions were used dozens of times in the plugin, but they were identified as missing symbols only in those three functions. By luck (and the help of a Mac aficionado who is also a colleague) we stumbled across a way to get SQLite3 to compile and link without error or warning. How we did it is provided in a previous email sent last evening, but I would be happy to share it again for anyone who finds him(her)self in the same boat. Take care, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of BareFeetWare Sent: Thursday, May 26, 2011 8:54 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] SQLite in Xcode On 27/05/2011, at 10:42 AM, Simon Slavin wrote: Tom, John ran across two common problems with SQLite and Xcode: A) Xcode seems to want to interpret .c and .h files as C++ instead of C. B) Confusion common to people who normally program for Windows or non- Open systems about what combination of files they need: a library, a framework, C source, a .h file. An explanation of these points somewhere would be great. I bypassed that whole issue by just using the SQLite framework built into Mac OSX and iOS, and by using an SQLite wrapper for Objective C. Then you don't have to worry about compiling SQLite source files into your project or even have to bother with the low level sqlite3_ C calls. The only code you then have to write is effectively an nice Objective-C executeQuery: method call, which returns and array of dictionaries. It's all very straight forward that way. The slideshow makes it pretty easy to follow: http://www.barefeetware.com/sqlite/iosxcode/?ml Thanks, Tom BareFeetWare -- Comparison of SQLite GUI tools: http://www.barefeetware.com/sqlite/compare/?ml ___ 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] SQLite in Xcode
Hello everyone. I am still trying to get SQLite to work on my Mac. I want to make sure I am doing what I should be doing. Here are the steps I have taken: 1.) I downloaded and uncompressed sqlite-autoconf-3070602.tar.gz from the SQLite download page. 2.) I moved SQLite3.c and SQLite3.h into my source folder and added them to the project. I made no changes to the code nor did I do anything special when I added them to my project (i.e. I did not set any special compile flags-I simply added the two files to the project). 3.) I compiled and received 1200+ errors. Since then I have tried using the sqlite.dylib file that comes with OSX but in doing so, some important SQLite functions (such as the prepare function) were not found during the link process. My most recent attempt has been to follow the instructions that come with the tarball I downloaded to create my own SQLite library. When I run ./configure, the procedure errors out, saying that it could not find an acceptable C compiler in the $Path. Anyone have any new possibilities to try? BTW, (and I apologize for not sharing this sooner-it didn't occur to me that it might be relevant until recently) I am using SQLite3 in concert with the InDesign SDK to produce an InDesign plugin (which we freely distribute to our customers). There is a possibility that the SDK has something going on that causes the massive explosion of errors. And finally, the very first time I used SQLite3 on my Windows box, upon compilation, it generated a whopping 200 errors, and continued to do so until I turned off using precompiled headers. I cannot see a way to do this in Xcode. Perhaps that is my problem? R, John A.M. Darnell Senior Programmer Walsworth Publishing Company Brookfield, MO John may also be reached at johnamdarn...@gmail.commailto:johnamdarn...@gmail.com Trivia question Trivia question: In The Lord of the Rings,Leglolas was a prince among the Silvan Elves. What was the name of his father the King? For extra credit, what was his surname? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] SQLite in Xcode
-Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Jean-Denis Muys Sent: Thursday, May 26, 2011 10:08 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] SQLite in Xcode On 26 mai 2011, at 16:49, john darnell wrote: Since then I have tried using the sqlite.dylib file that comes with OSX but in doing so, some important SQLite functions (such as the prepare function) were not found during the link process. This shouldn't happen. My app links just fine. You must add libsqlite3.dylib to the Link binary with libraries section of the Build Phases pane of your target settings. Jean-Denis Thank you, Jean-Denis for this information. I initially added the libsqlite3.dylib into the Libraries-API-Debug group. In so doing, Xcode automatically added the same dylib to the Link Binary with Libraries phase of my debug version. Are you suggesting that I should have added it directly? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] SQLite in Xcode
Mr. Slavin, here's the information you requested: Please note that I am working in Xcode 3.1.3. That may or may not be part/all of the problem. -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Simon Slavin Sent: Thursday, May 26, 2011 10:01 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] SQLite in Xcode 1.) I downloaded and uncompressed sqlite-autoconf-3070602.tar.gz from the SQLite download page. The top one, with just .c and .h is adequate. You shouldn't end up using any of the scripts or makefiles for building. I can confirm that I only moved/added sqlite3.c and sqlite3.h into the source folder and into the project. 2.) I moved SQLite3.c and SQLite3.h into my source folder and added them to the project. I made no changes to the code nor did I do anything special when I added them to my project (i.e. I did not set any special compile flags-I simply added the two files to the project). Make sure sqlite3.c is 'ticked' next to 'Target Membership' for your product file. I am not someone who uses Xcode frequently--I usually develop on Windows and port t the Mac, but if by Target Membership you mean the last column in the pane that lists all files when the project name is selected in the Groups Files pane, headed by an icon that looks like a target, the sqlite3.c file is 'ticked.' Also make sure sqlite3.c is listed as 'C source' and sqlite3.h is listed as 'C header' under 'Identity and Type'. I clicked the sqlite3.c filename in the Groups Files panel, clicked the information icon (the blue button with the white 'i' at the top of the window). Under the General tab, under the File Type dropdown, the file is listed as 'sourcecode.c.c', and the sqlite3.h file is listed as 'sourcecode.c.h.' If you have in mind some other location, please let me know. 3.) I compiled and received 1200+ errors. Try the above, and if those don't go away, post the first one or two (note all 1200+) here. Here are two errors out of the 1200+ errors generated (I tried to include as much information as possible to help identify the problem. Please forgive if I am overdoing it...): Compiling /.../sqlite3.c Error:invalid conversion from void * to char * This error was marked at line 13726. Error:forward declaration of 'struct SrcList_item' This error was marked at line 11047. There were six warnings as well, most of which were warnings about division by zero. R, John Simon. ___ 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] SQLite in Xcode
-Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Simon Slavin Sent: Thursday, May 26, 2011 12:38 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] SQLite in Xcode One thing that occurs to me is that you do not need both the dynamic library and the .c .h files. If you have included the .c code on your project, you should not be including or linking to anything else with 'sqlite' in its filename. Similarly, if you are linking against an SQLite library, you don't need the .c source code, just the version of the .h file that should be found with that library. I can promise you that I had removed the .c file from the project. However, I am intrigued by your remark that I should be using the header file that comes with the .dylib. I had been using the header that came with the amalgamation. Where can I find the header that should be used with the .dylib? I'm sorry about the incredibly picky questions we're asking, but Xcode with an existing project is huge and complicated and there doesn't seem to be any other way to figure out what's going on. On that we both agree. I don't mind the questions, not even a little bit. I am dually afraid of two things when I correspond with this list: 1.) I'm not giving enough information 2.) I'm being so wordy that no one will want to look at my questions/responses (there is a reason my moniker is 'Pedantic' :). R, John ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] SQLite in Xcode
I'm not sure what .dylib you're using. The standard installation of OS X with the Developer tools has sqlite header files in /usr/include/sqlite3.h and /Developer/SDKs/MacOSX10.6.sdk/usr/include/sqlite3.h which may or may not be identical to each-other. Wherever you got your library from, I would have thought it would point blatantly at a header file they wanted you to use. They might be and I just am not familiar enough with OSX to recognize it. Thanks for the information. I'll see what it brings me... ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] SQLite in Xcode
Thank you Mr. Ivanov. I can buy what you are saying 100%. What I need to know is how to tell Xcode to compile that file as a C file if the standard procedure is not working. I recoup: the files are being classified as sourcecode.c.c and sourcecode.c.h. What else do I need to do? R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Pavel Ivanov Sent: Thursday, May 26, 2011 1:56 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] SQLite in Xcode Here are two errors out of the 1200+ errors generated (I tried to include as much information as possible to help identify the problem. Please forgive if I am overdoing it...): Compiling /.../sqlite3.c Error:invalid conversion from void * to char * This error was marked at line 13726. IIRC, this error is the most famous difference between C and C++. And if this error appears then you are compiling it as C++, not as C. Pavel On Thu, May 26, 2011 at 12:35 PM, john darnell john.darn...@walsworth.com wrote: Mr. Slavin, here's the information you requested: Please note that I am working in Xcode 3.1.3. That may or may not be part/all of the problem. -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- boun...@sqlite.org] On Behalf Of Simon Slavin Sent: Thursday, May 26, 2011 10:01 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] SQLite in Xcode 1.) I downloaded and uncompressed sqlite-autoconf-3070602.tar.gz from the SQLite download page. The top one, with just .c and .h is adequate. You shouldn't end up using any of the scripts or makefiles for building. I can confirm that I only moved/added sqlite3.c and sqlite3.h into the source folder and into the project. 2.) I moved SQLite3.c and SQLite3.h into my source folder and added them to the project. I made no changes to the code nor did I do anything special when I added them to my project (i.e. I did not set any special compile flags-I simply added the two files to the project). Make sure sqlite3.c is 'ticked' next to 'Target Membership' for your product file. I am not someone who uses Xcode frequently--I usually develop on Windows and port t the Mac, but if by Target Membership you mean the last column in the pane that lists all files when the project name is selected in the Groups Files pane, headed by an icon that looks like a target, the sqlite3.c file is 'ticked.' Also make sure sqlite3.c is listed as 'C source' and sqlite3.h is listed as 'C header' under 'Identity and Type'. I clicked the sqlite3.c filename in the Groups Files panel, clicked the information icon (the blue button with the white 'i' at the top of the window). Under the General tab, under the File Type dropdown, the file is listed as 'sourcecode.c.c', and the sqlite3.h file is listed as 'sourcecode.c.h.' If you have in mind some other location, please let me know. 3.) I compiled and received 1200+ errors. Try the above, and if those don't go away, post the first one or two (note all 1200+) here. Here are two errors out of the 1200+ errors generated (I tried to include as much information as possible to help identify the problem. Please forgive if I am overdoing it...): Compiling /.../sqlite3.c Error:invalid conversion from void * to char * This error was marked at line 13726. Error:forward declaration of 'struct SrcList_item' This error was marked at line 11047. There were six warnings as well, most of which were warnings about division by zero. R, John Simon. ___ 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] SQLite in Xcode
Thank you Mr. Slavin. I checked as you suggest and there were no other options listed in the dropdown. However, with the help of my good friend and colleague Mark Woodring I think we found what we needed to change. First, under the Project info dialog, under the Build tab, under Language, there is a line item called Compile Source As. There are five options: C, C++, Objective-C, Objective_C++, and According to file type. The project as created was compiling all files as C++ files. I changed the option to According to File Type. That got rid of 200 of the 1200+ errors. In that same segment was an item called Increase Sharing of Precompiled Headers. I unchecked it as well, and that seemed to get rid of all but four warnings. Those warnings are as follows: Warning: declaration of fsInfo shadows a previous local Warning: shadowed declaration is here Warning: declaration of wait shadows a global decclaration Warning: shadowed declaration is here I am undecided as to whether I want to do anything about these warnings. They report that a variable has already been created someplace in that scope with the same name, and now inside a block inside that scope the programmer is creating a new variable with the same name. On Windows, Visual Studio doesn't care. In Xcode 3.1.3, it lets the programmer know that he is doing it. It's up to her to decide to fix it. Thanks to all of you who helped resolve this difficult problem. R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Simon Slavin Sent: Thursday, May 26, 2011 2:13 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] SQLite in Xcode On 26 May 2011, at 8:12pm, john darnell wrote: Thank you Mr. Ivanov. I can buy what you are saying 100%. What I need to know is how to tell Xcode to compile that file as a C file if the standard procedure is not working. I recoup: the files are being classified as sourcecode.c.c and sourcecode.c.h. What else do I need to do? Take a look at the other options in the popup. Are their options for 'C Source' and 'C Header' ? Simon. ___ 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] SQLite in Xcode
One final message on this topic. In my last message I mentioned four warnings remaining when I compile the file. I decided to at least look at them in situ and see what they were. It turned out that it took very little to fix them AFAIK. Here is what I did: Warning: declaration of fsInfo shadows a previous local Warning: shadowed declaration is here To resolve the above two warnings I changed this code: (Around line 29173): struct statfs fsinfo; if(statfs(zPath, fsInfo) == -1){ to struct statfs fsinfo1; if(statfs(zPath, fsInfo1) == -1){ **(note the change in fsInfo)** AND (found around line 29190) useProxy = !(fsInfo.f_flagsMNT_LOCAL); to this: useProxy = !(fsInfo1.f_flagsMNT_LOCAL); **(note the change in fsInfo)** Warning: declaration of wait shadows a global decclaration Warning: shadowed declaration is here To resolve these two warnings I changed this code (found around 29859): /* Not always defined in the headers as it ought to be */ Extern int gethostuuid(uuid_t id, const struct timespec wait); To this: /* Not always defined in the headers as it ought to be */ Extern int gethostuuid(uuid_t id, const struct timespec twait); **(note the change in wait)** I would appreciate it if those of you who know the code would double-check my hubris and let me know if I have done something monstrously (or maybe even just a little) stupid. It wouldn't be the first time... R, John ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Compiling in Xcode 3.1.3
I have code that compiles just fine using Visual Studio 8 on Windows XP, but when I port SQLite over to a Mac OSX (Snow Leopard) platform using Xcode 3.1.3 I get roughly 1000 errors based upon SQLite. Is there something I need to turn off/on when using SQLite on the Mac? R, John A.M. Darnell Senior Programmer Walsworth Publishing Company Brookfield, MO John may also be reached at johnamdarn...@gmail.commailto:johnamdarn...@gmail.com Trivia question Trivia question: In The Lord of the Rings,Leglolas was a prince among the Silvan Elves. What was the name of his father the King? For extra credit, what was his surname? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Compiling in Xcode 3.1.3
Thanks for responding, Mr HIpp. There are 1265 errors in all, but most of them look very close to something like this: Invalid conversion from void * to XXX * Or forward declaration of struct_ht I thought it might be a pathing error (I had not added the path to the directory where SQLite 3 is stored) but I did that and it didn't really resolve anything. R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Richard Hipp Sent: Monday, May 16, 2011 3:19 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Compiling in Xcode 3.1.3 On Mon, May 16, 2011 at 4:01 PM, john darnell john.darn...@walsworth.comwrote: I have code that compiles just fine using Visual Studio 8 on Windows XP, but when I port SQLite over to a Mac OSX (Snow Leopard) platform using Xcode 3.1.3 I get roughly 1000 errors based upon SQLite. Is there something I need to turn off/on when using SQLite on the Mac? No. We compile SQLite on Macs with no problems. What are the errors? R, John A.M. Darnell Senior Programmer Walsworth Publishing Company Brookfield, MO John may also be reached at johnamdarn...@gmail.commailto: johnamdarn...@gmail.com Trivia question Trivia question: In The Lord of the Rings,Leglolas was a prince among the Silvan Elves. What was the name of his father the King? For extra credit, what was his surname? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users -- D. Richard Hipp d...@sqlite.org ___ 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] Compiling in Xcode 3.1.3
Thanks again. I highlighted the file, clicked the information icon and then under the General category I changed the type of file from sourcecode.c.c to sourcecode.c. When pressing Command-K I get no errors but one warning: Warning, no rule to process sqlite3.c of type sourcecode.c for architecture i386 I am going to try this next: extern C { #include sqlite3.h } And see if that helps. -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Richard Hipp Sent: Monday, May 16, 2011 3:45 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Compiling in Xcode 3.1.3 On Mon, May 16, 2011 at 4:31 PM, john darnell john.darn...@walsworth.comwrote: Thanks for responding, Mr HIpp. There are 1265 errors in all, but most of them look very close to something like this: Invalid conversion from void * to XXX * Or forward declaration of struct_ht I thought it might be a pathing error (I had not added the path to the directory where SQLite 3 is stored) but I did that and it didn't really resolve anything. SQLite is ANSI-C code. Sounds to me like you are trying to compile it as C++, or maybe Objective-C. R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto: sqlite-users-boun...@sqlite.org] On Behalf Of Richard Hipp Sent: Monday, May 16, 2011 3:19 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Compiling in Xcode 3.1.3 On Mon, May 16, 2011 at 4:01 PM, john darnell john.darn...@walsworth.comwrote: I have code that compiles just fine using Visual Studio 8 on Windows XP, but when I port SQLite over to a Mac OSX (Snow Leopard) platform using Xcode 3.1.3 I get roughly 1000 errors based upon SQLite. Is there something I need to turn off/on when using SQLite on the Mac? No. We compile SQLite on Macs with no problems. What are the errors? R, John A.M. Darnell Senior Programmer Walsworth Publishing Company Brookfield, MO John may also be reached at johnamdarn...@gmail.commailto: johnamdarn...@gmail.com Trivia question Trivia question: In The Lord of the Rings,Leglolas was a prince among the Silvan Elves. What was the name of his father the King? For extra credit, what was his surname? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users -- D. Richard Hipp d...@sqlite.org ___ 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 -- D. Richard Hipp d...@sqlite.org ___ 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] Compiling in Xcode 3.1.3
Okay, I started looking at the code in SQLite3 and noticed that this is already done for me. Please have mercy on me, I am on the road and do not have access to my usual resources. What do I need to do to get Xcode to compile this code in 3.1.3? R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of john darnell Sent: Monday, May 16, 2011 4:09 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Compiling in Xcode 3.1.3 Thanks again. I highlighted the file, clicked the information icon and then under the General category I changed the type of file from sourcecode.c.c to sourcecode.c. When pressing Command-K I get no errors but one warning: Warning, no rule to process sqlite3.c of type sourcecode.c for architecture i386 I am going to try this next: extern C { #include sqlite3.h } And see if that helps. -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Richard Hipp Sent: Monday, May 16, 2011 3:45 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Compiling in Xcode 3.1.3 On Mon, May 16, 2011 at 4:31 PM, john darnell john.darn...@walsworth.comwrote: Thanks for responding, Mr HIpp. There are 1265 errors in all, but most of them look very close to something like this: Invalid conversion from void * to XXX * Or forward declaration of struct_ht I thought it might be a pathing error (I had not added the path to the directory where SQLite 3 is stored) but I did that and it didn't really resolve anything. SQLite is ANSI-C code. Sounds to me like you are trying to compile it as C++, or maybe Objective-C. R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto: sqlite-users-boun...@sqlite.org] On Behalf Of Richard Hipp Sent: Monday, May 16, 2011 3:19 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Compiling in Xcode 3.1.3 On Mon, May 16, 2011 at 4:01 PM, john darnell john.darn...@walsworth.comwrote: I have code that compiles just fine using Visual Studio 8 on Windows XP, but when I port SQLite over to a Mac OSX (Snow Leopard) platform using Xcode 3.1.3 I get roughly 1000 errors based upon SQLite. Is there something I need to turn off/on when using SQLite on the Mac? No. We compile SQLite on Macs with no problems. What are the errors? R, John A.M. Darnell Senior Programmer Walsworth Publishing Company Brookfield, MO John may also be reached at johnamdarn...@gmail.commailto: johnamdarn...@gmail.com Trivia question Trivia question: In The Lord of the Rings,Leglolas was a prince among the Silvan Elves. What was the name of his father the King? For extra credit, what was his surname? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users -- D. Richard Hipp d...@sqlite.org ___ 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 -- D. Richard Hipp d...@sqlite.org ___ 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] Compiling in Xcode 3.1.3
Thanks, Simon: In Xcode 3.1.3 when I highlight SQLite3.c, click the Info icon and look under the General Tab, and then click the File Type dropdown there are perhaps sixty to seventy choices I can make, but only a few make any sense, some more than others. They are: sourcecode.c sourcecode.c.c sourcecode.c.h sourcecode.c.objc sourcecode.cpp sourcecode.cpp.cpp sourcecode.cpp.h sourcecode.cpp.objcpp The default filetype for SQLite3.c was sourcecode.c.c. The default filetype for SQLite3.h was sourcode.c.c For grins I looked at a .CPP file and its file type was sourcecode.cpp.cpp Any thoughts? R, John . -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Simon Slavin Sent: Monday, May 16, 2011 4:32 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Compiling in Xcode 3.1.3 On 16 May 2011, at 10:09pm, john darnell wrote: I highlighted the file, clicked the information icon and then under the General category I changed the type of file from sourcecode.c.c to sourcecode.c. When pressing Command-K I get no errors but one warning: Warning, no rule to process sqlite3.c of type sourcecode.c for architecture i386 I had no problems with compiling the Amalgamation source code under Xcode 3.x. I've since moved to Xcode 4.0 so I can no longer tell you what my settings were but I never saw a '.c.c' extension, I just had to make sure the 'File Type' for sqlite3.c was 'C source', not 'Objective-C++ source', and that similarly 'File Type' for sqlite3.h was 'C header' not 'C++ header'. The only thing I'm getting in Xcode 4.0 with LLVM GCC 4.2 is some 'Unused Entity' warnings and I have no problem with those: they're right, and they're just warnings. Simon. ___ 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] using sqlite3_get_table
All I need to do is see how many rows a table has. I stumbled across this function and used it thusly in my code (I removed the error checking for the sake of brevity): Result = sqlite3_initialize(); sqlite3 *db_ptr; Result = 0; Result = sqlite3_open_v2(DBEnginePath, db_ptr, SQLITE_OPEN_READWRITE, NULL); char ***CArray = NULL; int iRow, iCol; char **err = NULL; sqlite3_get_table(db_ptr, Select * from Admin, CArray, iRow, iCol, err); Unfortunately, when I execute the sqlite_get_table call, I get an error message telling me that I have an unhandled error. It says that the error is occurring here: struct unixShm { unixShmNode *pShmNode; /* The underlying unixShmNode object */ unixShm *pNext;/* Next unixShm with the same unixShmNode */ u8 hasMutex; /* True if holding the unixShmNode mutex */ u16 sharedMask;/* Mask of shared locks held */ u16 exclMask; /* Mask of exclusive locks held */ #ifdef SQLITE_DEBUG u8 id; /* Id of this connection within its unixShmNode */ #endif I am QUITE CERTAIN that my problem lies with the way I am declaring the arrays, but not having an example to teach me, I have no idea what the correct method is. If anyone has an example of how he or she is using sqlite3_get_table that he or she wouldn't mind sharing, I would be appreciative. TIA! R, John A.M. Darnell Senior Programmer Walsworth Publishing Company Brookfield, MO John may also be reached at johnamdarn...@gmail.commailto:johnamdarn...@gmail.com Trivia question: Who saved Gandalf from his imprisonment at the Tower of Isengard in book 1 of The Lord of the Rings (i.e. The Fellowship of the Ring)? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] using sqlite3_get_table --additional info...
BTW, if there is a better way to get a row count without using sqlite3_get_table() that would also work. _ From: john darnell Sent: Thursday, March 31, 2011 9:27 AM To: 'General Discussion of SQLite Database' Subject: using sqlite3_get_table All I need to do is see how many rows a table has. I stumbled across this function and used it thusly in my code (I removed the error checking for the sake of brevity): Result = sqlite3_initialize(); sqlite3 *db_ptr; Result = 0; Result = sqlite3_open_v2(DBEnginePath, db_ptr, SQLITE_OPEN_READWRITE, NULL); char ***CArray = NULL; int iRow, iCol; char **err = NULL; sqlite3_get_table(db_ptr, Select * from Admin, CArray, iRow, iCol, err); Unfortunately, when I execute the sqlite_get_table call, I get an error message telling me that I have an unhandled error. It says that the error is occurring here: struct unixShm { unixShmNode *pShmNode; /* The underlying unixShmNode object */ unixShm *pNext;/* Next unixShm with the same unixShmNode */ u8 hasMutex; /* True if holding the unixShmNode mutex */ u16 sharedMask;/* Mask of shared locks held */ u16 exclMask; /* Mask of exclusive locks held */ #ifdef SQLITE_DEBUG u8 id; /* Id of this connection within its unixShmNode */ #endif I am QUITE CERTAIN that my problem lies with the way I am declaring the arrays, but not having an example to teach me, I have no idea what the correct method is. If anyone has an example of how he or she is using sqlite3_get_table that he or she wouldn't mind sharing, I would be appreciative. TIA! R, John A.M. Darnell Senior Programmer Walsworth Publishing Company Brookfield, MO John may also be reached at johnamdarn...@gmail.commailto:johnamdarn...@gmail.com Trivia question: Who saved Gandalf from his imprisonment at the Tower of Isengard in book 1 of The Lord of the Rings (i.e. The Fellowship of the Ring)? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Getting a table's field labels with Perl, DBI
Hello John Delacour...nice to see you join the SCLite list. Folks, John may be a SCLite beginner, but he has quite a reputation on the MacScript list. I personally am glad to see him here. R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of John Delacour Sent: Tuesday, January 25, 2011 10:42 AM To: General Discussion of SQLite Database Subject: [sqlite] Getting a table's field labels with Perl, DBI I've only been using SQLite for 5 days so I'm very much a beginner. I just spent an hour or so working out how to get a list of column headers from a table and come up with the script below, which will do fine, but I wonder if there's a more elegant way to do it. #!/usr/local/bin/perl use strict; use DBI qw(:sql_types); { my $db = a.db; my $dbh = DBI-connect(dbi:SQLite:dbname=$db,,) or ...; $_ = $dbh-selectall_arrayref(PRAGMA table_info(contacts)) ; for (@$_) {push @_, $$_[1]} print join ', ', @_; } # = firm, adr1, postcode1, adr2, postcode2, ... JD ___ 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] Troubleshooting...
that need to be taken to transform the WideString objects to basic_string objects, but that is an assumption that needs to be tested, and I am working on a way to do that right now. Could you show us how did you transform WideString objects into string ones? Supposedly, basic_string deals with nothing other than UTF8 strings. That has been my assumption until now. I will let you know what I figure out. Soon. You are wrong here. First of all don't talk about basic_string when you talk about string which is basic_stringchar - that makes a lot of difference. So string deals with nothing other than sequence of bytes. It doesn't know anything about encodings and doesn't even know if the data it has is text or some binary stuff. It knows only a sequence of bytes and its length. So if you put into string something in UTF-16 encoding it will work with that without problems, although SQLite won't understand it if it expects UTF-8. My only guess is that basic_string::c_str() doesn't really provide a pointer to a null-terminated c-style string, but a facsimile of one that SQLite doesn't like. c_str() provides pointer to the data that string has with additional null byte added at the end. That's it. Whether it is a null-terminated c-style string depends on what data you put into it. If that data has null bytes in it then SQLite will see only part of your string, though I'm not sure that it was the actual problem you have seen. char *surbuf[100]; memset(surbuf, 0, 100); strcpy(surbuf, CurrentName - second.GetSurName().c_str()); Don't do this in production application as it can overflow your surbuf (if GetSurName() returns something that is longer than 100 bytes). Apart from that this statement and call to strlen() further do nothing different than SQLite does by itself when you provide to it simple result of c_str() and let it determine length of the string. So this definitely can't fix any problem. I guess you somehow changed result of GetSurName() on the way here. Pavel On Fri, Dec 17, 2010 at 6:18 PM, john darnell john.darn...@walsworth.com wrote: Okay. I worked out a solution, but I am still unsure of why it fixes the problem. Or rather, I know why it works, but it still doesn't explain why the basic_string::c_str() call did not work. My only guess is that basic_string::c_str() doesn't really provide a pointer to a null-terminated c-style string, but a facsimile of one that SQLite doesn't like. Here's that statement from my code again with the mods included that make the code work: char *surbuf[100]; memset(surbuf, 0, 100); strcpy(surbuf, CurrentName - second.GetSurName().c_str()); idx = -1; idx = sqlite3_bind_parameter_index(ResultStmt, :sur); sqlite3_bind_text(ResultStmt, idx, surbuf, strlen(surbuf), SQLITE_STATIC); BTW, I was using the .output command in the SQLITE3 shell to attempt piping my output to a file. The command looked like this: .output c:\sqlite.txt Select * from Names; When I went to the root of C: I did not find the file. So I removed the path from the filename and later found it in the SQLLite directory from which I was running the shell. R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- boun...@sqlite.org] On Behalf Of Pavel Ivanov Sent: Friday, December 17, 2010 4:44 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Troubleshooting... So you can see that when I add the hard-coded data, everything looks fine in the results of the select statement, which leads me to believe that the problem is not confusion between UTF8 and UTF16 output. Your hardcoded data has only characters from ASCII set which don't differ from the same in UTF-8. Besides SQLite API and command line utility don't check your strings to be valid UTF-8. SQLite API puts into database whatever you give to it, command line utility throws to stdout whatever it finds in the database (so my guess could be wrong and your input strings could be not in UTF-8 but in some other encoding). It's totally developer's responsibility to make sure that encoding put into database is the same as is expected when it's retrieved from database. I could not figure out how to pipe my info to a file One of possible solutions is to use .output command in the sqlite3 utility (you can use .help command to see everything that is available to you there) or to provide your sql statement as last argument when you start sqlite3 utility and use standard redirection like this: sqlite3 database.db select * from mytable output.txt ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Troubleshooting...
Thank you for the reminder, Mr. Archer. The basic_string is actually stored as part of a STL map and is fairly long-lived; once it is created, it remains until the plugin's destructor clears the map. R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of jeff archer Sent: Sunday, December 19, 2010 4:21 PM To: sqlite-users@sqlite.org Subject: Re: [sqlite] Troubleshooting... My only guess is that basic_string::c_str() doesn't really provide a pointer to a null-terminated c-style string, but a facsimile of one that SQLite doesn't like. c_str() provides pointer to the data that string has with additional null byte added at the end. That's it. Whether it is a null-terminated c-style string depends on what data you put into it. If that data has null bytes in it then SQLite will see only part of your string, though I'm not sure that it was the actual problem you have seen. You may probably already know this but maybe I'll remind you. The pointer returned by c_str() is only valid in the statement where it is used or possibly as long as the life of the basic_stringchar it came from. ___ 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] FW: Troubleshooting...
Since Pavel was so certain that my problem was that I was processing a UTF8 string when I should be processing a UTF16, experience told me that I should listen to someone with greater knowledge of SQLite and at least give it a try, so I changed one field in the code to bind the text using sqlite3_bind_text16. Here is the results of the select statement executed in the SQLite3.exe shell: C:\Sourcecode\SQLitesqlite3 C:\_WPCYB\Index Engine\ SQLite version 3.7.3 Enter .help for instructions Enter SQL statements terminated with a ; sqlite .read BuildTables.txt sqlite select * from Names; ( It was this field) V 1||µàäµ╣▓µ▒Ñ|JohnDarnell, John||0|1|0 2||µàäµ╣▓µ▒Ñ|John|A|M||Darnell, John A M||0|1|0 3||µòäµà¼µò«|PatrickDelaney, Patrick||0|1|0 4||µàìµ╜│Γ╡«µàäµ╣▓µ▒Ñ|ToddMason-Darnell, Todd||0| 5||Θëŵ╜äµæ╖|WilliamOÆDowd, William||0|1|0 6||µ╜Ƶòóτæ▓|PatriciaRoberts, Patricia||0|1|0 R, John -Original Message- From: john darnell Sent: Monday, December 20, 2010 11:02 AM To: 'General Discussion of SQLite Database' Subject: RE: [sqlite] Troubleshooting... Pavel: Though I am a newbie to SQLite I am not a newbie to programming. Please keep that in mind in any future interaction. I did indeed look at the data through the SQLite command utility before I offered my answer below, and it supported my conclusion. And no, I am not going to provide you with output. If my testimony that it worked is not enough for you, then...well I'm sorry about that. The WideString object InDesign uses is its own WideString class that is part of the InDesign SDK. The headers for both WideString and PMString objects (the string object that InDesign uses primarily for UI purposes), declare that a WideString may be converted to a PMString simply by using the PMString constructor and the WideString as its argument. So I simply did this: WideString SomeWString(With some widestring data in it); PMString SomePMString(SomeWideString); std::string SomeString = SomePMString.GetPlatformString(). PMString::GetPlatformString() provides the user with a std::basic_string on US-standard Mac and Windows boxes. I suspect that on computers that use Kanji or other non-western alphabets, it provides strings appropriate to their language. That's why it's called GetPlatformString. Oh and by the way, I was using the STL basic_stringchar string object. I have no idea what other kind of basic_string you thought I might be using. The PMString does have enough flexibility to use 16-bit chars, but it also has enough intelligence to use 8-bit chars if the language warrants it (and a few other rules that are not clear but are obviously in play to someone who has had to work with PMString for the last eight years or so). Besides, I only used PMString as a stepping stone to get from WideString to basic_string, which, by the way, I looked at in the debugger and found it to be standard ASCII characters--no spaces or unexpected characters included except at the expected places. I should think that the fact that I was able to copy the string using the old-style strcpy(), and found its true length with strlen(), ending up with the expected data in the tables would have finally been proof enough to you that I knew what I was talking about, since strcpy is a simple byte-by-byte copy function. The locked-in-concrete size of the char buf that you point out is a good point. However, the code was proof of concept code. I was simply trying to figure out how to make something work. I wasn't interested in writing clean, elegant code with all the 'i's dotted and the 't's crossed. Programmers often do that when they're first wading into unknown waters. When you talk about pointers, there are all sorts of ways in which a pointer can be different and yet be functionally the same. Consider the following: Char *p; Char p[100]; Const char *p; Const char p[100]; Void *p; // cast to something like this: (char *) it would work just fine as a null-terminated C-style string. One could even do something like this, though why he/she might want to is a mystery (but I have seen stranger and more wondrous code): Smallint q[100]; Int a = strlen((char *) q); (Please note that Outlook is capitalizing the first words of the line--I recognize that they all should be lower case-so please don't be petty and point it out.) In C++ if a function calls for a *p and you give it a p[], the compiler will complain. The compiler did not complain when I used std::basic_string.c_str(), which is why this is all so puzzling. Yet it is obvious to me, even if it is not to you, that the data was fine (not UTF16). sqlite3_bind_text simply did not like the std::basic_string.c_str() pointer returned. But a standard, C-style null-terminated string worked fine. If the SQLite3 function expects the first kind of pointer and goes crazy with anything else, then that could have
Re: [sqlite] Troubleshooting...
Thank you Igor. That explanation makes sense. And it fits all the information I had collected. R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Igor Tandetnik Sent: Monday, December 20, 2010 12:10 PM To: sqlite-users@sqlite.org Subject: Re: [sqlite] Troubleshooting... On 12/17/2010 6:18 PM, john darnell wrote: Here's that statement from my code again with the mods included that make the code work: char *surbuf[100]; memset(surbuf, 0, 100); strcpy(surbuf, CurrentName - second.GetSurName().c_str()); idx = -1; idx = sqlite3_bind_parameter_index(ResultStmt, :sur); sqlite3_bind_text(ResultStmt, idx, surbuf, strlen(surbuf), SQLITE_STATIC); This works because the string no longer disappears from under the statement, the way it did before. -- 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] beginner
Hello Srindhi: From one SQLite beginner to another... SQLite and SQL are two different subjects. So you need to clarify for yourself what you want to do. Do you want to learn SQL? Then there are a number of good books you can get from Amazon to help you learn, and there are a number of fine tutorials on the web. Are you trying to embed a database into a program or web page? Then you need both SQL and SQLite (I have no experience embedding SQLite into a web page so don't ask for advice from me on that one). I am learning SQLite based on the O'Reilly book by Jay Kreibich, called USING SQLITE, which came out in August of this year, so it's pretty up to date. Amazon has a number of good books on both subjects, so surf on over to their site and enter SQL into the subject line. I personally have found any of the HEAD FIRST books to be superb for quickly picking up a new topic. I just checked; there is a *Head First SQL* book out there that should be ideal for learning SQL. -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Srinidhi Rao Sent: Friday, December 17, 2010 5:43 AM To: sqlite-users@sqlite.org Subject: [sqlite] beginner Hello SQLiters... I am interested to learn the nuances of a SQL but I have no background of using one as I am an electronics student. I would like to know few things, that does SQLite help me to learn and devoid the space of not having any background. Can any one suggest me where (and how...) to start, any good books that can help me here. -- Thanks and Regards, Srinidhi. Tell me and I forget. Teach me and I remember. Involve me and I learn. -- Benjamin Franklin. ___ 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] beginner
(Grin and embarrassed blush) I am. Quite useful, as a matter of fact. If you need an endorsement, please let me know. -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Jay A. Kreibich Sent: Friday, December 17, 2010 9:01 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] beginner On Fri, Dec 17, 2010 at 08:42:54AM -0600, john darnell scratched on the wall: I am learning SQLite based on the O'Reilly book by Jay Kreibich, called USING SQLITE, which came out in August of this year, so it's pretty up to date. I hope you're finding it useful. -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 ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Troubleshooting...
Thanks, Pavel. I will do this. R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Pavel Ivanov Sent: Friday, December 17, 2010 9:22 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] Troubleshooting... I am using SQLite3.exe to query the data with standard select statements (select * from table). Is there some setting within SQLite3 that I should be manipulating to provide me UTF8 output? I'm not strong in that but I believe your settings should be not in SQLite3 but in Windows. Try to search the internet for Windows terminal encoding. Meanwhile to check that your database contains what you want try to redirect all output from sqlite3.exe to some text file and then view it in notepad or browser. They can understand UTF-8 encoding pretty well. Pavel On Thu, Dec 16, 2010 at 4:47 PM, john darnell john.darn...@walsworth.com wrote: -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- boun...@sqlite.org] On Behalf Of Pavel Ivanov Sent: Thursday, December 16, 2010 2:53 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Troubleshooting... Once I bind the data to the Insert statement, how can I look at the final statement to see what I have done wrong when the statement does not work? There's no way to do that. You should print what you bind yourself. For me it looks like you insert into database some UTF-8 string and then try to look at it in the terminal working in some other encoding and it thus unable to show your UTF-8 string correctly. Pavel Thank you Pavel. I am using SQLite3.exe to query the data with standard select statements (select * from table). Is there some setting within SQLite3 that I should be manipulating to provide me UTF8 output? The last four fields lead me to believe that my problem may be up front, on input. They accurately reflect the values that I am storing. The only difference between them and the earlier fields is that they are integer while the rest is text. R, John On Thu, Dec 16, 2010 at 3:35 PM, john darnell john.darn...@walsworth.com wrote: IAW the SQLite book I purchased, I have incorporated data binding into my “INSERT” statements, but neither of the two most important statements are working…or rather, the first adds a record to the table, but it is mostly junk, looking like this: 4851||x|x|x||2|3|1|10 4852||ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■|ε■ε■ε■ε■ε■ε■ε■ε ■ε|ε■ε■ε■ε■ε■ε■ε■ε■ε■ε||2|3|1|10 4853||x|ε■ε■ε■ε■ε■ε■ε■ε■ε|ε■ε■ε■ε■ε■ε■ε■ε■ε■ε||2|3|1|10 4854||ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■|ε■ε■ε■ε■ε■ε■ε■ε ■ε|ε■ε■ε■ε■ε■ε■ε■ε■ε■ε||2|3|1|10 And the second one publishes a self-generating statement that the Insert statement did not work. Once I bind the data to the Insert statement, how can I look at the final statement to see what I have done wrong when the statement does not work? R, John A.M. Darnell Senior Programmer Walsworth Publishing Company Brookfield, MO John may also be reached at johnamdarn...@gmail.commailto:johnamdarn...@gmail.com Trivia SF question: In the movie, THE MATRIX, just before Neo and Trinity take a harrowing ride up an elevator shaft holding on to an elevator cable, Neo mutters a single phrase. What is that phrase? ___ 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] Troubleshooting...
I could not figure out how to pipe my info to a file (I guess I am still a very young (at 57 years) newbie when it comes to SQLite) so I tried something else. In my code, I hardcoded the data instead of using variables. Here is a copy of one of the statement groups I am using to bind data to the insert statement: idx = -1; idx = sqlite3_bind_parameter_index(ResultStmt, :disp); sqlite3_bind_text(ResultStmt, idx, CurrentName - second.GetDisplayName().c_str(), -1, SQLITE_STATIC); //sqlite3_bind_text(ResultStmt, idx, Smith, John Jacob Jingleheimer, -1, SQLITE_STATIC); The hard-coded data statement is commented out but left in FYI. The CurrentName - second.GetDisplayName().c_str() is one element of an STL map. The GetDisplayName() function returns a basic_string, and the c_str() is supposed to return a null-terminated c string style pointer to the data captured in a basic_string. Using SELECT * from NAMES in SQLite3.exe here is a glimpse of the data output with a mixture of hard-coded and variable-governed records (52 - 57 are hard-coded, above are records created using basic_string input): 52||Smith|John|Jacob|Jingleheimer||Smith, John Jacob Jingleheimer|dont use anything|1|101|0 53||Smith|John|Jacob|Jingleheimer||Smith, John Jacob Jingleheimer|dont use anything|1|101|0 54||Smith|John|Jacob|Jingleheimer||Smith, John Jacob Jingleheimer|dont use anything|1|101|0 55||Smith|John|Jacob|Jingleheimer||Smith, John Jacob Jingleheimer|dont use anything|1|101|0 56||Smith|John|Jacob|Jingleheimer||Smith, John Jacob Jingleheimer|dont use anything|1|101|0 57||Smith|John|Jacob|Jingleheimer||Smith, John Jacob Jingleheimer|dont use anything|1|101|0 58|0|1|0 59|||ε■ε■ε■ε■ε■ε■ε■ε■ε||0|1|0 60|||ε■ε■ε■ε■ε■ε■ε■ε■||0|1|0 61|||ε■ε■ε■ε■ε■ε■ε■ε■ε■ε||0|1|0 So you can see that when I add the hard-coded data, everything looks fine in the results of the select statement, which leads me to believe that the problem is not confusion between UTF8 and UTF16 output. Does SQLite3 have problems dealing with basic_strings? R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Pavel Ivanov Sent: Friday, December 17, 2010 9:22 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] Troubleshooting... I am using SQLite3.exe to query the data with standard select statements (select * from table). Is there some setting within SQLite3 that I should be manipulating to provide me UTF8 output? I'm not strong in that but I believe your settings should be not in SQLite3 but in Windows. Try to search the internet for Windows terminal encoding. Meanwhile to check that your database contains what you want try to redirect all output from sqlite3.exe to some text file and then view it in notepad or browser. They can understand UTF-8 encoding pretty well. Pavel On Thu, Dec 16, 2010 at 4:47 PM, john darnell john.darn...@walsworth.com wrote: -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- boun...@sqlite.org] On Behalf Of Pavel Ivanov Sent: Thursday, December 16, 2010 2:53 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Troubleshooting... Once I bind the data to the Insert statement, how can I look at the final statement to see what I have done wrong when the statement does not work? There's no way to do that. You should print what you bind yourself. For me it looks like you insert into database some UTF-8 string and then try to look at it in the terminal working in some other encoding and it thus unable to show your UTF-8 string correctly. Pavel Thank you Pavel. I am using SQLite3.exe to query the data with standard select statements (select * from table). Is there some setting within SQLite3 that I should be manipulating to provide me UTF8 output? The last four fields lead me to believe that my problem may be up front, on input. They accurately reflect the values that I am storing. The only difference between them and the earlier fields is that they are integer while the rest is text. R, John On Thu, Dec 16, 2010 at 3:35 PM, john darnell john.darn...@walsworth.com wrote: IAW the SQLite book I purchased, I have incorporated data binding into my “INSERT” statements, but neither of the two most important statements are working…or rather, the first adds a record to the table, but it is mostly junk, looking like this: 4851||x|x|x||2|3|1|10 4852||ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■|ε■ε■ε■ε■ε■ε■ε■ε ■ε|ε■ε■ε■ε■ε■ε■ε■ε■ε■ε||2|3|1|10 4853||x|ε■ε■ε■ε■ε■ε■ε■ε■ε|ε■ε■ε■ε■ε■ε■ε■ε■ε■ε||2|3|1|10 4854||ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■|ε■ε■ε■ε■ε■ε■ε■ε ■ε|ε■ε■ε■ε■ε■ε■ε■ε■ε■ε||2|3|1|10 And the second one publishes a self-generating statement that the Insert statement did
Re: [sqlite] Troubleshooting...
Pavel, I really appreciate you hanging with me on this subject. I can sometimes be a bit thick and your patience in dealing with my situation is greatly appreciated. The data I am using is a very small set of names pulled from an InDesign document text frame. They look like this: John Darnell Patrick O'Reilley William Roberts Patricia Smith So you can see that all the characters in the data are ASCII characters. Nevertheless your point is well-taken that the data could be something other than UTF8, especially since InDesign uses a WideString class internally. I'm pretty sure I have taken the steps that need to be taken to transform the WideString objects to basic_string objects, but that is an assumption that needs to be tested, and I am working on a way to do that right now. Supposedly, basic_string deals with nothing other than UTF8 strings. That has been my assumption until now. I will let you know what I figure out. Soon. R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Pavel Ivanov Sent: Friday, December 17, 2010 4:44 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Troubleshooting... So you can see that when I add the hard-coded data, everything looks fine in the results of the select statement, which leads me to believe that the problem is not confusion between UTF8 and UTF16 output. Your hardcoded data has only characters from ASCII set which don't differ from the same in UTF-8. Besides SQLite API and command line utility don't check your strings to be valid UTF-8. SQLite API puts into database whatever you give to it, command line utility throws to stdout whatever it finds in the database (so my guess could be wrong and your input strings could be not in UTF-8 but in some other encoding). It's totally developer's responsibility to make sure that encoding put into database is the same as is expected when it's retrieved from database. I could not figure out how to pipe my info to a file One of possible solutions is to use .output command in the sqlite3 utility (you can use .help command to see everything that is available to you there) or to provide your sql statement as last argument when you start sqlite3 utility and use standard redirection like this: sqlite3 database.db select * from mytable output.txt Pavel On Fri, Dec 17, 2010 at 5:23 PM, john darnell john.darn...@walsworth.com wrote: I could not figure out how to pipe my info to a file (I guess I am still a very young (at 57 years) newbie when it comes to SQLite) so I tried something else. In my code, I hardcoded the data instead of using variables. Here is a copy of one of the statement groups I am using to bind data to the insert statement: idx = -1; idx = sqlite3_bind_parameter_index(ResultStmt, :disp); sqlite3_bind_text(ResultStmt, idx, CurrentName - second.GetDisplayName().c_str(), -1, SQLITE_STATIC); //sqlite3_bind_text(ResultStmt, idx, Smith, John Jacob Jingleheimer, -1, SQLITE_STATIC); The hard-coded data statement is commented out but left in FYI. The CurrentName - second.GetDisplayName().c_str() is one element of an STL map. The GetDisplayName() function returns a basic_string, and the c_str() is supposed to return a null-terminated c string style pointer to the data captured in a basic_string. Using SELECT * from NAMES in SQLite3.exe here is a glimpse of the data output with a mixture of hard-coded and variable-governed records (52 - 57 are hard-coded, above are records created using basic_string input): 52||Smith|John|Jacob|Jingleheimer||Smith, John Jacob Jingleheimer|dont use anything|1|101|0 53||Smith|John|Jacob|Jingleheimer||Smith, John Jacob Jingleheimer|dont use anything|1|101|0 54||Smith|John|Jacob|Jingleheimer||Smith, John Jacob Jingleheimer|dont use anything|1|101|0 55||Smith|John|Jacob|Jingleheimer||Smith, John Jacob Jingleheimer|dont use anything|1|101|0 56||Smith|John|Jacob|Jingleheimer||Smith, John Jacob Jingleheimer|dont use anything|1|101|0 57||Smith|John|Jacob|Jingleheimer||Smith, John Jacob Jingleheimer|dont use anything|1|101|0 58|0|1|0 59|||ε■ε■ε■ε■ε■ε■ε■ε■ε||0|1|0 60|||ε■ε■ε■ε■ε■ε■ε■ε■||0|1|0 61|||ε■ε■ε■ε■ε■ε■ε■ε■ε■ε||0|1|0 So you can see that when I add the hard-coded data, everything looks fine in the results of the select statement, which leads me to believe that the problem is not confusion between UTF8 and UTF16 output. Does SQLite3 have problems dealing with basic_strings? R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- boun...@sqlite.org] On Behalf Of Pavel Ivanov Sent: Friday, December 17, 2010 9:22 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] Troubleshooting... I am using SQLite3.exe to query the data
Re: [sqlite] Troubleshooting...
Okay. I worked out a solution, but I am still unsure of why it fixes the problem. Or rather, I know why it works, but it still doesn't explain why the basic_string::c_str() call did not work. My only guess is that basic_string::c_str() doesn't really provide a pointer to a null-terminated c-style string, but a facsimile of one that SQLite doesn't like. Here's that statement from my code again with the mods included that make the code work: char *surbuf[100]; memset(surbuf, 0, 100); strcpy(surbuf, CurrentName - second.GetSurName().c_str()); idx = -1; idx = sqlite3_bind_parameter_index(ResultStmt, :sur); sqlite3_bind_text(ResultStmt, idx, surbuf, strlen(surbuf), SQLITE_STATIC); BTW, I was using the .output command in the SQLITE3 shell to attempt piping my output to a file. The command looked like this: .output c:\sqlite.txt Select * from Names; When I went to the root of C: I did not find the file. So I removed the path from the filename and later found it in the SQLLite directory from which I was running the shell. R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Pavel Ivanov Sent: Friday, December 17, 2010 4:44 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Troubleshooting... So you can see that when I add the hard-coded data, everything looks fine in the results of the select statement, which leads me to believe that the problem is not confusion between UTF8 and UTF16 output. Your hardcoded data has only characters from ASCII set which don't differ from the same in UTF-8. Besides SQLite API and command line utility don't check your strings to be valid UTF-8. SQLite API puts into database whatever you give to it, command line utility throws to stdout whatever it finds in the database (so my guess could be wrong and your input strings could be not in UTF-8 but in some other encoding). It's totally developer's responsibility to make sure that encoding put into database is the same as is expected when it's retrieved from database. I could not figure out how to pipe my info to a file One of possible solutions is to use .output command in the sqlite3 utility (you can use .help command to see everything that is available to you there) or to provide your sql statement as last argument when you start sqlite3 utility and use standard redirection like this: sqlite3 database.db select * from mytable output.txt ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Troubleshooting...
IAW the SQLite book I purchased, I have incorporated data binding into my “INSERT” statements, but neither of the two most important statements are working…or rather, the first adds a record to the table, but it is mostly junk, looking like this: 4851||x|x|x||2|3|1|10 4852||ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■|ε■ε■ε■ε■ε■ε■ε■ε■ε|ε■ε■ε■ε■ε■ε■ε■ε■ε■ε||2|3|1|10 4853||x|ε■ε■ε■ε■ε■ε■ε■ε■ε|ε■ε■ε■ε■ε■ε■ε■ε■ε■ε||2|3|1|10 4854||ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■|ε■ε■ε■ε■ε■ε■ε■ε■ε|ε■ε■ε■ε■ε■ε■ε■ε■ε■ε||2|3|1|10 And the second one publishes a self-generating statement that the Insert statement did not work. Once I bind the data to the Insert statement, how can I look at the final statement to see what I have done wrong when the statement does not work? R, John A.M. Darnell Senior Programmer Walsworth Publishing Company Brookfield, MO John may also be reached at johnamdarn...@gmail.commailto:johnamdarn...@gmail.com Trivia SF question: In the movie, THE MATRIX, just before Neo and Trinity take a harrowing ride up an elevator shaft holding on to an elevator cable, Neo mutters a single phrase. What is that phrase? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Troubleshooting...
-Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Pavel Ivanov Sent: Thursday, December 16, 2010 2:53 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Troubleshooting... Once I bind the data to the Insert statement, how can I look at the final statement to see what I have done wrong when the statement does not work? There's no way to do that. You should print what you bind yourself. For me it looks like you insert into database some UTF-8 string and then try to look at it in the terminal working in some other encoding and it thus unable to show your UTF-8 string correctly. Pavel Thank you Pavel. I am using SQLite3.exe to query the data with standard select statements (select * from table). Is there some setting within SQLite3 that I should be manipulating to provide me UTF8 output? The last four fields lead me to believe that my problem may be up front, on input. They accurately reflect the values that I am storing. The only difference between them and the earlier fields is that they are integer while the rest is text. R, John On Thu, Dec 16, 2010 at 3:35 PM, john darnell john.darn...@walsworth.com wrote: IAW the SQLite book I purchased, I have incorporated data binding into my “INSERT” statements, but neither of the two most important statements are working…or rather, the first adds a record to the table, but it is mostly junk, looking like this: 4851||x|x|x||2|3|1|10 4852||ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■|ε■ε■ε■ε■ε■ε■ε■ε ■ε|ε■ε■ε■ε■ε■ε■ε■ε■ε■ε||2|3|1|10 4853||x|ε■ε■ε■ε■ε■ε■ε■ε■ε|ε■ε■ε■ε■ε■ε■ε■ε■ε■ε||2|3|1|10 4854||ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■ε■|ε■ε■ε■ε■ε■ε■ε■ε ■ε|ε■ε■ε■ε■ε■ε■ε■ε■ε■ε||2|3|1|10 And the second one publishes a self-generating statement that the Insert statement did not work. Once I bind the data to the Insert statement, how can I look at the final statement to see what I have done wrong when the statement does not work? R, John A.M. Darnell Senior Programmer Walsworth Publishing Company Brookfield, MO John may also be reached at johnamdarn...@gmail.commailto:johnamdarn...@gmail.com Trivia SF question: In the movie, THE MATRIX, just before Neo and Trinity take a harrowing ride up an elevator shaft holding on to an elevator cable, Neo mutters a single phrase. What is that phrase? ___ 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] SQLite Documentation v2
-Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Dagdamor Sent: Friday, December 10, 2010 12:04 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] SQLite Documentation v2 Artur Reilin sql...@yuedream.de писал(а) в своём письме Fri, 10 Dec 2010 23:51:31 +0600: SQLite Documentation (unofficial, HTML Help version) has been updated. Changes: - keywords list (index) extended with many new terms - one missing link (Locking And Concurrency) added to the TOC - four missing images (rounded corners) added to the file - more accurate links to the main sections - SQLite releases are now listed in the correct, natural order The download link is the same: http://www.phpc.ru/files/sqlite/sqlite_docs_3_7_3.chm If you can't see the contents, unblock the .chm first (right-click on the file in Explorer, then click Unblock) - thanks to Luuk34 for the tip. Stupid question I know, but you did mean Windows Explorer, did you not? Anyway, stupid question or not, when I right-click the file in Windows Explorer, I see no option to unblock. I'm using XP SP3. Is there another option? R, John ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] SQLite Documentation v2
Indeed, Windows Explorer. Please investigate the options in the popup menu (maybe you should choose Properties first and then look in the dialog box... I'm not sure). It has to be there :) -- Regards, Serge Igitov Thanks, Serge. That worked. R, john ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] enums
Is there any way to build an SQLite table that recognizes enums? It's a lot easier to understand at data that looks like this: kHard kSoft kAlt kSoft kSoft kHard than this: 1 2 3 2 2 1 R, John A.M. Darnell Senior Programmer Walsworth Publishing Company Brookfield, MO John may also be reached at johnamdarn...@gmail.commailto:johnamdarn...@gmail.com Trivia SF question: In the movie, THE MATRIX, just before Neo and Trinity take a harrowing ride up an elevator shaft holding on to an elevator cable, Neo mutters a single phrase. What is that phrase? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] enums
I have no better reason than that I'm used to it in my dealings with MySQL and C++. It could save developer time and disk space, however, if it were efficiently implemented. From the sense of your comment, I get that the answer is no...Oh well. At least I learned something today. Thanks for the information, Max. R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Max Vlasov Sent: Tuesday, December 07, 2010 12:15 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] enums On Tue, Dec 7, 2010 at 8:38 PM, john darnell john.darn...@walsworth.comwrote: Is there any way to build an SQLite table that recognizes enums? Hmm, I always thought that this is better to be implemented by a separate table and lookup join. Can you name a reason to do this internally by sqlite? Max Vlasov ___ 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] enums
-Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Dagdamor Sent: Tuesday, December 07, 2010 12:46 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] enums john darnell john.darn...@walsworth.com писал(а) в своём письме Wed, 08 Dec 2010 00:22:54 +0600: I have no better reason than that I'm used to it in my dealings with MySQL and C++. It could save developer time and disk space, however, if it were efficiently implemented. From the sense of your comment, I get that the answer is no...Oh well. At least I learned something today. Thanks for the information, Max. R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Max Vlasov Sent: Tuesday, December 07, 2010 12:15 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] enums On Tue, Dec 7, 2010 at 8:38 PM, john darnell john.darn...@walsworth.comwrote: Is there any way to build an SQLite table that recognizes enums? Hmm, I always thought that this is better to be implemented by a separate table and lookup join. Can you name a reason to do this internally by sqlite? Max Vlasov Enums are useful for keeping your data correct - i.e. you declate a field as enum('alpha','beta','gamma') and you can be sure that that field will be holding only one of those values, and nothing more, never. Internally these values held as integers (0, 1, 2), one byte per field, so they won't waste too much space :) But SQLite has a principle of free-typing (or manifest typing), so I'm not sure how enums idea conflicts with that principle... -- Regards, Serge Igitov I cannot find a reference to enum in any SQLite documentation. Hmm. I suppose I could write a quick little function and use it as the Default... On a completely off-topic subject, Mr. Igitov, your moniker is Dagdamor...for a moment there I thought you might be Irish Celt (Dagda meaning the good father and was a principle Irish god in olden times), but Igitov kinda makes me think otherwise. Chat with me offline (meaning, outside the list) if you are interested in pursuing this wholly trivial but still interesting topic. R, John ___ 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
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 john.darn...@walsworth.com 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] Creating a database.
I know this is a fundamental question, but in the book I'm using to learn SQLite, there is no reference that I can find for what one needs to do to create a database. I thought that simply using a CREATE statement with a database name included might do the trick, but alas it does not. I went to the SQLite website and under the SQLite in 5 minutes page it says to simply do this (after downloading the appropriate files, which I did) at the dos prompt: SQLite3 test.db When I tried it, I received this back: SQLite version 3.7.3 Enter .help for instructions Enter SQL statements terminated with a ; sqlite I quit out of the SQLite shell and looked for test.db and did not find it. So my question remains. How do I create a database? R, John A.M. Darnell Senior Programmer Walsworth Publishing Company Brookfield, MO John may also be reached at johnamdarn...@gmail.commailto:johnamdarn...@gmail.com Trivia SF question: In the movie, THE MATRIX, just before Neo and Trinity take a harrowing ride up an elevator shaft holding on to an elevator cable, Neo mutters a single phrase. What is that phrase? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] creating a database
Okay, I seem to have figured it out. One needs to create the database and then add a table before the database will be created. Sorry for the baby steps. R, John A.M. Darnell Senior Programmer Walsworth Publishing Company Brookfield, MO John may also be reached at johnamdarn...@gmail.commailto:johnamdarn...@gmail.com Trivia SF question: In the movie, THE MATRIX, just before Neo and Trinity take a harrowing ride up an elevator shaft holding on to an elevator cable, Neo mutters a single phrase. What is that phrase? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Just compiled SQLite in Visual Studio
Hello Folks: I just started a big project that needed an internal database manager and SQLite looks like it will fit the bill. I am old hat with SQL but have absolutely no experience with SQLite, so here's hoping that you folks are a real friendly bunch and will help me get up to speed. Promise: I will do my homework first before contacting the list so if the question seems dumb, believe me, I've tried to figure it out on my own. Okay, now that that's out of the way, here's that first dumb-sounding question. I got my boss to purchase an O'Reilly book called Using SQLite, and the author makes a rather ominous statement: All of the SQLite source is written in C...Make sure you use a vanilla C Compiler. 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? R, John A.M. Darnell Senior Programmer Walsworth Publishing Company Brookfield, MO John may also be reached at johnamdarn...@gmail.commailto:johnamdarn...@gmail.com Trivia SF question: In the movie, THE MATRIX, just before Neo and Trinity take a harrowing ride up an elevator shaft holding on to an elevator cable, Neo mutters a single phrase. What is that phrase? ___ 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
Thanks, Simon. I'll take your advice. Oh and BTW, I apologize for the Mac truck remark--I meant no offense to my friends who code for the Mac (grin). R, John -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Simon Slavin Sent: Monday, November 29, 2010 5:39 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Just compiled SQLite in Visual Studio On 29 Nov 2010, at 11:10pm, john darnell wrote: here's that first dumb-sounding question. I got my boss to purchase an O'Reilly book called Using SQLite, and the author makes a rather ominous statement: All of the SQLite source is written in C...Make sure you use a vanilla C Compiler. 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? That's not dumb, that's I've been hurt before.. But you should definitely use the command-line tool to make a database and see if your application can read it before you relax. Portability is one of the main design criteria for SQLite. Unlike most SQL engines you can find these days it needs to run not only on desktop computers but TVs, phones, and tiny little embedded controllers. The simplest way to make that happen is to write it in C and make sure it compiles on anything with a C compiler available. It's a handicap in some ways, since the programmers can't use even C++, but it means people developing for any new gadget tend to turn to SQLite. And if it has to be compilable for a PVR/DVR a Wintel computer is no trouble at all. Simon. ___ 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