Re: [sqlite] I have a stumper

2011-11-14 Thread Matt Young
You saved the day!

On Mon, Nov 14, 2011 at 2:25 PM, Igor Tandetnik  wrote:

> On 11/14/2011 5:03 PM, Matt Young wrote:
>
>> OK,I found the gotcha.  I can swap out the target table in a view, but I
>> cannot read the rowids from a view.
>>
>
> You can, if you make them part of the view:
>
> create view MyView as select rowid, * from MyTable;
>
> It might be better though to give an explicit name to the rowid column in
> your tables, by declaring a column as INTEGER PRIMARY KEY. For details, see
>
> http://sqlite.org/lang_**createtable.html#rowid
>
> --
> 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] I have a stumper

2011-11-14 Thread Igor Tandetnik

On 11/14/2011 5:03 PM, Matt Young wrote:

OK,I found the gotcha.  I can swap out the target table in a view, but I
cannot read the rowids from a view.


You can, if you make them part of the view:

create view MyView as select rowid, * from MyTable;

It might be better though to give an explicit name to the rowid column 
in your tables, by declaring a column as INTEGER PRIMARY KEY. For 
details, see


http://sqlite.org/lang_createtable.html#rowid

--
Igor Tandetnik

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


Re: [sqlite] I have a stumper

2011-11-14 Thread Matt Young
OK,I found the gotcha.  I can swap out the target table in a view, but I
cannot read the rowids from a view.

So, do I have t, are rowids unavailable in a view?

>
>
> On Mon, Nov 14, 2011 at 10:25 AM, Nico Williams wrote:
>
>> I thought nowadays SQLite3 was smart enough to re-prepare a prepared
>> statement when the schema changes.
>>
>> 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] 3.7.7.1 database corruption

2011-11-14 Thread Kees Nuyt
On Mon, 14 Nov 2011 21:03:56 +0100, Kees Nuyt 
wrote:

>I can image. Soryy, I have no more ideas.

Oops. Make that:
I can imagine. Sorry, I have no more ideas.
-- 
  (  Kees Nuyt
  )
c[_]
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] 3.7.7.1 database corruption

2011-11-14 Thread Kees Nuyt
On Mon, 14 Nov 2011 18:24:46 +0100, "Alexandr N?mec"
 wrote:

>Thanks again for your answer,
> 
> no, no dangerous pragmas, no journal file removing.
> Our file system is NTFS so I hope that no stupid
> things are done by the file system :). In fact,
> we changed just two things only in the amalgamation file
> - we increased SQLITE_MAX_PAGE_COUNT to 2 000 000 000
>  and are using SQLITE_THREADSAFE 2
> - we are using multiple database files from inside one
> application, but there are separate database connections
> for each file and every connection is accessed by a single
> thread only (but two queries for two different files using
> two different connections can run simultanously in our app).
> So I hope we are correct here.

That all sounds healthy to me.

> We tested a lot of crash situations in the past and never
> experienced a problem.
> Now we were very surprised about the missing pages.

I can image. Soryy, I have no more ideas.

>Thanks.
> 
>Alex
>
>__
>> Od: "Kees Nuyt" 
>> Komu: 
>> Datum: 14.11.2011 15:52
>> P?edm?t: Re: [sqlite] 3.7.7.1 database corruption
>>
>On Mon, 14 Nov 2011 14:16:46 +0100, "Alexandr N?mec"
> wrote:
>
>> Dear Richard,
>> 
>> huh, thanks very much for the information, I see.
>> But anybody having an idea how this can happen?
>> There was a power outage and after restart 6 pages
>> of the database file are missing...
>> We checked the disk carefuly, no bad sector etc.
>> What can be the reason for this?
>
>The disk or the filesystem may have confirmed a write or sync
>while in fact the data wasn't on disk yet.
>Maybe the filesystem metadata is updated in a separate
>transaction, or your filesystem doesn't journal metadata.
>fsck only repairs inconsistencies it can find, depending on teh
>filesystem used there are quite a few corruptions it cannot detect
>nor repair.
>
>Did you use any dangerous PRAGMA to speed things up, like running
>without database journals? 
>
>Does some startup script remove journal files before the database
>is connected to by an application?
-- 
  (  Kees Nuyt
  )
c[_]
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Custom Column Default

2011-11-14 Thread Jay A. Kreibich
On Mon, Nov 14, 2011 at 12:49:46PM -0600, GGTESTER scratched on the wall:
> Can anybody show me how to use a function like
> "hex(randomblob(37))" as a column default (to create a SQL Server type
> unique identifier)?

  Expressions much be in parens.  Otherwise, just as you would expect:


sqlite> CREATE TABLE t ( r DEFAULT (  hex(randomblob(37)) )  );
sqlite> INSERT INTO t DEFAULT VALUES;
sqlite> INSERT INTO t DEFAULT VALUES;
sqlite> INSERT INTO t DEFAULT VALUES;
sqlite> INSERT INTO t DEFAULT VALUES;
sqlite> INSERT INTO t DEFAULT VALUES;
sqlite> SELECT * FROM t;
0530ABEA69D05C61F820BE6D06B3F394E4BF43DE5D120AD5BF91A7337AD5864494F04E2A8F
0471D87FEF35D4BD0D563BB1F28392B292EC45D169926A63823C27AB734905B71402030869
C402005D96F3C8EB6EA6652893019DEEF0E9F2D4F2449D76BDF76D7B38693B1A3218A2E026
11161A109353822ED6D708482D0490FAA3647EC7590FDF912F334D84B88D0EAE9962CDE463
6B37D811DE4ED9CDB4D96877C32D0B710CB7EEC11C9E428CA6AAEE9FDA74932E4EFF67AC5E
sqlite> 


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

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] PHP & SQLite examples

2011-11-14 Thread David Garfield
Please, be correct.  There are no secure ways to communicate.  Period.

Neither "persistent SQL datastores" or "websockets" will get you
secure communication.  Nor will SSL, or anything else.

Paranoia is essential in writing communication software.  (Of course,
paranoia is important in writing any software, but in communications,
you can't even trust yourself.)

http://xkcd.com/327/

--David Garfield

Simon Slavin writes:
> 
> On 14 Nov 2011, at 5:53pm, Dotan Cohen wrote:
> 
> > I recommend against formulating the SQL statements in Javascript.
> > Because if I find that page, I _will_ try to inject my own SQL.
> 
> My code on the PHP side executes only the first SQL command.  And
> there a hash.  But yes, people should be careful with doing things
> like that.
> 
> Unfortunately there are no secure ways to communicate between
> JavaScript and PHP.  Because whatever you do, you're still sending a
> text string from one to another.  You might have a protocol that the
> text string is XML or JSON but when it comes down to it, you hacker
> will figure that out too.  It's a nasty security problem with
> AJAX/SOAP/REST web apps which will be solved only when we all move
> to persistent SQL datastores or to websockets, both of which are in
> HTML5.
> 
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

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


[sqlite] Custom Column Default

2011-11-14 Thread GGTESTER

Can anybody show me how to use a function like
"hex(randomblob(37))" as a column default (to create a SQL Server type
unique identifier)?

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


Re: [sqlite] I have a stumper

2011-11-14 Thread Matt Young
I am still learning its behavior.
But, my experiment still works, even in embedded.  I want lots of
procedures working on the same table format, with different table names.
 So far, I write the procedures using table view.  As of right now, I can
change the table names using alter table rename and the view target to slip
different tale under the biews.  and is directed to the same file name with
different data  The works even for compiled statements.

Kind of neat, if it holds up. I dunno, maybe version 2 checks the list of
views on an alter table name, and recompiled the statement?  I  am using, I
don;t care if is fake, but I do care if there are gotchas!

Tell me, why does this work? And if it works, why  aren't we advertising it?
  Matt


On Mon, Nov 14, 2011 at 10:25 AM, Nico Williams wrote:

> I thought nowadays SQLite3 was smart enough to re-prepare a prepared
> statement when the schema changes.
>
> 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] more than 2000 columns

