Re: [sqlite] connection-specific user data in extensions

2010-11-22 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 11/22/2010 06:58 PM, Chris Wolf wrote:
>> Hmm, if you mean apsw,

Yes, I did.  (I'm the author of APSW if that wasn't clear.)

>>  that's actually one of the things I wanted to
>> do:  change the
>> Connection signature to accept an already open database connection as an
>> alternative to
>> always opening a database file. 

It has been a ticket for a while:

  http://code.google.com/p/apsw/issues/detail?id=79

Going the other way - handing a sqlite3 pointer from APSW to other code is
easy and there is an existing function to do that although it will cause
problems if the other code directly closes the connection or does silly
multi-threading tricks.  Please update the ticket if you have use cases that
wouldn't have a large probability of memory corruption or crashes.

Also, making APSW be a loadable extension means a separate compilation since
all calls have to go via a function pointer table not directly to SQLite so
it can't simultaneously be a Python extension and a SQLite extension,
although I guess the pointer table could be faked.

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzraOAACgkQmOOfHg372QQaDwCfYg/Zrst9SQNgxpmqrk/oe56o
xEMAoJ0CaVxUVgz76conZemoRZ6m8pOC
=INqG
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] virtual tables

2010-11-22 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 11/22/2010 06:59 PM, dcharno wrote:
> What are some of the things that people use virtual tables for?  Are 
> there any good example usages?

FTS3 uses them.  Various CSV extensions do too.

With my APSW package I include a virtual table that lets you access CouchDB:

 http://apidoc.apsw.googlecode.com/hg/couchdb.html

There are a list of other suggestions in the documentation:

 http://apidoc.apsw.googlecode.com/hg/vtable.html

In the example code I map the filesystem as a vtable,  This also shows how
much effort it is to write one in a higher level language like Python:

 http://apidoc.apsw.googlecode.com/hg/example.html#example-vtable

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzrZUwACgkQmOOfHg372QR1CQCZAaOBwSBoMuBWdM5q0vONUqCp
VhYAn1upr5J7htGR3mGeBPFUHR/CR2pK
=ifrv
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] virtual tables

2010-11-22 Thread Ben Harper
I have a database library that abstracts various DB types, such as DBF, 
shapefiles, CSV, PostGIS, etc.
I use the Sqlite virtual table mechanism to provide SQL functionality on top of 
any of these DB types.
Normally one would only need to do this for crude databases, such as a CSV 
file, but
the manner in which I cater for long transactions makes it necessary for me to 
strap Sqlite onto,
for instance, a modified Postgres table that has not yet been committed to the 
DB.

Ben

-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of dcharno
Sent: 23 November 2010 05:00 AM
To: sqlite-users@sqlite.org
Subject: [sqlite] virtual tables

What are some of the things that people use virtual tables for?  Are 
there any good example usages?
___
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] virtual tables

2010-11-22 Thread boscowitch
Am Montag, den 22.11.2010, 21:59 -0500 schrieb dcharno:
> What are some of the things that people use virtual tables for?  Are 
> there any good example usages?
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 


It's sth very special and i think virtual tables are not only usefull
for it but take a look at the FTS3 extension.
http://www.sqlite.org/fts3.html

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] virtual tables

2010-11-22 Thread dcharno
What are some of the things that people use virtual tables for?  Are 
there any good example usages?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] connection-specific user data in extensions

2010-11-22 Thread Chris Wolf


Roger Binns wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On 11/22/2010 11:31 AM, Chris Wolf wrote:
>   
>> Is there a way for me to store one or more pointers to data structures
>> as user data in a sqlite3 structure (i.e. the "connection")?  
>> 
>
> Nope.  It is also a problem if you want to share a connection between
> different libraries.  Currently the only way to find out that the connection
> is being closed is to register a function or collation with a nonsensical
> name and hook the xDelete method.
>
> There have been requests for my Python library to accept a sqlite3 pointer
>   

Hmm, if you mean apsw, that's actually one of the things I wanted to
do:  change the
Connection signature to accept an already open database connection as an
alternative to
always opening a database file. 

I'm also finding the degree of encapsulation difficult to work with (at
least for dynamically
loadable extensions, which can't include sqliteInt.h without linking
with the whole amalgamation,
but then may as well statically link, like your apsw)

> made from elsewhere (eg the application) but I can't implement it without
> great risk of memory corruption as I can't control what elsewhere does with
> the pointer.  There are also some data structures that are not reference
> counted such as the VFS so you don't know if it is safe to remove or change
> at any point.
>
> Roger
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkzq5dcACgkQmOOfHg372QSBbgCfYDtH6vFpY0eM4UqiCcDg6eCO
> AWgAn18QhsYDicO4ZQFZEP0/OUjV53ox
> =3KPy
> -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] connection-specific user data in extensions

2010-11-22 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 11/22/2010 11:31 AM, Chris Wolf wrote:
> Is there a way for me to store one or more pointers to data structures
> as user data in a sqlite3 structure (i.e. the "connection")?  

Nope.  It is also a problem if you want to share a connection between
different libraries.  Currently the only way to find out that the connection
is being closed is to register a function or collation with a nonsensical
name and hook the xDelete method.

There have been requests for my Python library to accept a sqlite3 pointer
made from elsewhere (eg the application) but I can't implement it without
great risk of memory corruption as I can't control what elsewhere does with
the pointer.  There are also some data structures that are not reference
counted such as the VFS so you don't know if it is safe to remove or change
at any point.

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzq5dcACgkQmOOfHg372QSBbgCfYDtH6vFpY0eM4UqiCcDg6eCO
AWgAn18QhsYDicO4ZQFZEP0/OUjV53ox
=3KPy
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Queries on PRAGMA table_info() [superview]

