[sqlite] GCC give a warning while passing a struct as the user data to the callback function of sqlite3_exec()

2008-08-19 Thread Midmay
I declare a struct and pass it as the 4th argument of sqlite3_exec(), and define the 1st argument of callback function a pointer to this kind of struct. while compiling, GCC give a warning like this: ae.c: In function ‘main’: ae.c:56: warning: passing argument 3 of ‘sqlite3_exec’

Re: [sqlite] GCC give a warning while passing a struct as the user data to the callback function of sqlite3_exec()

2008-08-19 Thread Markus Thiele
Greetings, > I declare a struct and pass it as the 4th argument of sqlite3_exec(), > and define the 1st argument of callback function a pointer to this kind > of struct. while compiling, GCC give a warning like this: > ae.c: In function ‘main’: > ae.c:56: warning: passing argument 3

Re: [sqlite] GCC give a warning while passing a struct as the user data to the callback function of sqlite3_exec()

2008-08-19 Thread Michael Knigge
> however, the program runs well. What may causing the warning? what > should i do to get rid of this warning. The warning is produced because your callback() isn't int callback(void *, int, char **, char **); try this: int callback(void *foo, int argc, char **argv, char **azColName) {

Re: [sqlite] GCC give a warning while passing a struct as the, user data to the callback function of sqlite3_exec()

2008-08-19 Thread Midmay
Thank you, Markus! > Simply change the type of the first argument to your callback function > to void* and the problem should go away. Of course you'll then have to > cast back to MyStruct* inside callback() to actually use the value. It works. Just ((MyStruct *) data)->x looks strange. > The

Re: [sqlite] GCC give a warning while passing a struct as the, user data to the callback function of sqlite3_exec()

2008-08-19 Thread Markus Thiele
Greetings, > It works. Just ((MyStruct *) data)->x looks strange. As Michael Knigge has suggested, you may just rename the parameter to something else and then have something like MyStruct* data = (MyStruct*)foo; as the first line in your callback() function. In fact I believe in C

Re: [sqlite] Using SQLite as an application file format (C++)

2008-08-19 Thread Chris Wedgwood
On Mon, Aug 18, 2008 at 04:38:03PM -0400, Darren Landrum wrote: > Software synthesis applications, particularly disk-streaming > samplers, are very high-performance programs, so I'd like to keep > disk I/O as clear as possible. Every touch of a GUI widget will > result in a query run on the

[sqlite] sqlite .dll package doesn't have .h file

2008-08-19 Thread Joshua Hudson
A precompiled .dll package is provided. I want to use it. The package doesn't contain a .h file to #include in my program. Now what? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] sqlite .dll package doesn't have .h file

2008-08-19 Thread Michael Knigge
Joshua Hudson schrieb: > A precompiled .dll package is provided. I want to use it. > The package doesn't contain a .h file to #include in my program. > > Now what? Download the source and take the .h file from the source code? Just as an idea

Re: [sqlite] sqlite .dll package doesn't have .h file

2008-08-19 Thread Mihai Limbasan
Joshua Hudson wrote: A precompiled .dll package is provided. I want to use it. The package doesn't contain a .h file to #include in my program. Now what? ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] GCC give a warning while passing a struct as the, user data to the callback function of sqlite3_exec()

2008-08-19 Thread Midmay
Greetings, > As Michael Knigge has suggested, you may just rename the parameter to > something else and then have something like > >MyStruct* data = (MyStruct*)foo; > > as the first line in your callback() function. Got it. Sorry but I make a mistake before, the '3rd argument' ought to be

Re: [sqlite] GCC give a warning while passing a struct as the, user data to the callback function of sqlite3_exec()

2008-08-19 Thread Enrique Ramirez
Looking at your address I can see you also use gmail. Threading for this message is working fine for me. Are you using the web client or an external mail program? On Tue, Aug 19, 2008 at 8:58 AM, Midmay <[EMAIL PROTECTED]> wrote: > Greetings, > >> As Michael Knigge has suggested, you may just