2011-11-14 Thread Gabor Grothendieck
On Mon, Nov 14, 2011 at 12:50 PM, Simon Slavin  wrote:
>
> On 14 Nov 2011, at 5:11pm, Gabor Grothendieck wrote:
>
>> The requirement for a large number of columns is actually one thing
>> that is often needed when using sqlite from R.  Typically the use case
>> is that a user wishes to read a portion of an external file into R and
>> that file has thousands of columns.  For example, each row might be an
>> individual and each column is a gene.
>
> That would be a text file, right ?  So SQLite isn't involved in that.  You 
> have other routines to read text files.
>

Yes. Its text.  Also this is not application specific.  Its a general
facility that everyone uses so writing application specific routines
is completely out of the question here.

>> Or each row is a time point and
>> each column is a security (stock, bond, etc.)  The file may too large
>> to reasonably handle in memory so rather than deal with it in chunks
>> at a time its easier to just read it into sqlite in its entirety and
>> then pick off the portion you want into R using sql.
>
> So I actually have R on my Mac and I went and had a look.  You're talking 
> about using RSQLite ?  Yes, there are fast ways to move data between a SQLite 
> table and an R matrix.  I can see the appeal.  But you can also execute 
> arbitrary SQL commands.  So you can write your own import/export routine 
> which takes a very wide matrix from R but stores it in a less wide table in 
> SQLite.
>

What users want is to get access to their data with as little hassle
as possible and currently its possible to do it all in one line of R
code which sets up an sqlite database and table, reads the data into
it and then applies a given sql statement to that and finally destroys
the database.  Its trivial to do.  The only limitation is that the
file can have no more than 999 columns as its currently set up.  In
most cases that works but some people have wider files and there are
constantly requests to increase the limit.  All you do is provide the
filename, certain parameters such as the input field separator and
optionally the sql statement (which defaults to select * from file).
Its very easy from the user's point of view. Its just one line of
code.

> What I think you're trying to do is use a SQLite table as a data frame.  If I 
> understand correctly, this means you can use the commands you'd normally use 
> with an R matrix, but with data still stored in a SQLite table, without 
> having to rewrite the code of your program.  It's a really neat hack.
>
> Trouble is, SQLite isn't efficient with such wide tables.  Your code is going 
> to operate really slowly.  I'm going to have to get backup from SQLite 
> experts here, but I understand that unlike how matrices are stored in R, a 
> table's columns are stored in a structure like a linked list.  So if you try 
> to access the 1,400th column it has to walk a list of 1,399 items to find it. 
>  Which isn't efficient.
>

I am not aware of any performance tests on very wide files with sqlite
followed by moving them into R but with the usual files of just a
handful of columns it is sufficiently fast -- its so fast that at
times it can be faster to read it into sqlite and then from there into
R than reading the file straight into R (in those cases where both are
possible). We will see what happens when it gets expanded beyond 999.
A previous thread on this list suggested that there was no real
downside to expanding the limit.  I asked for clarification at the
time but no one responded.

> So fine.  Use SQLite to store tables as wide as you like.  But write your own 
> import/export commands to fetch appropriate parts into memory.  There's no 
> need to use a SQLite table 2000 columns wide just because your matrix is 2000 
> columns wide.  Purely a recommendation for serious software intended for 
> proper use.  Do anything you like in quick hacks: CPU time and memory usage 
> can be stupid big for those.
>

I am not clear on what you are suggesting but the way it works is that
the file gets read in its entirety into an sqlite database and then an
sql statement specified by the user is applied to that and only the
output of the sql statement ever gets sent to R so even if the input
has thousands of columns, the data sent from sqlite to R might not.

Hope that clarifies the situation.

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] I have a stumper

2011-11-14 Thread Nico Williams
I thought nowadays SQLite3 was smart enough to re-prepare a prepared
statement when the schema changes.

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


Re: [sqlite] PHP & SQLite examples

2011-11-14 Thread Simon Slavin

On 14 Nov 2011, at 5:53pm, Dotan Cohen wrote:

> I recommend against formulating the SQL statements in Javascript.
> Because if I find that page, I _will_ try to inject my own SQL.

My code on the PHP side executes only the first SQL command.  And there a hash. 
 But yes, people should be careful with doing things like that.

Unfortunately there are no secure ways to communicate between JavaScript and 
PHP.  Because whatever you do, you're still sending a text string from one to 
another.  You might have a protocol that the text string is XML or JSON but 
when it comes down to it, you hacker will figure that out too.  It's a nasty 
security problem with AJAX/SOAP/REST web apps which will be solved only when we 
all move to persistent SQL datastores or to websockets, both of which are in 
HTML5.

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


Re: [sqlite] PHP & SQLite examples

2011-11-14 Thread Dotan Cohen
On Mon, Nov 14, 2011 at 13:43, Simon Slavin  wrote:
>
> On 14 Nov 2011, at 10:45am, Gert Van Assche wrote:
>
>> I would like to understand how a PHP web page communicates with  SQLite.
>
> All my responses to this are general, with a little hand-waving and 
> simplification.  And other posters to this list may have other points of 
> view.  I'm just trying to provide some knowledge that I have.
>
>> I
>> know something about SQLite, but nothing or not a lot about PHP.
>
> There are two common ways to do this.  One is to write your complete program 
> in PHP: talking to the SQLite database, constructing the web pages and 
> getting the values entered by the user.  The other is to write most of your 
> code in JavaScript and call PHP code simply for access to the SQLite 
> database.  So you might write one or three tiny PHP programs which just took 
> some parameters for which database and what command, executed the command, 
> and returned the results in XML or JSON format.
>
> People like to write more of their code in JavaScript these days, so they 
> just write little PHP shims, but if you're really into PHP, or want to put 
> more load on your server and less on your clients, you can go the other way.
>
> When using PHP to talk to a SQLite database you have the choice between two 
> options: the PDO API and the SQLite3 API.
>
> http://php.net/manual/en/book.pdo.php
> http://www.php.net/manual/en/book.sqlite3.php
>
> The advantage of the PDO API is that the necessary changes, should you ever 
> need to move from SQLite to another DBMS, are smaller.  Unfortunately, it 
> means that the commands you're issuing, and the results you get back, are 
> quite a long way from SQLite, and there are certain things you can't do 
> because it's a standardised interface intended for use with many different 
> database engines.  If you are already familiar with SQLite I'd recommend you 
> stick with the SQLite3 API which is a very thin conversion of the SQLite3 C 
> functions into PHP functions.
>
>>   - How does one take input from an input field or a check box and use it
>>   for doing an "INSERT" for instance?
>
> Your JavaScript code, or the PHP code you get as a result of the POST, 
> retrieves the values of the fields and makes up the appropriate SQL command 
> from it.  A trivial JavaScript example plucked from one of my utilities is
>
>    var newValue = prompt('Enter new value for column "'+colName+'" of row 
> '+rowName+'.', oldValue)
>    if (newValue != null && newValue != oldValue) {
>        var theCommand = "UPDATE "+tableName+" SET "+colName+" = 
> '"+newValue+"' WHERE rowid = "+rowName
>        doSQLite(theCommand)
>        clickedCell.innerHTML = newValue
>    }
>
>>   - How does one do a SELECT query based on what has been selected from a
>>   dropdown box?
>
> As above.  Retrieve the value which was selected, then construct a string 
> holding the appropriate SQL command.  Then pass that string to SQLite.
>
>>   - How do you fill a dropdown box with values retrieved from a table?
>>   - ...
>
> Write some PHP code which does a SELECT which returns the values which should 
> go into the dropdown box (both the text to be shown in on the screen and the 
> values to be set).  Then write PHP or JavaScript code which uses the result 
> of this query to construct the dropdown box using HTML DOM components.  A 
> trivial JavaScript example
>
>            var newPopup = document.createElement("select")
>            newPopup.id = newSelectID
>            for (i = 0; i < paramArray.length; i = i + 1) {
>                newOption = document.createElement("option")
>                newOption.text = paramArray[i]
>                newPopup.appendChild(newOption, null)
>            }
>            newPopup.addEventListener("change", handleFieldChange, true)
>
>> Does anyone have an example that I could use? I want to see if I can make a
>> mockup with PHP & SQLite.
>
> There are plenty around but you can't have mine.
>
> Simon.

I recommend against formulating the SQL statements in Javascript.
Because if I find that page, I _will_ try to inject my own SQL.

Do as much as you can on the server. This particular exercise has no
need of javascript.


-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] more than 2000 columns

