Re: [sqlite] multiple writers for in-memory datastore

2008-04-19 Thread James Gregurich

for those who may be interested:

I ran a test with SQLite version: 3.5.8


I tried the scheme described earlier with each thread sharing a  
connection but writing into its own attached in-memory db on that  
connection.   Didn't work. all but the first writer thread failed with  
a SQLITE_ERROR

oh well.

I think I will go with CoreData on MacOSX and figure out something  
else to do on Windows later.


my thanks to all who attempted to provide a solution.


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


Re: [sqlite] cidr data type

2008-04-19 Thread John Stanton
What stops you from building in the 128 bit address logic?

Christof Meerwald wrote:
> On Fri, 18 Apr 2008 15:59:14 -0600, Dennis Cote wrote:
> 
>>Christof Meerwald wrote:
>>
>>>Currently, I am thinking of storing start and end IP addresses as a blob in
>>>the database - that way I would be able to use the "between" operator in
>>>selects, e.g.
>>>  select X'c0a81234' between X'c0a8' and X'c0a8';
> 
> [...]
> 
>>I would store the IP addresses, network addresses, and subnet width as 
>>integers. Then create a few custom function to manipulate them.
> 
> 
> Ok, that would work for IPv4 addresses, but if I ever wanted to use IPv6
> addresses, then I would have to go back to using blobs - as integers are
> limited to 64 bits in SQLite.
> 
> 
> Christof
> 

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


Re: [sqlite] a suggestion to write tutorial for sqlite

2008-04-19 Thread Fred J. Stephens
I think one of the most lacking aspects of the documentation are 
examples. Perhaps this is better addressed in the proposed tutorial, but 
not all the "SQL Syntax" pages make it clear how to use the statement, 
especially the more complex ones like SELECT, and expressions.
The datetime use is also not always easy to grasp (as witnessed by 
questions on this list).
So, I think a tutorial is a great idea!
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] a suggestion to write tutorial for sqlite

2008-04-19 Thread Robert L Cochran

D. Richard Hipp wrote:
> On Apr 19, 2008, at 5:44 PM, Jay A. Kreibich wrote:
>   
>>  This is a bit off-topic for the mailing list, so please feel free
>>  to send stuff directly to the address below.
>>
>> 
>
> It would be good, I think, to have a public record of this
> conversation.  We can create an [EMAIL PROTECTED]
> mailing list if you think it would help.
>
> D. Richard Hipp
> [EMAIL PROTECTED]
>
>   
I agree with DRH. I too would like to see a public record so that
everyone can contribute and discuss. I see great value in a tutorial not
just for myself (I'm no great database expert...yet!), but also for
other members of my project team at my place of employment, and the
students I try to introduce databases to.

Also...I just recieved an Amazon Kindle reader. I am still learning how
to use it but I'd like the page design of any tutorial to take in mind
someone like me might pop it on an e-book reader like the Kindle. So
far, Amazon seems to be having trouble converting pdf documents to
Kindle format. The conversion process "mixes up" text on a short sample
PDF document I'm testing with. It could be due to the way the PDF is
designed (the author may have made mistakes during the conversion to PDF
which got amplified by my subsequent conversion to Amazon Kindle
format). Any errors that can be traced to Amazon's conversion software
will probably get fixed fast, especially if the company open sources it.
But anyhow folks, let's keep in mind that a tutorial should have a page
design that is e-book friendly.

Thanks

Bob Cochran
Greenbelt, Maryland, USA


>
> ___
> 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] a suggestion to write tutorial for sqlite

2008-04-19 Thread ajm
Why not include a section "User Contributed Notes" (in the style of the php 
doc) besides each page of the SQLite man pages?
specially those devoted to:

 1. List Of Objects
 2. List Of Constants
 3. List Of Functions

HTH 

Adolfo.

