[sqlite] SQL error: database is locked

2008-07-09 Thread Shain Lee
Hi

I am using sqlite in Fedora 9. Database created and done every thing perfectly. 
But when i going to test the DB via small transactions , inserting of records 
are failing.

SQL error: database is locked

DBD::SQLite::db commit failed: database is locked(5) at dbdimp.c line 218 at 
db_access.pl

what would be the reason , is it about a permission issue or coding issue ?
Please help

Many Thanks,
Shaine.


  __
Not happy with your email address?.
Get the one you really want - millions of new email addresses available now at 
Yahoo! http://uk.docs.yahoo.com/ymail/new.html
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] problem compiling loadable extensions usingVisualStudio

2008-07-09 Thread Teg
>>
>> The first one isn't decorated, the second one is.

IT> Have you actually tried it? Build a DLL with this code, check with 
IT> Dependency Walker. These two functions get exported under the following
IT> names:

IT> [EMAIL PROTECTED]
IT> ?PI_TestEx@@[EMAIL PROTECTED]

IT> The first name is decorated, the second is mangled (there's a difference
IT> between these two things, but it doesn't matter in this context where 
IT> all you want is to get an exported name exactly as it is in your code).

IT> Igor Tandetnik

I see your point. As someone else posted though, you can control this
with the declaration.

/*
** Make sure we can call this stuff from C++.
*/
#ifdef __cplusplus
extern "C" {
#endif

__declspec(dllexport) HANDLE _cdecl PI_Test(const char* pszFilename)
{
return(NULL);
}

#ifdef __cplusplus
}
#endif

__declspec(dllexport) HANDLE _cdecl PI_TestEx(const char* pszFilename)
{
return(NULL);
}

Results in:

  using "Dumpbin /exports" on the link library
  ?PI_TestEx@@[EMAIL PROTECTED] (void * __cdecl PI_TestEx(char const *))
  PI_Test


  using "Dumpbin /exports" on the dll
  
ordinal hint RVA  name
  40 1730 ?PI_TestEx@@[EMAIL PROTECTED] = 
@ILT+1835(?PI_TestEx@@[EMAIL PROTECTED])
 109 110E PI_Test = @ILT+265(PI_Test)




-- 
Best regards,
 Tegmailto:[EMAIL PROTECTED]

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


Re: [sqlite] problem compiling loadable extensions usingVisualStudio

2008-07-09 Thread Igor Tandetnik
Sherief N. Farouk <[EMAIL PROTECTED]>
wrote:
>> Have you actually tried it? Build a DLL with this code, check with
>> Dependency Walker. These two functions get exported under the
>> following names:
>>
>> [EMAIL PROTECTED]
>> ?PI_TestEx@@[EMAIL PROTECTED]
>>
>> The first name is decorated, the second is mangled (there's a
>> difference
>> between these two things, but it doesn't matter in this context where
>> all you want is to get an exported name exactly as it is in your
>> code).
>>
>> Igor Tandetnik
>>
>
> [Sherief N. Farouk]
>
> The decoration is due to the stdcall convention (APIENTRY). It's in
> the form _FunctionName@. If you don't want that,
> use cdecl.

Well, yes, except that when you build a DLL to somebody else's 
specification, you are not free to choose which calling convention to 
use - you have to use one that the caller expects. On Windows, more 
often than not that means stdcall.

Now, I don't actually know what calling convention SQLite expects a 
loadable extension to expose. If it's cdecl, then the OP should be all 
set with __declspec(dllexport).

Igor Tandetnik



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


Re: [sqlite] comments on db design

2008-07-09 Thread Steffen Scheer
Gerry Snyder wrote:
> steffen scheer wrote:
>> Hey all
>>
>> I want to use sqlite as a storage engine for DNA sequence data. It is 
>> part of a workflow engine for DNA processing. I was wondering whether i 
>> chose the right db design.
>>
>> The db holds information about DNA sequences. Arranged in three tables.
>> For every dna sequence one entry in all 3 tables will be made (1:1 
>> Relation). Data will be inserted once, never deleted, but some 
>> attributes get updated.
>>   
> To me, KISS (keep it simple, stupid) rules until its performance has 
> been shown to be unacceptable.
> 
> Surely you can create a dummy db file with nonsense data of typical size 
> all in a single table and see whether it meets your needs.
> 
> Keeping 2 or 3 tables in synch is not a difficult task, but it is a 
> potential source for error.