2010-11-22 Thread Petite Abeille

On Nov 22, 2010, at 10:09 PM, Jay A. Kreibich wrote:

>  Below is code for the "superview" virtual table module.  It allows
>  *any* SQL statement to be turned into a read-only virtual table--
>  including PRAGMA statements.

Oh... very nice... thanks for sharing :)

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Queries on PRAGMA table_info() [superview]

2010-11-22 Thread Jay A. Kreibich
On Mon, Nov 22, 2010 at 01:29:29PM -0500, Igor Tandetnik scratched on the wall: 
> Duquette, William H (316H)  wrote:
> > PRAGMA table_info(my_table) returns a row for each column in my_table.  Is 
> > it possible to do selects on this result set?
> 
> No.
> 
> > Or do
> > you simply have to loop over it, and pull out what you need. 
> 
> Yes.


  Below is code for the "superview" virtual table module.  It allows
  *any* SQL statement to be turned into a read-only virtual table--
  including PRAGMA statements.  In theory, you can issue the commnad:

CREATE VIRTUAL TABLE my_table_info
USING superview( PRAGMA table_info(my_table) );

  And then simply SELECT * FROM my_table_info WHERE...;

  I say "in theory" because I haven't looked at this code for some
  months.  I have no idea if it still compiles correctly, or if the
  comments are correct.  This was put together as a possible example
  for the O'Reilly book "Using SQLite."  In the end, it was decided
  this example was a bit too complex, and a simpler example was used.

  If someone wants to take this over, host it somewhere, and keep it
  current, please have at it.

   -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





==superview.c=starts=here===

#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1;

#include 

/**
***
***

  "superview" virtual table by Jay A. Kreibich

***

  THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESS OR IMPLIED
  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT,
  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  POSSIBILITY OF SUCH DAMAGE.

  The author or authors of this code dedicate any and all copyright
  interest in this code to the public domain. We make this dedication
  for the benefit of the public at large and to the detriment of our
  heirs and successors. We intend this dedication to be an overt act
  of relinquishment in perpetuity of all present and future rights to
  this code under copyright law.

***

 *** TO COMPILE:

   * Windows (Visual Studio CLI):

 $ cl /c superview.c
 $ link /dll /out:superview.sqlite3ext /export:superview_init superview.obj

   * Mac OS X:

 $ gcc -c superview.c
 $ ld -dylib -o superview.sqlite3ext superview.o

   * Linux:

 $ gcc -c superview.c
 $ ld -shared -o superview.sqlite3ext superview.o


 *** TO LOAD (sqlite3):

 sqlite> .load superview.sqlite3ext superview_init

 *** TO USE:

 sqlite> CREATE VIRTUAL TABLE  USING superview (  );

***
***
**/


typedef struct sview_vtab_s {
sqlite3_vtabvtab;   /* this must go first */
sqlite3 *db;/* module specific fields then follow */
char*cmd;   /* SQL command */
} sview_vtab;

typedef struct sview_cursor_s {
sqlite3_vtab_cursor   cur;/* this must go first */
sqlite3_stmt  *stmt;  /* statement */
sqlite3_int64 rowid;  /* virtual row id */
int   eof;/* EOF flag */
} sview_cursor;


static int sview_get_row( sview_cursor *svc )
{
int  rc;

if ( svc->eof ) return SQLITE_OK;
rc = sqlite3_step( svc->stmt );
if ( rc == SQLITE_ROW ) {
svc->rowid++;
return SQLITE_OK; /* we have a valid row */
}

sqlite3_reset( svc->stmt );
svc->eof = 1;
return ( rc == SQLITE_DONE ? SQLITE_OK : rc );  /* DONE -> OK */
}

static int sview_connect( sqlite3 *db, void *udp, int argc, 
const char *const *argv, sqlite3_vtab **vtab, char **errmsg )
{
sview_vtab*svt = NULL;
intct, rc;
char  *table_sql;
inttable_cols = 0;
sqlite3_stmt  *stmt = NULL;

*vtab = NULL;
*errmsg = 

Re: [sqlite] Trouble with adapter for custom class

2010-11-22 Thread Joshua Lippai
Thanks! That works, and it even simplifies my code a little.

Regards,
Josh

On Mon, Nov 22, 2010 at 11:50 AM, Simon Slavin  wrote:
>
> On 22 Nov 2010, at 4:37pm, Joshua Lippai wrote:
>
>> I decided that a decent way to implement this would be to create a
>> dummy class in which I first wrap any objects that are not NumPy
>> datatypes or datetime. Then, I wrote an adapter function that I could
>> register the dummy class with, with the adapter simply returning the
>> output Pickle string. I also wrote an analogous converter function
>> that returns the result of loading the string with Pickle. The reason
>> for going to all this trouble to preserve the data is I want to be
>> able to convert back as well.
>>
>> My problem now is that when I try to use this dummy class, even though
>> my adapter function should be passing a string into sqlite, I get the
>> dreaded sqlite3 interface error:
>>
>> sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported 
>> type.
>
> Make your container class in python, but have your SQLite interface register 
> the variables as BLOBs and use the SQLite functions related to BLOBs when 
> storing and retrieving your values from the database.  BLOBs are arbitrary 
> objects of any length you desire, and SQLite never does any conversion on the 
> values.
>
> 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] joining two sequences?