-Original Message-
From: D. Richard Hipp [mailto:[EMAIL PROTECTED]
Sent: Saturday, April 19, 2008 05:47 PM
To: [EMAIL PROTECTED], 'General Discussion of SQLite Database'
Subject: Re: [sqlite] a suggestion to write tutorial for sqlite

On Apr 19, 2008, at 5:44 PM,
Jay A. Kreibich wrote:
 >> This is a bit off-topic for the mailing list, so please feel free
> to send stuff directly to the address below.
>It would be good, I think, to have a public record of thisconversation.
 We can create an [EMAIL PROTECTED] list if you think it would help.
D. Richard [EMAIL PROTECTED]


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


Re: [sqlite] multiple writers for in-memory datastore

2008-04-19 Thread James Gregurich

ok. I think I see what you are suggesting. You want to provide a  
mechanism to create memory files that SQLite thinks are disk  
filesthat way you could create multiple connections to them.

an interesting idea. However, that may be more effort that I can  
justify at this point. I'll think about it.


yes. I am fluent in STL.


On Apr 19, 2008, at 1:19 PM, Virgilio Alexandre Fornazin wrote:

> Imagine the following cenario (I assume you know c++ stdlib)
>
> A map of strings (filenames) to in-memory file handlers (the objects  
> that
> will handle the shared memory or heap files).
>
> These files handlers will exists until the process exists and do not  
> receive
> a delelefile() vfs call.
>
> File handlers can synchronize RW-Locks using internal mutex/criticat
> sections/semaphores/spin locks, etc.
>
> When you create a new file in vfs, a new handler is created and  
> assigned to
> that filename and registered in this map.
>
>
>
>
>
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of James Gregurich
> Sent: sábado, 19 de abril de 2008 17:02
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] multiple writers for in-memory datastore
>
>
> I don't immediately see how that would solve the problem.
>
> The limitation of interest here (based on my perhaps limited
> understanding) is that locking has file-level granularity. I don't
> immediately see how a VST implementation would allow for changing the
> locking granularity of the overall system.
>
> -James
>
> On Apr 19, 2008, at 12:03 PM, Virgilio Fornazin wrote:
>
>> what about creating a VFS for such task ? Can be accomplished in
>> many ways,
>> using heap memory, shared memory... not so easy to do, but not much
>> complicated too... locking can be provided by multiple-readers
>> single-writers locks strategies, etc...
>>
>> On Sat, Apr 19, 2008 at 2:29 PM, James Gregurich  
>> <[EMAIL PROTECTED]>
>> wrote:
>>
>>>
>>> oh good! That isn't the version that ships with Leopard, but I can
>>> live with deploying my own version as part of my app.
>>>
>>> Will l get the writer parallelism I'm after as long as each thread
>>> writes exclusively into its own attached db?
>>>
>>>
>>> in other wordstwo bulk insert operations going on simultaneously
>>> on the same connection but each insert operation going into a
>>> different attached in-memory db.
>>>
>>>
>>> On Apr 19, 2008, at 9:20 AM, Dan wrote:
>>>

 On Apr 19, 2008, at 6:06 AM, James Gregurich wrote:

>
> I'll ask this question. The answer is probably "no," but I'll ask
> it
> for the sake of completeness.
>
>
> Suppose I created an in-memory db. I use the attach command to
> associate an additional in-memory db. Suppose I assign the main
> db to
> thread 1 and the associated db to thread 2. Can I share the
> connection
> across the 2 threads if each thread works exclusively in its own
> db?
>
> I am aware that the connection is generally not threadsafe, but
> will
> it work if the two threads don't operate on the same db at the  
> same
> time?

 As of 3.5, sqlite connections are threadsafe by default. With
 earlier versions, this trick will not work.

 Dan.


 ___
 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-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] a suggestion to write tutorial for sqlite

2008-04-19 Thread Ken
A few things that confused me in my (still ongoing) learning.
   
  1. Bindings, in that the bind needed to be perfomed each and every time.
  2. Transactions, the begin vs begin immediate. Coming from a database 
background I assumed the begin started the transaction but did not...
  3. Locking, SQLITE_BUSY waiting.
  4. Page size pragma having  to use this prior to creating a table for it to 
be effective.
  5. Prepare/bind/step/finalize/reset and when to use in success/error 
conditions.
  6. Thread safety and threaded access. But this has been vastly improved in 
