Re: [sqlite] Newby Question

2007-08-28 Thread Simon Davies
Hi Graham,

The trigger needs a where clause, as in the following:

sqlite>
sqlite> create table temp(  id integer primary key,
   ...> interested integer,
   ...> val1 text,
   ...> val2 text,
   ...> val3 text );
sqlite> create trigger temp_trigger
   ...> after update of interested on temp
   ...> begin
   ...> update temp set val1='newValue1',
   ...> val2='val2NewValue',
   ...> val3='val3NewValue'
where id=old.id;
   ...> end;
sqlite>
sqlite> insert into temp values( 1, 0, '1', '2', '3' );
sqlite> insert into temp values( 2, 0, '11', '22', '33' );
sqlite> insert into temp values( 3, 0, '111', '222', '333' );
sqlite> insert into temp values( 4, 0, '', '', '' );
sqlite>
sqlite> select * from temp;
1|0|1|2|3
2|0|11|22|33
3|0|111|222|333
4|0|||
sqlite>
sqlite> update temp set interested=1 where id=2;
sqlite>
sqlite> select * from temp;
1|0|1|2|3
2|1|newValue1|val2NewValue|val3NewValue
3|0|111|222|333
4|0|||
sqlite>

The use of 'old' and 'new' is covered on this sqlite documentation page:
http://www.sqlite.org/lang_createtrigger.html

Rgds,
Simon

On 28/08/07, Graham Wickens <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I'm trying to learn SQLITE from a book and am making slow progress. My
> question is, in the following TRIGGER how do I tell it to only update
> the single record that the field Interested was updated? its a logical
> field either TRUE of FALSE, I want the trigger to work when the Field is
> TRUE.
>
>
> *create trigger* sbslogger* after update of *Interested* on *Aircraft *
> begin
> update *Aircraft* set *UserString1 *= Registration;
> update *Aircraft *set *UserString2* = 'PAGANHILL SBS';
> update *Aircraft* set *UserString3* = current_date;
> end;
>
> *the above works, but of course does the whole table ! and I am now stuck!
>
> thanks in anticipation
> **
>
> --
>¿¿¿
>   (ô ô)   [EMAIL PROTECTED]
> ooO-(_)-Ooo   
>Wot! No SBS?
>
>
>

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] Newby Question

2007-08-28 Thread Graham Wickens

Hi All,

I'm trying to learn SQLITE from a book and am making slow progress. My 
question is, in the following TRIGGER how do I tell it to only update 
the single record that the field Interested was updated? its a logical 
field either TRUE of FALSE, I want the trigger to work when the Field is 
TRUE.



*create trigger* sbslogger* after update of *Interested* on *Aircraft *
begin
update *Aircraft* set *UserString1 *= Registration;
update *Aircraft *set *UserString2* = 'PAGANHILL SBS';
update *Aircraft* set *UserString3* = current_date;
end;

*the above works, but of course does the whole table ! and I am now stuck!

thanks in anticipation
**

--
   ¿¿¿
  (ô ô)   [EMAIL PROTECTED]
ooO-(_)-Ooo   
   Wot! No SBS?




Re: [sqlite] CURRENT_TIMESTAMP value in single transaction

2007-08-28 Thread Kees Nuyt

Hi Nick, 

On Tue, 28 Aug 2007 17:39:16 +0100, you wrote:

> When enclosed in a single transaction, would inserting
> many rows into a table using the special default keyword
> 'CURRENT_TIMESTAMP' result in all of the rows
> guaranteeing the same timestamp value?

Did you try?
I did. Surprisingly, it doesn't give the same value in every
row. Perhaps it should. Joe Celko thinks it should.
(SQL for Smarties, third edition, 2005 Elsevier; 
 paragraph 4.2.3 Handling Timestamps).

> If not, is there a recommended way to assign a unique
> value to a collection of inserts in a single transaction
> generated from a trigger?

I'm sorry, I have no usable ideas at the moment.
Your problem suggests the timestamp will be used as a foreign
key. In such cases I usually use a natural key (i.e. propagate
the primary key of the referred table) or generate a synthetic
key for both in the application.

> Thanks in advance
> Nick

Regards,
-- 
  (  Kees Nuyt
  )
c[_]

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] sqlite db portability

2007-08-28 Thread Shilpa Sheoran
Thanks everyone for your input.


Shilpa