[sqlite] vfs implementation question

2008-08-19 Thread Jeffrey Becker
Should the xLock member of sqlite3_io_methods object block until the lock can be acquired? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] GCC give a warning while passing a struct as the, user data to the callback function of sqlite3_exec()

2008-08-19 Thread Enrique Ramirez
I noticed what you mean (to reply to my own post). I just noticed the original subject and this thread's subject are different: (original) [sqlite] GCC give a warning while passing a struct as the user data to the callback function of sqlite3_exec() (this thread) [sqlite] GCC give a warning while

Re: [sqlite] GCC give a warning while passing a struct as the, user data to the callback function of sqlite3_exec()

2008-08-19 Thread Midmay
Enrique Ramirez wrote: > Looking at your address I can see you also use gmail. Threading for > this message is working fine for me. Are you using the web client or > an external mail program? > In fact, I'm using thunderbird, but it may doesn't matters. When i subscribed, I turn digest mode on,

Re: [sqlite] vfs implementation question

2008-08-19 Thread D. Richard Hipp
On Aug 19, 2008, at 9:02 AM, Jeffrey Becker wrote: > Should the xLock member of sqlite3_io_methods object block until the > lock can be acquired? xLock does not block on any of the built-in VFSes. But if you want to make your own custom VFS that blocks on locks, I don't know of any reason

Re: [sqlite] GCC give a warning while passing a struct as the, user data to the callback function of sqlite3_exec()

2008-08-19 Thread Midmay
Enrique Ramirez wrote: > I noticed what you mean (to reply to my own post). I just noticed the > original subject and this thread's subject are different: > > (original) [sqlite] GCC give a warning while passing a struct as the > user data to the callback function of sqlite3_exec() > (this

Re: [sqlite] vfs implementation question

2008-08-19 Thread Jeffrey Becker
So in the cases where the lock cant be acquired, the built in vfs implementations return SQLITE_BUSY? On Tue, Aug 19, 2008 at 9:16 AM, D. Richard Hipp <[EMAIL PROTECTED]> wrote: > > On Aug 19, 2008, at 9:02 AM, Jeffrey Becker wrote: > >> Should the xLock member of sqlite3_io_methods object block

Re: [sqlite] vfs implementation question

2008-08-19 Thread D. Richard Hipp
On Aug 19, 2008, at 9:37 AM, Jeffrey Becker wrote: > So in the cases where the lock cant be acquired, the built in vfs > implementations return SQLITE_BUSY? > Yes D. Richard Hipp [EMAIL PROTECTED] ___ sqlite-users mailing list

[sqlite] "Database is Locked"

2008-08-19 Thread rob
I currently have a project that runs on a Windows XP machine. The project was working with SQLite 3.5.7, but I recently upgraded to 3.6.1 . Since the upgrade I have been getting an "Database is Locked" error message on any type of query that is ran after the database is "opened". I am assuming

Re: [sqlite] "Database is Locked"

2008-08-19 Thread D. Richard Hipp
On Aug 19, 2008, at 10:33 AM, <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote: > I currently have a project that runs on a Windows XP machine. The > project was working with > SQLite 3.5.7, but I recently upgraded to 3.6.1 . Since the upgrade I > have been getting > an "Database is Locked"

Re: [sqlite] "Database is Locked"

2008-08-19 Thread rob
I haven't changed anything. I recompiled with 3.5.7 and it worked fine. Are there any problems with creating the database with 3.5.7 and then reading it with 3.6.1? Thanks > ---Original Message--- > From: D. Richard Hipp <[EMAIL PROTECTED]> > Subject: Re: [sqlite] "Database is

Re: [sqlite] "Database is Locked"

2008-08-19 Thread Robert Simpson
Show and tell time! Lets see some code :) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, August 19, 2008 8:15 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] "Database is Locked" I haven't changed

Re: [sqlite] "Database is Locked"

