Re: [sqlite] Problem with SQLite in BCB 4
- Original Message >From: Simon Davies>The return from sqlite3_column_text is not valid after subsequent calls to any >of >sqlite3_step/sqlite3_reset/sqlite3_finalize. Yes. What about void *p = sqlite3_column_blob()? >From my tests it looks that pointer p survives sqlite3_finalize(). Is it just a coincidence? On the other hand I experienced invalidations of blob handles obtained by sqlite3_blob_open() after updating records in an UNRELATED table. I could not find description of this behavior in the SQLite documentation. It may be nature of the beats, a bug or a "feature". Unfortunately this behavior may keep me away from using incremental read/write. Regards, Samuel __ Make your browsing faster, safer, and easier with the new Internet Explorer® 8. Optimized for Yahoo! Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/ ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Problem with SQLite in BCB 4
>> 2010/3/6 Chimerian: >> values.push_back((char*)sqlite3_column_text(statement, col)); >> // HERE IS ERROR ! >From: Simon Davies >What error? >I can not see why THIS line should provoke any error; This line will produce a runtime error when sqlite3_column_text(statement, col); returns NULL pointer (and NULL value is a valid value for any affinity if not restricted by NO NULL clause) > but be aware that you are creating a vector of INVALID pointers. No. values.push_back is not creating vector of invalid pointers. It is creating vector of strings. The problem is no valid string can be created from NULL pointer. This function will fail trying to obtain the length of the string from NULL pointer. >The return from sqlite3_column_text is not valid after subsequent calls to any of >sqlite3_step/sqlite3_reset/sqlite3_finalize. VERY TRUE! It is easy to forget about it! >You need to make a copy of the string and store that, not the pointer >returned from sqlite3_column_text. True. But this is done automatically by values.push_back() The vector, like all other Standard Library containers, stores copies - these copies are made with the copy constructor. Regards, Samuel __ Make your browsing faster, safer, and easier with the new Internet Explorer® 8. Optimized for Yahoo! Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/ ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Problem with SQLite in BCB 4
2010/3/6 Chimerian: > I have a problem with SQLite in BCB 4.0. I wrote my own application - > I found very useful information on > http://www.dreamincode.net/forums/index.php?showtopic=122300 > > On form (Form1) I have: Memo1 and Button3. > > File Unit1.cpp: > > . . . .> for(int col = 0; col < cols; col++) > { > > values.push_back((char*)sqlite3_column_text(statement, col)); > // HERE IS ERROR ! What error? I can not see why THIS line should provoke any error; but be aware that you are creating a vector of INVALID pointers. The return from sqlite3_column_text is not valid after subsequent calls to any of sqlite3_step/sqlite3_reset/sqlite3_finalize. You need to make a copy of the string and store that, not the pointer returned from sqlite3_column_text. > } > results.push_back(values); > } > else > { > break; > } . . . > How to fix it ? See above (possibly) > > I have Borland Builder 4 Standart and Windows 7. I use 3.6.22 version > of SQLite. > > Link to my project (comments in polish): http://chimerian.net/4prog.rar > > Regards, Simon ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Problem with SQLite in BCB 4
Chimerian, I compiled and tested the tutorial example (which you pointed out) with VC++ on XP Pro. Example is fine, except with the problem of not checking for NULL pointer, which I fixed for you. DB is created and values are stored and retrieved. No problem with SQLite or STL. I do not have Borland C++ Builder 6, but I assume it has debugger and you can put a break point to see where char *ptr points. You can also instead of using sqlite3.dll compile sqlite3.c source code and step through the qlite3_column_text(statement, col) function to see how it goes. I strongly suggest to test this example “AS IS” without any Borland GUI interference. Just pure C++ and STL. (There is always a remote possibility for memory overrun or bad linking job). So try the example alone without the pollution first. Good luck. - Original Message >From: Chimerian>To: sqlite-users@sqlite.org >Sent: Mon, March 8, 2010 12:18:53 PM >Subject: Re: [sqlite] Problem with SQLite in BCB 4 >Unfortunately I cant print the value of val before it's pushed to the >values vector because when do that I got this same error - I think >the problem is with pointer: >char * ptr = (char*)sqlite3_column_text(statement, col); >Maybe it hold wrong address ? __ Looking for the perfect gift? Give the gift of Flickr! http://www.flickr.com/gift/ ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Problem with SQLite in BCB 4
Unfortunately I cant print the value of val before it's pushed to the values vector because when do that I got this same error - I think the problem is with pointer: char * ptr = (char*)sqlite3_column_text(statement, col); Maybe it hold wrong address ? I compile this code on Borland C++ Builder 6 Personal and still have error. Summary: I have error on Windows XP / Windows 7 and in Borland Builder 4 Standart / 6 Personal ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Porting Sqlite to MQX Operating system
Hi I wasted another entire day on this without really being able to grasp what the problem is. The call sequence is for the sqlite3OsClose() function Working Windows version pager_unlock() pPager->jfpd where pMethods =0 releaseAllSavepoints() pPager->sjfpd where pMethods =0 above 2 lines repeat 3 times then sqlite3PagerClose() pPager->fd where pMethods <> 0 hence a real file close of the test.db file occurs MQX faulty version pager_unlock() pPager->jfpd where pMethods = 0 pager_unlock() pPager->jfpd where pMethods = 0 releaseAllSavepoints() pPager->sjfpd where pMethods <> 0 This call to releaseAllSavepoints has the pMethods pointer pointing at the sqlite3_io_methods mqxIoMethod structure, so a call to mqxClose() occurs and a the db file is erroneously closed. Any ideas on this would be greatly appreciated. Thanks Geoff GeoffW wrote: > > hello Dan > > Thanks for the very speedy reply. I have just been experimenting with the > working Windows version. > > I only get one hit of the winOpen() function and that is with a filename > parameter of the full path to my test.db file > > So maybe it is not a temporary journal file or maybe I am misunderstanding > what you a saying ? > > > The only other thing I have noticed since my initial post is that even for > the working Windows version I am getting 7 calls to the sqlite3OsClose() > function. The actual close of the file is prevented by the line if( > pId->pMethods ). As that is NULL, it doesnt close the file except for the > very last 7th time it is called where pMethods is not NULL. I didnt > expect it to do this on the windows version, seems odd to me. > > On MQX the 2nd call to sqlite3OsClose() has pId->pMethods != NULL so an > actual close occurs. > > Geoff > > > > > > Dan Kennedy-4 wrote: >> >>> >>> http://old.nabble.com/file/p27792715/stack.jpg >>> >>> I know its a long shot but does Dr Hipp or anyone have any possible >>> ideas >>> what could give rise to a premature file close ? Sorry my message >>> was so >>> long. Thanks for any ideas >> >> SQLite thinks it is closing the statement journal here, not >> the db file. This file should have been opened with the pathname >> argument to the xOpen call set to NULL. >> >> Dan. >> >> ___ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> >> > > -- View this message in context: http://old.nabble.com/Porting-Sqlite-to-MQX-Operating-system-tp27792715p27823835.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] SQL Server 2005 and SQLite data types
On 8 Mar 2010, at 10:33am, Preeti1 wrote: > I want to do some mappings for SQL Server and SQLite data types.I went > through the link http://www.sqlite.org/datatype3.html for the data types.But > still confused with few data type mappings from sql server to sql ce. > Can anyone please tell me the equivalent data type for sqlite for the > following sql server datatypes: > 1.uinqueidentifier > 2.nvarchar > 3.float > 4.ntext It would be helpful if you'd post a page where these types are defined for your version of SQL Server. Given what this mailing list is about we can naturally be expected to understand SQLite, but you have no idea whether any of us have ever used SQL Server. However, my guesses for your version of SQL Server are as follows: 1. You could hold them as TEXT but there is no special type for GUIDs. 2. TEXT 3. REAL 4. TEXT or perhaps BLOB (ntext is deprecated and no longer has a consistent definition) Also, I'll point out that SQLite uses column affinities, not column types. An SQLite column has an affinity, but that doesn't ensure that every value in that column has that type. In SQLite you can create an INTEGER column, but any row of that table might have a string stored in that column. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] SQL Server 2005 and SQLite data types
Hi, I want to do some mappings for SQL Server and SQLite data types.I went through the link http://www.sqlite.org/datatype3.html for the data types.But still confused with few data type mappings from sql server to sql ce. Can anyone please tell me the equivalent data type for sqlite for the following sql server datatypes: 1.uinqueidentifier 2.nvarchar 3.float 4.ntext Thanks in advance -- View this message in context: http://old.nabble.com/SQL-Server-2005-and-SQLite-data-types-tp27819465p27819465.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Question about using SQLite3 on Windows Mobile 6+
Anthony Papillion a écrit : Hello Anthony, Your windows Mobile device has a Arm processor, you will need to recompile sqlite.dll for that processor (with evc3+evc4 or visual studio 2005/2008) Best wishes Noël Frankinet > Hello Everyone, > > I'm totally new to SQLite and am trying to use it in a new Windows Mobile > application. I've downloaded the SQLite3.dll and went to my project and > tried to add a reference to the dll. For some reason, when I try to add the > reference, I am told "A reference to sqlite3.dll could not be added" with no > further information. > > I've been searching Google for a while and can't find a resolution so I'm > hoping someone can help me out. > > Thanks a lot! > Anthony Papillion > OpenEMR HQ, Inc. > www.openemrhq.com > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users