Re: [sqlite] Warning message in amalgamation

2009-02-02 Thread Mike Shal
On 2/2/09, Roger Binns  wrote:
>  Maurí­cio wrote:
>  > I know this is not a problem, but I would like to
>  > remove this warning since it's not important for
>  > the rest of the code. What could I do?
>
>
> The usual method is to cast the result to (void) but gcc still whines.
>  I suggest you just live with it.  With many people reporting warning
>  issues the assumption seems to be that somehow the compiler is reporting
>  an important insight that the developers missed and could cause SQLite
>  to trivially malfunction.  The opposite is actually true - SQLite
>  functions just fine and the compilers are making mistaken claims.
>  Consider those warnings pointing out an inadequacy in the compiler and
>  get the compiler people to fix their program!
>
>   http://sqlite.org/testing.html
>

I would hope the "usual method" would be to check the return value of
the write call to make sure that it actually wrote. Looking at the
file in question, a later pwrite() call correctly checks the return
value to see if it is negative (indicating an error), and also checks
to see if fewer bytes were written than was requested. So why should
this write() be different? The comment doesn't seem to indicate why we
can assume this particular write() will always succeed, or why we
don't care if it doesn't. The testing page you linked to suggests that
sqlite is tested under full-disk conditions, which is somewhat
reassuring, though without digging into the testing internals too
significantly I am not convinced that we could have a case where a
disk fills up just before the write() call, causing it to fail to
write the one byte and forcing the inode returned by fstat() to be the
bizarre 9 thing again. Can you explain why that shouldn't be a
concern? If so, it would be nice to comment that in the source.

Also, if you truly believe the unused result warning to be an error,
you would want to take it up with your libc maintainers, not the
compiler maintainers. The __warn_unused_result gcc attribute is a
useful facility - I think you're just questioning its use in the
write() call in libc.

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


Re: [sqlite] Warning message in amalgamation

2009-02-02 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Michael Comperchio wrote:
> in io.h write returns an int - number of bytes written. Declare an int 
> and catch the return value.  :)

And then the compiler will complain that the variable assigned the value
is not used elsewhere.  You get to keep playing whack-a-mole.

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

iEYEARECAAYFAkmHrB0ACgkQmOOfHg372QQnqQCcCL7HE3aZujFZV/Mn6o+LPYWL
VdUAnAlbcTWBuZZUCI+G3mEnAybh0gkU
=jNZ5
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Warning message in amalgamation

2009-02-02 Thread Michael Comperchio
Roger Binns wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Maurí­cio wrote:
>   
>> I know this is not a problem, but I would like to
>> remove this warning since it's not important for
>> the rest of the code. What could I do?
>> 
>
> The usual method is to cast the result to (void) but gcc still whines.
> I suggest you just live with it.  With many people reporting warning
> issues the assumption seems to be that somehow the compiler is reporting
> an important insight that the developers missed and could cause SQLite
> to trivially malfunction.  The opposite is actually true - SQLite
> functions just fine and the compilers are making mistaken claims.
> Consider those warnings pointing out an inadequacy in the compiler and
> get the compiler people to fix their program!
>
>   http://sqlite.org/testing.html
>
> Roger
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkmHdq4ACgkQmOOfHg372QQKAgCffeIn0vTBdSvx4MSD1owN8mg/
> K3EAn2ueJoNLXwfvnE52iiM6lf53FSe5
> =jjfQ
> -END PGP SIGNATURE-
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>   

in io.h write returns an int - number of bytes written. Declare an int 
and catch the return value.  :)

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


Re: [sqlite] (no subject)

2009-02-02 Thread Boris Arloff
Daniel,

Thanks for the pointers, but I do not believe that they apply.  You are correct 
in that the script is more complex and it is hard to post.  I tried to post the 
relevant portions with explanations. 

In terms of connection (self.con) and cursor (self.cur) these are the only 
existing attributes and no new connections or cursors are ever created.  
These attributes are passed around and used as needed.  Either pased as 
arguments to external classes or used as self within methods of the clas that 
created the connection.

Thanks anyway,
Boris




From: Daniel Watrous 
To: General Discussion of SQLite Database 
Sent: Monday, February 2, 2009 11:55:52 AM
Subject: Re: [sqlite] (no subject)

Hey Boris,

It's a bit hard to follow what you've posted here, but I'm sure that's
because it came from a complicated script.  Here are a few things to
keep in mind.

You've make the connection to be EXCLUSIVE, which means that once you
send the first SQL statement to the database the database is
effectively locked for any other connection regardless of what queries
they might send.  You imply that when you call getDBConnection you
call sqlite.connect().  If self.con already has a connection this
would create a new connection and you would expect your database to be
locked at that point.