3.5.x series!
  7. Shared cache, appropriate uses?
   
  Just a start and my .02
   
  Thanks,
  Ken
  
"Jay A. Kreibich" <[EMAIL PROTECTED]> wrote:
  
On Sat, Apr 19, 2008 at 05:40:45PM +0100, Toby Roworth scratched on the wall:
> mikeobe wrote:
> > i found it boring to learn how to use sqlite, maybe we can write a
> > tutorial for it, with examples, it will be much easier for the
> > beginner to start with sqlite.
>
> Agreed - I had to learn from the 5 minute introduction (which I was 
> later told was a poor way of doing it), and then by using the reference, 
> which leaves a lot to be desired when it comes to having little 
> knowledge of SQLite - and it's still giving me trouble now!

What are we looking for? A 60 minute introduction?

Any thoughts on specific topics, or is the main thing just
covering the basics of the API in vanilla situations?

I have a great deal of interest in this area, and would love to hear
from anyone that has thoughts, ideas, or comments. I would
especially like to hear if there is a specific area or concept that
confused folks when they were learning SQLite.

SQLite tends to get used by a lot of people that have a stronger
background in software development than in databases, so I would
expect there to be some confusion about "database things" like table
design and complex query commands. Solid introductory materials need
to take that into account, but we need to gather some more
information on precisely what that difference means.


This is a bit off-topic for the mailing list, so please feel free
to send stuff directly to the address below.

-j


-- 
Jay A. Kreibich < J A Y @ K R E I B I.C H >

"'People who live in bamboo houses should not throw pandas.' Jesus said that."
- "The Ninja", www.AskANinja.com, "Special Delivery 10: Pop!Tech 2006"
___
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] a suggestion to write tutorial for sqlite

2008-04-19 Thread D. Richard Hipp

On Apr 19, 2008, at 5:44 PM, Jay A. Kreibich wrote:
>
>  This is a bit off-topic for the mailing list, so please feel free
>  to send stuff directly to the address below.
>

It would be good, I think, to have a public record of this
conversation.  We can create an [EMAIL PROTECTED]
mailing list if you think it would help.

D. Richard Hipp
[EMAIL PROTECTED]



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


Re: [sqlite] a suggestion to write tutorial for sqlite

2008-04-19 Thread Jay A. Kreibich

On Sat, Apr 19, 2008 at 05:40:45PM +0100, Toby Roworth scratched on the wall:
> mikeobe wrote:
> > i found it boring to learn how to use sqlite, maybe we can write a
> > tutorial for it, with examples, it will be much easier for the
> > beginner to start with sqlite.
>
> Agreed - I had to learn from the 5 minute introduction (which I was 
> later told was a poor way of doing it), and then by using the reference, 
> which leaves a lot to be desired when it comes to having little 
> knowledge of SQLite - and it's still giving me trouble now!

  What are we looking for?  A 60 minute introduction?

  Any thoughts on specific topics, or is the main thing just
  covering the basics of the API in vanilla situations?

  I have a great deal of interest in this area, and would love to hear
  from anyone that has thoughts, ideas, or comments.  I would
  especially like to hear if there is a specific area or concept that
  confused folks when they were learning SQLite.

  SQLite tends to get used by a lot of people that have a stronger
  background in software development than in databases, so I would
  expect there to be some confusion about "database things" like table
  design and complex query commands.  Solid introductory materials need
  to take that into account, but we need to gather some more
  information on precisely what that difference means.


  This is a bit off-topic for the mailing list, so please feel free
  to send stuff directly to the address below.

   -j


-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"'People who live in bamboo houses should not throw pandas.' Jesus said that."
   - "The Ninja", www.AskANinja.com, "Special Delivery 10: Pop!Tech 2006"
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] multiple writers for in-memory datastore

2008-04-19 Thread Virgilio Alexandre Fornazin
Imagine the following cenario (I assume you know c++ stdlib)

A map of strings (filenames) to in-memory file handlers (the objects that
will handle the shared memory or heap files).

These files handlers will exists until the process exists and do not receive
a delelefile() vfs call.