On 8/27/07, Asif Lodhi <[EMAIL PROTECTED]> wrote:
> Hi Shilpa,
>
> On 8/28/07, Shilpa Sheoran <[EMAIL PROTECTED]> wrote:
> > Eg. I  create sqlite  db file say "mysqlitedb.db" and now I have MySQL
> > installed. Can it access "mysqlitedb.db"
>
> IIRC, I did read about "Linked Servers" in MS-SQL-Server documentation
> where, if your SQL Server is being used in an NT domain setting then
> you can create "Linked Servers" - which means that you can "link-in"
> different databases having ADO wrappers. MS-Access is NOT a database
> server but I think I did read that you could link in MS-Access
> databases to your SQL Server process. Though I am NOT sure but I think
> someone did mention ADO wrappers pertaining to Sqlite and I would
> suggest that you give that a shot.
>
> --
> Best,
>
> Asif
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
> -
>
>

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] CURRENT_TIMESTAMP value in single transaction

2007-08-28 Thread Dennis Cote

Brandon, Nicholas (UK) wrote:

When enclosed in a single transaction, would inserting many rows into a
table using the special default keyword 'CURRENT_TIMESTAMP' result in
all of the rows guaranteeing the same timestamp value?

If not, is there a recommended way to assign a unique value to a
collection of inserts in a single transaction generated from a trigger?


  

Brandon,

I don't think there is a recommended way, but something like this should 
work:


   begin;
   create temp table time as select julianday('now') as current;
   insert into tab1 values ((select current from time), ...);
   insert into tab2 values ((select current from time), ...);
   drop temp table time;
   commit;

Basically you need to store the timestamp you want to use for all the 
inserts in the transaction for the length of the transaction. The only 
good place to store things in sqlite is in a table.


HTH
Dennis Cote

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Skype client using SQLite?

2007-08-28 Thread Kees Nuyt
On Tue, 28 Aug 2007 18:44:50 +0200, you wrote:

>On Tue, 28 Aug 2007 15:13:47 +, you wrote:
>
>>In reference to
>>
>>   http://www.sqlite.org/cvstrac/tktview?tn=2592
>>
>>This is the first public indication we have had that
>>Skype is using SQLite in their windows clients.  However,
>>the person who wrote the ticket seems to be a bit confused.
>>Can any able hackers in the SQLite community confirm that
>>the Skype windows client is using SQLite?  It would be
>>nice to add them to the page of high-profile users.
>
[snip]

> My own Skype installation doesn't show any trace of SQLite.
> Either they don't use it, or they've hidden it very well.

Oops, found it: 
C:\Users\\AppData\Roaming\Skype\\dyncontent\bundle.dat
-- 
  (  Kees Nuyt
  )
c[_]

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] compiling 3.4.2 on solaris

2007-08-28 Thread Brian Munroe
On 8/28/07, rahed <[EMAIL PROTECTED]> wrote:

> /usr/include/sys/types.h:176: error: previous definition of 'B_TRUE' was here
> *** Error code 1
> make: Fatal error: Command failed for target `lemon'
>
> Could somenone suggest what's wrong?
>

Rahed:

Funny enough, I just ran into this problem yesterday!  I used the
information in this ticket [1] to fix the problem. All you have to do
is find/replace B_FALSE to BOOL_FALSE and B_TRUE to BOOL_TRUE in the
lemon.c file.

-- brian

[1] - http://www.sqlite.org/cvstrac/tktview?tn=2583,6

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] compiling 3.4.2 on solaris

2007-08-28 Thread drh
rahed <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> when running make I get:
> 
> sed -e s/--VERS--/3.4.2/ ../sqlite/src/sqlite.h.in | \
> sed -e s/--VERSION-NUMBER--/3004002/ >sqlite3.h
> gcc -g -O2 -o lemon ../sqlite/tool/lemon.c
> .../sqlite/tool/lemon.c:111: error: redeclaration of enumerator `B_FALSE'
> /usr/include/sys/types.h:176: error: previous definition of 'B_FALSE' was here
> .../sqlite/tool/lemon.c:111: error: redeclaration of enumerator `B_TRUE'
> /usr/include/sys/types.h:176: error: previous definition of 'B_TRUE' was here
> *** Error code 1
> make: Fatal error: Command failed for target `lemon'
> 
> Could somenone suggest what's wrong?
> 

http://www.sqlite.org/cvstrac/chngview?cn=4274
http://www.sqlite.org/cvstrac/tktview?tn=2583
--
D. Richard Hipp <[EMAIL PROTECTED]>


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Towards SQLite version 3.5.0

2007-08-28 Thread Eugene Wee
Would this be a good time to replace the older sqlite3_prepare() and 
sqlite3_prepare16() interfaces with what is currently the newer 
sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces respectively? 
Admittedly they are definitely not among the "less frequently used 
interfaces", but such an incompatible change to existing interfaces 
would be best done in such a version number jump if it is ever intended.


