[sqlite] LINQ - FirstOrDefault() crashes

2012-01-25 Thread Truls Haaland
I am trying out System.Data.SQLite.LINQ and I am getting crashes with FirstOrDefault(). I have created a table with the SQL: CREATE TABLE Person(   Id INTEGER PRIMARY KEY,   Name TEXT NOT NULL,   Age INTEGER NOT NULL ); The C# class I am reading into is defined as:  

[sqlite] Open source Json/Sqlite adtaper

2012-01-25 Thread Matt Young
https://github.com/Matt-Young/Embedded-SQL It speaks Json text at the console, and operates from self directed serialized Bson like streams formatted onto Sqlite triple tables. Working, but just out of the lab, buggy, good for browsing. c code ___

[sqlite] R*Tree virtual table / if not exists clause

2012-01-25 Thread g...@novadsp.com
The console output below indicates that 'if not exists' clause is unsupported for virtual tables. Is this a bug, oversight or by design? sqlite> CREATE VIRTUAL TABLE if not exists gps_index USING rtree(id,minX,maxX,minY,maxY); Error: near "not": syntax error Many thanks. Using SQLite

[sqlite] how to vice variable names in CREATE query.

2012-01-25 Thread bhaskarReddy
Hi Friends, I have two arrays, one is representing field names and another array representing field types. I am passing these two arrays to another function which will create a table using sqlite3_exec. #define INTEGER 0

Re: [sqlite] how to vice variable names in CREATE query.

2012-01-25 Thread Igor Tandetnik
bhaskarReddy wrote: > I have two arrays, one is representing field names and > another array representing field types. I am passing these two arrays to > another function which will create a table using sqlite3_exec. > > #define

Re: [sqlite] Found it