So, you could wrap the sqlite.connect() call in a conditional to see
if self.con is already a valid connection or you could call
self.con.commit() and self.con.close() before calling sqlite.connect
again.

Not sure if this helps.  If you have a larger snippet of code you can
send it along.

Daniel

On Sat, Jan 31, 2009 at 11:51 PM, Boris Arloff  wrote:
> Daniel,
>
> Apologize for not posting a subject in the original request.
>
> Thanks for offering to help; I do not think is a connection related
> problem, but I could be wrong.  Here are pertinent code segments:
>
> # Method getDBConnection() is called, which performs the following:
> 
> # create a connection property
> self.con = sqlite.connect( path + file,timeout=self.dbdefs.DB_TIMEOUT,
>                detect_types=sqlite.PARSE_DECLTYPES|sqlite.PARSE_COLNAMES,
>                isolation_level='EXCLUSIVE',check_same_thread=False)
> # config some extensions: row_factory, text_factory
> self..con.row_factory = sqlite.Row    # access by index or col names
> self.con.text_factory = sqlite.OptimizedUnicode    # uncode/bytestr
> #create a general cursor property
> self.cur = self.con.cursor()
> .
> # Then the following method is called to create the tables if they do not 
> exist:
> # create the database structure if does not exist
> errBool = not self._DBHandler__createDBTables()
> In this case it is a NOOP since the tables do exist; working with an existing 
> sqlite file.
>
> # Then method deleteData(self, **kwargs) is called, which ends up executing 
> the deletes
> # on each table:
> for table in kwargs.keys():
>    ...
>    cmd, errBool = self.__buildDeleteSQL(table, kwargs[table]) # build a 
>delete sql statement
>    ...
>    errBool, err = self.__execSQLCmd(cmd, self.cur)
>
> Method __execSQLCmd(self, cmd, cur), verifies for complete sql statement and:
> 
>    cur.execute(cmd)                                # execute sql command
> 
>
> Every DELETE executes correctly.
>
> # Then method insertData(self, **kwargs) is called:
> for table in kwargs.keys():
>    ...
>    for val in kwargs[table].keys():
>        ...
>        row = kwargs[table][val]
>        cmd, errBool = self.__buildInsertSQL(table, row) # build insert sql 
>statements
>        ...
>        errBool, err = self.__execSQLCmd(cmd, self.cur) # same method called 
>above to exec sql
>
> # The cur.execute(cmd) succeeds the insert with the first two tables,
> fails on the third table, only  if
> # the record of the first table is not the
> last record.
>
> # Delete and insert loops finish thru every db table; whenever errBool is 
> true, breaks out of the loop
> # with an exception:
> except err_handler.DBInsertFail:
>  errBool = True
>  errMsg += "\nInsert statement structure:\n" + str(kwargs)
> except:
>  errBool = True                                                    # 
>something else wrong; check args
>  errMsg += "\nGeneral exception at insertData; structure:\n" + str(kwargs)
> 
> # If error is returned attempts a rollback; else attempts a commit:
> if errBool:
>  try: self.cur.execute('ROLLBACK;')                # rollback on error
>  except: pass
> else:
>  try: self.cur.execute('COMMIT;')
>  except: pass
>
> The same connection object is maintained throughout; it is never closed
> until the program ends.  Again the same code is used for successful and
> failed results as outlined before.
>
> Thanks,
> Boris
>
>
>
>
>
>
> 
> From: Daniel Watrous 
> To: General Discussion of SQLite Database 
> Sent: 

Re: [sqlite] Warning message in amalgamation

2009-02-02 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Maurí­cio wrote:
> I know this is not a problem, but I would like to
> remove this warning since it's not important for
> the rest of the code. What could I do?

The usual method is to cast the result to (void) but gcc still whines.
I suggest you just live with it.  With many people reporting warning
issues the assumption seems to be that somehow the compiler is reporting
an important insight that the developers missed and could cause SQLite
to trivially malfunction.  The opposite is actually true - SQLite
functions just fine and the compilers are making mistaken claims.
Consider those warnings pointing out an inadequacy in the compiler and
get the compiler people to fix their program!

  http://sqlite.org/testing.html

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

iEYEARECAAYFAkmHdq4ACgkQmOOfHg372QQKAgCffeIn0vTBdSvx4MSD1owN8mg/
K3EAn2ueJoNLXwfvnE52iiM6lf53FSe5
=jjfQ
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite compile errors with gcc

2009-02-02 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