2010-11-22 Thread Petite Abeille
Hi Jim,

On Nov 20, 2010, at 6:52 PM, Jim Morris wrote:

>> This should return a the equivalent keys in the two maps.  The basic
>> idea is to compare the values in each key in foo(left outer join foo)
>> with the values for each key in bar where there are any matching
>> values(left outer join bar) and only select those with a complete match(
>> inner join).  Not sure this is the most efficient way.

Clever :) Thank you very much.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Queries on PRAGMA table_info()

2010-11-22 Thread Petite Abeille

On Nov 22, 2010, at 7:26 PM, Simon Slavin wrote:

>> PRAGMA table_info(my_table) returns a row for each column in my_table.  Is 
>> it possible to do selects on this result set?
> 
> Nope.  The PRAGMA command does not present data to the SQL engine, it returns 
> results directly.  Grab the whole response and parse it using whatever 
> programming language you're using.

Yeah, that sucks :))

In any case, for the foolhardy or desperate, here is a feeble attempt to map 
the various SQLite pragma into a subset of information_schema [1]:

http://dev.alt.textdrive.com/browser/IMDB/Info.ddl

Support the following entities:

information_schema.catalog_name
information_schema.schemata
information_schema.tables
information_schema.columns
information_schema.table_constraints
information_schema.referential_constraints
information_schema.key_column_usage

Implemented as a Lua script [2]:

http://dev.alt.textdrive.com/browser/IMDB/Info.lua

As always, YMMV.

[1] http://en.wikipedia.org/wiki/Information_schema
[2] http://www.lua.org/about.html

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] connection-specific user data in extensions

2010-11-22 Thread Chris Wolf


Chris Wolf wrote:
> Is there a way for me to store one or more pointers to data structures
> as user data in
> a sqlite3 structure (i.e. the "connection")?  I want to allocate some
> structures specific to the extension I'm
> thinking of and do this in sqlite3_extension_init(...) but have other
> routines have
> access without resorting to global variables.
>
> Thanks,
>
>
>   -Chris
>
>   
...and not by registering functions and using sqlite3_user_data().  
Unless that's the only way.

Thanks.

  -Chris
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] How to choose the good page size

2010-11-22 Thread Vander Clock Stephane
Hello,

our database have around 50 millions rows
the database have only one table with singleton value name(int)=valuet(int)

the database will be store in an hardrive formatted with cluster of 64kb (but 
we can format
it with lower if neccessary)

the database must use the minimal neccessary memory (we already have an in 
memory index,
the database is only use for accessing rarely records not already in memory).

1/ if i use a page cache of 64kb (same size of the cluster), it's mean that
if sqlite3 by default use 2000 pages caches, then it's will use by
default 2000 * 64 kb of memory right  ?

2/ what the consequence to chose a page size of 512 bytes instead of the cluster
size of 64kb ? also Every row in our table use max 100 bytes !

Thanks by advance for your help !
stephane



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] connection-specific user data in extensions

2010-11-22 Thread Chris Wolf
Is there a way for me to store one or more pointers to data structures
as user data in
a sqlite3 structure (i.e. the "connection")?  I want to allocate some
structures specific to the extension I'm
thinking of and do this in sqlite3_extension_init(...) but have other
routines have
access without resorting to global variables.

Thanks,


  -Chris
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how to set pragma page size before the database has not yet created ?

2010-11-22 Thread Vander Clock Stephane
thanks !

On 11/22/2010 4:23 PM, Igor Tandetnik wrote:
> Vander Clock Stephane  wrote:
>> i want to use the pragma command to setup the page size. however they say :
>> "The page size may only be set if the database has not yet been created."
>>
>> but how to do because as soon as i do sqlite3_open_v2 then the database
>> is created ?
> No, the database is created when the first data manipulation statement runs 
> (usually, CREATE TABLE). Precisely so that you could issue some pragmas first.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Queries on PRAGMA table_info()

2010-11-22 Thread Duquette, William H (316H)
Thanks!


On 11/22/10 10:26 AM, "Simon Slavin"  wrote:


On 22 Nov 2010, at 6:21pm, Duquette, William H (316H) wrote:

> PRAGMA table_info(my_table) returns a row for each column in my_table.  Is it 
> possible to do selects on this result set?

Nope.  The PRAGMA command does not present data to the SQL engine, it returns 
results directly.  Grab the whole response and parse it using whatever 
programming language you're using.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

--
Will Duquette -- william.h.duque...@jpl.nasa.gov
Athena Development Lead -- Jet Propulsion Laboratory
"It's amazing what you can do with the right tools."

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Queries on PRAGMA table_info()

2010-11-22 Thread Igor Tandetnik
Duquette, William H (316H)  wrote:
> PRAGMA table_info(my_table) returns a row for each column in my_table.  Is it 
> possible to do selects on this result set?

No.

> Or do
> you simply have to loop over it, and pull out what you need. 

Yes.
-- 
Igor Tandetnik


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Queries on PRAGMA table_info()

2010-11-22 Thread Simon Slavin

On 22 Nov 2010, at 6:21pm, Duquette, William H (316H) wrote:

> PRAGMA table_info(my_table) returns a row for each column in my_table.  Is it 
> possible to do selects on this result set?

Nope.  The PRAGMA command does not present data to the SQL engine, it returns 
results directly.  Grab the whole response and parse it using whatever 
programming language you're using.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Queries on PRAGMA table_info()