File handlers can synchronize RW-Locks using internal mutex/criticat
sections/semaphores/spin locks, etc.

When you create a new file in vfs, a new handler is created and assigned to
that filename and registered in this map.






-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of James Gregurich
Sent: sábado, 19 de abril de 2008 17:02
To: General Discussion of SQLite Database
Subject: Re: [sqlite] multiple writers for in-memory datastore


I don't immediately see how that would solve the problem.

The limitation of interest here (based on my perhaps limited  
understanding) is that locking has file-level granularity. I don't  
immediately see how a VST implementation would allow for changing the  
locking granularity of the overall system.

-James

On Apr 19, 2008, at 12:03 PM, Virgilio Fornazin wrote:

> what about creating a VFS for such task ? Can be accomplished in  
> many ways,
> using heap memory, shared memory... not so easy to do, but not much
> complicated too... locking can be provided by multiple-readers
> single-writers locks strategies, etc...
>
> On Sat, Apr 19, 2008 at 2:29 PM, James Gregurich <[EMAIL PROTECTED]>
> wrote:
>
>>
>> oh good! That isn't the version that ships with Leopard, but I can
>> live with deploying my own version as part of my app.
>>
>> Will l get the writer parallelism I'm after as long as each thread
>> writes exclusively into its own attached db?
>>
>>
>> in other wordstwo bulk insert operations going on simultaneously
>> on the same connection but each insert operation going into a
>> different attached in-memory db.
>>
>>
>> On Apr 19, 2008, at 9:20 AM, Dan wrote:
>>
>>>
>>> On Apr 19, 2008, at 6:06 AM, James Gregurich wrote:
>>>

 I'll ask this question. The answer is probably "no," but I'll ask  
 it
 for the sake of completeness.


 Suppose I created an in-memory db. I use the attach command to
 associate an additional in-memory db. Suppose I assign the main  
 db to
 thread 1 and the associated db to thread 2. Can I share the
 connection
 across the 2 threads if each thread works exclusively in its own  
 db?

 I am aware that the connection is generally not threadsafe, but  
 will
 it work if the two threads don't operate on the same db at the same
 time?
>>>
>>> As of 3.5, sqlite connections are threadsafe by default. With
>>> earlier versions, this trick will not work.
>>>
>>> Dan.
>>>
>>>
>>> ___
>>> 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


Re: [sqlite] multiple writers for in-memory datastore

2008-04-19 Thread James Gregurich

I don't immediately see how that would solve the problem.

The limitation of interest here (based on my perhaps limited  
understanding) is that locking has file-level granularity. I don't  
immediately see how a VST implementation would allow for changing the  
locking granularity of the overall system.

-James

On Apr 19, 2008, at 12:03 PM, Virgilio Fornazin wrote:

> what about creating a VFS for such task ? Can be accomplished in  
> many ways,
> using heap memory, shared memory... not so easy to do, but not much
> complicated too... locking can be provided by multiple-readers
> single-writers locks strategies, etc...
>
> On Sat, Apr 19, 2008 at 2:29 PM, James Gregurich <[EMAIL PROTECTED]>
> wrote:
>
>>
>> oh good! That isn't the version that ships with Leopard, but I can
>> live with deploying my own version as part of my app.
>>
>> Will l get the writer parallelism I'm after as long as each thread
>> writes exclusively into its own attached db?
>>
>>
>> in other wordstwo bulk insert operations going on simultaneously
>> on the same connection but each insert operation going into a
>> different attached in-memory db.
>>
>>
>> On Apr 19, 2008, at 9:20 AM, Dan wrote:
>>
>>>
>>> On Apr 19, 2008, at 6:06 AM, James Gregurich wrote:
>>>

 I'll ask this question. The answer is probably "no," but I'll ask  
 it
 for the sake of completeness.


 Suppose I created an in-memory db. I use the attach command to
 associate an additional in-memory db. Suppose I assign the main  
 db to
 thread 1 and the associated db to thread 2. Can I share the
 connection
 across the 2 threads if each thread works exclusively in its own  
 db?

 I am aware that the connection is generally not threadsafe, but  
 will
 it work if the two threads don't operate on the same db at the same
 time?