2011-11-14 Thread Simon Slavin

On 14 Nov 2011, at 5:11pm, Gabor Grothendieck wrote:

> The requirement for a large number of columns is actually one thing
> that is often needed when using sqlite from R.  Typically the use case
> is that a user wishes to read a portion of an external file into R and
> that file has thousands of columns.  For example, each row might be an
> individual and each column is a gene.

That would be a text file, right ?  So SQLite isn't involved in that.  You have 
other routines to read text files.

> Or each row is a time point and
> each column is a security (stock, bond, etc.)  The file may too large
> to reasonably handle in memory so rather than deal with it in chunks
> at a time its easier to just read it into sqlite in its entirety and
> then pick off the portion you want into R using sql.

So I actually have R on my Mac and I went and had a look.  You're talking about 
using RSQLite ?  Yes, there are fast ways to move data between a SQLite table 
and an R matrix.  I can see the appeal.  But you can also execute arbitrary SQL 
commands.  So you can write your own import/export routine which takes a very 
wide matrix from R but stores it in a less wide table in SQLite.

What I think you're trying to do is use a SQLite table as a data frame.  If I 
understand correctly, this means you can use the commands you'd normally use 
with an R matrix, but with data still stored in a SQLite table, without having 
to rewrite the code of your program.  It's a really neat hack.

Trouble is, SQLite isn't efficient with such wide tables.  Your code is going 
to operate really slowly.  I'm going to have to get backup from SQLite experts 
here, but I understand that unlike how matrices are stored in R, a table's 
columns are stored in a structure like a linked list.  So if you try to access 
the 1,400th column it has to walk a list of 1,399 items to find it.  Which 
isn't efficient.

So fine.  Use SQLite to store tables as wide as you like.  But write your own 
import/export commands to fetch appropriate parts into memory.  There's no need 
to use a SQLite table 2000 columns wide just because your matrix is 2000 
columns wide.  Purely a recommendation for serious software intended for proper 
use.  Do anything you like in quick hacks: CPU time and memory usage can be 
stupid big for those.

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


Re: [sqlite] more than 2000 columns

2011-11-14 Thread Gabor Grothendieck
On Mon, Nov 14, 2011 at 12:21 PM, Igor Tandetnik  wrote:
> On 11/14/2011 12:11 PM, Gabor Grothendieck wrote:
>>
>> The requirement for a large number of columns is actually one thing
>> that is often needed when using sqlite from R.  Typically the use case
>> is that a user wishes to read a portion of an external file into R and
>> that file has thousands of columns.  For example, each row might be an
>> individual and each column is a gene.  Or each row is a time point and
>> each column is a security (stock, bond, etc.)
>
> In relational databases, things like that are usually represented as
> GeneInfo(person, gene, infoAboutGene) or StockInfo(timestamp, stock, price)

That is a good point; however, in the context of this use case we are
dealing with external files and don't have control over their format.

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] 3.7.7.1 database corruption

2011-11-14 Thread Alexandr Němec

Thanks again for your answer,
 
no, no dangerous pragmas, no journal file removing. Our file system is NTFS so 
I hope that no stupid things are done by the file system :). In fact, we 
changed just two things only in the amalgamation file - we increased 
SQLITE_MAX_PAGE_COUNT to 2 000 000 000 and are using SQLITE_THREADSAFE 2 - we 
are using multiple database files from inside one application, but there are 
separate database connections for each file and every connection is accessed by 
a single thread only (but two queries for two different files using two 
different connections can run simultanously in our app). So I hope we are 
correct here. We tested a lot of crash situations in the past and never 
experienced a problem. Now we were very surprised about the missing pages.
 
Thanks.
 
Alex

__
Od: "Kees Nuyt" 
Komu: 
Datum: 14.11.2011 15:52

Předmět: Re: [sqlite] 3.7.7.1 database corruption


On Mon, 14 Nov 2011 14:16:46 +0100, "Alexandr N?mec"
wrote:


Dear Richard,
 
huh, thanks very much for the information, I see.
But anybody having an idea how this can happen?
There was a power outage and after restart 6 pages
of the database file are missing...
We checked the disk carefuly, no bad sector etc.
What can be the reason for this?


The disk or the filesystem may have confirmed a write or sync
while in fact the data wasn't on disk yet.
Maybe the filesystem metadata is updated in a separate
transaction, or your filesystem doesn't journal metadata.
fsck only repairs inconsistencies it can find, depending on teh
filesystem used there are quite a few corruptions it cannot detect
nor repair.

Did you use any dangerous PRAGMA to speed things up, like running
without database journals? 


Does some startup script remove journal files before the database
is connected to by an application?
--
 (  Kees Nuyt
 )
c[_]
___
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] more than 2000 columns

2011-11-14 Thread Igor Tandetnik

On 11/14/2011 12:11 PM, Gabor Grothendieck wrote:

The requirement for a large number of columns is actually one thing
that is often needed when using sqlite from R.  Typically the use case
is that a user wishes to read a portion of an external file into R and
that file has thousands of columns.  For example, each row might be an
individual and each column is a gene.  Or each row is a time point and
each column is a security (stock, bond, etc.)


In relational databases, things like that are usually represented as 
GeneInfo(person, gene, infoAboutGene) or StockInfo(timestamp, stock, price)

--
Igor Tandetnik

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


Re: [sqlite] more than 2000 columns

2011-11-14 Thread Gabor Grothendieck
On Mon, Nov 14, 2011 at 5:32 AM, Simon Slavin  wrote:
>
> On 14 Nov 2011, at 7:38am, vinayh4 wrote:
>
>> I need to create table with more than 2000 columns, How to reset
>> SQLITE_MAX_COLUMN value which
>> is  2000 . Plz help me on this issue.
>
> You almost never need to have more columns than you can fit in your head at 
> one time.  The way you handle 2000 columns is to make a database for them !

The requirement for a large number of columns is actually one thing
that is often needed when using sqlite from R.  Typically the use case
is that a user wishes to read a portion of an external file into R and
that file has thousands of columns.  For example, each row might be an
individual and each column is a gene.  Or each row is a time point and
each column is a security (stock, bond, etc.)  The file may too large
to reasonably handle in memory so rather than deal with it in chunks
at a time its easier to just read it into sqlite in its entirety and
then pick off the portion you want into R using sql.

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Number of transactions per second with WAL mode

2011-11-14 Thread Paxdo Presse


ok, thank you all.

Le 14 nov. 2011 à 16:57, Simon Slavin a écrit :

> 
> On 14 Nov 2011, at 3:49pm, Paxdo Presse wrote:
> 
>> I hesitate a lot in my choice of database for my web application. 
>> I guess the use of SSD dramatically increases the performance of SQLite. 
>> SQLITE work properly on SSD?
> 
> Yes, there are many users of SQLite using SSD.  In fact SQLite is used by the 
> Macintosh operating system and many Macintoshes come with SSD now.  So there 
> are at least half a million users.
> 
> If you are comparing SQLite with other database systems you should read the 
> end of this page:
> 
> 
> 
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

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


Re: [sqlite] Number of transactions per second with WAL mode