xianzhang wrote:
> sqlite/sqlite3.c:18848:3: #error SQLite will not work correctly with the
> -ffast-math option of GCC
[...]
> Any ideas how I can fix this? Thanks!

Exactly as it says.  Don't supply the -ffast-math option.  Something in
your build environment selected that flag so stop it :-)  In case you
are wondering the -ffast-math option allows gcc to take various
non-standards compliant shortcuts when doing floating point arithmetic.
 Those shortcuts end up causing SQLite to give very wrong floating point
results.

Roger

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

iEYEARECAAYFAkmHdU4ACgkQmOOfHg372QRCegCgx1kOhK9LYduvS4LjY8JPTiC/
twUAoM7El900s59WGdHtm/ViFhAtt4WA
=Pejd
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Question on the "like" item in "select"

2009-02-02 Thread Igor Tandetnik
J. R. Westmoreland  wrote:
> It is my understanding that if I use a wildcard at the front of the
> string
> then it will cause a linear table search rather than using the index
> if the
> string is the first part of the match. For example, "... col like
> '%String'"
> or "... col like '%String%'" would cause a linear table search
> ignoring the
> index.

Correct.

> As opposed to "... col like 'String%'" which would still use
> the
> index for matching.

_Might_ still use the index, if certain other conditions hold. See

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

section 4.0 The LIKE optimization.

> Also, would the following only search part of the table in a linear
> fashion? "select * from table where id >= 150 and id <= 1500 and col
> like '%String%';"
> This assumes that id and col are key and index respectively.

This would likely use the index on id to satisfy the first two 
inequalities, then would lineraly scan all records that satisfy the 
conditions on id and test the LIKE condition on each one.

Igor Tandetnik 



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


Re: [sqlite] Question on the "like" item in "select"

2009-02-02 Thread J. R. Westmoreland
It is my understanding that if I use a wildcard at the front of the string
then it will cause a linear table search rather than using the index if the
string is the first part of the match. For example, "... col like '%String'"
or "... col like '%String%'" would cause a linear table search ignoring the
index. As opposed to "... col like 'String%'" which would still use the
index for matching.
This is assuming that col is an indexed field.
Is this a correct understanding?

Also, would the following only search part of the table in a linear fashion?
"select * from table where id >= 150 and id <= 1500 and col like
'%String%';"
This assumes that id and col are key and index respectively.

Thanks in advance for your patients and help.

J. R.


J. R. Westmoreland
E-mail: j...@jrw.org


-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of P Kishor
Sent: Monday, February 02, 2009 10:37 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Question on the "like" item in "select"

On Mon, Feb 2, 2009 at 12:33 PM, J. R. Westmoreland  wrote:
> Please pardon me if this is really more SQL rather than sqlite behavior.
>
>
>
> If I have some thing like:
>
> SELECT . WHERE . LIKE "String" .;
>
> Is it going to work like:
>
> SELECT . WHERE . = "String" .;
>
>

LIKE is case-insensitive, and typically used with wild cards.

WHERE col = 'String' would be case-sensitive and only match 'String'
whereas LIKE will match 'String' and 'string'

Compare with GLOB which is case-sensitive.

In either case, you want to use single-quotes, not double-quotes.

>
> Thanks,
>
> J. R.
>
>
>
> 
>
> J. R. Westmoreland
>
> E-mail: j...@jrw.org
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
Puneet Kishor http://www.punkish.org/
Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
___
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] Substract and decimal

2009-02-02 Thread Carlos Suarez
THANK'S A LOT  IGOR

Igor Tandetnik escribió:
> Carlos Suarez 
> wrote:
>   
>> An date field can be null or not, depending of this the field it
>> writes  'without_a_date' or  the number of days from a date to another
>> *the problem is only the presentation cause I need the subtract
>> without decimals number* but round doesn't work here because the
>> result is "without_a_date" or ie: 34.0 or any number with period and
>> zero, I need only 34 in that case or 'withoutadate'
>> 
>
> Try   CAST(round(...) as integer)
>
> Igor Tandetnik 
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>   

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


Re: [sqlite] Substract and decimal

2009-02-02 Thread Igor Tandetnik
Carlos Suarez 
wrote:
> An date field can be null or not, depending of this the field it
> writes  'without_a_date' or  the number of days from a date to another
> *the problem is only the presentation cause I need the subtract
> without decimals number* but round doesn't work here because the
> result is "without_a_date" or ie: 34.0 or any number with period and
> zero, I need only 34 in that case or 'withoutadate'

Try   CAST(round(...) as integer)

Igor Tandetnik 



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


Re: [sqlite] Substract and decimal