>>>
>>> As of 3.5, sqlite connections are threadsafe by default. With
>>> earlier versions, this trick will not work.
>>>
>>> Dan.
>>>
>>>
>>> ___
>>> 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


Re: [sqlite] multiple writers for in-memory datastore

2008-04-19 Thread Virgilio Fornazin
what about creating a VFS for such task ? Can be accomplished in many ways,
using heap memory, shared memory... not so easy to do, but not much
complicated too... locking can be provided by multiple-readers
single-writers locks strategies, etc...

On Sat, Apr 19, 2008 at 2:29 PM, James Gregurich <[EMAIL PROTECTED]>
wrote:

>
> oh good! That isn't the version that ships with Leopard, but I can
> live with deploying my own version as part of my app.
>
> Will l get the writer parallelism I'm after as long as each thread
> writes exclusively into its own attached db?
>
>
> in other wordstwo bulk insert operations going on simultaneously
> on the same connection but each insert operation going into a
> different attached in-memory db.
>
>
> On Apr 19, 2008, at 9:20 AM, Dan wrote:
>
> >
> > On Apr 19, 2008, at 6:06 AM, James Gregurich wrote:
> >
> >>
> >> I'll ask this question. The answer is probably "no," but I'll ask it
> >> for the sake of completeness.
> >>
> >>
> >> Suppose I created an in-memory db. I use the attach command to
> >> associate an additional in-memory db. Suppose I assign the main db to
> >> thread 1 and the associated db to thread 2. Can I share the
> >> connection
> >> across the 2 threads if each thread works exclusively in its own db?
> >>
> >> I am aware that the connection is generally not threadsafe, but will
> >> it work if the two threads don't operate on the same db at the same
> >> time?
> >
> > As of 3.5, sqlite connections are threadsafe by default. With
> > earlier versions, this trick will not work.
> >
> > Dan.
> >
> >
> > ___
> > 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


Re: [sqlite] multiple writers for in-memory datastore

2008-04-19 Thread James Gregurich

oh good! That isn't the version that ships with Leopard, but I can  
live with deploying my own version as part of my app.

Will l get the writer parallelism I'm after as long as each thread  
writes exclusively into its own attached db?


in other wordstwo bulk insert operations going on simultaneously  
on the same connection but each insert operation going into a  
different attached in-memory db.


On Apr 19, 2008, at 9:20 AM, Dan wrote:

>
> On Apr 19, 2008, at 6:06 AM, James Gregurich wrote:
>
>>
>> I'll ask this question. The answer is probably "no," but I'll ask it
>> for the sake of completeness.
>>
>>
>> Suppose I created an in-memory db. I use the attach command to
>> associate an additional in-memory db. Suppose I assign the main db to
>> thread 1 and the associated db to thread 2. Can I share the  
>> connection
>> across the 2 threads if each thread works exclusively in its own db?
>>
>> I am aware that the connection is generally not threadsafe, but will
>> it work if the two threads don't operate on the same db at the same
>> time?
>
> As of 3.5, sqlite connections are threadsafe by default. With
> earlier versions, this trick will not work.
>
> Dan.
>
>
> ___
> 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] a suggestion to write tutorial for sqlite

2008-04-19 Thread Toby Roworth
Agreed - I had to learn from the 5 minute introduction (which I was 
later told was a poor way of doing it), and then by using the reference, 
which leaves a lot to be desired when it comes to having little 
knowledge of SQLite - and it's still giving me trouble now!

Toby

mikeobe wrote:
> i found it boring to learn how to use sqlite, maybe we can write a tutorial 
> for it, with examples, 
> it will be much easier for the beginner to start with sqlite.
>
> 2008-04-19 
> mikeobe 
>
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
>   

-- 

Sent by Toby Roworth ([EMAIL PROTECTED])
This message is intended for the named reciepients only, and should not 
be forwarded without permission
The conents of this message may be ©Toby Roworth


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