2011-11-14 Thread Simon Slavin

On 14 Nov 2011, at 3:49pm, Paxdo Presse wrote:

> I hesitate a lot in my choice of database for my web application. 
> I guess the use of SSD dramatically increases the performance of SQLite. 
> SQLITE work properly on SSD?

Yes, there are many users of SQLite using SSD.  In fact SQLite is used by the 
Macintosh operating system and many Macintoshes come with SSD now.  So there 
are at least half a million users.

If you are comparing SQLite with other database systems you should read the end 
of this page:



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


Re: [sqlite] Number of transactions per second with WAL mode

2011-11-14 Thread Petite Abeille

On Nov 14, 2011, at 4:49 PM, Paxdo Presse wrote:

> I hesitate a lot in my choice of database for my web application. 

FWIW...

Situations Where SQLite Works Well

• Websites

SQLite usually will work great as the database engine for low to medium traffic 
websites (which is to say, 99.9% of all websites). The amount of web traffic 
that SQLite can handle depends, of course, on how heavily the website uses its 
database. Generally speaking, any site that gets fewer than 100K hits/day 
should work fine with SQLite. The 100K hits/day figure is a conservative 
estimate, not a hard upper bound. SQLite has been demonstrated to work with 10 
times that amount of traffic.

http://www.sqlite.org/draft/whentouse.html

> I guess the use of SSD dramatically increases the performance of SQLite.

Yes.

> SQLITE work properly on SSD?

Yes.

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


Re: [sqlite] Number of transactions per second with WAL mode

2011-11-14 Thread Paxdo Presse

Thank you.

I hesitate a lot in my choice of database for my web application. 
I guess the use of SSD dramatically increases the performance of SQLite. SQLITE 
work properly on SSD?

Le 14 nov. 2011 à 16:37, Simon Slavin a écrit :

> 
> On 14 Nov 2011, at 3:05pm, Paxdo Presse wrote:
> 
>> It's not easy to calculate how many simultaneous users the database can 
>> handle.
> 
> You are correct.  It changes depending on what hard disk the database is 
> stored on, what networking methods you are using, how fast your copy of PHP 
> is running, how much memory your web server has, how much memory your file 
> server has, and many other things.  We cannot even give you a clue, I'm 
> afraid.  The only approach is to try it.
> 
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

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


Re: [sqlite] Number of transactions per second with WAL mode

2011-11-14 Thread Simon Slavin

On 14 Nov 2011, at 3:05pm, Paxdo Presse wrote:

> It's not easy to calculate how many simultaneous users the database can 
> handle.

You are correct.  It changes depending on what hard disk the database is stored 
on, what networking methods you are using, how fast your copy of PHP is 
running, how much memory your web server has, how much memory your file server 
has, and many other things.  We cannot even give you a clue, I'm afraid.  The 
only approach is to try it.

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


Re: [sqlite] Number of transactions per second with WAL mode

2011-11-14 Thread Paxdo Presse

Thanks to both :-)

It's not easy to calculate how many simultaneous users the database can handle.


Le 14 nov. 2011 à 15:58, Petite Abeille a écrit :

> 
> On Nov 14, 2011, at 3:53 PM, Paxdo Presse wrote:
> 
>> If each thread writing (a transaction that contains one or more 
>> INSERT/UPDATE) takes an average of 10 ticks, and each thread reading (a 
>> transaction that contains one or more SELECT) takes an average of 10 ticks, 
>> I would like to know how many thread SQLite can handle in one second or one 
>> minute, very roughly, with WAL.
> 
> As many as your hardware can sustain.
> 
> ___
> 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] Number of transactions per second with WAL mode

2011-11-14 Thread Petite Abeille

On Nov 14, 2011, at 3:53 PM, Paxdo Presse wrote:

> If each thread writing (a transaction that contains one or more 
> INSERT/UPDATE) takes an average of 10 ticks, and each thread reading (a 
> transaction that contains one or more SELECT) takes an average of 10 ticks, I 
> would like to know how many thread SQLite can handle in one second or one 
> minute, very roughly, with WAL.

As many as your hardware can sustain.

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


Re: [sqlite] Number of transactions per second with WAL mode

2011-11-14 Thread Paxdo Presse


Thank you, but the question is not how I can insert records per second.

it is for a web application (multiuser, WAL mode). 

Many threads (connections via internet) can access the database. 

If each thread writing (a transaction that contains one or more INSERT/UPDATE) 
takes an average of 10 ticks, and each thread reading (a transaction that 
contains one or more SELECT) takes an average of 10 ticks, I would like to know 
how many thread SQLite can handle in one second or one minute, very roughly, 
with WAL.

Le 14 nov. 2011 à 15:42, Petite Abeille a écrit :

> 
> On Nov 14, 2011, at 3:33 PM, Paxdo Presse wrote:
> 
>> If my write transactions consume an average of 10 ticks (1 ticks = 60th of a 
>> second), it means that I can get very approximately 6 write operations per 
>> second? (with a recent computer powerful enough).
>> At the same time, how many read operations (an average of 10 ticks) do you 
>> think SQLITE can do?
> 
> 15:56:06 [ETL.Load] Inserting into movie
> 15:56:41 [ETL.Load] Inserted 1846820 rows into movie
> 
> If you can insert 1,846,820 rows in 35 seconds, or around 57,766  rows per 
> second, what's the age of the DBA?
> 
> 
> ___
> 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] 3.7.7.1 database corruption

2011-11-14 Thread Kees Nuyt
On Mon, 14 Nov 2011 14:16:46 +0100, "Alexandr N?mec"
 wrote:

> Dear Richard,
> 
> huh, thanks very much for the information, I see.
> But anybody having an idea how this can happen?
> There was a power outage and after restart 6 pages
> of the database file are missing...
> We checked the disk carefuly, no bad sector etc.
> What can be the reason for this?

The disk or the filesystem may have confirmed a write or sync
while in fact the data wasn't on disk yet.
Maybe the filesystem metadata is updated in a separate
transaction, or your filesystem doesn't journal metadata.
fsck only repairs inconsistencies it can find, depending on teh
filesystem used there are quite a few corruptions it cannot detect
nor repair.

Did you use any dangerous PRAGMA to speed things up, like running
without database journals? 

Does some startup script remove journal files before the database
is connected to by an application?
-- 
  (  Kees Nuyt
  )
c[_]
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Number of transactions per second with WAL mode

2011-11-14 Thread Petite Abeille

On Nov 14, 2011, at 3:45 PM, Paxdo Presse wrote:

> The writing is sequential, so I guess only one thread at a time. 

Yes, only one writer at one time.

> But for reading? Are multiple threads can "simultaneously" perform read 
> operations?

As many readers as you want.

http://www.sqlite.org/draft/wal.html

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


Re: [sqlite] Number of transactions per second with WAL mode

2011-11-14 Thread Igor Tandetnik
Paxdo Presse  wrote:
> No, I do not know how many "readind threads" SQLITE can handle simultaneously.

As many as you want. But recall that your hard drive only has one set of 
reading heads. Trying to read different parts of the database at once is likely 
to lead to excessive disk seek activity. Just blindly rampting up the number of 
threads will probably hurt performance, not help it.

> But for reading? Are multiple threads can "simultaneously" perform read 
> operations?

Yes.
-- 
Igor Tandetnik

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


Re: [sqlite] Number of transactions per second with WAL mode

2011-11-14 Thread Paxdo Presse

Le 14 nov. 2011 à 15:38, Igor Tandetnik a écrit :