Regards,
Eugene Wee

[EMAIL PROTECTED] wrote:

The transition from 3.4.2 to 3.5.0 will perhaps be the
largest single change to SQLite since 2.8->3.0.  There 
will not be that many visible changes, but a lot is 
changing behind the scenes.  Some less frequently used

interfaces will be changing in slightly incompatible
ways.  Users who have build customized OS intereface layers
or backends for SQLite will find that they are going to
need to do some rework.

SQLite version 3.5.0 is not close to being ready yet.
But it is to the point where the source code will
compile and pass many tests.  And so I would like to
take this opportunity to encourage people in the 
community to download the CVS HEAD and give it

a whirl in their applications.  Please let me know
about any serious issues you run across.

I have *started* to prepare documentation describing
the changes in 3.5.0.  This is draft documentation.
But for those who are interested, please visit

   http://www.sqlite.org/34to35.html
   http://www.sqlite.org/capi350ref.html

In particular, if your application uses a customized
OS interface for SQLite, you should read the 34to35.html
document to see exactly what will be involved in porting
your application to run with version 3.5.0.

The SQLite code currently in CVS HEAD is not ready for
production use.  We know that.  We know what many of the
problems are and Dan and I are working long hours to fix
them.  It's the problems that we *do not* know about that
are scary.  So that is why I am inviting the larger
community to have an early look and perhaps bring our
attention to issues sooner rather than later.

--
D. Richard Hipp <[EMAIL PROTECTED]>


-
To unsubscribe, send email to [EMAIL PROTECTED]
-




-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Skype client using SQLite?

2007-08-28 Thread Kees Nuyt
On Tue, 28 Aug 2007 15:13:47 +, you wrote:

>In reference to
>
>   http://www.sqlite.org/cvstrac/tktview?tn=2592
>
>This is the first public indication we have had that
>Skype is using SQLite in their windows clients.  However,
>the person who wrote the ticket seems to be a bit confused.
>Can any able hackers in the SQLite community confirm that
>the Skype windows client is using SQLite?  It would be
>nice to add them to the page of high-profile users.

I think he is confused indeed.

The use of C:\Windows\Temp\ as temp folder, and the problems he
has to get voice working in not only Skype but also other
messenger programs seem to indicate an old version of Windows
(95 or 98, maybe ME).

Newer versions (WinNT family) would use a folder within a user
profile. Assuming an old Windows installation we might also
assume an old version of the virusscanner that still uses a
version of SQLite that prefixes its tempfiles with sqlite
instead of etilqs.

My own Skype installation doesn't show any trace of SQLite.
Either they don't use it, or they've hidden it very well.

CyberLink seems to use SQLite for its PowerDVD and/or
PowerProducer programs to store references. 
Table names:

ATSC_Frequency
ATSC_FrequencyTable
Country
CountryToATSC_FrequencyTable
CountryToDVBT_FrequencyTable
DVBS_Channel
DVBS_Frequency
DVBS_Region
DVBS_Satellite
DVBT_Frequency
DVBT_FrequencyTable
DVBT_FrequencyTableToFrequency
DVB_IPService
Version

Regards,
-- 
  (  Kees Nuyt
  )
c[_]

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] CURRENT_TIMESTAMP value in single transaction

2007-08-28 Thread Brandon, Nicholas \(UK\)


When enclosed in a single transaction, would inserting many rows into a
table using the special default keyword 'CURRENT_TIMESTAMP' result in
all of the rows guaranteeing the same timestamp value?

If not, is there a recommended way to assign a unique value to a
collection of inserts in a single transaction generated from a trigger?

Thanks in advance
Nick


This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] Skype client using SQLite?

2007-08-28 Thread Robert Simpson
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, August 28, 2007 8:14 AM
> To: sqlite-users@sqlite.org
> Subject: [sqlite] Skype client using SQLite?
> 
> In reference to
> 
>http://www.sqlite.org/cvstrac/tktview?tn=2592
> 
> This is the first public indication we have had that
> Skype is using SQLite in their windows clients.  However,
> the person who wrote the ticket seems to be a bit confused.
> Can any able hackers in the SQLite community confirm that
> the Skype windows client is using SQLite?  It would be
> nice to add them to the page of high-profile users.
> 

Bundle.dat file also confirmed on Windows Skype, found it:
C:\Documents and Settings\\Application Data\Skype\\dyncontent\bundle.dat

In my case the tables are populated.  Example below.