[sqlite] a suggestion to write tutorial for sqlite

2008-04-19 Thread mikeobe
i found it boring to learn how to use sqlite, maybe we can write a tutorial for 
it, with examples, 
it will be much easier for the beginner to start with sqlite.

2008-04-19 
mikeobe 


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


Re: [sqlite] multiple writers for in-memory datastore

2008-04-19 Thread Dan

On Apr 19, 2008, at 6:06 AM, James Gregurich wrote:

>
> I'll ask this question. The answer is probably "no," but I'll ask it
> for the sake of completeness.
>
>
> Suppose I created an in-memory db. I use the attach command to
> associate an additional in-memory db. Suppose I assign the main db to
> thread 1 and the associated db to thread 2. Can I share the connection
> across the 2 threads if each thread works exclusively in its own db?
>
> I am aware that the connection is generally not threadsafe, but will
> it work if the two threads don't operate on the same db at the same
> time?

As of 3.5, sqlite connections are threadsafe by default. With
earlier versions, this trick will not work.

Dan.


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


Re: [sqlite] cidr data type

2008-04-19 Thread Nicolas Williams
On Fri, Apr 18, 2008 at 08:59:17PM -0500, John Stanton wrote:
> Use a function and convert the IP address from dotted format to a 32 bit 
> unsigned integer.  You can AND and OR these to establish inclusion and 
> exclusion.

That doesn't get you the prefix length.  If you represent the
mask/prefix length as a separate value then you have to be careful when
sorting.  If you represent prefixes as bit strings then you lose that
problem, but without a way to cast them to integers you have to add
user-defined functions to do bit-wise operations on them -- or at least
functions to convert to/from integert (but that only works well for
IPv4).

BTW, this can be very useful when one stores data on networks and
aggregations, such as when building a model of routing, or a database of
network and aggregate allocations.  It then becomes important to be able
to determine whether one prefix is inside the other -- that's almost the
most important operation -- and to be able to query for prefixes that
fit inside another, ...

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


[sqlite] how to build sqlite under winxp?

2008-04-19 Thread mikeobe
NO make file found in that zip, downloaded from the official website...

2008-04-19 



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


Re: [sqlite] Question about using sqlite database located on shared folder

2008-04-19 Thread Eric Minbiole
> server machine actually per request from cient. Now if, for some reason, 
> connection with machine taht started writing table goes awol. That 
> client finished his job or is just dead but server still thinks 
> connection is needed and keeps file locked hence preventing any other 
> client to do reading/writing.

Though I haven't tested it, I would hope that the O/S would detect that 
the client disconnected, and would release any file lock(s) held.

Seems like it would be easy enough to test: On a couple of machines, 
start a couple of SQLite command shells to the shared Db.  On the first, 
start a BEGIN IMMEDIATE;, then yank the ethernet plug.  See if the OS 
eventually releases the lock, such that the second client can get access.

I'm sure others have more experience with this.  But it seems like it 
would be easy enough to test.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] fetching and updating

2008-04-19 Thread Igor Tandetnik
"Mike Johnston" <[EMAIL PROTECTED]>
wrote in message news:[EMAIL PROTECTED]
> I'm in a loop processing the result set using sqlite3_step. I need to
> insert/update the same sqlite database but a different table.  I
> can't get the write lock while I have this active statement I'm using
> sqlite3_step to move through.

With a recent enough SQLite version, you can run modification statements 
while a select statement is in progress. You have to do it on the same 
connection.

Igor Tandetnik



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


[sqlite] Question about using sqlite database located on shared folder

2008-04-19 Thread Darko Miletic
I received a task to investigate feasibility of using sqlite database 
located on a server in an internal windows network.

I know this is not most recommended scenario but I still have to do 
investigation.

Let us assume this case:

2 machines are accessing sqlite database located on a third machine in 
shared folder with full read/write permissions.

At some point in time both machines want to access database for writing 
some data in teh same table. One machine request comes first and table 
is locked. Therefore the other machine receives error, or goes to wait 
timeout period before trying again. Locking and releasing is done by 
server machine actually per request from cient. Now if, for some reason, 
connection with machine taht started writing table goes awol. That 
client finished his job or is just dead but server still thinks 
connection is needed and keeps file locked hence preventing any other 
client to do reading/writing.