> Paxdo Presse  wrote:
>> a question from a beginner please:
>> 
>> SQLITE with WAL mode.
>> 
>> If my write transactions consume an average of 10 ticks (1 ticks = 60th of a 
>> second), it means that I can get very approximately
>> 6 write operations per second? (with a recent computer powerful enough).
> 
> I'm not quite sure what you mean by "write operation". Usually, you would 
> want go group a few thousand of, say, INSERT statements into a single 
> transaction, precisely because committing a transaction is expensive and you 
> want to amortize that expense across many row writes.
> 
>> At the same time, how many read operations (an average
>> of 10 ticks) do you think SQLITE can do? 
> 
> This question makes no sense to me. You declare up front how long each 
> "operation" would take, then turn around and ask how many of them you can 
> perform in a given time. Haven't you answered your own question already?


No, I do not know how many "readind threads" SQLITE can handle simultaneously.

Since with WAL, there are two files, one for writing and another for the 
database / reading. 

The writing is sequential, so I guess only one thread at a time. 

But for reading? Are multiple threads can "simultaneously" perform read 
operations?





> -- 
> 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] Number of transactions per second with WAL mode

2011-11-14 Thread Petite Abeille

On Nov 14, 2011, at 3:33 PM, Paxdo Presse wrote:

> If my write transactions consume an average of 10 ticks (1 ticks = 60th of a 
> second), it means that I can get very approximately 6 write operations per 
> second? (with a recent computer powerful enough).
> At the same time, how many read operations (an average of 10 ticks) do you 
> think SQLITE can do?

15:56:06 [ETL.Load] Inserting into movie
15:56:41 [ETL.Load] Inserted 1846820 rows into movie

If you can insert 1,846,820 rows in 35 seconds, or around 57,766  rows per 
second, what's the age of the DBA?


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


Re: [sqlite] Number of transactions per second with WAL mode

2011-11-14 Thread Paxdo Presse


I know it depends on many things.
But in your experience, how many write transactions and read transactions could 
you see at most per second or minute?
Very approximately ? with transactions fast enough.

Le 14 nov. 2011 à 15:33, Paxdo Presse a écrit :

> 
> Hi,
> 
> a question from a beginner please:
> 
> SQLITE with WAL mode.
> 
> If my write transactions consume an average of 10 ticks (1 ticks = 60th of a 
> second), it means that I can get very approximately 6 write operations per 
> second? (with a recent computer powerful enough).
> At the same time, how many read operations (an average of 10 ticks) do you 
> think SQLITE can do?
> 
> Thank you
> 
> olivier
> ___
> 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] Docs on SQLITE_DEFAULT_WAL_AUTOCHECKPOINT

2011-11-14 Thread Black, Michael (IS)
I was looking at this:

http://www.sqlite.org/draft/compile.html#default_wal_autocheckpoint

And was wondering how to change it.



Noticed it's missing the "the compile-time default may be overidden at runtime 
by the PRAGMA wal_autocheckpoint command".



Thought someone might want to update this.  Would've made things a touch easier 
for me.





Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

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


Re: [sqlite] Number of transactions per second with WAL mode

2011-11-14 Thread Igor Tandetnik
Paxdo Presse  wrote:
> a question from a beginner please:
> 
> SQLITE with WAL mode.
> 
> If my write transactions consume an average of 10 ticks (1 ticks = 60th of a 
> second), it means that I can get very approximately
> 6 write operations per second? (with a recent computer powerful enough).

I'm not quite sure what you mean by "write operation". Usually, you would want 
go group a few thousand of, say, INSERT statements into a single transaction, 
precisely because committing a transaction is expensive and you want to 
amortize that expense across many row writes.

> At the same time, how many read operations (an average
> of 10 ticks) do you think SQLITE can do? 

This question makes no sense to me. You declare up front how long each 
"operation" would take, then turn around and ask how many of them you can 
perform in a given time. Haven't you answered your own question already?
-- 
Igor Tandetnik

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


[sqlite] Number of transactions per second with WAL mode

2011-11-14 Thread Paxdo Presse

Hi,

a question from a beginner please:

SQLITE with WAL mode.

If my write transactions consume an average of 10 ticks (1 ticks = 60th of a 
second), it means that I can get very approximately 6 write operations per 
second? (with a recent computer powerful enough).
At the same time, how many read operations (an average of 10 ticks) do you 
think SQLITE can do?

Thank you

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


Re: [sqlite] OK,OK I have an experiment

2011-11-14 Thread Igor Tandetnik
Matt Young  wrote:
> I have table1,  I make a view view one of that table.  I then delete the
> table, the view does not work.
> I then recreate the table, and alter its name to the one viewed.
> and view suddenly works.
> Am I dreaming?  Does SQLite3 maintain a schema in views an allow us to
> alter table names?

A view is nothing more than a stored SELECT statement. Basically, when you 
prepare a statement like

select * from ViewName;

it is rewritten as

select * from (select * from UnderlyingTable);

and then the result of such rewriting is parsed and processed as usual.
-- 
Igor Tandetnik

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


Re: [sqlite] I have a stumper

2011-11-14 Thread Simon Slavin

On 14 Nov 2011, at 1:52pm, Matt Young wrote:

> SQL needs a create schema, then the statement can be prepared against a
> know schema, and swap out the table pointer at run time.  The problem of
> one great sql procedure that works on many different table of the same
> format.
> 
> I have a work around.

Solutions:

A) Merge the tables which all have the same schema.  Make the table name a 
column.

B) Prepare the whole command as text, rather than binding variables.

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


[sqlite] OK,OK I have an experiment

2011-11-14 Thread Matt Young
I have table1,  I make a view view one of that table.  I then delete the
table, the view does not work.
I then recreate the table, and alter its name to the one viewed.
 and view suddenly works.
Am I dreaming?  Does SQLite3 maintain a schema in views an allow us to
alter table names?
Matt
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] I have a stumper

2011-11-14 Thread Matt Young
SQL needs a create schema, then the statement can be prepared against a
know schema, and swap out the table pointer at run time.  The problem of
one great sql procedure that works on many different table of the same
format.

I have a work around.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Integrity check reliability

2011-11-14 Thread Simon Slavin

On 14 Nov 2011, at 1:19pm, Verstappen, Jos wrote:

> Can anyone confirm that the command "PRAGMA integrity_check;" will not
> crash the SQLite code on a corrupt database?
> I made a corrupt database on purpose to test, it seems to run ok. The
> command neatly reports the corruption. But this is just one try.

The code is designed to do lots of testing and not make any assumptions.  
However, it's possible that you'll find some weird situation the programmers 
never thought of.  There's no way you're ever going to get the SQLite team to 
say that it's completely bug-free.

However, there are very few reasons to put that call in to production code 
anyway.  I would expect to see it only in utilities used by whoever wrote the 
SQLite software.  If your software or hardware is so poor that it continually 
corrupts the SQLite database you should be paying personal attention.  So of 
all the places in SQLite to put code which can crash, this is probably the best 
!

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


[sqlite] Integrity check reliability

2011-11-14 Thread Verstappen, Jos
Dear SQLite users,

Can anyone confirm that the command "PRAGMA integrity_check;" will not
crash the SQLite code on a corrupt database?
I made a corrupt database on purpose to test, it seems to run ok. The
command neatly reports the corruption. But this is just one try.


Thank you!
Jos

This message and attachment(s) are intended solely for use by the addressee and 
may contain information that is privileged, confidential or otherwise exempt 
from disclosure under applicable law.

If you are not the intended recipient or agent thereof responsible for 
delivering this message to the intended recipient, you are hereby notified that 
any dissemination, distribution or copying of this communication is strictly 
prohibited.

If you have received this communication in error, please notify the sender 
immediately by telephone and with a 'reply' message.

Thank you for your co-operation.


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


Re: [sqlite] 3.7.7.1 database corruption

2011-11-14 Thread Alexandr Němec

Dear Richard,
 
huh, thanks very much for the information, I see. But anybody having an idea 
how this can happen? There was a power outage and after restart 6 pages of the 
database file are missing... We checked the disk carefuly, no bad sector etc. 
What can be the reason for this?
 
Thanks once more.
 
Alex
 