2008-08-19 Thread rob
Below is the call to open a new database. This comes back successful. sqlite3_open16(pchFileName, _sqliteDB) pchFileName: is the path to the database m_sqliteDB: is the database handler This function executes a PRAGMA statement. sqlite3_exec(m_sqliteDB, m_formatBuffer, g_sqlCallback, this,

Re: [sqlite] "Database is Locked"

2008-08-19 Thread D. Richard Hipp
On Aug 19, 2008, at 11:14 AM, <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote: > Are there > any problems with creating the database with 3.5.7 and then reading > it with 3.6.1? There are not suppose to be any difference. Nobody else has reported differences. D. Richard Hipp [EMAIL

[sqlite] Detecting DB Integrity and Recovery

2008-08-19 Thread Imran Habib
I am currently writing a method that detects that database is corrupt or not and return SQLITE_OK if OK otherwise an error. If I detect an error then I delete the existing database file.and then Create the new database file with the same name and after that populate the database file with the

[sqlite] 2 Questions from a newbie

2008-08-19 Thread cstrader
I'm just starting with SQLite (from vb.net) and could use some advice. I have a set of 2400 (could get substantially higher) tables in a single database (each table contains daily stock prices for a different stock). Each table has 9 columns (all text for now) and some several thousand rows. So

Re: [sqlite] 2 Questions from a newbie

2008-08-19 Thread .:UgumugU:.
Hi cstrader, Just send some table structure and the explain what you are trying todo. In my opinion it is not a good way to deal with 2400 tables :) ugumugu cstrader yazm?s,: > I'm just starting with SQLite (from vb.net) and could use some advice. > > I have a set of 2400 (could get

Re: [sqlite] 2 Questions from a newbie

2008-08-19 Thread Jeff Hamilton
If all 2,400 tables have the same 9 columns you could try using a single table and adding a column for the ticker of the stock and then add an index to that column to allow quick lookups based on the ticker. -Jeff On Tue, Aug 19, 2008 at 9:44 AM, .:UgumugU:. <[EMAIL PROTECTED]> wrote: > Hi

Re: [sqlite] 2 Questions from a newbie

2008-08-19 Thread cstrader
OK, cool idea... let me try that. - Original Message - From: "Jeff Hamilton" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; "General Discussion of SQLite Database" Sent: Tuesday, August 19, 2008 12:51 PM Subject: Re: [sqlite] 2 Questions from a newbie > If all

Re: [sqlite] 2 Questions from a newbie

2008-08-19 Thread Greg Morphis
Also why are you adding new columns? doesn't sound like you have the db set up properly.. On Tue, Aug 19, 2008 at 11:53 AM, cstrader <[EMAIL PROTECTED]> wrote: > OK, cool idea... let me try that. > > > - Original Message - > From: "Jeff Hamilton" <[EMAIL PROTECTED]> > To: <[EMAIL

Re: [sqlite] 2 Questions from a newbie

2008-08-19 Thread cstrader
Well I need to have the new columns for subsequent processing of the data. I have some complex functions that I need to use to modify the existing data into the new columns. I don't think I can do that with user-defined functions within the select command itself. Does that make any sense?

Re: [sqlite] 2 Questions from a newbie

2008-08-19 Thread Fred Williams
Third normal says: Table: Stock ID Integer Primary Key, Symbol Varchar(n), ... Other stuff Table: DaylyPrice (I'd call it "Price") StockID Integer (Foreign key:

Re: [sqlite] 2 Questions from a newbie

2008-08-19 Thread cstrader
OK, this seems really helpful, but I'm afraid you've lost me a bit. 1. Third normal??? :) 2. Your idea would be to have one table that's relatively static, with the names (and perhaps other data) of the stocks, a 2nd table that holds prices? I'm not sure I see the advantage of this approach.

[sqlite] Segmentation fault

2008-08-19 Thread Paul Simon
Hi List, I get the following segmentation fault whenever I exit sqlite3. The segmentation fault does not seem to happen If I write something to the database then exit. sqlite3(27109,0xa000ed88) malloc: *** error for object 0x1806c00: incorrect checksum for freed object - object was probably

Re: [sqlite] 2 Questions from a newbie

2008-08-19 Thread Fred Williams
1. Third Normal, as in "Database normalization." (Database 101) No offence intended, you said you are a beginner. 2. Right. My "unlimited" stock and prices advantage. No creating a table for each new stock. No creating a table or adding columns (Both time and logically intensive.) for

Re: [sqlite] 2 Questions from a newbie

2008-08-19 Thread Dennis Cote
cstrader wrote: > OK, this seems really helpful, but I'm afraid you've lost me a bit. > > 1. Third normal??? :) See http://en.wikipedia.org/wiki/Third_normal_form for an explanation. > > 2. Your idea would be to have one table that's relatively static, with the > names (and perhaps other