2010-11-22 Thread Duquette, William H (316H)
Howdy!

PRAGMA table_info(my_table) returns a row for each column in my_table.  Is it 
possible to do selects on this result set? Or do you simply have to loop over 
it, and pull out what you need.

Thanks!

Will

--
Will Duquette -- william.h.duque...@jpl.nasa.gov
Athena Development Lead -- Jet Propulsion Laboratory
"It's amazing what you can do with the right tools."

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] query question

2010-11-22 Thread Artur Reilin
> Artur Reilin  wrote:
>> CREATE TABLE [challenge_players]
>> (
>>[player_id] INTEGER PRIMARY KEY ,
>>[player_name] TEXT
>> )
>>
>> CREATE TABLE [challenge_wins]
>> (
>>[round_id] INTEGER PRIMARY KEY ,
>>[round_winner] INTEGER
>> )
>>
>> I tried to do a joined select to get the both tables together. I want to
>> sort them after how much wins a player has.
>
> select player_id, player_name, count(round_winner) player_wins
> from challenge_players left join challenge_wins on (player_id =
> round_winner)
> group by player_id
> order by player_wins desc;
>
> --
> Igor Tandetnik
>

Thanks, worked like charm. So I needed "group by" in my query too. I
should do some additional research into that :/

with best wishes

Artur Reilin
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] query question

2010-11-22 Thread Igor Tandetnik
Artur Reilin  wrote:
> CREATE TABLE [challenge_players]
> (
>[player_id] INTEGER PRIMARY KEY ,
>[player_name] TEXT
> )
> 
> CREATE TABLE [challenge_wins]
> (
>[round_id] INTEGER PRIMARY KEY ,
>[round_winner] INTEGER
> )
>
> I tried to do a joined select to get the both tables together. I want to
> sort them after how much wins a player has.

select player_id, player_name, count(round_winner) player_wins
from challenge_players left join challenge_wins on (player_id = round_winner)
group by player_id
order by player_wins desc;

-- 
Igor Tandetnik


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] query question

2010-11-22 Thread Artur Reilin
Hello.

So I tested yesterday some queries with joins and cannot found the right
solution. So I'm trying it here and hope you have a solution or an Idea. I
think it's some really easy thing and I just don't get it.

Okay let's see:

I have the following scheme:

CREATE TABLE [challenge_players]
(
[player_id] INTEGER PRIMARY KEY ,
[player_name] TEXT
)

CREATE TABLE [challenge_wins]
(
[round_id] INTEGER PRIMARY KEY ,
[round_winner] INTEGER
)

challenge_players just contain a list of all players.
challenge_wins is list of all rounds with the winner player_id as
round_winner.

I tried to do a joined select to get the both tables together. I want to
sort them after how much wins a player has.

Something like:

player_id = 1; player_name = testuser; player_wins = 3;

I hope you have an idea for me.

with best regards

Artur Reilin
sqlite.yuedream.de
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] NO_GETTOD

2010-11-22 Thread Dan Kennedy
On 11/22/2010 11:48 PM, Black, Michael (IS) wrote:
> Bug in 3.7.3?
> gcc -c -DNO_GETTOD sqlite3.c
> sqlite3.c: In function âunixCurrentTimeInt64â:
> sqlite3.c:27870: error: âiâ undeclared (first use in this function)
> sqlite3.c:27870: error: (Each undeclared identifier is reported only once
> sqlite3.c:27870: error: for each function it appears in.)
>
> static int unixCurrentTimeInt64(sqlite3_vfs *NotUsed, sqlite3_int64 *piNow){
>static const sqlite3_int64 unixEpoch = 24405875*(sqlite3_int64)864;
> #if defined(NO_GETTOD)
>time_t t;
>time();
>*piNow = ((sqlite3_int64)i)*1000 + unixEpoch;
> #elif OS_VXWORKS
>
> I assume this is supposed to be "t" intead of "i" ??

Correct. Thanks for the report.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Trouble with adapter for custom class

2010-11-22 Thread Simon Slavin

On 22 Nov 2010, at 4:37pm, Joshua Lippai wrote:

> I decided that a decent way to implement this would be to create a
> dummy class in which I first wrap any objects that are not NumPy
> datatypes or datetime. Then, I wrote an adapter function that I could
> register the dummy class with, with the adapter simply returning the
> output Pickle string. I also wrote an analogous converter function
> that returns the result of loading the string with Pickle. The reason
> for going to all this trouble to preserve the data is I want to be
> able to convert back as well.
> 
> My problem now is that when I try to use this dummy class, even though
> my adapter function should be passing a string into sqlite, I get the
> dreaded sqlite3 interface error:
> 
> sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported type.

Make your container class in python, but have your SQLite interface register 
the variables as BLOBs and use the SQLite functions related to BLOBs when 
storing and retrieving your values from the database.  BLOBs are arbitrary 
objects of any length you desire, and SQLite never does any conversion on the 
values.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] NO_GETTOD

2010-11-22 Thread Black, Michael (IS)
Bug in 3.7.3?
gcc -c -DNO_GETTOD sqlite3.c
sqlite3.c: In function âunixCurrentTimeInt64â:
sqlite3.c:27870: error: âiâ undeclared (first use in this function)
sqlite3.c:27870: error: (Each undeclared identifier is reported only once
sqlite3.c:27870: error: for each function it appears in.)