__
Od: "Richard Hipp" 
Komu: General Discussion of SQLite Database 
Datum: 14.11.2011 14:03

Předmět: Re: [sqlite] 3.7.7.1 database corruption

2011/11/14 Alexandr Němec 


Dear Filip,

thanks for your reply. I thought that small attachments will go trough. If
I run

sqlite3 data.db
pragma integrity_check;

I receive this message only:

Error: database disk image is malformed.

Anyway, you can download the database here: http://www.u-consult.cz/db/**
server.db 



This database file has been truncated.  The last 6 pages (6144 bytes) are
missing.





No, WAL mode is not used.

Thanks very much for your help.

Alex

__**__**__


Od: "Filip Navara" Komu: General Discussion of SQLite Database Datum:
14.11.2011 11:17
Předmět: Re: [sqlite] 3.7.7.1 database corruption

 Hi Alexandr,


the mailing list doesn't allow attachments. Please send us the output
of "pragma integrity_check;" on the corrupted database file. Also, is
the database used in WAL mode?

Best regards,
Filip Navara

2011/11/14 Alexandr Němec :

 Dear all,


we are using SQLite in our projects. We are using the 3.7.7.1 version
compiled on Windows platform from the amalgamation file. One of our
servers
crashed badly (power outage) and after the server restarted, we saw that
the
database was corrupt (all queries we tried return SQLITE_CORRUPT). We had
a
look at http://www.sqlite.org/**howtocorrupt.htmland verified, that the
hardware (disk, memory) of the server should be ok - we used some hardware
tools to check. In the past we already had some crash situations and
SQLite
could recover from the crash nicely, so we were surprised that after this
crash the database was corrupt. In fact, we cant create a repro, because
we
do not know, what the server was exactly doing, so it might be difficult
to
find the reason, but we saved the corrupted database in the hope, that
somebody from the develpers (maybe) could put some light on this problem.
Because the database is rather small and is used to save some
configuration
data only, I have att
ached it to this message.

Thanks for any suggestions.

Alex



__**_
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





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

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


Re: [sqlite] I have a stumper

2011-11-14 Thread Igor Tandetnik
Matt Young  wrote:
> I install a prepared statement, but it cannot allow the table identifiers
> to be replaced with sqlite3_bind.

Of course not. How do you expect SQLite to prepare a query execution plan 
without knowing which tables it's going to execute against?

> If the table in the statements is a view,
> then I suppode it is an error to redefine the vie?

Redefining the view counts as a schema change. See 
http://sqlite.org/c3ref/prepare.html for a description of how that affects a 
prepared statement.

> Bottom line, it is an error to change any table definition in a prepared
> statement?

If you use sqlite3_prepare[16] to prepare your statement, then yes, you'll get 
an error next time you try to use it after the change, at which point you would 
need to finalize the statement and prepare it again. If you use 
sqlite3_prepare[16]_v2, then SQLite will try to re-prepare the statement 
automatically. Of course, this may still fail if the schema changed in ways 
that make the statement invalid.
-- 
Igor Tandetnik

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


Re: [sqlite] 3.7.7.1 database corruption

2011-11-14 Thread Richard Hipp
2011/11/14 Alexandr Němec 

> Dear Filip,
>
> thanks for your reply. I thought that small attachments will go trough. If
> I run
>
> sqlite3 data.db
> pragma integrity_check;
>
> I receive this message only:
>
> Error: database disk image is malformed.
>
> Anyway, you can download the database here: http://www.u-consult.cz/db/**
> server.db 
>

This database file has been truncated.  The last 6 pages (6144 bytes) are
missing.



>
> No, WAL mode is not used.
>
> Thanks very much for your help.
>
> Alex
>
> __**__**__
>
>> Od: "Filip Navara" Komu: General Discussion of SQLite Database Datum:
>> 14.11.2011 11:17
>> Předmět: Re: [sqlite] 3.7.7.1 database corruption
>>
>>  Hi Alexandr,
>
> the mailing list doesn't allow attachments. Please send us the output
> of "pragma integrity_check;" on the corrupted database file. Also, is
> the database used in WAL mode?
>
> Best regards,
> Filip Navara
>
> 2011/11/14 Alexandr Němec :
>
>  Dear all,
>>
>> we are using SQLite in our projects. We are using the 3.7.7.1 version
>> compiled on Windows platform from the amalgamation file. One of our
>> servers
>> crashed badly (power outage) and after the server restarted, we saw that
>> the
>> database was corrupt (all queries we tried return SQLITE_CORRUPT). We had
>> a
>> look at 
>> http://www.sqlite.org/**howtocorrupt.htmland
>>  verified, that the
>> hardware (disk, memory) of the server should be ok - we used some hardware
>> tools to check. In the past we already had some crash situations and
>> SQLite
>> could recover from the crash nicely, so we were surprised that after this
>> crash the database was corrupt. In fact, we cant create a repro, because
>> we
>> do not know, what the server was exactly doing, so it might be difficult
>> to
>> find the reason, but we saved the corrupted database in the hope, that
>> somebody from the develpers (maybe) could put some light on this problem.
>> Because the database is rather small and is used to save some
>> configuration
>> data only, I have att
>> ached it to this message.
>>
>> Thanks for any suggestions.
>>
>> Alex
>>
>>
>>
>> __**_
>> 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
>
>


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


[sqlite] I have a stumper

2011-11-14 Thread Matt Young
Using cv api.
I install a prepared statement, but it cannot allow the table identifiers
to be replaced with sqlite3_bind. If the table in the statements is a view,
then I suppode it is an error to redefine the vie?

Bottom line, it is an error to change any table definition in a prepared
statement?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] 3.7.7.1 database corruption

2011-11-14 Thread Alexandr Němec

Dear Filip,
 
thanks for your reply. I thought that small attachments will go trough. If I run
 
sqlite3 data.db
pragma integrity_check;
 
I receive this message only:
 
Error: database disk image is malformed.
 
Anyway, you can download the database here: http://www.u-consult.cz/db/server.db
 
No, WAL mode is not used.
 
Thanks very much for your help.
 
Alex

__
Od: "Filip Navara" 
Komu: General Discussion of SQLite Database 
Datum: 14.11.2011 11:17

Předmět: Re: [sqlite] 3.7.7.1 database corruption


Hi Alexandr,

the mailing list doesn't allow attachments. Please send us the output
of "pragma integrity_check;" on the corrupted database file. Also, is
the database used in WAL mode?

Best regards,
Filip Navara

2011/11/14 Alexandr Němec :

Dear all,

we are using SQLite in our projects. We are using the 3.7.7.1 version
compiled on Windows platform from the amalgamation file. One of our servers
crashed badly (power outage) and after the server restarted, we saw that the
database was corrupt (all queries we tried return SQLITE_CORRUPT). We had a
look at http://www.sqlite.org/howtocorrupt.html and verified, that the
hardware (disk, memory) of the server should be ok - we used some hardware
tools to check. In the past we already had some crash situations and SQLite
could recover from the crash nicely, so we were surprised that after this
crash the database was corrupt. In fact, we cant create a repro, because we
do not know, what the server was exactly doing, so it might be difficult to
find the reason, but we saved the corrupted database in the hope, that
somebody from the develpers (maybe) could put some light on this problem.
Because the database is rather small and is used to save some configuration
data only, I have att
ached it to this message.

Thanks for any suggestions.

Alex



___
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] more than 2000 columns

2011-11-14 Thread Jay A. Kreibich
On Mon, Nov 14, 2011 at 02:41:55AM -0800, vinayh4 scratched on the wall:
> 
> Hi Simon
> 
>   In my application a ESB will update more than 2000 columns in
> simultaneously based on some algorithm 
> processing in real time . So i need to create single table with 2000 columns
> updated based on result
> of processing of records.
> 
> So i need to know how extend no of columns per table for SQLite Table.

  http://sqlite.org/limits.html#max_column

  Just redefine and recompile.

   -j

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

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] PHP & SQLite examples