Re: [sqlite] rtree performance problems?

2008-08-19 Thread Hartwig Wiesmann
Am 18.08.2008 um 21:32 schrieb Dennis Cote: > Thomas Sailer wrote: >> >> Interestingly, the original query is extremely compute-bound, there >> is >> almost no disk activity! >> >> Looking at the output opcodes from the queries, I can't see any >> significant difference. Though I have to admit

[sqlite] sqlite 4 bytes write

2008-08-19 Thread Julian Qian
I would like us to understand the write patterns of Sqlite. . That write pattern happens first to the journal then to the database. I found a lot of 4 byte writes. What are these 4 byte writes and can the be avoided? I would also like data on the write patterns for a 1k,2k,128k, and 256k writes

[sqlite] .import with .separator and quoted strings

2008-08-19 Thread Wilson, Ron P
I'm trying to import a table using the command line tool. sqlite> .separator , sqlite> .import export.csv library export.csv line 1: expected 53 columns of data but found 77 sqlite> .mode csv sqlite> .import export.csv library export.csv line 1: expected 53 columns of data but found 77

[sqlite] Correct SQL name resolution on AS clauses in a SELECT?

2008-08-19 Thread D. Richard Hipp
Consider a table: CREATE TABLE t1(a INTEGER, b INTEGER); INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(9,8); I am reworking (read: trying to fix) the name resolution algorithm in SQLite and I am wondering what is the correct behavior of the following queries? Can anybody

Re: [sqlite] SPAM: Correct SQL name resolution on AS clauses in a SELECT?

2008-08-19 Thread Robert Simpson
Sql Server 2005: SELECT a AS b, b AS a FROM #t1 ORDER BY a; b a --- --- 1 2 9 8 SELECT b AS a, a AS b FROM #t1 ORDER BY a; a b --- --- 2 1 8 9 SELECT a, b AS a FROM #t1 ORDER BY a; Msg 209, Level 16,

Re: [sqlite] Correct SQL name resolution on AS clauses in a SELECT?

2008-08-19 Thread Robert Simpson
Slight change so you can see the order by results more clearly: (Sql Server 2005) CREATE TABLE #t1(a int, b int); INSERT INTO #t1 VALUES(1,6); INSERT INTO #t1 VALUES(9,5); SELECT a AS b, b AS a FROM #t1 ORDER BY a; b a --- --- 9 5 1 6 SELECT b AS

Re: [sqlite] vfs implementation question

2008-08-19 Thread Richard Klein
D. Richard Hipp wrote: > On Aug 19, 2008, at 9:02 AM, Jeffrey Becker wrote: > > >> Should the xLock member of sqlite3_io_methods object block until the >> lock can be acquired? > > xLock does not block on any of the built-in VFSes. But if you want to > make your own custom VFS that blocks on

[sqlite] Multiple connection to in-memory database

2008-08-19 Thread vincent cridlig
Hi, I would like to use transactions from separate threads, each thread having one connection to a single in-memory db. I just read in the sqlite doc that in-memory sqlite databases (using sqlite3_open(":memory:", ...)) are private to a single connection. Is there a way to open a second

Re: [sqlite] vfs implementation question