2009-02-02 Thread Carlos Suarez
Hello,

I need to use a case with that situation:

An date field can be null or not, depending of this the field it  
writes  'without_a_date' or  the number of days from a date to another
*the problem is only the presentation cause I need the subtract without 
decimals number* but round doesn't work here because the result is
"without_a_date" or ie: 34.0 or any number with period and zero, I need 
only 34 in that case or 'withoutadate'

select
case
when (date1field is null)
then ('without_a_date')
else round (strftime('%J',date1field)-strftime('%J',date2field))
end as datessubstract


from  datestable

I need XX not XX.0
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Question on the "like" item in "select"

2009-02-02 Thread P Kishor
On Mon, Feb 2, 2009 at 12:33 PM, J. R. Westmoreland  wrote:
> Please pardon me if this is really more SQL rather than sqlite behavior.
>
>
>
> If I have some thing like:
>
> SELECT . WHERE . LIKE "String" .;
>
> Is it going to work like:
>
> SELECT . WHERE . = "String" .;
>
>

LIKE is case-insensitive, and typically used with wild cards.

WHERE col = 'String' would be case-sensitive and only match 'String'
whereas LIKE will match 'String' and 'string'

Compare with GLOB which is case-sensitive.

In either case, you want to use single-quotes, not double-quotes.

>
> Thanks,
>
> J. R.
>
>
>
> 
>
> J. R. Westmoreland
>
> E-mail: j...@jrw.org
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
Puneet Kishor http://www.punkish.org/
Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Question on the "like" item in "select"

2009-02-02 Thread J. R. Westmoreland
Please pardon me if this is really more SQL rather than sqlite behavior.

 

If I have some thing like:

SELECT . WHERE . LIKE "String" .;

Is it going to work like:

SELECT . WHERE . = "String" .;

 

Thanks,

J. R.

 



J. R. Westmoreland

E-mail: j...@jrw.org

 

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


Re: [sqlite] Fast and simple database merge

2009-02-02 Thread Griggs, Donald

 Regarding: "...Really cool would be something like:
 cat db1.dat db2.dat db3.dat > final.dat"


I don't think there are any "really cool cat's" available.   ;-)
The format of the database is fairly fancy, though it is documented if
you think you'd be interested in writing a utility against it.

You can use the command line utility with its ".dump" command to output
the schema and data for the databases to be appended, then run these
against the original database to add in the new tables and data.

It will be slower, since the data must be dumped as well as inserted,
but if you don't have any conflicting names in your schemas, maybe this
would save you writing code. (If you can delay adding indicies until
after adding the data you may see some speed improvements.)


Don't know if this helps,
   Donald

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


Re: [sqlite] (no subject)

2009-02-02 Thread Daniel Watrous
Hey Boris,

It's a bit hard to follow what you've posted here, but I'm sure that's
because it came from a complicated script.  Here are a few things to
keep in mind.

You've make the connection to be EXCLUSIVE, which means that once you
send the first SQL statement to the database the database is
effectively locked for any other connection regardless of what queries
they might send.  You imply that when you call getDBConnection you
call sqlite.connect().  If self.con already has a connection this
would create a new connection and you would expect your database to be
locked at that point.

So, you could wrap the sqlite.connect() call in a conditional to see
if self.con is already a valid connection or you could call
self.con.commit() and self.con.close() before calling sqlite.connect
again.

Not sure if this helps.  If you have a larger snippet of code you can
send it along.

Daniel