2011-11-14 Thread Simon Slavin

On 14 Nov 2011, at 10:45am, Gert Van Assche wrote:

> I would like to understand how a PHP web page communicates with  SQLite.

All my responses to this are general, with a little hand-waving and 
simplification.  And other posters to this list may have other points of view.  
I'm just trying to provide some knowledge that I have.

> I
> know something about SQLite, but nothing or not a lot about PHP.

There are two common ways to do this.  One is to write your complete program in 
PHP: talking to the SQLite database, constructing the web pages and getting the 
values entered by the user.  The other is to write most of your code in 
JavaScript and call PHP code simply for access to the SQLite database.  So you 
might write one or three tiny PHP programs which just took some parameters for 
which database and what command, executed the command, and returned the results 
in XML or JSON format.

People like to write more of their code in JavaScript these days, so they just 
write little PHP shims, but if you're really into PHP, or want to put more load 
on your server and less on your clients, you can go the other way.

When using PHP to talk to a SQLite database you have the choice between two 
options: the PDO API and the SQLite3 API.

http://php.net/manual/en/book.pdo.php
http://www.php.net/manual/en/book.sqlite3.php

The advantage of the PDO API is that the necessary changes, should you ever 
need to move from SQLite to another DBMS, are smaller.  Unfortunately, it means 
that the commands you're issuing, and the results you get back, are quite a 
long way from SQLite, and there are certain things you can't do because it's a 
standardised interface intended for use with many different database engines.  
If you are already familiar with SQLite I'd recommend you stick with the 
SQLite3 API which is a very thin conversion of the SQLite3 C functions into PHP 
functions.

>   - How does one take input from an input field or a check box and use it
>   for doing an "INSERT" for instance?

Your JavaScript code, or the PHP code you get as a result of the POST, 
retrieves the values of the fields and makes up the appropriate SQL command 
from it.  A trivial JavaScript example plucked from one of my utilities is

var newValue = prompt('Enter new value for column "'+colName+'" of row 
'+rowName+'.', oldValue)
if (newValue != null && newValue != oldValue) {
var theCommand = "UPDATE "+tableName+" SET "+colName+" = '"+newValue+"' 
WHERE rowid = "+rowName
doSQLite(theCommand)
clickedCell.innerHTML = newValue
}

>   - How does one do a SELECT query based on what has been selected from a
>   dropdown box?

As above.  Retrieve the value which was selected, then construct a string 
holding the appropriate SQL command.  Then pass that string to SQLite.

>   - How do you fill a dropdown box with values retrieved from a table?
>   - ...

Write some PHP code which does a SELECT which returns the values which should 
go into the dropdown box (both the text to be shown in on the screen and the 
values to be set).  Then write PHP or JavaScript code which uses the result of 
this query to construct the dropdown box using HTML DOM components.  A trivial 
JavaScript example

var newPopup = document.createElement("select")
newPopup.id = newSelectID
for (i = 0; i < paramArray.length; i = i + 1) {
newOption = document.createElement("option")
newOption.text = paramArray[i]
newPopup.appendChild(newOption, null)
}
newPopup.addEventListener("change", handleFieldChange, true)

> Does anyone have an example that I could use? I want to see if I can make a
> mockup with PHP & SQLite.

There are plenty around but you can't have mine.

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


Re: [sqlite] PHP & SQLite examples

2011-11-14 Thread Stephan Beal
On Mon, Nov 14, 2011 at 11:45 AM, Gert Van Assche wrote:

> I would like to understand how a PHP web page communicates with  SQLite. I
> know something about SQLite, but nothing or not a lot about PHP. I have
> questions like this:

  - How does one take input from an input field or a check box and use it
>   for doing an "INSERT" for instance?

  - How does one do a SELECT query based on what has been selected from a
>   dropdown box?
>

It sounds like you need a PHP list, not the sqlite list. i personally
recommend the PHP PDO API:

http://php.net/manual/en/book.pdo.php

You're trying to collapse 3 different topics into an sqlite discussion:
HTML, PHP, and sqlite. Both of the above have to do with HTML and/or PHP,
not sqlite.


>   - How do you fill a dropdown box with values retrieved from a table?
>

http://www.php.net/manual/en/pdo.prepare.php
http://www.php.net/manual/en/pdostatement.fetch.php

Does anyone have an example that I could use? I want to see if I can make a
> mockup with PHP & SQLite.
>
>
Google for "php sqlite example" and you'll find tons. But you need to first
figure out which sqlite API you want to use. There are 2 or 3 active sqlite
APIs for PHP (i personally prefer PDO but others on this list can/will
likely recommend other APIs).

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] FTS: Phrase queries

2011-11-14 Thread nobre

Comment from the source:

  ** TODO: Strangely, it is not possible to associate a column specifier
  ** with a quoted phrase, only with a single token. Not sure if this was
  ** an implementation artifact or an intentional decision when fts3 was
  ** first implemented. Whichever it was, this module duplicates the 
  ** limitation.

So, seems its really not possible
Rafael


Fabian-40 wrote:
> 
> When I have a basic FTS query that needs to be restricted to a column, I
> can write it in two ways:
> 
> 1.) WHERE column MATCH 'apple'
> 2.) WHERE table MATCH 'column:apple'
> 
> But when I have a phrase query, I can only write it in one way:
> 
> 1.) WHERE column MATCH '"apple juice"'
> 
> The problem is that when I want to combine the queries (search for 'apple'
> in column1 and for "apple juice" in column2) i cannot write the query
> like:
> 
> WHERE column1 MATCH 'apple' AND column2 MATCH '"apple juice"'
> 
> Nor can I write it like:
> 
> WHERE table MATCH 'column1:apple column2:"apple juice"'
> 
> So this fairly simple query, seems impossible in FTS? Or does anyone know
> how to workaround this (without doing two seperate queries)?
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/FTS%3A-Phrase-queries-tp32834649p32839669.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] PHP & SQLite examples

2011-11-14 Thread Gert Van Assche
All,

I would like to understand how a PHP web page communicates with  SQLite. I
know something about SQLite, but nothing or not a lot about PHP. I have
questions like this:


   - How does one take input from an input field or a check box and use it
   for doing an "INSERT" for instance?
   - How does one do a SELECT query based on what has been selected from a
   dropdown box?
   - How do you fill a dropdown box with values retrieved from a table?
   - ...


Does anyone have an example that I could use? I want to see if I can make a
mockup with PHP & SQLite.

thanks

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


Re: [sqlite] more than 2000 columns

2011-11-14 Thread vinayh4

Hi Simon

  In my application a ESB will update more than 2000 columns in
simultaneously based on some algorithm 
processing in real time . So i need to create single table with 2000 columns
updated based on result
of processing of records.

So i need to know how extend no of columns per table for SQLite Table.

Thanks
Vinay 


Simon Slavin-3 wrote:
> 
> 
> On 14 Nov 2011, at 7:38am, vinayh4 wrote:
> 
>> I need to create table with more than 2000 columns, How to reset
>> SQLITE_MAX_COLUMN value which
>> is  2000 . Plz help me on this issue.
> 
> You almost never need to have more columns than you can fit in your head
> at one time.  The way you handle 2000 columns is to make a database for
> them !
> 
> Have you considered storing your data as triplets:
> 
> row   column  value
> 1 first   234
> 1 second  54.234
> 1 third   232.41
> ...
> 2 first   432
> 2 second  23.413
> 
> ?
> 
> 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://old.nabble.com/determine-SQLITE_MAX_LENGTH-or-sql_limit-sqlite3_limit-tp30885748p32839447.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] more than 2000 columns

2011-11-14 Thread Simon Slavin

On 14 Nov 2011, at 7:38am, vinayh4 wrote:

> I need to create table with more than 2000 columns, How to reset
> SQLITE_MAX_COLUMN value which
> is  2000 . Plz help me on this issue.

