[sqlite] SQLite FTS3 Crashed after SQLIte error message "database disk image is malformed"

2010-01-07 Thread subbareddy kuluru
Hi I am using SQLite Fts3 table for indexing the some raw data. I have got a crash when I search for some special string pattern. I have done the following steps before its crashed: 1) PREPARED the statement using sqlite3_prepare 2) BIND the text using sqlite3_bind_text for the string (

Re: [sqlite] temp directory?

2010-01-07 Thread Dan Kennedy
On Jan 8, 2010, at 2:45 AM, Kris Groves wrote: > FYI, in a previous posting, I discovered that even if you set > temp_store > to memory only, you still need a temp_store_directory that is > writable. > I can't recall specifically, but there is one temp file that is > always > on disk

Re: [sqlite] Creation of a sqlite database in VC++

2010-01-07 Thread Pavel Ivanov
Use an API to open a database. If database file does not exist at the time of opening then it will be automatically created (unless you try to open it for read-only access). Pavel On Thu, Jan 7, 2010 at 3:43 PM, gary clark wrote: > Hi, > > I'm looking for an API in

[sqlite] Creation of a sqlite database in VC++

2010-01-07 Thread gary clark
Hi, I'm looking for an API in sqlite3 that allows me to create a database? Does one exist or do I have to do this from the command line i.e sqlite3.exe test.db Much appreciate any help on this as I thought one would be more available. Thanks, Gazza

Re: [sqlite] temp directory?

2010-01-07 Thread Kris Groves
Apparently, and unfortunately not... using pragma temp_store_directory; returns nothing if it is not explicitly set. In this case you know that sqlite will then "search for best option... It would be great if the pragma returned what it is going to use even if it wasn't explicitly set. I

Re: [sqlite] Is there a way to "predict" autoincrement rowid range

2010-01-07 Thread Scott Hess
As mentioned, don't use raw rowid, define a "my_id INTEGER PRIMARY KEY AUTOINCREMENT". This currently acts as an alias to rowid, but if the implementation changes in the future, it will continue to work as documented. So things will be correct, but they might not be as efficient as before.

Re: [sqlite] temp directory?

2010-01-07 Thread Robert Citek
On Thu, Jan 7, 2010 at 12:54 PM, Kris Groves wrote: > So it seems as if TMPDIR will work in two different OSes. What would be an easy test to verify if setting TMPDIR works or not? I did this, which shows that TMPDIR is indeed being used, but I think this test is a bit

Re: [sqlite] temp directory?

2010-01-07 Thread Kris Groves
When I was digging around trying to figure out why things wern't working the way I thought they should I came across a function in the sqlite code called getTempname. In certain situations(i.e. the temp_store_directory is not set), this function will get a tempname based on an environment

Re: [sqlite] temp directory?

2010-01-07 Thread Robert Citek
On Thu, Jan 7, 2010 at 10:42 AM, Jay A. Kreibich wrote: > On Thu, Jan 07, 2010 at 10:35:21AM -0500, Robert Citek scratched on the wall: >> You mention a temp environment variable.  I've googled through the >> sqlite.org site and haven't found any mention of an environment >>

Re: [sqlite] temp directory?

2010-01-07 Thread Artur Reilin
I meaned the php envirement variable. the TMP env for the temporally path of apache. But it doesn't work. But that's not the thing of sqlite3, then the thing that I use sqlite 2.8.17 databases and there the variable doesn't work. The Pragma temp_store and temp_store_directory works only

Re: [sqlite] Is there a way to "predict" autoincrement rowid range

2010-01-07 Thread Jay A. Kreibich
On Thu, Jan 07, 2010 at 11:25:28AM -0500, Pavel Ivanov scratched on the wall: > > ?At the very least, do the initial INSERT and get-last in a > > ?single transaction. > > Not necessarily. You can do INSERT and get-last without starting > transaction because get-last is per-connection, not

Re: [sqlite] SQlite query performs 10 times slower than MS Access query

2010-01-07 Thread Todd F. Richmond
If you test the last query in this email, be careful to test with your original " where x or y" clause along with the "in" version. There is a serious problem where "in" sometimes confuses the search in even simple queries and sqlite ends up doing a table scan instead of an obvious index. I

Re: [sqlite] Is there a way to "predict" autoincrement rowid range

2010-01-07 Thread Pavel Ivanov
>  At the very least, do the initial INSERT and get-last in a >  single transaction. Not necessarily. You can do INSERT and get-last without starting transaction because get-last is per-connection, not per-database. So the only thing that should be taken care of is no inserts are executed on the

Re: [sqlite] Is there a way to "predict" autoincrement rowid range

2010-01-07 Thread Jay A. Kreibich
On Thu, Jan 07, 2010 at 03:39:42PM +, Simon Slavin scratched on the wall: > > On 7 Jan 2010, at 1:15pm, Jay A. Kreibich wrote: > > > There isn't a correct way of doing this. You need to manually loop > > over the SELECT, do the INSERT, and call sqlite3_last_insert_rowid() > > (or the SQL

Re: [sqlite] Is there a way to "predict" autoincrement rowid range

2010-01-07 Thread Max Vlasov
Thanks for the answers. At the first place I wanted to use rowid to save space (since rowids always exist). After reading the replies I changed declaration of ID to the one without AUTOINCREMENT and manually fill the consecutive values starting current max(rowid)+1. So rowids still used but now

Re: [sqlite] temp directory?

2010-01-07 Thread Jay A. Kreibich
On Thu, Jan 07, 2010 at 10:35:21AM -0500, Robert Citek scratched on the wall: > You mention a temp environment variable. I've googled through the > sqlite.org site and haven't found any mention of an environment > variable. What environment variable can I set to change the default > value for

Re: [sqlite] Is there a way to "predict" autoincrement rowid range

2010-01-07 Thread Simon Slavin
On 7 Jan 2010, at 1:15pm, Jay A. Kreibich wrote: > There isn't a correct way of doing this. You need to manually loop > over the SELECT, do the INSERT, and call sqlite3_last_insert_rowid() > (or the SQL function last_insert_rowid()) after each INSERT to build > up a collection of ROWIDs.

Re: [sqlite] temp directory?

2010-01-07 Thread Robert Citek
You mention a temp environment variable. I've googled through the sqlite.org site and haven't found any mention of an environment variable. What environment variable can I set to change the default value for the temporary directory? Regards, - Robert On Fri, Nov 20, 2009 at 5:04 AM, Kris

Re: [sqlite] SQlite query performs 10 times slower than MS Access query

2010-01-07 Thread Jay A. Kreibich
On Thu, Jan 07, 2010 at 08:18:56AM -0500, Tim Romano scratched on the wall: > I don't claim any SQLite expertise, but indexes on values like > True/False, Male/Female -- i.e. where there are only a couple or a few > different values possible in the column -- are normally to be avoided >

Re: [sqlite] Is there a way to "predict" autoincrement rowid range

2010-01-07 Thread Pavel Ivanov
max(rowid) + 1 before the insert is a good approximation for the left bound. But if you want to know the exact value you can remember max(rowid) + 1 before insert and execute this after insert: select min(rowid) from table_name where rowid >= remembered_value It will be guaranteed to give you

Re: [sqlite] SQlite query performs 10 times slower than MS Access query

2010-01-07 Thread Simon Slavin
On 7 Jan 2010, at 1:18pm, Tim Romano wrote: > I don't claim any SQLite expertise, but indexes on values like > True/False, Male/Female -- i.e. where there are only a couple or a few > different values possible in the column -- are normally to be avoided > because low-cardinality indexes

Re: [sqlite] SQLITE_ERROR with system usage

2010-01-07 Thread Christopher Sansone
Thanks for the help, everyone! I tried downloading the latest version, and indeed, that seems to have fixed the problem. I will also add a call to sqlite3_reset() as suggested as well... it may be that this call was a requirement older versions but is not anymore. Cheers, Christopher

Re: [sqlite] SQlite query performs 10 times slower than MS Access query

2010-01-07 Thread Tim Romano
I don't claim any SQLite expertise, but indexes on values like True/False, Male/Female -- i.e. where there are only a couple or a few different values possible in the column -- are normally to be avoided because low-cardinality indexes tend to be inefficient. What is the advice of the

Re: [sqlite] Is there a way to "predict" autoincrement rowid range

2010-01-07 Thread Jay A. Kreibich
On Thu, Jan 07, 2010 at 03:49:59PM +0300, Max Vlasov scratched on the wall: > I have a query "INSERT ... SELECT" and after it performed it I have to to > store range of rowids (autoincrement) of the inserted rows. While max(rowid) > for right bound seems ok, assuming max(rowid)+1 for the left

Re: [sqlite] How to compile the source code when I use the "Online Backup API" ?

2010-01-07 Thread Jay A. Kreibich
On Thu, Jan 07, 2010 at 04:46:26PM +0800, Jinson Wang scratched on the wall: > Hi,all > > Thers is an example "Loading and Saving In-Memory Databases" at > http://www.sqlite.org/backup.html. > I used this function in my code, but when I compiled it, that displays" > " gcc src.c -lsqlite3 >

Re: [sqlite] Is there a way to "predict" autoincrement rowid range

2010-01-07 Thread Max Vlasov
On Thu, Jan 7, 2010 at 3:56 PM, Igor Tandetnik wrote: > Max Vlasov wrote: > > I have a query "INSERT ... SELECT" and after it performed it I have to to > > If by autoincrement you mean a column actually declared with the > AUTOINCREMENT keyword, then the next ID is stored in

[sqlite] Is there a way to "predict" autoincrement rowid range

2010-01-07 Thread Max Vlasov
I have a query "INSERT ... SELECT" and after it performed it I have to to store range of rowids (autoincrement) of the inserted rows. While max(rowid) for right bound seems ok, assuming max(rowid)+1 for the left bound (before the query) depends on the fact whether there were deletes from the table

[sqlite] How to compile the source code when I use the "Online Backup API" ?

2010-01-07 Thread Jinson Wang
Hi,all Thers is an example "Loading and Saving In-Memory Databases" at http://www.sqlite.org/backup.html. I used this function in my code, but when I compiled it, that displays" " gcc src.c -lsqlite3 /tmp/ccEdrLUm.o: In function `loadOrSaveDb': flbsql.c:(.text+0x4fe): undefined reference to

Re: [sqlite] store query

2010-01-07 Thread Simon Slavin
On 7 Jan 2010, at 8:29am, Fabio Spadaro wrote: > I'm building an wxPython' application in advanced cases may require a > user to write a query and run it. I would also expect that the same > query is saved in the database to be reused whenever you want. > Someone gives me an indication? Sure.

[sqlite] store query

2010-01-07 Thread Fabio Spadaro
hi all. I'm building an wxPython' application in advanced cases may require a user to write a query and run it. I would also expect that the same query is saved in the database to be reused whenever you want. Someone gives me an indication? -- Fabio Spadaro www.fabiospadaro.com