2012-01-25 Thread John Elrick
I started with the place where iGeneration was being changed and found nothing out of the ordinary. I started an examination and noticed the following. My "huh?" surrounds the question, why is sqlite3SchemaClear being called if pBt is assigned? SQLITE_PRIVATE Schema *sqlite3SchemaGet(sqlite3

Re: [sqlite] Found it

2012-01-25 Thread John Elrick
...especially given that the results of sqlite3SchemaClear are being passed as a parameter and from the declaration, sqlite3SchemaClear doesn't return anything. On Wed, Jan 25, 2012 at 7:53 AM, John Elrick wrote: > I started with the place where iGeneration was being

Re: [sqlite] R*Tree virtual table / if not exists clause

2012-01-25 Thread Jay A. Kreibich
On Wed, Jan 25, 2012 at 11:39:27AM +, g...@novadsp.com scratched on the wall: > The console output below indicates that 'if not exists' clause is > unsupported for virtual tables. Is this a bug, oversight or by > design? By design. The syntax diagrams make it clear that IF NOT EXISTS is

Re: [sqlite] SQL query causes various hangs/crashes/exits

2012-01-25 Thread Igor Tandetnik
Larry Knibb wrote: > SELECT DISTINCT d.rowid AS id, d.*, i.relevance > FROM dictionary d > JOIN hp_index i ON i.dictionary_id = d.rowid > JOIN hanzi h ON h.rowid = i.hanzi_id > WHERE h.traditional = '我' OR h.simplified = '我' > ORDER BY i.relevance desc > > I can get it to

Re: [sqlite] Found it

2012-01-25 Thread Richard Hipp
On Wed, Jan 25, 2012 at 7:53 AM, John Elrick wrote: > I started with the place where iGeneration was being changed and found > nothing out of the ordinary. I started an examination and noticed the > following. My "huh?" surrounds the question, why is sqlite3SchemaClear

Re: [sqlite] Found it

2012-01-25 Thread John Elrick
On Wed, Jan 25, 2012 at 8:02 AM, Richard Hipp wrote: > On Wed, Jan 25, 2012 at 7:53 AM, John Elrick >wrote: > > > I started with the place where iGeneration was being changed and found > > nothing out of the ordinary. I started an examination and

Re: [sqlite] Incompatible versions of SQLite on same system

2012-01-25 Thread Black, Michael (IS)
Try this utility on both programs and find out what DLL they are actually going for. And remember that if the DLL is already loaded it will use that. http://www.dependencywalker.com/ Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit

Re: [sqlite] SQL query causes various hangs/crashes/exits

2012-01-25 Thread Simon Slavin
On 25 Jan 2012, at 1:01pm, Igor Tandetnik wrote: > So your query devolves to a full table scan, and apparently, that just takes > a long time. That's my guess: the query is taking a long time. It's taking long enough that your database infrastructure (which seems to be SQLite Database

[sqlite] FirstOrDefault crashes using linq

2012-01-25 Thread Truls Haaland
I am trying out System.Data.SQLite.LINQ and I am getting crashes with FirstOrDefault(). I have created a table with the SQL: CREATE TABLE Person(   Id INTEGER PRIMARY KEY,   Name TEXT NOT NULL,   Age INTEGER NOT NULL ); The C# class I am reading into is defined as:  

Re: [sqlite] Found it

2012-01-25 Thread John Elrick
On Tue, Jan 24, 2012 at 7:46 PM, Richard Hipp wrote: > On Tue, Jan 24, 2012 at 7:37 PM, John Elrick >wrote: > > > > > It appears that the value is set here: > > > > u.av.pBt = db->aDb[pOp->p1].pBt; > > if( u.av.pBt ){ > >

Re: [sqlite] Found it

2012-01-25 Thread John Elrick
One more bit of interesting information. if( db->aDb[pOp->p1].pSchema->schema_cookie!=u.av.iMeta ){ fenestra_sqlite3_dump_stack_trace("OP_VerifyCookie"); sqlite3ResetInternalSchema(db, pOp->p1); } The call to fenestra_sqlite3_dump_stack_trace is never invoked. Whatever is

Re: [sqlite] C# amalgamation hand holding requested

2012-01-25 Thread Don V Nielsen
Yeah. I've been stung by the GAC in the past. When I first learned of it, I thought it was the bee's knees and life would be rosy after that. Instead, it turned out to be a wolf in sheep's clothing. I avoid it with all my applications, now. On Tue, Jan 24, 2012 at 10:22 AM, Roosevelt Anderson

Re: [sqlite] Found it

2012-01-25 Thread Richard Hipp
On Wed, Jan 25, 2012 at 9:02 AM, John Elrick wrote: > > current state = 'db=03FB1188, db->aDb[pOp->p1].pSchema=02110AB0, > db->aDb[pOp->p1].pSchema->schema_cookie=27, > db->aDb[pOp->p1].pSchema->iGeneration=63, u.av.iMeta=27, u.av.iGen=63, > pOp->p1=1, pOp->p2=27,

[sqlite] sqlite and boolean type (some problem)

2012-01-25 Thread Zygmunt Ptak
Hi everybody, there is some strange behaviour in sqlite. I create table with boolean type and everything is fine. I can add some rows, and it's OK. sqlite> create table t(val boolean); sqlite> insert into t values(0); sqlite> insert into t values(1); sqlite> insert into t values('true');

Re: [sqlite] Found it

2012-01-25 Thread John Elrick
On Wed, Jan 25, 2012 at 9:50 AM, Richard Hipp wrote: > On Wed, Jan 25, 2012 at 9:02 AM, John Elrick >wrote: > > > > > current state = 'db=03FB1188, db->aDb[pOp->p1].pSchema=02110AB0, > > db->aDb[pOp->p1].pSchema->schema_cookie=27, > >

Re: [sqlite] EXT : sqlite and boolean type (some problem)

2012-01-25 Thread Black, Michael (IS)
If you do a .dump of your table you will see that your 'true' and 'false' are exactly that -- the strings (and not the boolean values). So yes, there's only one row that has a value 0. The other rows have 1, 'true', and 'false'. As the web page says, use 1 or 0 for true/false. It won't

Re: [sqlite] sqlite and boolean type (some problem)

2012-01-25 Thread Simon Slavin
On 25 Jan 2012, at 3:10pm, Zygmunt Ptak wrote: > On webpage: http://www.sqlite.org/datatype3.html is: > > 1.1 Boolean Datatype > > SQLite does not have a separate Boolean storage class. > Instead, Boolean values are stored as integers 0 (false) > and 1 (true). > > >

Re: [sqlite] FirstOrDefault crashes using linq

2012-01-25 Thread Joe Mistachkin
Truls Haaland wrote: > > I am using the latest official version (1.0.77.0) on Windows7 with .NET 4.0. > > The full error message (including stack trace) is: > Would it be possible to see the generated SQL statement (from inside the Prepare method) that is causing the exception? -- Joe

Re: [sqlite] Found it

2012-01-25 Thread Simon Slavin
On 25 Jan 2012, at 3:18pm, John Elrick wrote: > So, it appears that something is making SQLite think the schema has changed. Can you read the following: If you think this corresponds to what you are seeing in the source code, can you

Re: [sqlite] R*Tree virtual table / if not exists clause

2012-01-25 Thread g...@novadsp.com
On 25/01/2012 12:55, Jay A. Kreibich wrote: That makes me think there is some more fundamental reason why IF NOT EXISTS is not supported. Thanks. Indeed. Hence the question. Something of a puzzle. ___ sqlite-users mailing list

[sqlite] sqlite3_bind_text destructor

2012-01-25 Thread Bill McCormick
The documentation I see for the sqlite3_bind_text 5th argument (a destructor used to dispose of the BLOB or string after SQLite has finished with it) isn't clear: 1. I assume the "string" that we're talking about here is the 3rd argument (const char*) 2. What will be void* argument be to the

Re: [sqlite] sqlite3_bind_text destructor

2012-01-25 Thread Stephan Beal
On Wed, Jan 25, 2012 at 5:45 PM, Bill McCormick wrote: > 2. What will be void* argument be to the destructor? > 3. What void* should the destructor return? > int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*)); It doesn't return a (void *) - it

Re: [sqlite] Found it

2012-01-25 Thread John Elrick
On Wed, Jan 25, 2012 at 10:32 AM, Simon Slavin wrote: > > On 25 Jan 2012, at 3:18pm, John Elrick wrote: > > > So, it appears that something is making SQLite think the schema has > changed. > > Can you read the following: > >

Re: [sqlite] FirstOrDefault crashes using linq

2012-01-25 Thread Truls Haaland
> Would it be possible to see the generated SQL statement (from inside > the Prepare method) that is causing the exception? I have tried unsuccessfully to create the debug version of System.Data.SQLite , so that is why I put the project on github. If anyone has the time to check out the project

Re: [sqlite] Found it

2012-01-25 Thread John Elrick
Ok. Possible scenario. I can't prove it, but somebody tell me if this is what could be going on: prepare query1 prepare query2 create something -> schema change query1.step - schema invalid so recreate - recreation of schema changes the generation query2.step - schema invalid so recreate

Re: [sqlite] sqlite3_bind_text destructor

2012-01-25 Thread Bill McCormick
Stephan Beal wrote, On 1/25/2012 11:01 AM: On Wed, Jan 25, 2012 at 5:45 PM, Bill McCormickwrote: 2. What will be void* argument be to the destructor? 3. What void* should the destructor return? int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n,

Re: [sqlite] sqlite3_bind_text destructor

2012-01-25 Thread Stephan Beal
On Wed, Jan 25, 2012 at 6:33 PM, Bill McCormick wrote: > http://www.sqlite.org/**capi3ref.html#sqlite3_bind_**blob >> > Ha! That's the full description that left me with my questions in the > first place!! Lol! Fair

[sqlite] serialized thread mode and transactions

2012-01-25 Thread Erik Fears
Hello, Right now I'm using WAL mode with a single writer, and many readers. At the moment, each reader is opening its own database connection. As you can imagine, this is quite expensive. Instead of maintaining a pool of sqlite connections, I'd like to move every thread to share the same

Re: [sqlite] Found it

2012-01-25 Thread John Elrick
On Wed, Jan 25, 2012 at 9:50 AM, Richard Hipp wrote: > On Wed, Jan 25, 2012 at 9:02 AM, John Elrick >wrote: > > > > > current state = 'db=03FB1188, db->aDb[pOp->p1].pSchema=02110AB0, > > db->aDb[pOp->p1].pSchema->schema_cookie=27, > >

Re: [sqlite] Found it

2012-01-25 Thread John Elrick
Addendum On Wed, Jan 25, 2012 at 1:12 PM, John Elrick wrote: > On Wed, Jan 25, 2012 at 9:50 AM, Richard Hipp wrote: > >> On Wed, Jan 25, 2012 at 9:02 AM, John Elrick > >wrote: >> >> > >> > current state = 'db=03FB1188,

Re: [sqlite] Found it

2012-01-25 Thread Richard Hipp
On Wed, Jan 25, 2012 at 10:18 AM, John Elrick wrote: > > I do have some more information for you. I tracking everything which could > call reset and discovered that all of these are stemming from > > SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){ > >/* Rollback

Re: [sqlite] Found it

2012-01-25 Thread John Elrick
On Wed, Jan 25, 2012 at 1:13 PM, Richard Hipp wrote: > On Wed, Jan 25, 2012 at 10:18 AM, John Elrick >wrote: > > > > > I do have some more information for you. I tracking everything which > could > > call reset and discovered that all of these are

Re: [sqlite] serialized thread mode and transactions

2012-01-25 Thread Pavel Ivanov
> For example, > if the writer thread starts a transaction, and one of the reader threads > does a SELECT, > would the SELECT be part of the transaction? Or are transactions per-thread > on a shared connection? All transactions are per-connection. So yes, SELECT will be a part of transaction and

Re: [sqlite] serialized thread mode and transactions

2012-01-25 Thread Erik Fears
OK. So I'd probably give one connection to the writer, and then let the readers share a connection. So the next question is, if a reader is in the middle of an exec and has not finalized its statement yet, how would it affect another thread that attempts a statement? Thanks! --erik On Wed, Jan

Re: [sqlite] Found it

2012-01-25 Thread John Elrick
Richard, Is it reasonable to say that, assuming: 1. The schema has not changed 2. There is only one connection to the database that the value of iGeneration should always equal pOp->p3 in OP_VerifyCookie? ___ sqlite-users mailing list

Re: [sqlite] sqlite3_bind_text destructor

2012-01-25 Thread Bill McCormick
Stephan Beal wrote, On 1/25/2012 11:36 AM: On Wed, Jan 25, 2012 at 6:33 PM, Bill McCormickwrote: http://www.sqlite.org/**capi3ref.html#sqlite3_bind_**blob Ha! That's the full description that left me with my

Re: [sqlite] Found it

2012-01-25 Thread John Elrick
Richard, I've found a problem that I don't understand. Looking at the case OP_VerifyCookie, I attempted to output pOp->opcode, which I expected to equal OP_VerifyCookie. However, it doesn't: Schema has changed current state = 'db=0025, pOp->opCode=66785672,

Re: [sqlite] Found it

2012-01-25 Thread Richard Hipp
On Wed, Jan 25, 2012 at 3:39 PM, Richard Hipp wrote: > I'm testing a candidate fix for your problem now. I'll send you a link > once the tests finish (assuming they all work). Please try http://www.sqlite.org/src/info/11f68d997d and let me know if it solves your problem.

Re: [sqlite] Found it

2012-01-25 Thread John Elrick
Much better. I wasn't sure which version to incorporate the changes into (the link is to the source), so I put them into 3.7.9. The total mallocs have dropped to 1.5 million -- twice as high as 3.7.5 but in line. I'll have to run some additional performance testing but visually the system

Re: [sqlite] Found it

2012-01-25 Thread Richard Hipp
On Wed, Jan 25, 2012 at 4:01 PM, John Elrick wrote: > Much better. I wasn't sure which version to incorporate the changes into > (the link is to the source), so I put them into 3.7.9. > > The total mallocs have dropped to 1.5 million -- twice as high as 3.7.5 but > in

Re: [sqlite] Found it

2012-01-25 Thread John Elrick
On Wed, Jan 25, 2012 at 4:07 PM, Richard Hipp wrote: > On Wed, Jan 25, 2012 at 4:01 PM, John Elrick >wrote: > > > Much better. I wasn't sure which version to incorporate the changes into > > (the link is to the source), so I put them into 3.7.9. > >

Re: [sqlite] Found it

2012-01-25 Thread Petite Abeille
On Jan 25, 2012, at 10:09 PM, John Elrick wrote: > DML? http://en.wikipedia.org/wiki/Data_Manipulation_Language ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Found it

2012-01-25 Thread John Elrick
Thanks. On Wed, Jan 25, 2012 at 4:11 PM, Petite Abeille wrote: > > On Jan 25, 2012, at 10:09 PM, John Elrick wrote: > > > DML? > > http://en.wikipedia.org/wiki/Data_Manipulation_Language > > > ___ > sqlite-users mailing list >

Re: [sqlite] serialized thread mode and transactions

2012-01-25 Thread Pavel Ivanov
> So the next question is, if a reader is in the middle of an exec > and has not finalized its statement yet, how would it affect > another thread that attempts a statement? Only one thread can enter sqlite3_* function on the same connection at the same time. So if you are using sqlite3_exec()

Re: [sqlite] Found it

2012-01-25 Thread Nico Williams
On Wed, Jan 25, 2012 at 3:07 PM, Richard Hipp wrote: > The SQLite byte-code engine was being too conservative and was reparsing > the schema in places where it was not strictly necessary.  The fix was to > restrict the places where the schema was reparsed to situations that

Re: [sqlite] Found it

2012-01-25 Thread John Elrick
On Wed, Jan 25, 2012 at 4:07 PM, Richard Hipp wrote: > On Wed, Jan 25, 2012 at 4:01 PM, John Elrick >wrote: > > > Much better. I wasn't sure which version to incorporate the changes into > > (the link is to the source), so I put them into 3.7.9. > >

Re: [sqlite] Found it

2012-01-25 Thread John Elrick
On Wed, Jan 25, 2012 at 4:21 PM, Nico Williams wrote: > On Wed, Jan 25, 2012 at 3:07 PM, Richard Hipp wrote: > > The SQLite byte-code engine was being too conservative and was reparsing > > the schema in places where it was not strictly necessary. The fix

Re: [sqlite] FirstOrDefault crashes using linq

2012-01-25 Thread Joe Mistachkin
It looks like the DataContext class is the culprit here as it is specific to SQL Server, see: http://stackoverflow.com/questions/3706954/is-the-datacontext-class-specific -to-sql-server The supported alternative here is the ObjectContext class from the Entity Framework, see:

[sqlite] Query on Sqlite3 in an Android app

2012-01-25 Thread Lavanya Ramanan
Hello, I am new to Java and Android. I am trying to build an android application which could access my own sqlite.db file. For using my own sqlite database in an android app, I followed the code given in

Re: [sqlite] Query on Sqlite3 in an Android app

2012-01-25 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 25/01/12 14:31, Lavanya Ramanan wrote: > What am i missing? The SQLite Java wrapper in Android automatically creates the directory when you use it to create a database. Since you are bypassing that you'll need to create the directory yourself

[sqlite] "database is locked" on WAL with large number of reader connections

2012-01-25 Thread Erik Fears
I've got a WAL database with only readers right now. I'm opening and close the database at pretty rapid rate, and usually have about 100 connections open at a time. I'm using prepared statements for SELECTS and I'm pretty sure I'm finalizing the statements. After a while I start getting back

Re: [sqlite] "database is locked" on WAL with large number of reader connections

2012-01-25 Thread Richard Hipp
On Wed, Jan 25, 2012 at 8:01 PM, Erik Fears wrote: > I've got a WAL database with only readers right now. I'm opening and close > the database > at pretty rapid rate, and usually have about 100 connections open at a > time. I'm > using prepared statements for SELECTS and I'm

Re: [sqlite] "database is locked" on WAL with large number of reader connections

2012-01-25 Thread Erik Fears
I have a writer, but the thread is not writing during this test. This is built by me. This is single process, one connection per thread, 100 threads. The threads are being created/destroyed often, though, and each time one is created it creates a new DB connection. I understand this isn't

[sqlite] SQLite DBaaS

2012-01-25 Thread Ryan Macy
Would there be any reason SQLite would have a hard time functioning in a database as a service model? Each user would generate a database (or many databases) and connect to it with an API. Ryan Macy ___ sqlite-users mailing list

Re: [sqlite] SQLite DBaaS

2012-01-25 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 25/01/12 18:48, Ryan Macy wrote: > Would there be any reason SQLite would have a hard time functioning in > a database as a service model? SQLite lives in the same process as the code using it. > Each user would generate a database (or many

Re: [sqlite] SQLite DBaaS

2012-01-25 Thread Ryan Macy
Yes I have used SQLite previously, but not extremely extensively. I used API generically (not necessarily SQLites API) , the whole idea is a side project to increase my knowledge. I am creating an application in python that uses an RESTful API to allow the user connect to my service and submit

Re: [sqlite] SQLite DBaaS

2012-01-25 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 25/01/12 19:52, Ryan Macy wrote: > I used API generically (not necessarily SQLites API) You can't use SQLite's API although it wasn't clear you realised that! > I am creating an application in python that uses an RESTful API to > allow the user

Re: [sqlite] SQLite DBaaS

2012-01-25 Thread Nico Williams
If you're building a small web service, SQLite3 will do fine. If you want to scale big you might be able to use SQLite3 for some pieces of it, but you can't scale up a web service to thousands of servers with tens of cores and one single SQLite3 DB -- that just doesn't work given SQLite3's

Re: [sqlite] SQLite DBaaS

2012-01-25 Thread Ryan Macy
>This seems inconsequential >Huh? If you are making it available as a service then you have to care >about authentication. And identity - how do you tell users apart and keep >their databases separate? How will you deal with attacks from malicious >users? How will you add a security model to

Re: [sqlite] SQLite DBaaS

2012-01-25 Thread Larry Brasfield
(Top-posting undone for comprehensibility.) Ryan Macy wrote: Would there be any reason SQLite would have a hard time functioning in a database as a service model? Roger Binns replied: [Reasonable explanation of why SQLite as a service is not a good solution, including "introduction of latency"

Re: [sqlite] SQLite DBaaS

2012-01-25 Thread Ryan Macy
Simple is exactly what I'm trying to accomplish Nico. It's a pet project to increase my knowledge, yet the high cost of most database options on PaaS providers like Heroku leads me to believe that the users would welcome a [very] low cost simple DBaaS implementation. SQLite also hasn't been in the

Re: [sqlite] SQLite DBaaS

2012-01-25 Thread Ryan Macy
Larry I think we moved past this. I was put off but the bluntness of his response, I'm not trying cause issues. Ryan Macy On 1/25/12 11:29 PM, "Larry Brasfield" wrote: >(Top-posting undone for comprehensibility.) >Ryan Macy wrote: Would there be any reason

Re: [sqlite] SQLite DBaaS

2012-01-25 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 25/01/12 20:29, Ryan Macy wrote: > I was trying to say that I don't believe this would have anything to > do with SQLite, you would have to deal with these issues regardless of > the solution that is selected. Those issues (identity,

Re: [sqlite] SQLite DBaaS

2012-01-25 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 25/01/12 20:32, Ryan Macy wrote: > Simple is exactly what I'm trying to accomplish Nico. It's a pet > project to increase my knowledge, yet the high cost of most database > options on PaaS providers like Heroku leads me to believe that the > users

Re: [sqlite] "database is locked" on WAL with large number of reader connections

2012-01-25 Thread Dan Kennedy
On 01/26/2012 09:05 AM, Erik Fears wrote: I have a writer, but the thread is not writing during this test. This is built by me. This is single process, one connection per thread, 100 threads. The threads are being created/destroyed often, though, and each time one is created it creates a new