You almost never need to have more columns than you can fit in your head at one 
time.  The way you handle 2000 columns is to make a database for them !

Have you considered storing your data as triplets:

row column  value
1   first   234
1   second  54.234
1   third   232.41
...
2   first   432
2   second  23.413

?

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


Re: [sqlite] 3.7.7.1 database corruption

2011-11-14 Thread Filip Navara
Hi Alexandr,

the mailing list doesn't allow attachments. Please send us the output
of "pragma integrity_check;" on the corrupted database file. Also, is
the database used in WAL mode?

Best regards,
Filip Navara

2011/11/14 Alexandr Němec :
> Dear all,
>
> we are using SQLite in our projects. We are using the 3.7.7.1 version
> compiled on Windows platform from the amalgamation file. One of our servers
> crashed badly (power outage) and after the server restarted, we saw that the
> database was corrupt (all queries we tried return SQLITE_CORRUPT). We had a
> look at http://www.sqlite.org/howtocorrupt.html and verified, that the
> hardware (disk, memory) of the server should be ok - we used some hardware
> tools to check. In the past we already had some crash situations and SQLite
> could recover from the crash nicely, so we were surprised that after this
> crash the database was corrupt. In fact, we cant create a repro, because we
> do not know, what the server was exactly doing, so it might be difficult to
> find the reason, but we saved the corrupted database in the hope, that
> somebody from the develpers (maybe) could put some light on this problem.
> Because the database is rather small and is used to save some configuration
> data only, I have att
> ached it to this message.
>
> Thanks for any suggestions.
>
> Alex
>
>
>
> ___
> 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] determine SQLITE_MAX_LENGTH or sql_limit/sqlite3_limit

2011-11-14 Thread vinayh4

Sir , Firstly Thanks for quick reply  

But  actually i need to know about how reset these values ... Is there any
file available where we need to

edit these values or in command line we need to set these values

Please if u can share link or procedure to change these default settings it
will be helpful

Thanks 



Kevin Benson wrote:
> 
> http://www.sqlite.org/limits.html
> 
> "2.Maximum Number Of Columns
> 
> The SQLITE_MAX_COLUMN compile-time parameter is used to set an upper bound
> on:
> 
> ◦The number of columns in a table
> ◦The number of columns in an index
> ◦The number of columns in a view
> ◦The number of terms in the SET clause of an UPDATE statement
> ◦The number of columns in the result set of a SELECT statement
> ◦The number of terms in a GROUP BY or ORDER BY clause
> ◦The number of values in an INSERT statement
> 
> The default setting for SQLITE_MAX_COLUMN is 2000. You can change it
> at compile time to values as large as 32767. On the other hand, many
> experienced database designers will argue that a well-normalized
> database will never need more than 100 columns in a table.
> 
> In most applications, the number of columns is small - a few dozen.
> There are places in the SQLite code generator that use algorithms that
> are O(N²) where N is the number of columns. So if you redefine
> SQLITE_MAX_COLUMN to be a really huge number and you generate SQL that
> uses a large number of columns, you may find that sqlite3_prepare_v2()
> runs slowly.
> 
> The maximum number of columns can be lowered at run-time using the
> sqlite3_limit(db,SQLITE_LIMIT_COLUMN,size) interface."
> 
> On 11/14/11, vinayh4  wrote:
>>
>> Hi All
>>
>> I need to create table with more than 2000 columns, How to reset
>> SQLITE_MAX_COLUMN value which
>> is  2000 . Plz help me on this issue.
>>
>> Thanks
>> Vinay
>>
>>
>> Vannus wrote:
>>>
>>> That should do the trick, thanks for pointing it out.
>>>
>>> On 10 February 2011 06:18, Dan Kennedy  wrote:
>>>
 On 02/10/2011 01:56 AM, Vannus wrote:
 > Zeoslib is reading sqlite field lengths incorrectly, as it checks for
 > brackets after the field typename ie. CHAR(123)
 > presumably this is only affecting me because I haven't defined field
 lengths
 > in my sqlite3 db.
 >
 > I don't want to hard-code 1,000,000,000 or 2147483647 in as the field
 length
 > - but how do I check what SQLITE_MAX_LENGTH or the limit imposed by
 > sql_limit or sqlite3_limit is?

 At http://www.sqlite.org/c3ref/limit.html the third paragraph
 has:

   Regardless of whether or not the limit was changed, the
   sqlite3_limit() interface returns the prior value of the limit.
   Hence, to find the current value of a limit without changing it,
   simply invoke this interface with the third parameter set to -1.

 Maybe you can use that.

 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
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/determine-SQLITE_MAX_LENGTH-or-sql_limit-sqlite3_limit-tp30885748p32838625.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
>>
> 
> 
> -- 
> --
>--
>   --
>  --ô¿ô--
> K e V i N
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/determine-SQLITE_MAX_LENGTH-or-sql_limit-sqlite3_limit-tp30885748p32839229.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] determine SQLITE_MAX_LENGTH or sql_limit/sqlite3_limit

2011-11-14 Thread Kevin Benson
http://www.sqlite.org/limits.html

"2.Maximum Number Of Columns

The SQLITE_MAX_COLUMN compile-time parameter is used to set an upper bound on:

◦The number of columns in a table
◦The number of columns in an index
◦The number of columns in a view
◦The number of terms in the SET clause of an UPDATE statement
◦The number of columns in the result set of a SELECT statement
◦The number of terms in a GROUP BY or ORDER BY clause
◦The number of values in an INSERT statement

The default setting for SQLITE_MAX_COLUMN is 2000. You can change it
at compile time to values as large as 32767. On the other hand, many
experienced database designers will argue that a well-normalized
database will never need more than 100 columns in a table.

In most applications, the number of columns is small - a few dozen.
There are places in the SQLite code generator that use algorithms that
are O(N²) where N is the number of columns. So if you redefine
SQLITE_MAX_COLUMN to be a really huge number and you generate SQL that
uses a large number of columns, you may find that sqlite3_prepare_v2()
runs slowly.

The maximum number of columns can be lowered at run-time using the
sqlite3_limit(db,SQLITE_LIMIT_COLUMN,size) interface."

On 11/14/11, vinayh4  wrote:
>
> Hi All
>
> I need to create table with more than 2000 columns, How to reset
> SQLITE_MAX_COLUMN value which
> is  2000 . Plz help me on this issue.
>
> Thanks
> Vinay
>
>
> Vannus wrote:
>>
>> That should do the trick, thanks for pointing it out.
>>
>> On 10 February 2011 06:18, Dan Kennedy  wrote:
>>
>>> On 02/10/2011 01:56 AM, Vannus wrote:
>>> > Zeoslib is reading sqlite field lengths incorrectly, as it checks for
>>> > brackets after the field typename ie. CHAR(123)
>>> > presumably this is only affecting me because I haven't defined field
>>> lengths
>>> > in my sqlite3 db.
>>> >
>>> > I don't want to hard-code 1,000,000,000 or 2147483647 in as the field
>>> length
>>> > - but how do I check what SQLITE_MAX_LENGTH or the limit imposed by
>>> > sql_limit or sqlite3_limit is?
>>>
>>> At http://www.sqlite.org/c3ref/limit.html the third paragraph
>>> has:
>>>
>>>   Regardless of whether or not the limit was changed, the
>>>   sqlite3_limit() interface returns the prior value of the limit.
>>>   Hence, to find the current value of a limit without changing it,
>>>   simply invoke this interface with the third parameter set to -1.
>>>
>>> Maybe you can use that.
>>>
>>> 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
>>
>>
>
> --
> View this message in context:
> http://old.nabble.com/determine-SQLITE_MAX_LENGTH-or-sql_limit-sqlite3_limit-tp30885748p32838625.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
>


-- 
--
   --
  --
 --ô¿ô--
K e V i N
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users