On Sat, Jan 31, 2009 at 11:51 PM, Boris Arloff  wrote:
> Daniel,
>
> Apologize for not posting a subject in the original request.
>
> Thanks for offering to help; I do not think is a connection related
> problem, but I could be wrong.  Here are pertinent code segments:
>
> # Method getDBConnection() is called, which performs the following:
> 
> # create a connection property
> self.con = sqlite.connect( path + file,timeout=self.dbdefs.DB_TIMEOUT,
>detect_types=sqlite.PARSE_DECLTYPES|sqlite.PARSE_COLNAMES,
>isolation_level='EXCLUSIVE',check_same_thread=False)
> # config some extensions: row_factory, text_factory
> self.con.row_factory = sqlite.Row# access by index or col names
> self.con.text_factory = sqlite.OptimizedUnicode# uncode/bytestr
> #create a general cursor property
> self.cur = self.con.cursor()
> 
> # Then the following method is called to create the tables if they do not 
> exist:
> # create the database structure if does not exist
> errBool = not self._DBHandler__createDBTables()
> In this case it is a NOOP since the tables do exist; working with an existing 
> sqlite file.
>
> # Then method deleteData(self, **kwargs) is called, which ends up executing 
> the deletes
> # on each table:
> for table in kwargs.keys():
>...
>cmd, errBool = self.__buildDeleteSQL(table, kwargs[table]) # build a 
> delete sql statement
>...
>errBool, err = self.__execSQLCmd(cmd, self.cur)
>
> Method __execSQLCmd(self, cmd, cur), verifies for complete sql statement and:
> 
>cur.execute(cmd)# execute sql command
> 
>
> Every DELETE executes correctly.
>
> # Then method insertData(self, **kwargs) is called:
> for table in kwargs.keys():
>...
>for val in kwargs[table].keys():
>...
>row = kwargs[table][val]
>cmd, errBool = self.__buildInsertSQL(table, row) # build insert sql 
> statements
>...
>errBool, err = self.__execSQLCmd(cmd, self.cur) # same method called 
> above to exec sql
>
> # The cur.execute(cmd) succeeds the insert with the first two tables,
> fails on the third table, only  if
> # the record of the first table is not the
> last record.
>
> # Delete and insert loops finish thru every db table; whenever errBool is 
> true, breaks out of the loop
> # with an exception:
> except err_handler.DBInsertFail:
>   errBool = True
>   errMsg += "\nInsert statement structure:\n" + str(kwargs)
> except:
>  errBool = True# 
> something else wrong; check args
>  errMsg += "\nGeneral exception at insertData; structure:\n" + str(kwargs)
> 
> # If error is returned attempts a rollback; else attempts a commit:
> if errBool:
>   try: self.cur.execute('ROLLBACK;')# rollback on error
>   except: pass
> else:
>  try: self.cur.execute('COMMIT;')
>  except: pass
>
> The same connection object is maintained throughout; it is never closed
> until the program ends.  Again the same code is used for successful and
> failed results as outlined before.
>
> Thanks,
> Boris
>
>
>
>
>
>
> 
> From: Daniel Watrous 
> To: General Discussion of SQLite Database 
> Sent: Saturday, January 31, 2009 5:42:40 PM
> Subject: Re: [sqlite] (no subject)
>
> why don't you send us some code.  It sounds like you might have an
> issue managing your connections.
>
> On Sat, Jan 31, 2009 at 3:09 PM, Boris Arloff  wrote:
>> Hi,
>>
>> I am having a small problem with an sqlite3 v3.5.6 database being accessed 
>> from within python 2.5 (import sqlite3 as sqlite).
>>
>> The database has been working correctly with the exception of the following 
>> issue:
>> There are 17 tables with the first table being a dataset index table with 
>> three columns (index, name, datetimestamp).  All other records have various 
>> columns one being a field that stores the index reference to this first 
>> table.  Therefore we can access different datasets.

Re: [sqlite] checking database file

2009-02-02 Thread Zaphod
Dan wrote:
> On Feb 2, 2009, at 2:34 PM, Zaphod wrote:
> 
>> Hi All,
>>
>> Let's say every time before my system starts to run, i would like to  
>> check the
>> database for any kind of errors/mistakes.
>> Is there any API or utility for such purpose?
> 
> See "PRAGMA integrity_check" here:
> 
>http://www.sqlite.org/pragma.html#pragma_integrity_check
> 
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
Thank you
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] unsubscribe

2009-02-02 Thread Horton, John
 


John Horton 
Megger Limited Archcliffe Road Dover 
Kent CT17 9EN England. 
T +44(0)1304-502100. (Switchboard) 
T +44(0)1304-502139. (Direct) 
F +44(0)1304-502306. 
E john.hor...@megger.com 
www.megger.com 
The information contained in this electronic mail message is confidential.
It is intended solely for the use of the individual or entity to whom it is
addressed and others authorised to receive it. If the reader of this message
is not the intended recipient, you are hereby notified that any use,
copying, dissemination or disclosure of this information is strictly
prohibited.
Megger Limited, Registered in England and Wales Number 190137, Registered
office Archcliffe Road, Dover, Kent CT17 9EN

-Original Message-
From: Lukas Haase [mailto:lukasha...@gmx.at] 
Sent: 02 February 2009 15:34
To: sqlite-users@sqlite.org
Subject: [sqlite] Fast and simple database merge

Hi,

For an application I use SQLite as datafile. I have written a "compiler" 
(script chain in Linux) for creating my database file. There are
dependencies between tables and "compiling" my single database takes about
1-2 hours. When there is an error I have to restart the whole procedure.
Very bad.

In order to overcome this problem, I divided my script in small chunks and
use "make". Each scripts takes now a few minutes and creates its own SQLite
dat-file. When another script needs data from another file, it just uses
"ATTACH DATABASE". Works fine.