You are right. I merged seq_desc_static and seq_desc_var.
This was my initial design. In the majority of cases the first design
is the best. KISS rules


Steffen




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


Re: [sqlite] problem compiling loadable extensions usingVisualStudio

2008-07-09 Thread Sherief N. Farouk
> Have you actually tried it? Build a DLL with this code, check with
> Dependency Walker. These two functions get exported under the following
> names:
> 
> [EMAIL PROTECTED]
> ?PI_TestEx@@[EMAIL PROTECTED]
> 
> The first name is decorated, the second is mangled (there's a
> difference
> between these two things, but it doesn't matter in this context where
> all you want is to get an exported name exactly as it is in your code).
> 
> Igor Tandetnik
> 

[Sherief N. Farouk] 

The decoration is due to the stdcall convention (APIENTRY). It's in the form
_FunctionName@. If you don't want that, use cdecl.

- Sherief

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


Re: [sqlite] comments on db design

2008-07-09 Thread Gerry Snyder
steffen scheer wrote:
> Hey all
>
> I want to use sqlite as a storage engine for DNA sequence data. It is 
> part of a workflow engine for DNA processing. I was wondering whether i 
> chose the right db design.
>
> The db holds information about DNA sequences. Arranged in three tables.
> For every dna sequence one entry in all 3 tables will be made (1:1 
> Relation). Data will be inserted once, never deleted, but some 
> attributes get updated.
>   
To me, KISS (keep it simple, stupid) rules until its performance has 
been shown to be unacceptable.

Surely you can create a dummy db file with nonsense data of typical size 
all in a single table and see whether it meets your needs.

Keeping 2 or 3 tables in synch is not a difficult task, but it is a 
potential source for error.


HTH,

Gerry


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


Re: [sqlite] problem compiling loadable extensions usingVisualStudio

2008-07-09 Thread Igor Tandetnik
Teg <[EMAIL PROTECTED]> wrote:
> /*
> ** Make sure we can call this stuff from C++.
> */
> #ifdef __cplusplus
> extern "C" {
> #endif
>
> __declspec(dllexport) HANDLE APIENTRY PI_Test(const char* pszFilename)
> {
>return(NULL);
> }
>
> #ifdef __cplusplus
> }
> #endif
>
> __declspec(dllexport) HANDLE APIENTRY PI_TestEx(const char*
> pszFilename) {
>return(NULL);
> }
>
>
> The first one isn't decorated, the second one is.

Have you actually tried it? Build a DLL with this code, check with 
Dependency Walker. These two functions get exported under the following 
names:

[EMAIL PROTECTED]
?PI_TestEx@@[EMAIL PROTECTED]

The first name is decorated, the second is mangled (there's a difference 
between these two things, but it doesn't matter in this context where 
all you want is to get an exported name exactly as it is in your code).

Igor Tandetnik



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


Re: [sqlite] problem compiling loadable extensions using VisualStudio

2008-07-09 Thread Teg
Hello Igor,

Wednesday, July 9, 2008, 3:22:46 PM, you wrote:

IT> Shane Harrelson
IT> <[EMAIL PROTECTED]> wrote:
>> Without creating a .DEF file for MSVC to use, you need to tell it
>> which functions to "export".
>> The easiest way to do this is with the __declspec(dllexport).

IT> I assumed the OP was doing this. Anyway, __declspec(dllexport) always 
IT> results in a decorated name being exported.

IT> Igor Tandetnik 



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

/*
** Make sure we can call this stuff from C++.
*/
#ifdef __cplusplus
extern "C" {
#endif

__declspec(dllexport) HANDLE APIENTRY PI_Test(const char* pszFilename)
{
return(NULL);
}

#ifdef __cplusplus
}
#endif

__declspec(dllexport) HANDLE APIENTRY PI_TestEx(const char* pszFilename)
{
return(NULL);
}


The first one isn't decorated, the second one is.

-- 
Best regards,
 Tegmailto:[EMAIL PROTECTED]

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


[sqlite] [ANN] IPLocation.db

2008-07-09 Thread Petite Abeille
Hello,

IPLocation.db provides access to MaxMind's GeoLite City data as a - 
rather hefty- SQLite3 database.