Is there a way to detect this situation and what would be the remedy? 
Please do not respond me with use client/server database. This 
investigation is only related to sqlite usage.

Thanks in advance,
Darko Miletic
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] no VFS error

2008-04-19 Thread Toby Roworth
Thanks - that seems to have fixed it

D. Richard Hipp wrote:
> On Apr 19, 2008, at 9:19 AM, Toby Roworth wrote:
>   
>>> What value are you passing as the 4th argument to
>>> sqlite3_open_v2()?  (I assume you are using sqlite3_open_v2()
>>> since that seems the mostly likely way to get this error.)
>>>
>>>   
>> I'm passing a blank string - this would appear to be the problem!
>> errorCode = sqlite3_open_v2("data/texts.db", &dataBase,
>> SQLITE_OPEN_READONLY, "");
>>
>> 
>
> A null pointer (aka zero).  0.  Very different from an
> empty string.
>
> D. Richard Hipp
> [EMAIL PROTECTED]
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
>   

-- 

Sent by Toby Roworth ([EMAIL PROTECTED])
This message is intended for the named reciepients only, and should not 
be forwarded without permission
The conents of this message may be ©Toby Roworth


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


Re: [sqlite] no VFS error

2008-04-19 Thread D. Richard Hipp

On Apr 19, 2008, at 9:19 AM, Toby Roworth wrote:
>>
>> What value are you passing as the 4th argument to
>> sqlite3_open_v2()?  (I assume you are using sqlite3_open_v2()
>> since that seems the mostly likely way to get this error.)
>>
> I'm passing a blank string - this would appear to be the problem!
> errorCode = sqlite3_open_v2("data/texts.db", &dataBase,
> SQLITE_OPEN_READONLY, "");
>

A null pointer (aka zero).  0.  Very different from an
empty string.

D. Richard Hipp
[EMAIL PROTECTED]



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


Re: [sqlite] no VFS error

2008-04-19 Thread Toby Roworth
D. Richard Hipp wrote:
> On Apr 19, 2008, at 7:41 AM, Toby Roworth wrote:
>
>   
>> When attempting to open a database, I am getting a "no such vfs"  
>> error.
>>
>> What is likely to be causing this - a quick search suggested that vfs
>> may stand for virtual file system - is this right?
>>
>> Any help would be appreciated
>>
>> 
>
>
> What value are you passing as the 4th argument to
> sqlite3_open_v2()?  (I assume you are using sqlite3_open_v2()
> since that seems the mostly likely way to get this error.)
>   
I'm passing a blank string - this would appear to be the problem!
errorCode = sqlite3_open_v2("data/texts.db", &dataBase, 
SQLITE_OPEN_READONLY, "");

What shoudl I be passing (on a windows system)

Thanks
> D. Richard Hipp
> [EMAIL PROTECTED]
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
>   

-- 

Sent by Toby Roworth ([EMAIL PROTECTED])
This message is intended for the named reciepients only, and should not 
be forwarded without permission
The conents of this message may be ©Toby Roworth


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


Re: [sqlite] EXISTS operator doesn't seem to work

2008-04-19 Thread D. Richard Hipp

On Apr 19, 2008, at 7:06 AM, pinco palletto wrote:

> update register
> set note = (select ORT.note from old_register ORT
> where ORT.person_id = person_id and ORT.document_id = document_id)
> where exists (
> select ORT.* from old_register ORT
> where ORT.person_id = person_id and ORT.document_id = document_id);


update register
set note = (select ORT.note from old_register ORT
 where ORT.person_id = register.person_id
   and ORT.document_id = register.document_id)
  where exists (select ORT.* from old_register ORT
 where ORT.person_id = register.person_id
   and ORT.document_id = register. document_id);


D. Richard Hipp
[EMAIL PROTECTED]



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


Re: [sqlite] no VFS error

2008-04-19 Thread D. Richard Hipp