BUT: I end up with 10 files instead of one; all of them having their
indices. But for my application I need one file.

My question now is: Is there a simple, fast and efficient way to just merge
these databases to a single file?

The one solution I have is to recreate all tables (CREATE TABLE) in a new
file and use INSERT INTO ... SELECT FROM (and again using ATTACH
DATABASE) and after that to recreate each single index.

But:
a) This takes very long
b) I have to write code for CREATE TABLE's twice
c) I have to write code for CREATE INDEX's twice

Really cool would be something like:

cat db1.dat db2.dat db3.dat > final.dat

;-)

Thank you in advance,
Luke

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

_
This e-mail has been scanned for viruses by MessageLabs.

_
This e-mail has been scanned for viruses by MessageLabs.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Fast and simple database merge

2009-02-02 Thread Lukas Haase
Hi,

For an application I use SQLite as datafile. I have written a "compiler" 
(script chain in Linux) for creating my database file. There are 
dependencies between tables and "compiling" my single database takes 
about 1-2 hours. When there is an error I have to restart the whole 
procedure. Very bad.

In order to overcome this problem, I divided my script in small chunks 
and use "make". Each scripts takes now a few minutes and creates its own 
SQLite dat-file. When another script needs data from another file, it 
just uses "ATTACH DATABASE". Works fine.

BUT: I end up with 10 files instead of one; all of them having their 
indices. But for my application I need one file.

My question now is: Is there a simple, fast and efficient way to just 
merge these databases to a single file?

The one solution I have is to recreate all tables (CREATE TABLE) in a 
new file and use INSERT INTO ... SELECT FROM (and again using ATTACH 
DATABASE) and after that to recreate each single index.

But:
a) This takes very long
b) I have to write code for CREATE TABLE's twice
c) I have to write code for CREATE INDEX's twice

Really cool would be something like:

cat db1.dat db2.dat db3.dat > final.dat

;-)

Thank you in advance,
Luke

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


Re: [sqlite] sqlite3_bind_int returns SQLITE_RANGE

2009-02-02 Thread Shibu.Narayanan
There should be no single quotes around question marks

-Shibu

-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of P Kishor
Sent: Monday, February 02, 2009 6:14 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] sqlite3_bind_int returns SQLITE_RANGE

Farzana,

You can save a lot of email back-and-forth by showing your code in the
first place. The very minimum information that you (that anyone)
should provide when asking a code-related question is --

1. db schema
2. code

adding info about computer and operating system, plus any driver
version being used, is also advisable.

On Mon, Feb 2, 2009 at 6:40 AM, hussainfarzana
 wrote:
>
> Yes,the SQL prepared statement has got 14 placeholders.
>
> The statement is "INSERT INTO CollDataNum
> values(?,?,?,?,?,?,?,?,'?',?,?,?,?,?)"
>
> Regards,
> Farzana.
>
>
> SimonDavies wrote:
>>
>> 2009/2/2 hussainfarzana :
>>>
>>> Dear All,
>>>
>>> We are working with SQLite Version 3.6.10.
>>> We tried to insert or update the records in the database using
>>> sqlite3_prepare and binding the values using sqlite3_bind
functions.We
>>> have
>>> started with the index 1.We have a table with 14 columns and when we
use
>>> sqlite3_bind_int,for the first 13 columns its returning 0 and for
the
>>> last
>>> 14th column which is also an integer datatype, but the function is
>>> returning
>>> value 25(SQLITE_RANGE) error.
>>
>> Your table may have 14 columns, but has the SQL for your prepared
>> statement got 14 parameter placeholders?
>>
>>>
>>> Please help us how to proceed further.
>>>
>>> Regards,
>>> Farzana.
>>
>> Rgds,
>> Simon
>> ___
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>>
>
> --
> View this message in context:
http://www.nabble.com/sqlite3_bind_int-returns-SQLITE_RANGE-tp21788383p2
1788991.html
> Sent from the SQLite mailing list archive at Nabble.com.
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



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


DISCLAIMER:
This message contains privileged and confidential information and is intended 
only for an individual named. If you are not the intended recipient, you should 
not disseminate, distribute, store, print, copy or deliver this message. Please 
notify the sender immediately by e-mail if you have received this e-mail by 
mistake and delete this e-mail from your system. E-mail transmission cannot be 
guaranteed to be secure or error-free as information could be intercepted, 
corrupted, lost, destroyed, arrive late or incomplete or contain viruses. The 
sender, therefore,  does not accept liability for any errors or omissions in 
the contents of this message which arise as a result of e-mail transmission. If 
verification is required, please request a hard-copy version.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3_bind_int returns SQLITE_RANGE