2008-08-19 Thread Jeffrey Becker
Cool. I'm actually working on extending Robert Simson's ADO.Net provider to allow vfs implementations to be written in managed code. I hope to get at least two custom vfs implementations into his codebase, a custom memory backed vfs and a true client-server vfs. On Tue, Aug 19, 2008 at 5:45 PM,

[sqlite] Reducing SQLite Memory footprint(!)

2008-08-19 Thread Brown, Daniel
Good afternoon list, Are there any known techniques for reducing SQLite's memory footprint? I am currently evaluating SQLite as a possible replacement to our current proprietary database solution. However SQLite is very memory intensive compared to our current solution (although SQLite is faster

Re: [sqlite] Reducing SQLite Memory footprint(!)

2008-08-19 Thread D. Richard Hipp
On Aug 19, 2008, at 6:24 PM, Brown, Daniel wrote: > Good afternoon list, > > Are there any known techniques for reducing SQLite's memory footprint? Construct your database into a file (say "test.db"). Then run the sqlite3_analyzer utility (available for download on the SQLite website) over

Re: [sqlite] Correct SQL name resolution on AS clauses in a SELECT?

2008-08-19 Thread Dennis Cote
D. Richard Hipp wrote: > Consider a table: > > CREATE TABLE t1(a INTEGER, b INTEGER); > INSERT INTO t1 VALUES(1,2); > INSERT INTO t1 VALUES(9,8); > > I am reworking (read: trying to fix) the name resolution algorithm in > SQLite and I am wondering what is the correct behavior of

Re: [sqlite] Segmentation fault

2008-08-19 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Paul Simon wrote: > Is this a bug? Or do I need to compile the source differently than what the > README file directs? The chances that you found a bug in SQLite that noone else nor the test suite nor valgrind has hit is vanishingly small :-) >

Re: [sqlite] vfs implementation question

2008-08-19 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jeffrey Becker wrote: > Cool. I'm actually working on extending Robert Simson's ADO.Net > provider to allow vfs implementations to be written in managed code. I'm doing the same in my Python wrapper for SQLite (APSW). One feature I have implemented

[sqlite] pragma table_info on a table in attached db

2008-08-19 Thread Mrinal Kant
>Try: >PRAGMA [database.]table_info(table-name); > ( Kees Nuyt Thankyou Kees for the solution But, I am facing another problem which is as follows: I open an sqlite db and create a table "trial". pragma main.table_info(trial) shows correct info. Then I create a temp table with the same name

Re: [sqlite] sqlite 4 bytes write

2008-08-19 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Julian Qian wrote: > I would like us to understand the write patterns of Sqlite. It looks like the 4 bytes is some sort of header for each database page. Your trace seems to be of the Android emulator rather than your application (there are no

Re: [sqlite] Multiple connection to in-memory database

2008-08-19 Thread Alex Katebi
You don't need to open a second connection. The sole connection can be used from any thread. On Tue, Aug 19, 2008 at 6:17 PM, vincent cridlig <[EMAIL PROTECTED]> wrote: > Hi, > > I would like to use transactions from separate threads, each thread having > one connection to a single in-memory

[sqlite] Help with Sqlite

2008-08-19 Thread Jeffrey Needle
I'm using the install of Firefox that comes with the Wubi install of Linux. I like sqlite, but have a little problem. Perhaps someone can help. When I add a new record to a database, an entry screen comes up with my fields and the ability to enter the new record. But the information I type

Re: [sqlite] Help with Sqlite

2008-08-19 Thread P Kishor
On 8/20/08, Jeffrey Needle <[EMAIL PROTECTED]> wrote: > I'm using the install of Firefox that comes with the Wubi install of > Linux. I like sqlite, but have a little problem. Perhaps someone can > help. You don't have any problem with SQLite. Your problem is with whatever this Wubi thing is

Re: [sqlite] Help with Sqlite

2008-08-19 Thread Graeme
As the previous rely said, this is not a sqlite problem. I am not sure what it is because Firefox by itself does not seem to allow direct editing of the sqlite databases it uses (are you using some extension?). I suggest you ask on the Ubuntu forums. Also, look for the issue in the Wubi