static int unixCurrentTimeInt64(sqlite3_vfs *NotUsed, sqlite3_int64 *piNow){
  static const sqlite3_int64 unixEpoch = 24405875*(sqlite3_int64)864;
#if defined(NO_GETTOD)
  time_t t;
  time();
  *piNow = ((sqlite3_int64)i)*1000 + unixEpoch;
#elif OS_VXWORKS

I assume this is supposed to be "t" intead of "i" ??

 
Michael D. Black
Senior Scientist
Advanced Analytics Directorate
Northrop Grumman Information Systems
 

 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Trouble with adapter for custom class

2010-11-22 Thread Joshua Lippai
Hello all,

I am in the process of writing a program using sqlite3 whose purpose
is to "convert" a custom type of 2-dimensional array into an sqlite
table. My progress has been rather good, but I've run into a stumbling
block. This type of array - a NumPy recarray - can take any type of
data object as an entry. To get around this, I decided for the
purposes of not halting the conversion process because of something
the user will likely not be using in any sort of query, I would have
Pickle turn any objects I am not explicitly providing support for into
strings, which should then be able to be inserted into the table, even
if nothing meaningful can be done with them. I want to do this rather
than just, say, kick the elements out, because I want to be able to
reverse the process as well and thus simply Pickle.loads to get back
what is supposed to be there. Of course, the troublesome part lies in
this working for a not-defined set of classes.

I decided that a decent way to implement this would be to create a
dummy class in which I first wrap any objects that are not NumPy
datatypes or datetime. Then, I wrote an adapter function that I could
register the dummy class with, with the adapter simply returning the
output Pickle string. I also wrote an analogous converter function
that returns the result of loading the string with Pickle. The reason
for going to all this trouble to preserve the data is I want to be
able to convert back as well.

My problem now is that when I try to use this dummy class, even though
my adapter function should be passing a string into sqlite, I get the
dreaded sqlite3 interface error:

sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported type.

I think my adapter function is written more or less correctly and am
at a loss. Attached is a test example of my code, where I try to do it
with a list as the object being pickled (note the list just stands
alone here, it is not part of a recarray; this is just to get it
working on the individual element level). Note that this is basically
the exact example from the python.org page on sqlite, with my class
and adapter/converter functions being used instead.

Can I get any feedback on what I might be doing wrong? I'm perplexed,
as I don't see why this shouldn't work. Maybe there's some really
simple syntax mistake I'm making. Full error text below:

$ python dclasstest.py
Traceback (most recent call last):
  File "dclasstest.py", line 31, in 
cur.execute("insert into test(p) values (?)", (p,))
sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported type.

Thanks in advance for any feedback.

Regards,
Josh
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] temp files for app file format

2010-11-22 Thread Scott Frankel

On Nov 22, 2010, at 5:26 AM, Igor Tandetnik wrote:

> Scott Frankel  wrote:
>> Are journal files written to disk by applications that create SQLite
>> DBs on the fly?  If so, what are they called and where are they
>> written to?
>
> You seem to refer to in-memory (:memory:) database. No files,  
> journal or otherwise, are created for those.

OK, scratching that off the list.

Thanks
Scott



> -- 
> 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] how can I use a larger cache ? "Application Defined Page Cache." ??

2010-11-22 Thread Pavel Ivanov
> I do not set anything for the "application defined page cache", so
> what is the behavior of the default one?

Default implementation of page cache uses all the size you said it to
use and in some cases even more. So don't worry about that. Just
remember that cache_size is not a global setting, it's a connection
setting or (in case if you use shared cache) a setting for all
connections to the same database file. So do your math and don't run
accidentally out of memory.


Pavel

On Fri, Nov 19, 2010 at 4:21 PM, Yang  wrote:
> I read from the docs that by setting
> "PRAGMA cache_size = Number-of-pages;"
> (http://www.sqlite.org/pragma.html#pragma_cache_size)
> I can use a larger cache, but the same paragraph mentions that how
> much is used is actually "at the discretion of the application defined
> page cache"
>
> I do not set anything for the "application defined page cache", so
> what is the behavior of the default one?
> the application page cache page does not describe this.
> with the default "application defined page cache", would it utilize
> all of the cache I declared ?
>
> I am hoping to use a very large cache, for example 1G
>
> Thanks
> Yang
> ___
> 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] filling an in-memory database from a byte stream?

2010-11-22 Thread Pavel Ivanov
> Would it be possible to create an in-memory database and fill it from a byte 
> stream or a file?

If your Java driver allows you to attach your own VFS (Virtual File
System) then you can achieve your goal using it. Otherwise there's no
way to do that.

Pavel

On Mon, Nov 22, 2010 at 9:42 AM, Niemann, Hartmut
 wrote:
> Hello *!
>
> I am using sqlite (with Java) as a readonly database in a viewer application.
> One problem is that the database can reside not only on the local hard disc, 
> but also on a
> possibly slowly connected remote system that can be contacted only via ftp or 
> some
> proprietary interface.
>
> I would like to create and fill an in-memory database instead of copying the 
> database
> to the local hard drive.
>
> But the online backup API uses two database
> objects, i.e. it can not read from something that is not
> a database.
>
> Would it be possible to create an in-memory database and fill it from a byte 
> stream or a file?
>
> (There is no need for the opposite direction. The in-memory database is used 
> read-only and
> goes to the bit bucket at program end.)
>
>
> Mit freundlichen Grüßen
> Dr. Hartmut Niemann
>
> Siemens AG
> Industry Sector
> Mobility Division
> Rolling Stock
> I MO RS LC EN LE 8
> Werner-von-Siemens-Str. 67
> 91052 Erlangen, Deutschland
> Tel.: +49 (9131) 7-34264
> Fax: +49 (9131) 7-26254
> mailto:hartmut.niem...@siemens.com
>
> Siemens Aktiengesellschaft: Vorsitzender des Aufsichtsrats: Gerhard Cromme; 
> Vorstand: Peter Löscher, Vorsitzender; Wolfgang Dehen, Brigitte Ederer, Joe 
> Kaeser, Barbara Kux, Hermann Requardt, Siegfried Russwurm, Peter Y. Solmssen; 
> Sitz der Gesellschaft: Berlin und München, Deutschland; Registergericht: 
> Berlin Charlottenburg, HRB 12300, München, HRB 6684; WEEE-Reg.-Nr. DE 23691322
>
> ___
> 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] filling an in-memory database from a byte stream?

2010-11-22 Thread Niemann, Hartmut
Hello *!

I am using sqlite (with Java) as a readonly database in a viewer application.
One problem is that the database can reside not only on the local hard disc, 
but also on a
possibly slowly connected remote system that can be contacted only via ftp or 
some
proprietary interface.

I would like to create and fill an in-memory database instead of copying the 
database
to the local hard drive.

But the online backup API uses two database
objects, i.e. it can not read from something that is not
a database.

Would it be possible to create an in-memory database and fill it from a byte 
stream or a file?

(There is no need for the opposite direction. The in-memory database is used 
read-only and
goes to the bit bucket at program end.)


Mit freundlichen Grüßen
Dr. Hartmut Niemann

Siemens AG
Industry Sector
Mobility Division
Rolling Stock
I MO RS LC EN LE 8
Werner-von-Siemens-Str. 67
91052 Erlangen, Deutschland
Tel.: +49 (9131) 7-34264
Fax: +49 (9131) 7-26254
mailto:hartmut.niem...@siemens.com

Siemens Aktiengesellschaft: Vorsitzender des Aufsichtsrats: Gerhard Cromme; 
Vorstand: Peter Löscher, Vorsitzender; Wolfgang Dehen, Brigitte Ederer, Joe 
Kaeser, Barbara Kux, Hermann Requardt, Siegfried Russwurm, Peter Y. Solmssen; 
Sitz der Gesellschaft: Berlin und München, Deutschland; Registergericht: Berlin 
Charlottenburg, HRB 12300, München, HRB 6684; WEEE-Reg.-Nr. DE 23691322

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Confused by import of NULL values from CSV file

2010-11-22 Thread Jean-Christophe Deschamps

>I import a CSV flat file into a table (using sqliteman as GUI).  The 
>flat file has NULL values as simply no data between two delimiters (I 
>use 'tab' as Delimiter).
>
>The resulting table does not treat 'no data' between 2 delimiters as 
>NULL.  When I run CHECK constraints etc. on it it behaves as if the 
>'no data' was some value.  For example in a query it will show an 
>empty value but not as NULL (I can see this as SQLiteman has 
>highlights showing NULL fields).
>
>How can I set up Sqlite so it will read 'no data' between two 
>delimiters as NULL on file import?  Thanks

I believe it isn't as much an issue that's up to SQLite itself to 
manage, but rather the import tool you use.

While Igor is right to point out that NULLs were never mentionned in 
any .CSV RFC/document, it is still possible for an import tool to adopt 
a [private] convention, like:

"col_1","col_2","col_3"
"abc",123,"def"
,456,
"ghi",,"jkl"

being imported as

abc|123|def
null|456|null
ghi|null|jkl

but this requires a contract between the .csv producer[s] and the 
importer, as well as the use of text delimiters in order to 
differentiate an empty string from a null.

 From this point of view, SQLite has little control over that.  You can 
probably modify your copy of the CLI to adopt this convention, or write 
your own importer, which isn't hard if you don't try to make it 
universal but instead highly proprietary.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] temp files for app file format

2010-11-22 Thread Igor Tandetnik
Scott Frankel  wrote:
> Are journal files written to disk by applications that create SQLite
> DBs on the fly?  If so, what are they called and where are they
> written to?

You seem to refer to in-memory (:memory:) database. No files, journal or 
otherwise, are created for those.
-- 
Igor Tandetnik

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] EXTERNAL: Confused by import of NULL values from CSV file

2010-11-22 Thread Black, Michael (IS)
That's not SQLite doing it...it's sqliteman treating it as empy strings.
 
If you want it be NULL after import just update it yourself.
 
UPDATE mytable SET key=NULL where key='';
 
 
Michael D. Black
Senior Scientist
Advanced Analytics Directorate
Northrop Grumman Information Systems
 



From: sqlite-users-boun...@sqlite.org on behalf of rf rf
Sent: Mon 11/22/2010 3:40 AM
To: sqlite-users@sqlite.org
Subject: EXTERNAL:[sqlite] Confused by import of NULL values from CSV file



Hello hopefully someone can help me out on this item
 
I import a CSV flat file into a table (using sqliteman as GUI).  The flat file 
has NULL values as simply no data between two delimiters (I use 'tab' as 
Delimiter).
 
The resulting table does not treat 'no data' between 2 delimiters as NULL.  
When I run CHECK constraints etc. on it it behaves as if the 'no data' was some 
value.  For example in a query it will show an empty value but not as NULL (I 
can see this as SQLiteman has highlights showing NULL fields).
 