sqlite> .schema
CREATE TABLE bupdate (uri text, type text, meta text, prio integer,id integer, b
ody blob, terms blob);
CREATE TABLE events (id intenger, event integer, event_time integer);
CREATE TABLE install (uri text, type text, meta text, prio integer,id integer, b
ody blob, terms blob);
CREATE TABLE itemkeys (id integer, keys text);
CREATE TABLE reported (id integer, exposed_cnt integer, exposed_time integer, ex
ec_cnt integer, close_cnt integer);
CREATE TABLE stats (id integer, exposed_cnt integer,exposed_time integer, exec_c
nt integer, close_cnt integer,last_expose_start integer, exposing_now integer);
CREATE INDEX bupdate_id on bupdate (id);
CREATE INDEX bupdate_uri on bupdate (uri);
CREATE INDEX events_id on events (id);
CREATE INDEX install_id on install (id);
CREATE INDEX install_uri on install (uri);
CREATE INDEX itemkeys_id on itemkeys (id);
CREATE INDEX reported_id on reported(id);
CREATE INDEX stats_id on stats (id);

sqlite> select * from install;
uri|type|meta|prio|id|body|terms
ui/banners/main/81|text/x-rich|information|1|81|How is your call quality? Please give us your feedba
ck|☺




-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Skype client using SQLite?

2007-08-28 Thread Trevor Talbot
On 8/28/07, Jeremy Hinegardner <[EMAIL PROTECTED]> wrote:
> On Tue, Aug 28, 2007 at 03:13:47PM +, [EMAIL PROTECTED] wrote:
> > In reference to
> >
> >http://www.sqlite.org/cvstrac/tktview?tn=2592
> >
> > This is the first public indication we have had that
> > Skype is using SQLite in their windows clients.  However,
> > the person who wrote the ticket seems to be a bit confused.
> > Can any able hackers in the SQLite community confirm that
> > the Skype windows client is using SQLite?  It would be
> > nice to add them to the page of high-profile users.
>
> I can confirm that there is a sqlite db in my Skype on Mac OSX
>
> In the file $HOME/Library/Application\ 
> Support/Skype//dyncontent/bundle.dat

Also confirmed on Windows.  It appears to contain downloaded UI data
-- icons, tips, promotions, etc.  It's notable that the contact list,
chat history etc are using something other than SQLite.

Hard to tell if what's in that ticket is actually from Skype or not,
but at least they're using SQLite for some things.

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] compiling 3.4.2 on solaris

2007-08-28 Thread rahed
Hello,

when running make I get:

sed -e s/--VERS--/3.4.2/ ../sqlite/src/sqlite.h.in | \
sed -e s/--VERSION-NUMBER--/3004002/ >sqlite3.h
gcc -g -O2 -o lemon ../sqlite/tool/lemon.c
../sqlite/tool/lemon.c:111: error: redeclaration of enumerator `B_FALSE'
/usr/include/sys/types.h:176: error: previous definition of 'B_FALSE' was here
../sqlite/tool/lemon.c:111: error: redeclaration of enumerator `B_TRUE'
/usr/include/sys/types.h:176: error: previous definition of 'B_TRUE' was here
*** Error code 1
make: Fatal error: Command failed for target `lemon'

Could somenone suggest what's wrong?

Thanks.

-- 
Radek

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] Skype client using SQLite?

2007-08-28 Thread Mike Marshall
The same file appears on the windows version

-Original Message-
From: Jeremy Hinegardner [mailto:[EMAIL PROTECTED] 
Sent: 28 August 2007 17:05
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Skype client using SQLite?

On Tue, Aug 28, 2007 at 03:13:47PM +, [EMAIL PROTECTED] wrote:
> In reference to
> 
>http://www.sqlite.org/cvstrac/tktview?tn=2592
> 
> This is the first public indication we have had that
> Skype is using SQLite in their windows clients.  However,
> the person who wrote the ticket seems to be a bit confused.
> Can any able hackers in the SQLite community confirm that
> the Skype windows client is using SQLite?  It would be
> nice to add them to the page of high-profile users.

I can confirm that there is a sqlite db in my Skype on Mac OSX

In the file $HOME/Library/Application\
Support/Skype//dyncontent/bundle.dat

% echo .schema | sqlite3 bundle.dat 
CREATE TABLE bupdate (uri text, type text, meta text, prio integer,id
integer, body blob, terms blob);
CREATE TABLE events (id intenger, event integer, event_time integer);
CREATE TABLE install (uri text, type text, meta text, prio integer,id
integer, body blob, terms blob);
CREATE TABLE itemkeys (id integer, keys text);
CREATE TABLE reported (id integer, exposed_cnt integer, exposed_time
integer, exec_cnt integer, close_cnt integer);
CREATE TABLE stats (id integer, exposed_cnt integer,exposed_time integer,
exec_cnt integer, close_cnt integer,last_expose_start integer, exposing_now
integer);
CREATE INDEX bupdate_id on bupdate (id);
CREATE INDEX bupdate_uri on bupdate (uri);
CREATE INDEX events_id on events (id);
CREATE INDEX install_id on install (id);
CREATE INDEX install_uri on install (uri);
CREATE INDEX itemkeys_id on itemkeys (id);
CREATE INDEX reported_id on reported(id);
CREATE INDEX stats_id on stats (id);

% od -c -N 16 bundle.dat 
000S   Q   L   i   t   e   f   o   r   m   a   t   3  \0

Although in mycase, all the tables are empty.

enjoy,

-jeremy


-- 

 Jeremy Hinegardner  [EMAIL PROTECTED] 



-
To unsubscribe, send email to [EMAIL PROTECTED]

-



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] In memory database question

2007-08-28 Thread Virgilio Alexandre Fornazin
I'm thinking in a more generic way... using /dev/shm works on linux, but not
on windows.
Also, r/w support is a must have, so this approach cannot solve the problem.
Since we have 'drivers' for windows / linux / etc, a 'memory' driver would
be enought,
simulating file opening / closing / deleting, creating the possibility of
managing 
various in-memory databases at same time usable by the other threads of the
process.

There´s some planning to support a thing like this? It´s a bit crazy but a
lot interesting.


-Original Message-
From: RaghavendraK 70574 [mailto:[EMAIL PROTECTED] 
Sent: terça-feira, 28 de agosto de 2007 12:56
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] In memory database question


Hi,

I did tried something crazy like this (it worked, for read only DB only).
I changed pread to preadCustom api.Then in preadCustom maintained a static
fdArray. if fd is not listed then i mmap the whole file and the use the
memcpy to return the data. There was significant performance again as there
was no context switch.
U can overload all the os wrappers to your custom impl and then share it
with multiple threads.

I had to do this as even mounting the file on /dev/shm there was no
significant performance gain.

Just a possible direction,

regards
ragha


**
 This email and its attachments contain confidential information from
HUAWEI, which is intended only for the person or entity whose address is
listed above. Any use of the information contained herein in any way
(including, but not limited to, total or partial disclosure, reproduction,
or dissemination) by persons other than the intended recipient(s) is
prohibited. If you receive this e-mail in error, please notify the sender by
phone or email immediately and delete it!
 

*

- Original Message -
From: Virgilio Alexandre Fornazin <[EMAIL PROTECTED]>
Date: Tuesday, August 28, 2007 8:42 pm
Subject: [sqlite] In memory database question

> Hi
> 
> 
> 
> There´s possible to share a sqlite3 handle to a memory database in all
> threads of application?
> 
> Or there´s a way to ?duplicate? the handle (sqlite_open() or 
> something like
> that)?
> 
> 
> 
> 
> 
> 


-
To unsubscribe, send email to [EMAIL PROTECTED]

-


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Skype client using SQLite?

2007-08-28 Thread Jeremy Hinegardner
On Tue, Aug 28, 2007 at 03:13:47PM +, [EMAIL PROTECTED] wrote:
> In reference to
> 
>http://www.sqlite.org/cvstrac/tktview?tn=2592
> 
> This is the first public indication we have had that
> Skype is using SQLite in their windows clients.  However,
> the person who wrote the ticket seems to be a bit confused.
> Can any able hackers in the SQLite community confirm that
> the Skype windows client is using SQLite?  It would be
> nice to add them to the page of high-profile users.

I can confirm that there is a sqlite db in my Skype on Mac OSX

In the file $HOME/Library/Application\ 
Support/Skype//dyncontent/bundle.dat

% echo .schema | sqlite3 bundle.dat 
CREATE TABLE bupdate (uri text, type text, meta text, prio integer,id integer, 
body blob, terms blob);
CREATE TABLE events (id intenger, event integer, event_time integer);
CREATE TABLE install (uri text, type text, meta text, prio integer,id integer, 
body blob, terms blob);
CREATE TABLE itemkeys (id integer, keys text);
CREATE TABLE reported (id integer, exposed_cnt integer, exposed_time integer, 
exec_cnt integer, close_cnt integer);
CREATE TABLE stats (id integer, exposed_cnt integer,exposed_time integer, 
exec_cnt integer, close_cnt integer,last_expose_start integer, exposing_now 
integer);
CREATE INDEX bupdate_id on bupdate (id);
CREATE INDEX bupdate_uri on bupdate (uri);
CREATE INDEX events_id on events (id);
CREATE INDEX install_id on install (id);
CREATE INDEX install_uri on install (uri);
CREATE INDEX itemkeys_id on itemkeys (id);
CREATE INDEX reported_id on reported(id);
CREATE INDEX stats_id on stats (id);

% od -c -N 16 bundle.dat 
000S   Q   L   i   t   e   f   o   r   m   a   t   3  \0

Although in mycase, all the tables are empty.

enjoy,

-jeremy


-- 

 Jeremy Hinegardner  [EMAIL PROTECTED] 


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] In memory database question

2007-08-28 Thread RaghavendraK 70574

Hi,

I did tried something crazy like this (it worked, for read only DB only).
I changed pread to preadCustom api.Then in preadCustom maintained a static 
fdArray. if fd is not listed then i mmap the whole file and the use the memcpy 
to return the data. There was significant performance again as there was no 
context switch.
U can overload all the os wrappers to your custom impl and then share it with 
multiple threads.

I had to do this as even mounting the file on /dev/shm there was no significant 
performance gain.

Just a possible direction,

regards
ragha

**
 This email and its attachments contain confidential information from HUAWEI, 
which is intended only for the person or entity whose address is listed above. 
Any use of the information contained herein in any way (including, but not 
limited to, total or partial disclosure, reproduction, or dissemination) by 
persons other than the intended recipient(s) is prohibited. If you receive this 
e-mail in error, please notify the sender by phone or email immediately and 
delete it!
 
*

- Original Message -
From: Virgilio Alexandre Fornazin <[EMAIL PROTECTED]>
Date: Tuesday, August 28, 2007 8:42 pm
Subject: [sqlite] In memory database question

> Hi
> 
> 
> 
> There´s possible to share a sqlite3 handle to a memory database in all
> threads of application?
> 
> Or there´s a way to ?duplicate? the handle (sqlite_open() or 
> something like
> that)?
> 
> 
> 
> 
> 
>

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Towards SQLite version 3.5.0

2007-08-28 Thread drh
Dennis Cote <[EMAIL PROTECTED]> wrote:
> 
> I wonder if it might not be better to change this API to accept an empty 
> string, in addition to a NULL pointer, to find the default VFS. It seems 
> to me this might make life easier for those writing wrappers in 
> languages that don't have a concept of a NULL pointer.
> 

I'll meet you half way.  I have changed the sqlite3_vfs_register()
documentation to make the behavior undefined if you try to
register a VFS with a name that an empty string.

This way, you can be certain that no valid VFS has an empty
string as its name.  And your wrapper can map empty string
into NULL.

--
D. Richard Hipp <[EMAIL PROTECTED]>


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] In memory database question

2007-08-28 Thread Virgilio Alexandre Fornazin
Hi

 

There´s possible to share a sqlite3 handle to a memory database in all
threads of application?

Or there´s a way to ‘duplicate’ the handle (sqlite_open() or something like
that)?

 

 



Re: [sqlite] Towards SQLite version 3.5.0

2007-08-28 Thread Joe Wilson
--- Dennis Cote <[EMAIL PROTECTED]> wrote:
> > sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName);
> >
> >
> > The argument is the symbolic name for the desired VFS. If the argument 
> > is a NULL pointer, then the default VFS is returned. The function 
> > returns a pointer to the *sqlite3_vfs* object that implements the VFS. 
> > Or it returns a NULL pointer if no object could be found that matched 
> > the search criteria.
> >
> >
> 
> I wonder if it might not be better to change this API to accept an empty 
> string, in addition to a NULL pointer, to find the default VFS. It seems 
> to me this might make life easier for those writing wrappers in 
> languages that don't have a concept of a NULL pointer.

That's an issue for the wrapper language binding, not the language itself.
The wrapper language binding can call a null pointer whatever it wants.


   

Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, 
photos & more. 
http://mobile.yahoo.com/go?refer=1GNXIC

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Towards SQLite version 3.5.0

2007-08-28 Thread Marco Bambini

On Aug 28, 2007, at 4:51 PM, Dennis Cote wrote:

I wonder if it might not be better to change this API to accept an  
empty string, in addition to a NULL pointer, to find the default  
VFS. It seems to me this might make life easier for those writing  
wrappers in languages that don't have a concept of a NULL pointer.


Dennis Cote



Just pass 0 in that case.

---
Marco Bambini
http://www.sqlabs.net
http://www.sqlabs.net/blog/
http://www.sqlabs.net/realsqlserver/

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Towards SQLite version 3.5.0

2007-08-28 Thread Klemens Friedl
The "sqlite3_exec" function has resided in the "legacy.c" file since
shift to version 3. The function is still around in current v3.5 draft
as http://www.sqlite.org/capi350ref.html says.

That function is still kept around for compatibility reasons, as it
was a important function in SQLite v2 days.
On the other side it is quite handy to execute e.g. "create", and
generally for queries that modify the database and don't return data.

Will it stay around for the whole life-span of version 3? Currently, I
prefer to avoid "sqlite3_exec" function, as it's in the "legacy.c"
file and I am unsure about its future.

The official SQLite 3 API documentation says nothing about the legacy
status of the "sqlite3_exec" function:
http://www.sqlite.org/capi3ref.html#sqlite3_exec
... nor any info in the source code, and I haven't found any
information about it beside a short footnote in "The Definitive Guide
to SQLite" book and the "legacy.c" filename in the source code.

My propose, either move function out of legacy file or add some legacy
information text to API documentation (or at least to the source code)
and about its planned life span.




About mutex usage, the following page
http://www.sqlite.org/34to35.html mentions :
"[...] The SQLite source code provides multiple implementations of
these APIs, suitable for varying environments. [...]"
"[...] Embedded applications may wish to provide their own mutex
implementation. [...]"

For Unix, the POSIX Pthreads specification supports mutexes. The four
basic functions are as follows:
* pthread_mutex_init
* pthread_mutex_destory
* ptrhead_mutex_lock
* pthread_mutex_unlock

In Win32 world, the same can be solved by using Win32 Mutex functions
or CRITICAL_SECTIONS (beside others):
* CreateMutex
* ReleaseMutex
* OpenMutex

SQLite 3 already use Win32 Mutex for WinCE (file) locking ("os_win.c"
file). Most of that code could be reused for WinNT Win32 API (with the
help of some macros, because of the "wince" part of the WinAPI
function names).

Will SQLite 3.5 use operating system related mutex API or does it ship
with its own mutex implemented functions (I have seen some related
code, but haven't investigated further)?

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] sqlite db portability

2007-08-28 Thread Uma Krishnan
Just FYI, ODBC specs is very similar to JDBC, except that ODBC is in C whereas 
JDBC is in java. 

Thanks

Uma

Markus Hoenicka <[EMAIL PROTECTED]> wrote: Quoting Uma Krishnan :

> Hello Markus,
>
> How is libdbi different from, say odbc?
>

I've never used ODBC, but from what I read I'd say the main  
differences are the footprint and the scope. libdbi is  
language-specific (C), lightweight, and allows you to do simple things  
in a simple fashion. However, you're still required to handle database  
engine specific stuff in your code to use more advanced SQL features.  
ODBC seems to encapsulate all and everything, at the price of being  
huge.

regards,
Markus

-- 
Markus Hoenicka
[EMAIL PROTECTED]
(Spam-protected email: replace the quadrupeds with "mhoenicka")
http://www.mhoenicka.de


-
To unsubscribe, send email to [EMAIL PROTECTED]
-




Re: [sqlite] Towards SQLite version 3.5.0

2007-08-28 Thread Dennis Cote

[EMAIL PROTECTED] wrote:

The transition from 3.4.2 to 3.5.0 will perhaps be the
largest single change to SQLite since 2.8->3.0.  
  
I have *started* to prepare documentation describing

the changes in 3.5.0.  This is draft documentation.
But for those who are interested, please visit

   http://www.sqlite.org/34to35.html
   http://www.sqlite.org/capi350ref.html



  

Richard,

The API function sqlite3_vfs_find() is documented as:

The *sqlite3_vfs_find()* API is used to locate a particular VFS by 
name. Its prototype is as follows:


sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName);


The argument is the symbolic name for the desired VFS. If the argument 
is a NULL pointer, then the default VFS is returned. The function 
returns a pointer to the *sqlite3_vfs* object that implements the VFS. 
Or it returns a NULL pointer if no object could be found that matched 
the search criteria.





I wonder if it might not be better to change this API to accept an empty 
string, in addition to a NULL pointer, to find the default VFS. It seems 
to me this might make life easier for those writing wrappers in 
languages that don't have a concept of a NULL pointer.


Dennis Cote

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Towards SQLite version 3.5.0

2007-08-28 Thread Joe Wilson
--- [EMAIL PROTECTED] wrote:
> Joe Wilson <[EMAIL PROTECTED]> wrote:
> > --- [EMAIL PROTECTED] wrote:
> > > The transition from 3.4.2 to 3.5.0 will perhaps be the
> > 
> > > The SQLite code currently in CVS HEAD is not ready for
> > > production use.  We know that.  We know what many of the
> > > problems are and Dan and I are working long hours to fix
> > > them.  It's the problems that we *do not* know about that
> > > are scary.  So that is why I am inviting the larger
> > > community to have an early look and perhaps bring our
> > > attention to issues sooner rather than later.
> > 
> > Just to clarify, you don't want to see "make test" failure
> > tickets at this time?
> 
> Correct.  I can figure out for myself when "make test"
> fails.  Those failures are examples of things I know about.
> I'm much more interested in errors that I don't know about.

http://en.wikipedia.org/wiki/Unknown_unknown


   

Choose the right car based on your needs.  Check out Yahoo! Autos new Car 
Finder tool.
http://autos.yahoo.com/carfinder/

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] sqlite db portability

2007-08-28 Thread John Stanton

Markus Hoenicka wrote:

Quoting Uma Krishnan <[EMAIL PROTECTED]>:


Hello Markus,

How is libdbi different from, say odbc?



I've never used ODBC, but from what I read I'd say the main  differences 
are the footprint and the scope. libdbi is  language-specific (C), 
lightweight, and allows you to do simple things  in a simple fashion. 
However, you're still required to handle database  engine specific stuff 
in your code to use more advanced SQL features.  ODBC seems to 
encapsulate all and everything, at the price of being  huge.


regards,
Markus

ODBC is a proprietary name for the ANSI Standard SQL/CLI, the computer 
language interface to SQL.  Other computer language interfaces to SQL 
databases are less cumbersome having not been designed by a standards 
committee.


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Towards SQLite version 3.5.0

2007-08-28 Thread drh
Joe Wilson <[EMAIL PROTECTED]> wrote:
> --- [EMAIL PROTECTED] wrote:
> > The transition from 3.4.2 to 3.5.0 will perhaps be the
> 
> > The SQLite code currently in CVS HEAD is not ready for
> > production use.  We know that.  We know what many of the
> > problems are and Dan and I are working long hours to fix
> > them.  It's the problems that we *do not* know about that
> > are scary.  So that is why I am inviting the larger
> > community to have an early look and perhaps bring our
> > attention to issues sooner rather than later.
> 
> Just to clarify, you don't want to see "make test" failure
> tickets at this time?
> 

Correct.  I can figure out for myself when "make test"
fails.  Those failures are examples of things I know about.
I'm much more interested in errors that I don't know about.

--
D. Richard Hipp <[EMAIL PROTECTED]>


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] Unique ids for each record

2007-08-28 Thread Sreedhar.a
Hi,

First my thanks to everyone for the response.
Sorry for the delay in replying I was on leave.
I am working on client server database method.

I am going to manage a large amount of data. Somewhere around 4 records.
Is it possible for me to fix the id range for each and every column.

So that I can do the search fast.

Best Regards,
Sreedhar.


-Original Message-
From: Dwight Ingersoll [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 21, 2007 11:43 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Unique ids for each record

On 8/20/07, Sreedhar.a <[EMAIL PROTECTED]> wrote:

<>

>
> I want to restrict the Artist range to 100 to 199 so that with the id 
> I can make my search fast and also I knew with unique id that I need 
> to search for the Artist alone.


<>

Considering the small range of data it appears you want to deal with, SQLite
should be more than capable of quickly returning the results you desire,
especially since it appears that you're using a numeric field as primary
keys.

It would be helpful to understand why you chose this approach, and the
source of your data.  The reason I'm asking is because the project I'm
currently working on is an offline viewer which utilizes the data available
from the FreeDB Organization.



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] sqlite db portability

2007-08-28 Thread Markus Hoenicka

Quoting Uma Krishnan <[EMAIL PROTECTED]>:


Hello Markus,

How is libdbi different from, say odbc?



I've never used ODBC, but from what I read I'd say the main  
differences are the footprint and the scope. libdbi is  
language-specific (C), lightweight, and allows you to do simple things  
in a simple fashion. However, you're still required to handle database  
engine specific stuff in your code to use more advanced SQL features.  
ODBC seems to encapsulate all and everything, at the price of being  
huge.


regards,
Markus

--
Markus Hoenicka
[EMAIL PROTECTED]
(Spam-protected email: replace the quadrupeds with "mhoenicka")
http://www.mhoenicka.de


-
To unsubscribe, send email to [EMAIL PROTECTED]
-