2009-02-02 Thread Igor Tandetnik
"hussainfarzana"
 wrote in
message news:21788991.p...@talk.nabble.com
> Yes,the SQL prepared statement has got 14 placeholders.
>
> The statement is "INSERT INTO CollDataNum
> values(?,?,?,?,?,?,?,?,'?',?,?,?,?,?)"

No, there are only thirteen. '?' is not a parameter placeholder, it's a 
string literal consisting of a single question mark character.

Igor Tandetnik



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


Re: [sqlite] sqlite3_bind_int returns SQLITE_RANGE

2009-02-02 Thread Martin.Engelschalk
Hi,

no, you habe 13 placeholders and one string constant '?' on position 9.
You do not need to include the ? in quotes if the value you want to bind 
is a string.

Martin

hussainfarzana schrieb:
> Yes,the SQL prepared statement has got 14 placeholders.
>
> The statement is "INSERT INTO CollDataNum
> values(?,?,?,?,?,?,?,?,'?',?,?,?,?,?)"
>
> Regards,
> Farzana.
>
>
> SimonDavies wrote:
>   
>> 2009/2/2 hussainfarzana :
>> 
>>> Dear All,
>>>
>>> We are working with SQLite Version 3.6.10.
>>> We tried to insert or update the records in the database using
>>> sqlite3_prepare and binding the values using sqlite3_bind functions.We
>>> have
>>> started with the index 1.We have a table with 14 columns and when we use
>>> sqlite3_bind_int,for the first 13 columns its returning 0 and for the
>>> last
>>> 14th column which is also an integer datatype, but the function is
>>> returning
>>> value 25(SQLITE_RANGE) error.
>>>   
>> Your table may have 14 columns, but has the SQL for your prepared
>> statement got 14 parameter placeholders?
>>
>> 
>>> Please help us how to proceed further.
>>>
>>> Regards,
>>> Farzana.
>>>   
>> Rgds,
>> Simon
>> ___
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>>
>> 
>
>   

-- 

* Codeswift GmbH *
Traunstr. 30
A-5026 Salzburg-Aigen
Tel: +49 (0) 8662 / 494330
Mob: +49 (0) 171 / 4487687
Fax: +49 (0) 12120 / 204645
engelsch...@codeswift.com
www.codeswift.com / www.swiftcash.at

Codeswift Professional IT Services GmbH
Firmenbuch-Nr. FN 202820s
UID-Nr. ATU 50576309

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


Re: [sqlite] sqlite3_bind_int returns SQLITE_RANGE

2009-02-02 Thread P Kishor
Farzana,

You can save a lot of email back-and-forth by showing your code in the
first place. The very minimum information that you (that anyone)
should provide when asking a code-related question is --

1. db schema
2. code

adding info about computer and operating system, plus any driver
version being used, is also advisable.

On Mon, Feb 2, 2009 at 6:40 AM, hussainfarzana  wrote:
>
> Yes,the SQL prepared statement has got 14 placeholders.
>
> The statement is "INSERT INTO CollDataNum
> values(?,?,?,?,?,?,?,?,'?',?,?,?,?,?)"
>
> Regards,
> Farzana.
>
>
> SimonDavies wrote:
>>
>> 2009/2/2 hussainfarzana :
>>>
>>> Dear All,
>>>
>>> We are working with SQLite Version 3.6.10.
>>> We tried to insert or update the records in the database using
>>> sqlite3_prepare and binding the values using sqlite3_bind functions.We
>>> have
>>> started with the index 1.We have a table with 14 columns and when we use
>>> sqlite3_bind_int,for the first 13 columns its returning 0 and for the
>>> last
>>> 14th column which is also an integer datatype, but the function is
>>> returning
>>> value 25(SQLITE_RANGE) error.
>>
>> Your table may have 14 columns, but has the SQL for your prepared
>> statement got 14 parameter placeholders?
>>
>>>
>>> Please help us how to proceed further.
>>>
>>> Regards,
>>> Farzana.
>>
>> Rgds,
>> Simon
>> ___
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/sqlite3_bind_int-returns-SQLITE_RANGE-tp21788383p21788991.html
> Sent from the SQLite mailing list archive at Nabble.com.
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



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


Re: [sqlite] sqlite3_bind_int returns SQLITE_RANGE

2009-02-02 Thread hussainfarzana

Yes,the SQL prepared statement has got 14 placeholders.

The statement is "INSERT INTO CollDataNum
values(?,?,?,?,?,?,?,?,'?',?,?,?,?,?)"