How can I set up Sqlite so it will read 'no data' between two delimiters as 
NULL on file import?  Thanks
 
Richard Freggi


 
___
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] Confused by import of NULL values from CSV file

2010-11-22 Thread Igor Tandetnik
rf rf  wrote:
> I import a CSV flat file into a table (using sqliteman as GUI). The flat file 
> has NULL values as simply no data between two
> delimiters (I use 'tab' as Delimiter). 

In CSV format, there is no way to distinguish between NULL and '' (an empty 
string).
-- 
Igor Tandetnik

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how to set pragma page size before the database has not yet created ?

2010-11-22 Thread Igor Tandetnik
Vander Clock Stephane  wrote:
> i want to use the pragma command to setup the page size. however they say :
> "The page size may only be set if the database has not yet been created."
> 
> but how to do because as soon as i do sqlite3_open_v2 then the database
> is created ?

No, the database is created when the first data manipulation statement runs 
(usually, CREATE TABLE). Precisely so that you could issue some pragmas first.
-- 
Igor Tandetnik

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Loading a FTS3 table into ram without reindexing

2010-11-22 Thread Richard Hipp
On Sun, Nov 21, 2010 at 7:49 PM, boscowitch  wrote:

>
> or can i advise sqlite to load at least the whole pre generated index
> into the ram to speed it up?
>

http://www.sqlite.org/backup.html

-- 
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] Auto Reply: sqlite-users Digest, Vol 35, Issue 22

2010-11-22 Thread bogdan . coman
This is an auto-replied message. I am out of office right now, with no access 
to e-mail.

I will be returning on Friday, 03 Dec.

If you need Berkeley DB assistance before then, please use My Oracle Support or 
the Oracle Berkeley DB Forums. For urgent issues, please contact Adam Whitter 
at adam.whit...@oracle.com

Bogdan
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Confused by import of NULL values from CSV file

2010-11-22 Thread rf rf
Hello hopefully someone can help me out on this item
 
I import a CSV flat file into a table (using sqliteman as GUI).  The flat file 
has NULL values as simply no data between two delimiters (I use 'tab' as 
Delimiter).
 
The resulting table does not treat 'no data' between 2 delimiters as NULL.  
When I run CHECK constraints etc. on it it behaves as if the 'no data' was some 
value.  For example in a query it will show an empty value but not as NULL (I 
can see this as SQLiteman has highlights showing NULL fields).
 
How can I set up Sqlite so it will read 'no data' between two delimiters as 
NULL on file import?  Thanks
 
Richard Freggi


  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] how to set pragma page size before the database has not yet created ?

2010-11-22 Thread Vander Clock Stephane
Hello,

i want to use the pragma command to setup the page size. however they say :
"The page size may only be set if the database has not yet been created."

but how to do because as soon as i do sqlite3_open_v2 then the database 
is created ?
and to execute the pragma i need connection to the database ?


also regarding page size, the default page size on our hardrive is 64kb 
(the maximum),
but i thing it's too much for the sqlite as we will use it only to store
on one table juste singleton index(int)=value(int) pair (but a very lot 
of rows,
arround 50 millions). memory consumption must be minimal also !
what a good page size you thing i need to use ?

thanks by advance
stéphane



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Compile 64bit version of SQLIte on Solaris?

2010-11-22 Thread Lynton Grice
Hi Dan,

You are THE MAN! You are 100% correct...I was using GCC in:

/usr/local/bin/gcc

But should have been using:

/usr/sfw/bin/gcc

Thanks ;-)

Lynton

-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Dan Kennedy
Sent: 22 November 2010 11:05 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Compile 64bit version of SQLIte on Solaris?

On 11/22/2010 03:25 PM, Lynton Grice wrote:
> Hi there,
>
> That does not work, I tried that already.
>
> # /usr/local/bin/gcc -m64 -D_FILE_OFFSET_BITS=64 -c -fPIC -DHAVE_USLEEP
> sqlite3.c
> sqlite3.c:1: sorry, unimplemented: 64-bit mode not compiled in
> #
>
> And I am on a 64-bit Solaris box...
>
> And other ideas?


The message means that your gcc build does not support
64-bit targets. You could rebuild gcc or try using solaris
compiler if you have it.


___
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] Compile 64bit version of SQLIte on Solaris?

2010-11-22 Thread Dan Kennedy
On 11/22/2010 03:25 PM, Lynton Grice wrote:
> Hi there,
>
> That does not work, I tried that already.
>
> # /usr/local/bin/gcc -m64 -D_FILE_OFFSET_BITS=64 -c -fPIC -DHAVE_USLEEP
> sqlite3.c
> sqlite3.c:1: sorry, unimplemented: 64-bit mode not compiled in
> #
>
> And I am on a 64-bit Solaris box...
>
> And other ideas?


The message means that your gcc build does not support
64-bit targets. You could rebuild gcc or try using solaris
compiler if you have it.


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Compile 64bit version of SQLIte on Solaris?

2010-11-22 Thread Lynton Grice
Hi there,

That does not work, I tried that already.

# /usr/local/bin/gcc -m64 -D_FILE_OFFSET_BITS=64 -c -fPIC -DHAVE_USLEEP
sqlite3.c
sqlite3.c:1: sorry, unimplemented: 64-bit mode not compiled in
#

And I am on a 64-bit Solaris box...

And other ideas?

Lynton