http://alt.textdrive.com/assets/public/Nanoki/IPLocation.100.zip (48.3  
MB)

Usage example:

% sqlite3 IPLocation.db

select  location.start as start,
 location.end as end,
 city.name as city,
 region.name as region,
 region.code as region_code,
 country.name as country,
 country.code as country_code
fromlocation
joincity on city.id = location.city_id
joinregion on region.id = city.region_id
joincountry on country.id = region.country_id
where   location.start <= 2154863525
order bylocation.start desc
limit   1

 > 2154823680|2154889215|Princeton|New Jersey|NJ|United States|US

Kudos to Igor Tandetnik for highlighting an efficient way of querying  
such data [1].

There is also a Lua [2] front-end for it:

#!/usr/bin/env lua
local IPLocation = require( 'IPLocation' )
local aLocation = IPLocation[ '128.112.155.165' ]

print( aLocation.city, aLocation.region, aLocation.country  )

 > PrincetonNew Jersey  United States

Cheers,

--
PA.
http://alt.textdrive.com/nanoki/

[1] http://www.mail-archive.com/sqlite-users@sqlite.org/msg28622.html
[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


[sqlite] comments on db design

2008-07-09 Thread steffen scheer
Hey all

I want to use sqlite as a storage engine for DNA sequence data. It is 
part of a workflow engine for DNA processing. I was wondering whether i 
chose the right db design.

The db holds information about DNA sequences. Arranged in three tables.
For every dna sequence one entry in all 3 tables will be made (1:1 
Relation). Data will be inserted once, never deleted, but some 
attributes get updated.

First a static description table which holds information about a DNA
sequence. The unique key, the source etc. Once inserted the data is 
never modified.

CREATE TABLE seq_desc_static(
 seq_id  INTEGER PRIMARY KEY
 file TEXT UNIQUE,
sample TEXT,
source TEXT,
type INTEGER
);


Second a static data table which holds the base sequence for every row 
from seq_desc_static, approx. 30 to 800 bases, and for each base two 
numerical values, a quality value (two digit) and a integer. This data 
will never be modified as well, but will be inserted after the 
seq_desc_static table is populated. This table gets huge.
The table seq_data is just a data storage, query only be seq_id

CREATE TABLE seq_data(
seq_id INTEGER PRIMARY KEY,
 base TEXT,
qual TEXT,
call TEXT
)';

During the processing of a dna sequence we will generate some additional
infos for every row of seq_desc_static. These informations are kept in 
the third table. This table will be updated often during processing.

CREATE TABLE seq_desc_var(
 seq_id INTEGER PRIMARY KEY,
clear_range TEXT,
classification INTEGER,
history TEXT
)

Most of the queries select rows from seq_desc_static and then join with 
the seq_data table to retrieve the data. My impression was that it is 
faster to put the big data in an extra table and to join. Am I right ?

Is it a good solution to create an extra table for the updated data 
'seq_desc_var' or should i put it in seq_desc_static table ?
Selecting all data includes two joins ! That is expensive.


Thanks for any comments




























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


Re: [sqlite] View with Dynamic Fields ?

2008-07-09 Thread Andrea Connell

I'm not thinking big picture here. I just want this one view. I am not
planning on using it in other queries, I just don't want to have to
either group lots of data together or parse data apart in all of my
projects that will be using these tables. I suppose that is what I will
be doing though. It's not a big deal - I was just wondering if a simpler
solution was available. 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Nicolas Williams
Sent: Wednesday, July 09, 2008 2:41 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] View with Dynamic Fields ?

On Wed, Jul 09, 2008 at 12:32:27PM -0700, Andrea Connell wrote:
> > From: [EMAIL PROTECTED] 
> > [mailto:[EMAIL PROTECTED] On Behalf Of Dennis Cote
> > 
> > Andrea Connell wrote:
> > > I am still holding a shred of hope for a trigger that can recreate

> > > the view whenever the questions table is modified
> > 
> > I wouldn't hold much hope for that. Triggers can only execute 
> > insert, update, delete, or select SQL statements. There is no way to

> > execute a create table or create view command.
> 
>  Really? I never knew about that restriction before. Well, okay then.
> Everybody is telling me it is impossible, and that's kind of what I 
> was thinking coming in to this so I guess that's that. Thanks!

It's not just that it's impossible.  Imagine you develop a dynamic SQL
extension to SQLite (or any other open source SQL engine).  Then what?
How do you use the results of SQL queries with dynamic column counts in
larger SQL queries?  That's the hard part here.

If you want "dynamic" column counts only for display purposes then you
avoid that hard problem.  But then, you might as well use
group_concat() to get what you want, rather than work on extending the
engine to support some notion of dynamic SQL.

Nico
--
___
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] View with Dynamic Fields ?