Regards,
Farzana.


SimonDavies wrote:
> 
> 2009/2/2 hussainfarzana :
>>
>> Dear All,
>>
>> We are working with SQLite Version 3.6.10.
>> We tried to insert or update the records in the database using
>> sqlite3_prepare and binding the values using sqlite3_bind functions.We
>> have
>> started with the index 1.We have a table with 14 columns and when we use
>> sqlite3_bind_int,for the first 13 columns its returning 0 and for the
>> last
>> 14th column which is also an integer datatype, but the function is
>> returning
>> value 25(SQLITE_RANGE) error.
> 
> Your table may have 14 columns, but has the SQL for your prepared
> statement got 14 parameter placeholders?
> 
>>
>> Please help us how to proceed further.
>>
>> Regards,
>> Farzana.
> 
> Rgds,
> Simon
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/sqlite3_bind_int-returns-SQLITE_RANGE-tp21788383p21788991.html
Sent from the SQLite mailing list archive at Nabble.com.

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


Re: [sqlite] sqlite3_bind_int returns SQLITE_RANGE

2009-02-02 Thread Simon Davies
2009/2/2 hussainfarzana :
>
> Dear All,
>
> We are working with SQLite Version 3.6.10.
> We tried to insert or update the records in the database using
> sqlite3_prepare and binding the values using sqlite3_bind functions.We have
> started with the index 1.We have a table with 14 columns and when we use
> sqlite3_bind_int,for the first 13 columns its returning 0 and for the last
> 14th column which is also an integer datatype, but the function is returning
> value 25(SQLITE_RANGE) error.

Your table may have 14 columns, but has the SQL for your prepared
statement got 14 parameter placeholders?

>
> Please help us how to proceed further.
>
> Regards,
> Farzana.

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


[sqlite] sqlite3_bind_int returns SQLITE_RANGE

2009-02-02 Thread hussainfarzana

Dear All,

We are working with SQLite Version 3.6.10.
We tried to insert or update the records in the database using
sqlite3_prepare and binding the values using sqlite3_bind functions.We have
started with the index 1.We have a table with 14 columns and when we use
sqlite3_bind_int,for the first 13 columns its returning 0 and for the last
14th column which is also an integer datatype, but the function is returning
value 25(SQLITE_RANGE) error.

Please help us how to proceed further.

Regards,
Farzana.
-- 
View this message in context: 
http://www.nabble.com/sqlite3_bind_int-returns-SQLITE_RANGE-tp21788383p21788383.html
Sent from the SQLite mailing list archive at Nabble.com.

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


[sqlite] SQLite compile errors with gcc

2009-02-02 Thread xianzhang

Hello.

I am trying to install the SQLite package for R. When I was compiling the
source  RSQLite_0.7-1.tar.gz, I got the following error message:

sqlite/sqlite3.c:18848:3: #error SQLite will not work correctly with the
-ffast-math option of GCC
 
The compiler was gcc version 3.4.6 20060404 (Red Hat 3.4.6-8). 

Any ideas how I can fix this? Thanks!

-- 
View this message in context: 
http://www.nabble.com/SQLite-compile-errors-with-gcc-tp21787175p21787175.html
Sent from the SQLite mailing list archive at Nabble.com.

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


Re: [sqlite] onthefly Compression of SQLite database

2009-02-02 Thread Alexey Pechnikov
Hello!

В сообщении от Monday 02 February 2009 03:31:16 Lukas Haase написал(а):
> I searched a little bit with google but I could not find any code or
> extensions to compress an SQLite database on the fly. Is this possible?

There are functions compress/uncompress in attached file.

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


Re: [sqlite] onthefly Compression of SQLite database

2009-02-02 Thread Michael Knigge
> VARCHARs. In total, my SQLite database is about 100MB. Very, very huge.

100 MB? Come on, this isn't that "BIG"


> It seems that compressing an SQLite database is very efficient. Is there 
> any way to compress/decompress a whole database on the fly ?

Well, you could license the CEROD extension, see 
http://www.hwaci.com/sw/sqlite/cerod.html

If this is too expensive for you, you could think about using the 
compression techniques built into your operating system. So you could 
use the compression of NTFS-Filesystems to use compression on the fly 
(you can compress individual files and don't need to compress a complete 
drive or directory). But check the performance!

Hey... as I'm thinking about that this would be something usefull... an 
extension to the function sqlite3_open_v2(F,D,G,0): The third paramater 
could get a flag named "SQLITE_OPEN_COMPRESSED" - this would create the 
file "ntfs-compressed" if it doesn't exist


Bye,
Michael

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