-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of a...@sibmail.ru
Sent: 22 November 2010 10:16 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Compile 64bit version of SQLIte on Solaris?

use -m64 flag to compile and link

> I just tried to see what ELF class is in after running the following
> (added
> -D_FILE_OFFSET_BITS=64):
>
> /usr/local/bin/gcc -D_FILE_OFFSET_BITS=64 -c -fPIC -DHAVE_USLEEP
> sqlite3.c
>
> # file libsqlite3.so grep ELF
> libsqlite3.so:  ELF 32-bit LSB dynamic lib 80386 Version 1 [FPU],
> dynamically linked, not stripped, no debugging information available
>
> How can I get the ELF class to reflect "ELF 64-bit"?
>
> Any ideas?
>
> Lynton
>
> -Original Message-
> From: sqlite-users-boun...@sqlite.org
> [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Lynton Grice
> Sent: 22 November 2010 09:33 AM
> To: 'General Discussion of SQLite Database'
> Subject: Re: [sqlite] Compile 64bit version of SQLIte on Solaris?
>
> Hi there,
>
> The reason I ask is that I have created a C shared lib using SQLite
> functions etc and the custom shared lib I have created needs to be ELF
> class
> 64.
>
> At the moment I am getting the ELF class issues:
> wrong ELF class: ELFCLASS32
>
> That is why I am hoping I can compile the main SQLite shared lib in ELF
> class 64..
>
> This possible?
>
> Thanks
>
> Lynton
>
>
> -Original Message-
> From: sqlite-users-boun...@sqlite.org
> [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Lynton Grice
> Sent: 22 November 2010 09:28 AM
> To: sqlite-users@sqlite.org
> Subject: [sqlite] Compile 64bit version of SQLIte on Solaris?
>
> Hi there,
>
>
>
> I am getting the following error when trying to compile SQLite on a
> Solaris
> 64 bit machine:
>
>
>
> /usr/local/bin/gcc -m64 -R/usr/sfw/lib/64 -c -fPIC -DHAVE_USLEEP
> sqlite3.c
>
> sqlite3.c:1: sorry, unimplemented: 64-bit mode not compiled in
>
>
>
> Can someone please let me know how I can do this so I can use SQLite on a
> 64
> bit Solaris machine?
>
>
>
> Thanks
>
>
>
> Lynton
>
> ___
> 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


[sqlite] temp files for app file format

2010-11-22 Thread Scott Frankel

Hi all,

Are journal files written to disk by applications that create SQLite  
DBs on the fly?  If so, what are they called and where are they  
written to?

I've recently started using SQLite as a file format for the  
application I'm developing.  Tracking down a mysterious bus error  
crash has lead me to consider SQLite temp files.

The Crash Report I'm getting on OSX 10.5 lists  
KERN_PROTECTION_FAILURE.  A few googles later, I find that this  
exception is caused by the thread trying to write to read-only  
memory.  My app mysteriously and suddenly stopped accepting all writes  
to its internal SQLite DB.  A stuck temp file lock could be consistent  
with this behavior.

My app creates an in-memory SQLite DB from PyQt:
theDb = QtSql.QSqlDatabase.addDatabase("QSQLITE")
theDb.setDatabaseName(":memory:")


Thanks!
Scott

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Compile 64bit version of SQLIte on Solaris?

2010-11-22 Thread alm
use -m64 flag to compile and link

> I just tried to see what ELF class is in after running the following
> (added
> -D_FILE_OFFSET_BITS=64):
>
> /usr/local/bin/gcc -D_FILE_OFFSET_BITS=64 -c -fPIC -DHAVE_USLEEP
> sqlite3.c
>
> # file libsqlite3.so grep ELF
> libsqlite3.so:  ELF 32-bit LSB dynamic lib 80386 Version 1 [FPU],
> dynamically linked, not stripped, no debugging information available
>
> How can I get the ELF class to reflect "ELF 64-bit"?
>
> Any ideas?
>
> Lynton
>
> -Original Message-
> From: sqlite-users-boun...@sqlite.org
> [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Lynton Grice
> Sent: 22 November 2010 09:33 AM
> To: 'General Discussion of SQLite Database'
> Subject: Re: [sqlite] Compile 64bit version of SQLIte on Solaris?
>
> Hi there,
>
> The reason I ask is that I have created a C shared lib using SQLite
> functions etc and the custom shared lib I have created needs to be ELF
> class
> 64.
>
> At the moment I am getting the ELF class issues:
> wrong ELF class: ELFCLASS32
>
> That is why I am hoping I can compile the main SQLite shared lib in ELF
> class 64..
>
> This possible?
>
> Thanks
>
> Lynton
>
>
> -Original Message-
> From: sqlite-users-boun...@sqlite.org
> [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Lynton Grice
> Sent: 22 November 2010 09:28 AM
> To: sqlite-users@sqlite.org
> Subject: [sqlite] Compile 64bit version of SQLIte on Solaris?
>
> Hi there,
>
>
>
> I am getting the following error when trying to compile SQLite on a
> Solaris
> 64 bit machine:
>
>
>
> /usr/local/bin/gcc -m64 -R/usr/sfw/lib/64 -c -fPIC -DHAVE_USLEEP
> sqlite3.c
>
> sqlite3.c:1: sorry, unimplemented: 64-bit mode not compiled in
>
>
>
> Can someone please let me know how I can do this so I can use SQLite on a
> 64
> bit Solaris machine?
>
>
>
> Thanks
>
>
>
> Lynton
>
> ___
> 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