2008-07-09 Thread Nicolas Williams
On Wed, Jul 09, 2008 at 12:32:27PM -0700, Andrea Connell wrote:
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Dennis Cote
> > 
> > Andrea Connell wrote:
> > > I am still holding a shred of hope for a trigger that can recreate the
> > > view whenever the questions table is modified
> > 
> > I wouldn't hold much hope for that. Triggers can only execute insert,
> > update, delete, or select SQL statements. There is no way to execute a
> > create table or create view command.
> 
>  Really? I never knew about that restriction before. Well, okay then.
> Everybody is telling me it is impossible, and that's kind of what I was
> thinking coming in to this so I guess that's that. Thanks!

It's not just that it's impossible.  Imagine you develop a dynamic SQL
extension to SQLite (or any other open source SQL engine).  Then what?
How do you use the results of SQL queries with dynamic column counts in
larger SQL queries?  That's the hard part here.

If you want "dynamic" column counts only for display purposes then you
avoid that hard problem.  But then, you might as well use
group_concat() to get what you want, rather than work on extending the
engine to support some notion of dynamic SQL.

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


Re: [sqlite] View with Dynamic Fields ?

2008-07-09 Thread Andrea Connell

 Really? I never knew about that restriction before. Well, okay then.
Everybody is telling me it is impossible, and that's kind of what I was
thinking coming in to this so I guess that's that. Thanks!

Andrea

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dennis Cote
Sent: Tuesday, July 08, 2008 5:08 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] View with Dynamic Fields ?

Andrea Connell wrote:
> 
> I am still holding a shred of hope for a trigger that can recreate the

> view whenever the questions table is modified
> 

I wouldn't hold much hope for that. Triggers can only execute insert,
update, delete, or select SQL statements. There is no way to execute a
create table or create view command.

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


Re: [sqlite] Subselect question

2008-07-09 Thread D. Richard Hipp

On Jul 9, 2008, at 3:23 PM, Shawn Wilsher wrote:

> Hey all,
>
> Quick (and hopefully simple) question regarding subselects in a where
> clause.  Does sqlite cache the values of a subselect so it doesn't
> have to run the query each time it evaluates a row?
>
> Example:
> SELECT *
> FROM foo
> WHERE id NOT IN (SELECT id FROM bar)


Yes it does.

Assuming it is possible.  If the subquery depends on the outer query  
that is not possible.  Example:

  SELECT * FROM foo WHERE id NOT IN (SELECT id FROM bar WHERE  
x>foo.y)

So in your original query, the subquery runs once and the results are  
cached.  In the second query, the subquery runs once for each row in  
the result set.


D. Richard Hipp
[EMAIL PROTECTED]



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


[sqlite] Subselect question

2008-07-09 Thread Shawn Wilsher
Hey all,

Quick (and hopefully simple) question regarding subselects in a where
clause.  Does sqlite cache the values of a subselect so it doesn't
have to run the query each time it evaluates a row?

Example:
SELECT *
FROM foo
WHERE id NOT IN (SELECT id FROM bar)

Cheers,

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


Re: [sqlite] problem compiling loadable extensions using VisualStudio

2008-07-09 Thread Igor Tandetnik
Shane Harrelson
<[EMAIL PROTECTED]> wrote:
> Without creating a .DEF file for MSVC to use, you need to tell it
> which functions to "export".
> The easiest way to do this is with the __declspec(dllexport).

I assumed the OP was doing this. Anyway, __declspec(dllexport) always 
results in a decorated name being exported.

Igor Tandetnik 



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


Re: [sqlite] problem compiling loadable extensions using Visual Studio

2008-07-09 Thread Shane Harrelson
Without creating a .DEF file for MSVC to use, you need to tell it which
functions to "export".
The easiest way to do this is with the __declspec(dllexport).