On Apr 19, 2008, at 7:41 AM, Toby Roworth wrote:

> When attempting to open a database, I am getting a "no such vfs"  
> error.
>
> What is likely to be causing this - a quick search suggested that vfs
> may stand for virtual file system - is this right?
>
> Any help would be appreciated
>


What value are you passing as the 4th argument to
sqlite3_open_v2()?  (I assume you are using sqlite3_open_v2()
since that seems the mostly likely way to get this error.)


D. Richard Hipp
[EMAIL PROTECTED]



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


[sqlite] no VFS error

2008-04-19 Thread Toby Roworth
When attempting to open a database, I am getting a "no such vfs" error.

What is likely to be causing this - a quick search suggested that vfs 
may stand for virtual file system - is this right?

Any help would be appreciated

Toby Roworth
-- 

Sent by Toby Roworth ([EMAIL PROTECTED])
This message is intended for the named reciepients only, and should not 
be forwarded without permission
The conents of this message may be ©Toby Roworth


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


[sqlite] EXISTS operator doesn't seem to work

2008-04-19 Thread pinco palletto
Hi everybody,
I have to update a 'note' field of a 'register' table with the values from the 
correspective entries of an 'old_register' table.
The 'old_register' table is shorter than 'register', I mean it has less 
records, but every primary key's value in 'old_register'
is also the value of one record of 'register'. In other words, if I just could 
succeed in the update, the resulting 'register' table's record set
would be a superset of the 'old_register' 's one. BTW in both tables the tuple 
(person_id, document_id) is the primary key.

Here's the query:

update register
set note = (select ORT.note from old_register ORT
where ORT.person_id = person_id and ORT.document_id = document_id)
where exists (
select ORT.* from old_register ORT
where ORT.person_id = person_id and ORT.document_id = document_id);

Well, it just keeps updating the 'note' field of ALL the records of 'register' 
with the 'note' field's value of the first record of 'old_register'.
Weird, isn't it? And most of all, the following query works, I mean it 
correctly returns the only records of 'register' which have a correspondant
record in 'old_register' whith the same values for the (primary) key 
(person_id, document_id)!

select RT.person_id, RT.document_id, RT.note
from register RT
where exists (
select ORT.* from old_register ORT
where ORT.person_id = RT.person_id and ORT.document_id = RT.document_id)

One might think that it is a problem of full qualification of the field names, 
but if you try to fully qualify the person_id and document_id
in the 'update' query, sqlite raises an error.

It drives me mad, please help!

Thanks,

C.

_
Racconta le tue emozioni sul blog!
http://home.services.spaces.live.com/
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] logging statements executed by the db

2008-04-19 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

P Kishor wrote:
> I have a rather opaque application that is calling my db. Is there
> something I can turn on in SQLite that will log all the statements
> executed against it?

If you are using Linux then you can use the ltrace program to trace
calls and their parameters.  You would want to track execution of
sqlite3_prepare.

  http://linux.die.net/man/1/ltrace

Roger

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFICc9vmOOfHg372QQRAiX6AKCxaMN8kzLVGmSYagQIcdrjeV544gCgtUhR
M51O8+VbS4RR43Ussb8a1UM=
=jiLg
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] cidr data type

2008-04-19 Thread Christof Meerwald
On Fri, 18 Apr 2008 15:59:14 -0600, Dennis Cote wrote:
> Christof Meerwald wrote:
>> Currently, I am thinking of storing start and end IP addresses as a blob in
>> the database - that way I would be able to use the "between" operator in
>> selects, e.g.
>>   select X'c0a81234' between X'c0a8' and X'c0a8';
[...]
> I would store the IP addresses, network addresses, and subnet width as 
> integers. Then create a few custom function to manipulate them.

Ok, that would work for IPv4 addresses, but if I ever wanted to use IPv6
addresses, then I would have to go back to using blobs - as integers are
limited to 64 bits in SQLite.


Christof

-- 

http://cmeerw.org  sip:cmeerw at cmeerw.org
mailto:cmeerw at cmeerw.org   xmpp:cmeerw at cmeerw.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users