You should modify your source file and add the following before each public
function:
   __declspec(dllexport)

So for instance:
   int sqlite3_extension_init(
becomes:
   __declspec(dllexport) int sqlite3_extension_init(

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


Re: [sqlite] problem compiling loadable extensions using Visual Studio

2008-07-09 Thread Igor Tandetnik
Jackson, Douglas H
<[EMAIL PROTECTED]> wrote:
> I'm trying to find the way to develop loadable extensions using
> Visual Studio 2005.
>
> I've started by using the "half.c" extension from the documentation.
> I'm compiling using this command:
>cl /LD /I. /Fmhalf.map half.c
> The compilation proceeds without producing errors.
> I get a "half.dll", and the map file indicates that the
> "sqlite3_extension_init" is exported.

Use Dependency Walker (www.dependencywalker.com) to see what name the 
function got exported under. My educated guess is that it's exported 
under some sort of a decorated name (perhaps with a leading underscore).

Use a .DEF file or /EXPORT linker option to export an undecorated name.

Igor Tandetnik



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


[sqlite] problem compiling loadable extensions using Visual Studio

2008-07-09 Thread Jackson, Douglas H
I'm trying to find the way to develop loadable extensions using Visual Studio 
2005.

I've started by using the "half.c" extension from the documentation.
I'm compiling using this command:
cl /LD /I. /Fmhalf.map half.c
The compilation proceeds without producing errors.
I get a "half.dll", and the map file indicates that the 
"sqlite3_extension_init" is exported.

But when I try to load the extension, I get this:

SQLite version 3.5.9
Enter ".help" for instructions
sqlite> .load 'half.dll'
The specified procedure could not be found.

sqlite>

I've seen many descriptions in the archives that look to be similar to this, 
but I haven't found any that specifically named the Microsoft compiler in the 
problem statement.

Anyone have the secret sauce for developing an extension using the Microsoft 
tools?

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


Re: [sqlite] SQLITE_BUSY question

2008-07-09 Thread George Ryan
Oops, I RTFMed poorly. Thanks for the help. :-)

Dennis Cote wrote:
> George Ryan wrote:
>   
>> Hello. I'm a first-time sqlite user, and I have a question. I'm using 
>> the C/C++ API as shown in the code below, and the sqlite3_step() 
>> function always seems to return SQLITE_BUSY for me. I'm not sure what I 
>> am doing wrong. I'm running on Ubuntu 8.04, and I don't have any 
>> multiple threads or clients or virus software running, so I can't see 
>> why the database would be locked. The database file gets created okay, 
>> but it's empty.
>>
>> Any suggestions?
>>
>>   int rc = sqlite3_open_v2( "simple.db", &db_, SQLITE_OPEN_CREATE, 0 );
>> 
>
>  From the documentation at http://www.sqlite.org/c3ref/open.html you can 
> see that you are using an illegal flags argument to sqlite3_open_v2. You 
> need to or in the SQLITE_OPEN_READWRITE flag as well.
>
>  int rc = sqlite3_open_v2( "simple.db", &db_,
>  SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0 );
>
> HTH
> Dennis Cote
>
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>   

-- 
George Ryan
Senior Software Architect
Akoostix Inc., Nova Scotia Canada
902-404-PING | www.akoostix.com

"Simplicity and elegance are unpopular because they require hard work and 
discipline to achieve and education to be appreciated."
- Edsger W. Dijkstra

The information contained in this e-mail may contain confidential information 
intended for a specific individual and purpose. The information is private and 
is legally protected by law. If you are not the intended recipient, you are 
hereby notified that any disclosure, copying, distribution or the taking of any 
action in reliance on the comments of this information is strictly prohibited. 
If you have received this communication in error, please notify the sender 
immediately by telephone or return e-mail.



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


Re: [sqlite] SQLITE_BUSY question

2008-07-09 Thread George Ryan
Nope, it's a local ext3 filesystem.

D. Richard Hipp wrote:
> On Jul 9, 2008, at 11:00 AM, George Ryan wrote:
>
>   
>> Hello. I'm a first-time sqlite user, and I have a question. I'm using
>> the C/C++ API as shown in the code below, and the sqlite3_step()
>> function always seems to return SQLITE_BUSY for me. I'm not sure  
>> what I
>> am doing wrong. I'm running on Ubuntu 8.04, and I don't have any
>> multiple threads or clients or virus software running, so I can't see
>> why the database would be locked. The database file gets created okay,
>> but it's empty.
>>
>> Any suggestions?
>>
>> 
>
> Are you using an NFS filesystem?
>
> D. Richard Hipp
> [EMAIL PROTECTED]
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>   

-- 
George Ryan
Senior Software Architect
Akoostix Inc., Nova Scotia Canada
902-404-PING | www.akoostix.com

"Simplicity and elegance are unpopular because they require hard work and 
discipline to achieve and education to be appreciated."
- Edsger W. Dijkstra

The information contained in this e-mail may contain confidential information 
intended for a specific individual and purpose. The information is private and 
is legally protected by law. If you are not the intended recipient, you are 
hereby notified that any disclosure, copying, distribution or the taking of any 
action in reliance on the comments of this information is strictly prohibited. 
If you have received this communication in error, please notify the sender 
immediately by telephone or return e-mail.



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


Re: [sqlite] SQLITE_BUSY question

2008-07-09 Thread Dennis Cote
George Ryan wrote:
> Hello. I'm a first-time sqlite user, and I have a question. I'm using 
> the C/C++ API as shown in the code below, and the sqlite3_step() 
> function always seems to return SQLITE_BUSY for me. I'm not sure what I 
> am doing wrong. I'm running on Ubuntu 8.04, and I don't have any 
> multiple threads or clients or virus software running, so I can't see 
> why the database would be locked. The database file gets created okay, 
> but it's empty.
> 
> Any suggestions?
> 
>   int rc = sqlite3_open_v2( "simple.db", &db_, SQLITE_OPEN_CREATE, 0 );

 From the documentation at http://www.sqlite.org/c3ref/open.html you can 
see that you are using an illegal flags argument to sqlite3_open_v2. You 
need to or in the SQLITE_OPEN_READWRITE flag as well.

 int rc = sqlite3_open_v2( "simple.db", &db_,
 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0 );

HTH
Dennis Cote


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


Re: [sqlite] SQLITE_BUSY question

2008-07-09 Thread D. Richard Hipp

On Jul 9, 2008, at 11:00 AM, George Ryan wrote:

> Hello. I'm a first-time sqlite user, and I have a question. I'm using
> the C/C++ API as shown in the code below, and the sqlite3_step()
> function always seems to return SQLITE_BUSY for me. I'm not sure  
> what I
> am doing wrong. I'm running on Ubuntu 8.04, and I don't have any
> multiple threads or clients or virus software running, so I can't see
> why the database would be locked. The database file gets created okay,
> but it's empty.
>
> Any suggestions?
>

Are you using an NFS filesystem?

D. Richard Hipp
[EMAIL PROTECTED]



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


[sqlite] SQLITE_BUSY question

2008-07-09 Thread George Ryan
Hello. I'm a first-time sqlite user, and I have a question. I'm using 
the C/C++ API as shown in the code below, and the sqlite3_step() 
function always seems to return SQLITE_BUSY for me. I'm not sure what I 
am doing wrong. I'm running on Ubuntu 8.04, and I don't have any 
multiple threads or clients or virus software running, so I can't see 
why the database would be locked. The database file gets created okay, 
but it's empty.

Any suggestions?



#include 
#include 
using namespace std;

int main()
{
  sqlite3* db_;
  int rc = sqlite3_open_v2( "simple.db", &db_, SQLITE_OPEN_CREATE, 0 );
  if ( rc ) {
cout << "failed to connect" << endl;
sqlite3_close( db_ );
return EXIT_FAILURE;
  }

  sqlite3_stmt* stmt;
  std::string query( "create table if not exists version(major int, 
minor int)" );

  rc = sqlite3_prepare_v2( db_,  query.c_str(), query.size(), &stmt, 0 );

  if ( rc ) {
cout << "failed to create statement" << endl;
sqlite3_close( db_ );
return EXIT_FAILURE;
  }
 
  rc = sqlite3_step( stmt );

  cout << "step returned " << rc << endl;
 
  sqlite3_finalize( stmt );
  sqlite3_close( db_ );
}

-- 
George Ryan
Senior Software Architect
Akoostix Inc., Nova Scotia Canada
902-404-PING | www.akoostix.com




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