Re: [sqlite] formatting the output on the command line?

2006-08-24 Thread John Salerno

Thanks guys!

On 8/24/06, Gary Kruck <[EMAIL PROTECTED]> wrote:

There is a tutorial Here
 .

Gary

Martin Jenkins wrote:
> John Salerno wrote:
>> Is there any special command I need to use to get
these options
>> listed? I didn't see the particular abbreviations
that you told me
>> about.
>
> You can abbreviate the commands - enter enough to be
unambiguous.
>
> SQLite version 3.3.6
> Enter ".help" for instructions
> sqlite> .h
> .databases List names and files of
attached databases
> .dump ?TABLE? ...  Dump the database in an SQL
text format
> .echo ON|OFF   Turn command echo on or off
> .exit  Exit this program
> .explain ON|OFFTurn output mode suitable for
EXPLAIN on or off.
> .header(s) ON|OFF  Turn display of headers on or
off
> .help  Show this message
> .import FILE TABLE Import data from FILE into
TABLE
> .indices TABLE Show names of all indices on
TABLE
> .mode MODE ?TABLE? Set output mode where MODE is
one of:
>  csv  Comma-separated
values
>  column   Left-aligned
columns.  (See .width)
>  html HTML  code
>  insert   SQL insert
statements for TABLE
>  line One value per line
>  list Values delimited
by .separator string
>  tabs Tab-separated
values
>  tcl  TCL list elements
> .nullvalue STRING  Print STRING in place of NULL
values
> .output FILENAME   Send output to FILENAME
> .output stdout Send output to the screen
> .prompt MAIN CONTINUE  Replace the standard prompts
> .quit  Exit this program
> .read FILENAME Execute SQL in FILENAME
> .schema ?TABLE?Show the CREATE statements
> .separator STRING  Change separator used by
output mode and .import
> .show  Show the current values for
various settings
> .tables ?PATTERN?  List names of tables matching
a LIKE pattern
> .timeout MSTry opening locked tables for
MS milliseconds
> .width NUM NUM ... Set column widths for
"column" mode
> sqlite>
>
> Martin
>
>
-

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

>
>
>
>

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

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




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



Re: [sqlite] formatting the output on the command line?

2006-08-24 Thread Gary Kruck
There is a tutorial Here
 .

Gary

Martin Jenkins wrote:
> John Salerno wrote:
>> Is there any special command I need to use to get
these options
>> listed? I didn't see the particular abbreviations
that you told me
>> about.
>
> You can abbreviate the commands - enter enough to be
unambiguous.
>
> SQLite version 3.3.6
> Enter ".help" for instructions
> sqlite> .h
> .databases List names and files of
attached databases
> .dump ?TABLE? ...  Dump the database in an SQL
text format
> .echo ON|OFF   Turn command echo on or off
> .exit  Exit this program
> .explain ON|OFFTurn output mode suitable for
EXPLAIN on or off.
> .header(s) ON|OFF  Turn display of headers on or
off
> .help  Show this message
> .import FILE TABLE Import data from FILE into
TABLE
> .indices TABLE Show names of all indices on
TABLE
> .mode MODE ?TABLE? Set output mode where MODE is
one of:
>  csv  Comma-separated
values
>  column   Left-aligned
columns.  (See .width)
>  html HTML  code
>  insert   SQL insert
statements for TABLE
>  line One value per line
>  list Values delimited
by .separator string
>  tabs Tab-separated
values
>  tcl  TCL list elements
> .nullvalue STRING  Print STRING in place of NULL
values
> .output FILENAME   Send output to FILENAME
> .output stdout Send output to the screen
> .prompt MAIN CONTINUE  Replace the standard prompts
> .quit  Exit this program
> .read FILENAME Execute SQL in FILENAME
> .schema ?TABLE?Show the CREATE statements
> .separator STRING  Change separator used by
output mode and .import
> .show  Show the current values for
various settings
> .tables ?PATTERN?  List names of tables matching
a LIKE pattern
> .timeout MSTry opening locked tables for
MS milliseconds
> .width NUM NUM ... Set column widths for
"column" mode
> sqlite>
>
> Martin
>
>
-

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

>
>
>
>

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: [sqlite] formatting the output on the command line?

2006-08-24 Thread Martin Jenkins

John Salerno wrote:

Is there any special command I need to use to get these options
listed? I didn't see the particular abbreviations that you told me
about.


You can abbreviate the commands - enter enough to be unambiguous.

SQLite version 3.3.6
Enter ".help" for instructions
sqlite> .h
.databases List names and files of attached databases
.dump ?TABLE? ...  Dump the database in an SQL text format
.echo ON|OFF   Turn command echo on or off
.exit  Exit this program
.explain ON|OFFTurn output mode suitable for EXPLAIN on or off.
.header(s) ON|OFF  Turn display of headers on or off
.help  Show this message
.import FILE TABLE Import data from FILE into TABLE
.indices TABLE Show names of all indices on TABLE
.mode MODE ?TABLE? Set output mode where MODE is one of:
 csv  Comma-separated values
 column   Left-aligned columns.  (See .width)
 html HTML  code
 insert   SQL insert statements for TABLE
 line One value per line
 list Values delimited by .separator string
 tabs Tab-separated values
 tcl  TCL list elements
.nullvalue STRING  Print STRING in place of NULL values
.output FILENAME   Send output to FILENAME
.output stdout Send output to the screen
.prompt MAIN CONTINUE  Replace the standard prompts
.quit  Exit this program
.read FILENAME Execute SQL in FILENAME
.schema ?TABLE?Show the CREATE statements
.separator STRING  Change separator used by output mode and .import
.show  Show the current values for various settings
.tables ?PATTERN?  List names of tables matching a LIKE pattern
.timeout MSTry opening locked tables for MS milliseconds
.width NUM NUM ... Set column widths for "column" mode
sqlite>

Martin

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



Re: [sqlite] problem with application which uses sqlite

2006-08-24 Thread renato71


Martin Jenkins wrote:
> 
> As you suggest later in your message, this sounds like a bug in the KTU 
> config scripts, so you're probably not going to get much joy here. If 
> you look at the KTU page at http://www.kde-apps.org (the Administration, 
> System Tools category) you'll see there was a similar dependency problem 
> with svn, so that's probably the best place to ask.
> 
> In the meantime,
> 
>  > If it is due to an error in KTU configure file, how do I fix it?
> 
> Have a look in config.log(sp?) to see where config thinks sqlite(3) 
> lives (it might be hard coded to the wrong place) and check if there's a 
> "--sqlite-dir=/path/to/sqlite" (or similar) option for ./configure.
> 

Well, I am trying to solve the problem from that angle as well. For now, I
was told that KTU depends on libsqlite3. I was trying to install
libsqlite3-dev, but I'm not sure I now how to.
I cannot deducate as what is crucial in config.log. I just says "sqlite3
found - NO".
I tried above option for ./configure (with my paths, I hope), but with same
result. And am not that god with scripting so I don't undertand mush from
configurate file...

Btw, when I istalled sqlite, I could locate following files:

./usr/local/lib/
libsqlite3.a
libsqlite3.la
libsqlite3.so
libsqlite3.so.0
libsqlite3.so.0.8.6

./usr/local/lib/pkgconfig/
sqlite3.pc

./usr/lib/
libsqlite3.so.0
libsqlite3.so.0.8.6

./usr/local/bin/sqlite3
./usr/local/include/sqlite3

Furthermore, via konsole:

[EMAIL PROTECTED] ~]$ whereis sqlite3
sqlite3: /usr/local/bin/sqlite3
[EMAIL PROTECTED] ~]$ whereis libsqlite
libsqlite: /usr/local/lib/libsqlite3.so
/usr/local/lib/libsqlite3.la
/usr/local/lib/libsqlite3.a
[EMAIL PROTECTED] ~]$ sqlite3 -version
3.3.7

Btw, KDE is 3.4, not 3.2, my mistake.

Thnx for advices
Renato
-- 
View this message in context: 
http://www.nabble.com/problem-with-application-which-uses-sqlite-tf2156856.html#a5974818
Sent from the SQLite forum at Nabble.com.


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



Re: [sqlite] formatting the output on the command line?

2006-08-24 Thread John Salerno

Is there any special command I need to use to get these options
listed? I didn't see the particular abbreviations that you told me
about.

John

On 8/24/06, Martin Jenkins <[EMAIL PROTECTED]> wrote:

John Salerno wrote:
> Thanks! Boxes aren't necessary, but it's nice to have the columns like
> that. I'll have to look into these options more.

.h is your friend. You can set the output format to HTML etc

Martin [off for a pint]

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




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



Re: [sqlite] formatting the output on the command line?

2006-08-24 Thread Martin Jenkins

John Salerno wrote:

Thanks! Boxes aren't necessary, but it's nice to have the columns like
that. I'll have to look into these options more.


.h is your friend. You can set the output format to HTML etc

Martin [off for a pint]

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



Re: [sqlite] formatting the output on the command line?

2006-08-24 Thread John Salerno

Thanks! Boxes aren't necessary, but it's nice to have the columns like
that. I'll have to look into these options more.

John

On 8/24/06, Martin Jenkins <[EMAIL PROTECTED]> wrote:

John Salerno wrote:
> Hi everyone. Is it possible to format the output of a query
> differently when using the command line program? I'm thinking along
> the lines of MySQL, which puts rows and columns in boxes, and has the
> column names at the top. It's very nice and easy to read. I find the
> default format hard to read and too close together.

To get column separators and headings (but not boxes) issue the
following commands at the prompt.

.mo co
.he on

The .w [20 30 40] command lets you change column widths - as many as
you've specified - three in my example.

I think you can put these commands into a .sqliterc file so that they're
loaded when you start the command line client, but I've not tried that.

Martin

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




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



RE: [sqlite] sqlite3_interrupt()

2006-08-24 Thread Rob Richardson
I think I've found the problem.

The next step in debugging was to find the actual sqlite3 library calls
I was making, just to make sure the delay wasn't somewhere else in my
code.  Here's the trace statements:

GetTrendData() started at Thu Aug 24 16; sqlite object is at 056B9570.
select tag_key,value,datetime(value_timestamp, 'localtime') from
trend_view where trend_key=1 and value_timestamp <=
julianday('2006-08-22 16C

SqlOpen(): First sqlite3_step() called at Thu Aug 24 16:30:52 2006
; sqlite object is at 056C20E0.

Interrupt requested at Thu Aug 24 16:30:54 2006
 for object at 056B9570.

CSqlOpen(): Back from first sqlite3_step() call at Thu Aug 24 16:32:04
2006
; sqlite object is at 056C20E0.

GetTrendData() finished at Thu Aug 24 16

The object pointer reported in the second statement is not the same as
the one in the first statement.  The second statement's pointer is the
one that was used in the call to sqlite3_prepare().  The
sqlite3_interrupt() pointer had better be the same as the one in
sqlite3_prepare(), and it wasn't.  

Bottom line:  I was trying to interrupt the wrong sqlite3 object.

Once I figure out how to get the correct sqlite3 object to use in the
interrupt call, I'll let you know how it works.

Rob Richardson
RAD-CON INC.

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



RE: [sqlite] sqlite3_interrupt()

2006-08-24 Thread Rob Richardson
Dr. Hipp,

Thank you very much for your earlier assistance.  As you suggested, I
downloaded the version 3.3.7 source code and built it into a static
library.  My application now correctly reports that it is using version
3.3.7.

But sqlite3_interrupt() still seems to be doing nothing.  I added TRACE
statements to my code to show the times things happened, and I included
the value of the pointer to the sqlite3 object that was being used when
the query starts and as the argument to sqlite3_interrupt():

GetTrendData() started at Thu Aug 24 16:03:54 2006
; sqlite object is at 056B89E0.
select tag_key,value,datetime(value_timestamp, 'localtime') from
trend_view where trend_key=1 and value_timestamp <=
julianday('2006-08-22 16:01:41.000', 'utc') order by value_timestamp
desc
Interrupt requested at Thu Aug 24 16:03:57 2006
 for object at 056B89E0.
GetTrendData() finished at Thu Aug 24 16:05:07 2006

Rob Richardson
RAD-CON INC.

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



Re: [sqlite] formatting the output on the command line?

2006-08-24 Thread Martin Jenkins

John Salerno wrote:

Hi everyone. Is it possible to format the output of a query
differently when using the command line program? I'm thinking along
the lines of MySQL, which puts rows and columns in boxes, and has the
column names at the top. It's very nice and easy to read. I find the
default format hard to read and too close together.


To get column separators and headings (but not boxes) issue the 
following commands at the prompt.


.mo co
.he on

The .w [20 30 40] command lets you change column widths - as many as 
you've specified - three in my example.


I think you can put these commands into a .sqliterc file so that they're 
loaded when you start the command line client, but I've not tried that.


Martin

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



Re: [sqlite] sqlite3_interrupt()

2006-08-24 Thread drh
"Rob Richardson" <[EMAIL PROTECTED]> wrote:
> Dr. Hipp,
> 
> Thank you very much for your earlier assistance.  As you suggested, I
> downloaded the version 3.3.7 source code and built it into a static
> library.  My application now correctly reports that it is using version
> 3.3.7.
> 
> But sqlite3_interrupt() still seems to be doing nothing.  I added TRACE
> statements to my code to show the times things happened, and I included
> the value of the pointer to the sqlite3 object that was being used when
> the query starts and as the argument to sqlite3_interrupt():
> 

Can you run your program in a debugger?

The sqlite3_interrupt() routine should set the 
sqlite3.u1.isInterrupted flag.  That flag is then
tested at various points in the file vdbe.c
(whereever you see the macro CHECK_FOR_INTERRUPT)
and if it is true, the execution of the statement
should stop.  The flag is reset once the statement
completes.

Run your program in a debugger and try to figure
out what is going wrong.  Let me know if you find
a bug in SQLite.  (It works when I test it)
--
D. Richard Hipp   <[EMAIL PROTECTED]>


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



[sqlite] Can't figure out index problem

2006-08-24 Thread Doug Nebeker
I'm wondering if someone can help me understand why a table scan is
being done for the SQL below even though I've created what I thought
would be appropriate indices.
 
When I do a EXPLAIN QUERY PLAN on the following SQL:
 
SELECT S.ScanID S.Date, S.RootDirID, S.OwningMonitorID, D.Path 
FROM Check S, Directory D 
WHERE 
 S.RootDirID = D.DirID AND 
 S.bHasFileInfo = 1 AND 
 S.bComplete= 1 
ORDER BY D.PATH ASC, S.DATE DESC
 
it tells me it will do a table scan on Check and Directory
 
CREATE TABLE Directory 
(
 DirID INTEGER PRIMARY KEY,
 Path TEXT NOT NULL,
 ParentDirID INTEGER NOT NULL
);
CREATE INDEX Ind_Directory_ParentDirID ON Directory (ParentDirID);
CREATE UNIQUE INDEX Ind_Directory_Path ON Directory (Path);
 
CREATE TABLE Check 
( 
 ScanID INTEGER PRIMARY KEY,
 Date INTEGER NOT NULL, 
 OwningMonitorID INTEGER NOT NULL,
 RootDirID INTEGER NOT NULL,
 bHasDirInfo INTEGER NOT NULL,   
 bHasFileInfo INTEGER NOT NULL,  
 bHasOwnerInfo INTEGER NOT NULL, 
 bComplete INTEGER NOT NULL
);
CREATE UNIQUE INDEX Ind_Check_Date ON Check (Date);
CREATE UNIQUE INDEX Ind_Check_RootDirID ON Check (RootDirID);
 
What can I do so this statement will use the/an index?
 
Thanks
 
 


To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Reuters Ltd.



[sqlite] formatting the output on the command line?

2006-08-24 Thread John Salerno

Hi everyone. Is it possible to format the output of a query
differently when using the command line program? I'm thinking along
the lines of MySQL, which puts rows and columns in boxes, and has the
column names at the top. It's very nice and easy to read. I find the
default format hard to read and too close together.

Thanks,
John

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



RE: [sqlite] sqlite3_interrupt()

2006-08-24 Thread Rob Richardson
Dr. Hipp,

Thanks for your reply.  The question of which version I'm using is up in
the air right now.  I threw a call to sqlite3_libversion() into my
application, and it returned "3.2.1".  I asked our lead developer (who's
in Indiana while the rest of us are just west of Cleveland, OH) what
version we should have, and he said 3.3.5.  He sent the source code.  I
opened my existing copy of sqlite3.h and saw that SQLITE_VERSION was set
to "3.3.5".  Yet, when I my application, I get 3.2.1.  I deleted all
copies of sqlite3.lib and sqlite3.dll from my machine, rebuilt sqlite3
from Visual Studio, and still I get 3.2.1.  I have no idea where it's
coming from, but it seems to be telling me I'm using an old version of
SQLite.

RobR

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



RE: [sqlite] Btree

2006-08-24 Thread William Chan
I used the SQLite BTree for indexing.  If you are doing complex query, I
think you are much better off with SQL...  The btree API is undocumented
(documented somewhat in the source files) and unsupported.  If you are gonna
do that, I had recently posted some problems/solutions I encounter using the
Btree library.  I also think it does not support duplicate keys... I am not
too sure so I program around it to make the key unique.  Honestly I think I
was lucky to got it working to the way I want it.  I really appreciated all
the self-less efforts people put into SQLite and therefore still receiving
this newsletter and keep an eye on it.  :-)

-Original Message-
From: Cesar David Rodas Maldonado [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 24, 2006 1:41 PM
To: sqlite-users@sqlite.org
Subject: [sqlite] Btree

Hello to everyone.

I want to ask something for the people who made SQLite.

Every Index in a table is a Btree?

So is the a manual of how can I use the SQLite Btree algorithm for my own?
And if I use the Btree will be faster than use SQLite? because SQLite need
to understand the SQL and I think that took time... if the query is complex

Thank



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



Re: [sqlite] Btree

2006-08-24 Thread Cesar David Rodas Maldonado

Thanks Jay now i can understand.

On 8/24/06, Jay Sprenkle <[EMAIL PROTECTED]> wrote:


> So is the a manual of how can I use the SQLite Btree algorithm for my
own?

It's not exposed so you can do it easily.

> And if I use the Btree will be faster than use SQLite? because SQLite
need
> to understand the SQL and I think that took time... if the query is
complex

I doubt it would be significantly faster, except when you execute many
different queries. If you use the same set of queries "Preparing" allows
you to parse it once and execute it many times. This is probably 90%
of what you want with only 10% of the effort.


-
To unsubscribe, send email to [EMAIL PROTECTED]

-




[sqlite] how can i optimize this query

2006-08-24 Thread Cesar David Rodas Maldonado

I have done this project
http://www.phpclasses.org/browse/package/3303.htmlis a fulltext
search. Please help me to optimize this souce, couse i am
planning to move this souce to C. This a fulltext search that supports
SQLite or mysql. Please Help me to do this project better. Thanks to all

On 8/24/06, Cesar David Rodas Maldonado <[EMAIL PROTECTED]> wrote:


I will like to join to your group! what i have to do? how can we exchange
info?

Thanks Pierre Aubert


On 8/24/06, Pierre Aubert < [EMAIL PROTECTED]> wrote:
>
> Hello Cesar,
> I have a lot of idea for ft3 but not much time currently. If you want to
> join the project you are welcome. My next work will be on creating a sqlite
> extension called ft3:) with a module and
> virtual tables.
>
> Pierre
>
> P.S.: don't stress over your english, French is my mother tongue and I
> do a lot of mistakes
> myself. On the other hand, it is necessary to speak in english thus ...
>
> - Message d'origine 
> De : Cesar David Rodas Maldonado <[EMAIL PROTECTED] >
> À : Pierre Aubert <[EMAIL PROTECTED]>
> Envoyé le : Mercredi, 23 Août 2006, 7h25mn 47s
> Objet : Re: [sqlite] Re : [sqlite] how can i optimize this query
>
>
> Hello Pierre Aubert
>
> I saw your project ft3, that was my inspiration, can I ask you more
> about
> your projects? more details?
>
> Thanks Cesar Rodas
>
> On 8/23/06, Pierre Aubert <[EMAIL PROTECTED]> wrote:
> >
> > Hello Cesar,
> > may be you can have a look at ft3 (ft3.sourceforge.net) which does the
> > same thing.
> > Some advices:
> > * partition your table ft_index on wordid
> >I use 1024  tables and use them like that:
> > ft_index[ wordid % 1024 ]
> >   to access them. This reduce the size of the table and thus the size
> of
> > the index.
> > * use a large block size via pragma (this speed up large reads)
> >
> > FT3 ways is to switch to a binary index stored into a blob for each
> word.
> > Something like
> > create table ft_index (
> > wordid int,
> > scores blob
> > );
> >
> > and the blob is an array of (docid, rank, position, ...)
> >
> > This is a lot faster of course but you have to deal with the join
> > yourself.
> >
> > PIerre.
> >
> > P.S.: I will try to use the new virtual table interface to access the
> blob
> > datas.
> >
> > - Message d'origine 
> > De : Cesar David Rodas Maldonado < [EMAIL PROTECTED]>
> > À : sqlite-users@sqlite.org
> > Envoyé le : Mardi, 22 Août 2006, 10h10mn 30s
> > Objet : [sqlite] how can i optimize this query
> >
> > I have the next table with about 10.000.000 of records-
> >
> > CREATE TABLE ft_index (
> >   docid int(11) NOT NULL default '0',
> >   wordid int(11) NOT NULL default '0',
> >   posicion int(11) NOT NULL default '0',
> >   ranking float NOT NULL default '0',
> >   lang int(11) NOT NULL default '0',
> >   KEY docid (docid,wordid,posicion,ranking),
> >   KEY lang (lang)
> > );
> >
> > How can i optimize the next query, couse i need velocity (this is for
> a
> > fulltext search project):
> >
> >
> > select
> > t0.*,
> > t0.ranking + t1.ranking + t2.ranking + t3.ranking + t4.ranking as
> ranking
> > from ft_index as t0
> > inner join ft_index as t1 on (t0.docid = t1.docid)
> > inner join ft_index as t2 on ( t0.docid = t2.docid)
> > inner join ft_index as t3 on (t0.docid = t3.docid)
> > inner join ft_index as t4 on (t0.docid = t4.docid)
> > where (t0.wordid = '18929') AND (t1.wordid = '27283') AND( t2.wordid =
> > '4351' and t2.posicion + 1 = t3.posicion and t3.wordid = '9418' and
> > t3.posicion + 1 = t4.posicion ) group by t0.docid order by ranking;
> >
> > Every inner join is for search a word that i save in another table
> (with
> > the
> > number of words).
> >
> >
> >
> >
> >
> >
>
>



Re: [sqlite] Btree

2006-08-24 Thread Jay Sprenkle

So is the a manual of how can I use the SQLite Btree algorithm for my own?


It's not exposed so you can do it easily.


And if I use the Btree will be faster than use SQLite? because SQLite need
to understand the SQL and I think that took time... if the query is complex


I doubt it would be significantly faster, except when you execute many
different queries. If you use the same set of queries "Preparing" allows
you to parse it once and execute it many times. This is probably 90%
of what you want with only 10% of the effort.

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



[sqlite] Btree

2006-08-24 Thread Cesar David Rodas Maldonado

Hello to everyone.

I want to ask something for the people who made SQLite.

Every Index in a table is a Btree?

So is the a manual of how can I use the SQLite Btree algorithm for my own?
And if I use the Btree will be faster than use SQLite? because SQLite need
to understand the SQL and I think that took time... if the query is complex

Thanks


[sqlite] Minimizing sqlite db-file size

2006-08-24 Thread Hendrik Bock
Hello!
 
I am currently evaluating the minimum possible size which sqlite is able to
provide in the case when many blobs are inserted into the database.
There was some discussion with the title "disk locality (and delta storage)"
in this mailinglist which i followed - it provided some very interesting
information about how sqlite handles memory pages in the file. In the
discussion Mr. Hipp explained that sqlite only allocates a new page from the
disk, when there is no space left in the existing pages. 
So i tried to verify that with a simple experiment using a db with a
page_size of 1024 bytes:
- I created a database and added 50.000 blobs with 800 bytes each - the
resulting file size was 52.520.960 bytes
- I created another database and added 50.000 blobs with 950 bytes each -
the resulting file size was 52.520.960 bytes (the same as above)
 
To this point, the results are as expected, as there is no possible way for
the db to add two blobs to one page.
 
Then i created a third database and added 50.000 blobs with 800 bytes each
and then 50.000 blobs with 150 bytes each - the resulting file was
61.681.664 bytes.
 
This result was not expected, as i assumed that the 150 bytes of each of the
smaller blobs could be inserted into an already allocated memory page.
Unfortunately, that doesn't seem to be the case.
 
I seem to have understood something wrong, as i can't explain these results
- can anybody enlighten this behaviour?
 
Any comments are greatly appreciated :-)
 
 
 
For reference, here is the excerpt from the mentioned discussion:
___
 
>>Nathaniel Smith <[EMAIL PROTECTED]> wrote:
>> 
>> So and rows are basically written to the file in the same order that 
>> the INSERT statements are executed?

> Right.  If there are no free pages in the database file (which is the
usual 
> case for Monotone, I expect) then new pages are allocated from the end of
the 
> file.  If the INSERT is small and will fit on an existing page, then no
new 
> page allocations are required and the data gets inserted in exactly the
right 
> spot.
> But when inserting large blobs, as monotone does, you typically will
require a 
> least one new page and that page will come at the end.

___
 
Kind regards,
 
Hendrik Bock
 
 


Re: [sqlite] sqlite3_interrupt()

2006-08-24 Thread drh
"Rob Richardson" <[EMAIL PROTECTED]> wrote:
> I have a thread that executes a query that takes about 30 seconds on my
> test setup.  In the field, the query could take several minutes.  The
> user needs to be able to stop this query if it was started by accident.
> I have a pointer to the sqlite3 object that is running the query inside
> my thread.  In the main GUI thread of the application, I call
> sqlite3_interrupt(), passing it the stored sqlite3 pointer.  But after I
> do that, the query still stops executing 30 seconds after it started.
> The interruption seems to have no effect.  Is this expected?  How soon
> after I issue sqlite3_interrupt() should a long query stop executing?
> Or am I doing something wrong?
> 

The query should stop immediately.

Are you using the latest version of SQLite that supports
calling sqlite3_interrupt() from a separate thread, or an
older version that might have problems?
--
D. Richard Hipp   <[EMAIL PROTECTED]>


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



[sqlite] sqlite3_interrupt()

2006-08-24 Thread Rob Richardson
I have a thread that executes a query that takes about 30 seconds on my
test setup.  In the field, the query could take several minutes.  The
user needs to be able to stop this query if it was started by accident.
I have a pointer to the sqlite3 object that is running the query inside
my thread.  In the main GUI thread of the application, I call
sqlite3_interrupt(), passing it the stored sqlite3 pointer.  But after I
do that, the query still stops executing 30 seconds after it started.
The interruption seems to have no effect.  Is this expected?  How soon
after I issue sqlite3_interrupt() should a long query stop executing?
Or am I doing something wrong?

 

Thank you very much.

 

RobR



[sqlite] Compiling Sqlite3.3.6 on Windows

2006-08-24 Thread Dixon Hutchinson
When compiling under windows, I get lots of warning messages from Visual 
Studio.  All of the warnings have to do with worries about 64 bit vs 32 
bit enties existing togeather, eg:


   vdbemem.c(194) : warning C4267: '=' : conversion from 'size_t' to
   'int', possible loss of data

I could just turn off the appropriate warning with a VS pragma, but I'm 
wondering if there is a better option to make the compiler happy.


D



[sqlite] Adding specific architecture

2006-08-24 Thread Eduardo

Hello:

I want to know how add specific architecture code to sqlite. 
Obviously i know how do that, but is there a correct way to do it?. I 
think a specific code as ffmepg has for several cpus. For example, 
altivec/mmx/sse code for hashing or b-tree or sort etc...




Antivirus. Warning: User detected. Please, keep away form keyvboard 
or you will be eliminated. Press any key. 



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



[sqlite] How can I tell what version of SQLite a database was created with?

2006-08-24 Thread Rob Richardson
Greetings!

I have an SqLite database file that cannot be opened in my application
or with SQLiteExplorer.  Both of them report "Unsupported file format".
However, it can be opened with SQLiteSpy.  If I open it in Visual
Studio's hex editor, I see that the first few bytes of the database file
identify it as a version 3 database.  The only thing I can think of is
that the database and SQliteSpy were built with a newer version of
SQLite than I have.  My library is version 3.2.1.  

So, is there a way to find out exactly what SQLite library built this
database file?

Thanks very much!

RobR

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



Re: [sqlite] Solaris 10 - sqlite3 config failed

2006-08-24 Thread Stephen Fitch

I'll changed the  $LD_OPTIONS  from -lposix4 to -lrt

And that works as well...

% ruby setup.rb distclean
---> lib
---> lib/sqlite3
---> lib/sqlite3/driver
---> lib/sqlite3/driver/dl
<--- lib/sqlite3/driver/dl
---> lib/sqlite3/driver/native
<--- lib/sqlite3/driver/native
<--- lib/sqlite3/driver
<--- lib/sqlite3
<--- lib
---> ext
---> ext/sqlite3_api
<--- ext/sqlite3_api
<--- ext
rm -f .config
rm -f InstalledFiles
% export LD_OPTIONS=-lrt
% ruby setup.rb config ---> lib
---> lib/sqlite3
---> lib/sqlite3/driver
---> lib/sqlite3/driver/dl
<--- lib/sqlite3/driver/dl
---> lib/sqlite3/driver/native
<--- lib/sqlite3/driver/native
<--- lib/sqlite3/driver
<--- lib/sqlite3
<--- lib
---> ext
---> ext/sqlite3_api
/usr/local/bin/ruby /l/p/sqlite/sqlite3-ruby-1.1.0/ext/sqlite3_api/extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_open() in -lsqlite3... yes
creating Makefile
<--- ext/sqlite3_api
<--- ext

---

So...

I'll have to sift through some docs to figure out which (posix4 or rt)
is more appropriate
or correct...

Two solutiions... and more questions :-) Love it... It's progress anyway.

Regards,

Stephen

On 8/24/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

On Thu, Aug 24, 2006 at 06:12:34AM -0700, Stephen Fitch wrote:
> "gcc -o conftest -I. -I/usr/local/lib/ruby/1.8/sparc-solaris2.10
> -I/usr/local/include  -g -O2 conftest.c  -L'/usr/local/lib'
> -Wl,-R'/usr/local/lib' -L'/usr/local/lib' -Wl,-R'/usr/local/lib'
> -lruby-static -lsqlite3  -ldl -lcrypt -lm   -lc"
> Undefined   first referenced
> symbol in file
> fdatasync   /usr/local/lib/libsqlite3.so
> ld: fatal: Symbol referencing errors. No output written to conftest

fdatasync is in librt.  You will have to add -lrt to the libraries.

See man fdatasync for details.

I've built sqlite3 on Solaris 10 successfully (though I can't help with
ruby.)

--
Geoff Lane

Today's Excuse:  Just type 'mv * /dev/null'.

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




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



Re: [sqlite] Seems like a bug in the parser

2006-08-24 Thread Jay Sprenkle

> The question should be what the compelling reason is to remove a useful
> feature.

... And *that* is exactly why Windows will always be full of security holes.


I thought it was because it used the network for inter process communications
(thus allowing external processes to attack it)

--
SqliteImporter and SqliteReplicator: Command line utilities for Sqlite
http://www.reddawn.net/~jsprenkl/Sqlite

Cthulhu Bucks!
http://www.cthulhubucks.com

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



Re: [sqlite] Solaris 10 - sqlite3 config failed

2006-08-24 Thread zzassgl
On Thu, Aug 24, 2006 at 06:12:34AM -0700, Stephen Fitch wrote:
> "gcc -o conftest -I. -I/usr/local/lib/ruby/1.8/sparc-solaris2.10
> -I/usr/local/include  -g -O2 conftest.c  -L'/usr/local/lib'
> -Wl,-R'/usr/local/lib' -L'/usr/local/lib' -Wl,-R'/usr/local/lib'
> -lruby-static -lsqlite3  -ldl -lcrypt -lm   -lc"
> Undefined   first referenced
> symbol in file
> fdatasync   /usr/local/lib/libsqlite3.so
> ld: fatal: Symbol referencing errors. No output written to conftest

fdatasync is in librt.  You will have to add -lrt to the libraries.

See man fdatasync for details.

I've built sqlite3 on Solaris 10 successfully (though I can't help with
ruby.)

-- 
Geoff Lane

Today's Excuse:  Just type 'mv * /dev/null'.

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



[sqlite] Solaris 10 - sqlite3 config failed

2006-08-24 Thread Stephen Fitch

Hi,

I resolved an issue on Solaris (10)...

When I tried (using Ruby 1.8.4) to run 'setup.rb config' on Solaris 10 I saw:

% ruby setup.rb config
---> lib
---> lib/sqlite3
---> lib/sqlite3/driver
---> lib/sqlite3/driver/dl
<--- lib/sqlite3/driver/dl
---> lib/sqlite3/driver/native
<--- lib/sqlite3/driver/native
<--- lib/sqlite3/driver
<--- lib/sqlite3
<--- lib
---> ext
---> ext/sqlite3_api
/usr/local/bin/ruby /l/p/sqlite/sqlite3-ruby-1.1.0/ext/sqlite3_api/extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_open() in -lsqlite3... no
*** /l/p/sqlite/sqlite3-ruby-1.1.0/ext/sqlite3_api/extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
   --with-opt-dir
   --without-opt-dir
   --with-opt-include
   --without-opt-include=${opt-dir}/include
   --with-opt-lib
   --without-opt-lib=${opt-dir}/lib
   --with-make-prog
   --without-make-prog
   --srcdir=/l/p/sqlite/sqlite3-ruby-1.1.0/ext/sqlite3_api
   --curdir
   --ruby=/usr/local/bin/ruby
   --with-sqlite3-dir
   --without-sqlite3-dir
   --with-sqlite3-include
   --without-sqlite3-include=${sqlite3-dir}/include
   --with-sqlite3-lib
   --without-sqlite3-lib=${sqlite3-dir}/lib
   --with-sqlite3lib
   --without-sqlite3lib
'system /usr/local/bin/ruby
/l/p/sqlite/sqlite3-ruby-1.1.0/ext/sqlite3_api/extconf.rb ' failed
Try 'ruby setup.rb --help' for detailed usage.


> Wild 

> So looking in the 

% more ext/sqlite3_api/mkmf.log
have_header: checking for sqlite3.h...  yes

"gcc -E -I. -I/usr/local/lib/ruby/1.8/sparc-solaris2.10
-I/usr/local/include  -g -O2  conftest.c -o conftest.i"
checked program was:
/* begin */
#include 
/* end */



have_library: checking for sqlite3_open() in -lsqlite3...
 no

"gcc -o conftest -I. -I/usr/local/lib/ruby/1.8/sparc-solaris2.10
-I/usr/local/include  -g -O2 conftest.c  -L'/usr/local/lib'
-Wl,-R'/usr/local/lib' -L'/usr/local/lib' -Wl,-R'/usr/local/lib'
-lruby-static -lsqlite3  -ldl -lcrypt -lm   -lc"
Undefined   first referenced
symbol in file
fdatasync   /usr/local/lib/libsqlite3.so
ld: fatal: Symbol referencing errors. No output written to conftest
collect2: ld returned 1 exit status
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { sqlite3_open(); return 0; }
/* end */

"gcc -o conftest -I. -I/usr/local/lib/ruby/1.8/sparc-solaris2.10
-I/usr/local/include  -g -O2 conftest.c  -L'/usr/local/lib'
-Wl,-R'/usr/local/lib' -L'/usr/local/lib' -Wl,-R'/usr/local/lib'
-lruby-static -lsqlite3  -ldl -lcrypt -lm   -lc"
conftest.c: In function `t':
conftest.c:5: error: `sqlite3_open' undeclared (first use in this function)
conftest.c:5: error: (Each undeclared identifier is reported only once
conftest.c:5: error: for each function it appears in.)
checked program was:
/* begin */


/*top*/
int main() { return 0; }
int t() { void ((*volatile p)()); p = (void ((*)()))sqlite3_open; return 0; }
/* end */



> The ld/link failed... on symbol fdatasync

I resolved this by:

% export LD_OPTIONS="-lposix4"
% ruby setup.rb config ---> lib
---> lib/sqlite3
---> lib/sqlite3/driver
---> lib/sqlite3/driver/dl
<--- lib/sqlite3/driver/dl
---> lib/sqlite3/driver/native
<--- lib/sqlite3/driver/native
<--- lib/sqlite3/driver
<--- lib/sqlite3
<--- lib
---> ext
---> ext/sqlite3_api
/usr/local/bin/ruby /l/p/sqlite/sqlite3-ruby-1.1.0/ext/sqlite3_api/extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_open() in -lsqlite3... yes
creating Makefile
<--- ext/sqlite3_api
<--- ext

Now all seems well and there's no undefined symbol for fdatasync

Still... I need to test the end result for working functionality, but I wanted
to pass on this information...

Not sure if this is a build bug or just a piece of voodoo needed on
Solaris (10).

Anyone care to comment?

Thanks.

Stephen

--

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



Re: [sqlite] journal-off assert

2006-08-24 Thread weiyang wang

Martin, thanks for your message.

i found out that the problem is actually caused by the missing update for
offset in my porting layer. i thought the two operations: 'seek' and 'write'
work in a strict coupled way, but they are not. so i need update my
structure that stores the offset values each time after the writing or
reading operations.

best regards,

wang


On 8/24/06, Martin Pfeifle <[EMAIL PROTECTED]> wrote:


hi,
i got the same error when I ported sqlite to an operating system using a
proprietary file system.
The reason was that our file system did not support sparse files. i.e.
the fstat-command returned the wrong file-size.

Maybe you should independently of SQLite try to
* create a file,
* write data to it
* do an fseek over the end of the file
* write data to the file
and then determine the size with fstat.
In my case that was not working.
It was a bug of the underlying file system and not of SQLite...
best Martin



- Ursprüngliche Mail 
Von: weiyang wang <[EMAIL PROTECTED]>
An: sqlite-users@sqlite.org
Gesendet: Donnerstag, den 24. August 2006, 09:52:37 Uhr
Betreff: [sqlite] journal-off assert


hi,

i am trying to integrate sqlite into mobile platform, and porting layer,
like 'win_os.c' , have been created for that purpose.

the integrated sqlite works well on our mobile platform with the default
settings, but error come out when i try to tune the performance with
'pragma
cache_size = 1'.

what i have done is:

/* create a new database*/
   sqlite3_open("contacts.db", );

/*tune the cache_size for m */
sqlite3_exec(contactsdb,"pragma default_cache_size = 1" , callback, 0,
);

/*create a table */
   sqlite3_exec(contactsdb,"create table IF NOT EXISTS contacts (name
text,phone int)" , callback, 0, );

   /*insert values into the table, totally 250 entries*/
  for ( i< 250)
{
  sqlite3_exec(("insert xxx,xxx");
}


the symptom is :

after the size of the database increased to 3K, the prgram can not insert
entries into the table anymore. the error returned is ' The database disk
image is malformed'

i have checked the porting layer i have made, the read, write, and offset
operations seems correct.

then, i recompile the sqlite codes with SQLITE_DEBUG and add
'  sqlite3_exec(contactsdb,"PRAGMA vdbe_trace=ON" , callback, 0,
);',
an assetion stalled the execution:   "assert( pPager->journalOff==jSz );"
in
pager.c

the stacked vaules at the broken time is :
pPager->journalOff= 1544
jSz= 1543
file size of contacts.db-journal is 1543 (checked from windows)

i guess the problems are related to file offset, reading, and writing. or
related to bugs of SQlite, i am not quite sure.

so, is there anyone can help me out?


best regards,

yang



Re: [sqlite] Schema updates invalidating connection

2006-08-24 Thread Matthew Jones

The only way for a database connection to know if the schema
has changed is to open and read the database file.  Sqlite_prepare()
tries to avoid reading the database file in order to reduce
contention, though, so it is unlikely to discover a database
change.  The change is only discovered when sqlite3_step()
is run.

Having sqlite3_prepare() avoid opening and reading the database
file is a desirable optimization since it makes sqlite3_prepare()
run faster in the common case where no schema change occurs.


A fair enough optimisation.


The only way I know of to force sqlite3_prepare() to check
the database schema is to close and reopen the database
connection.  But doing so will dramatically increase the
amount of time it takes to prepare each statement.


When the step fails (with SQLITE_ERROR not SQLITE_SCHEMA) the finalize 
is called and it returns SQLITE_SCHEMA. (If sqlite3_step could return 
SQLITE_SCHEMA the condition would be easier to detect). Having finalized 
the previous statement, the next statement prepared and stepped works 
perfectly. Does this mean that sqlite3_finalize is closing and reopening 
the database under the hood? If so, does this mean that sqlite3_finalize 
is very expensive? If not, then there is something that sqlite3_finalize 
does that updates the connection's view of the schema. Would it possible 
to do this prior to the prepare? (should one wish to do so and knowing 
that there is an overhead involved)



Your best approach is to modify your code so that you are
prepared to deal with SQLITE_SCHEMA errors returned by
sqlite3_step.  You'll need this anyway for the rare case
when the schema changes in between sqlite3_prepare and
sqlite3_step.


And, presumably, the less rare case where subsequent steps are called to 
retrieve data. Indeed, this is easy to cope with from a users 
perspective, an active query is terminated due to a schema change. It 
just seems a little strange (to us) that a schema change by another 
thread/process that may have completed "ages" ago means that the next 
query we attempt fails.


We can program for this in that if the first sqlite3_step of a prepared 
statement fails then, like sqlite3_exec, we can re-try the prepare and 
step. If it isn't the first step then we can terminate the select and 
somehow indicate that the schema has changed during the select.


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



Re: [sqlite] Schema updates invalidating connection

2006-08-24 Thread drh
Matthew Jones <[EMAIL PROTECTED]> wrote:
> what should our program do prior to 
> preparing a statement to ensure that its view of the database schema is 
> correct?
> 

The only way for a database connection to know if the schema
has changed is to open and read the database file.  Sqlite_prepare()
tries to avoid reading the database file in order to reduce
contention, though, so it is unlikely to discover a database
change.  The change is only discovered when sqlite3_step()
is run.

Having sqlite3_prepare() avoid opening and reading the database
file is a desirable optimization since it makes sqlite3_prepare()
run faster in the common case where no schema change occurs.

The only way I know of to force sqlite3_prepare() to check
the database schema is to close and reopen the database
connection.  But doing so will dramatically increase the
amount of time it takes to prepare each statement.

Your best approach is to modify your code so that you are
prepared to deal with SQLITE_SCHEMA errors returned by
sqlite3_step.  You'll need this anyway for the rare case
when the schema changes in between sqlite3_prepare and
sqlite3_step.
--
D. Richard Hipp   <[EMAIL PROTECTED]>


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



[sqlite] Schema updates invalidating connection

2006-08-24 Thread Matthew Jones
We have a problem that is obviously to do with our failing to understand 
sqlite properly. Using a test program (enclosed) we create a table in a 
new database and then wait (for use input). If we then open the same 
sqlite database using sqlite3 and create another table in the database 
when we continue with our program it fails to insert data into the table 
it has created. Now, we know that schema changes invalidate any 
previously prepared statements but we always prepare and execute (step) 
our statements in one go. So what should our program do prior to 
preparing a statement to ensure that its view of the database schema is 
correct?


If we use sqlite3_exec instead it all works as this has a built in retry 
for the step failing and then the finalize returning SQLITE_SCHEMA. I 
thought this was to cater for the case of preparing before the schema 
change and then stepping afterwards, the documented failure, but it also 
covers our case.


I raised a bug at sqlite.org, ticket 1936, but have been told that I 
should post to the list to receive support. Obviously, we are missing 
something very basic here or .


Our problem occurs in a multi-threaded environment but we have minimized 
the code in the attached example to remove any threading issues.


code follows:

/* Prepare, execute, finalize as an atomic operation */
void execute(struct sqlite3 *db, const char *sql)
{
int status = 0;
struct sqlite3_stmt *stmt;
const char *tail = 0;

fprintf(stdout, "%s\n", sql);

if((status = sqlite3_prepare(db, sql, strlen(sql), ,
)) != SQLITE_OK)
{
fprintf(stderr, "sqlite3_prepare: %d\n", status);
}

status = sqlite3_step(stmt);
if(status != SQLITE_DONE)
{
fprintf(stderr, "sqlite3_step: %d, %s\n", status,
sqlite3_errmsg(db));
}

if((status = sqlite3_finalize(stmt)) != SQLITE_OK)
{
fprintf(stderr, "sqlite3_finalize: %d, %s\n", status,
sqlite3_errmsg(db));
}
}

int main(int ac, char* av[])
{
int status = 0;
struct sqlite3 *db = 0;
char buffer[256];

if((status = sqlite3_open("test.db", )) != SQLITE_OK)
{
fprintf(stderr, "sqlite3_open: %d\n", status);
}

sprintf(buffer, "create table %s (i int)", av[1]);
execute(db, buffer);

puts("type  to continue:");
getchar();

sprintf(buffer, "insert into %s values (4)", av[1]);
execute(db, buffer);

if((status = sqlite3_close(db)) != SQLITE_OK)
{
fprintf(stderr, "sqlite3_close: %d\n", status);
}

return 0;
}

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



AW: [sqlite] journal-off assert

2006-08-24 Thread Martin Pfeifle
hi,
i got the same error when I ported sqlite to an operating system using a 
proprietary file system.
The reason was that our file system did not support sparse files. i.e.
the fstat-command returned the wrong file-size. 
 
Maybe you should independently of SQLite try to 
* create a file,
* write data to it
* do an fseek over the end of the file
* write data to the file
and then determine the size with fstat.
In my case that was not working.
It was a bug of the underlying file system and not of SQLite...
best Martin


 
- Ursprüngliche Mail 
Von: weiyang wang <[EMAIL PROTECTED]>
An: sqlite-users@sqlite.org
Gesendet: Donnerstag, den 24. August 2006, 09:52:37 Uhr
Betreff: [sqlite] journal-off assert


hi,

i am trying to integrate sqlite into mobile platform, and porting layer,
like 'win_os.c' , have been created for that purpose.

the integrated sqlite works well on our mobile platform with the default
settings, but error come out when i try to tune the performance with 'pragma
cache_size = 1'.

what i have done is:

 /* create a new database*/
sqlite3_open("contacts.db", );

 /*tune the cache_size for m */
 sqlite3_exec(contactsdb,"pragma default_cache_size = 1" , callback, 0,
);

 /*create a table */
sqlite3_exec(contactsdb,"create table IF NOT EXISTS contacts (name
text,phone int)" , callback, 0, );

/*insert values into the table, totally 250 entries*/
   for ( i< 250)
  {
   sqlite3_exec(("insert xxx,xxx");
  }


the symptom is :

after the size of the database increased to 3K, the prgram can not insert
entries into the table anymore. the error returned is ' The database disk
image is malformed'

i have checked the porting layer i have made, the read, write, and offset
operations seems correct.

then, i recompile the sqlite codes with SQLITE_DEBUG and add
'  sqlite3_exec(contactsdb,"PRAGMA vdbe_trace=ON" , callback, 0,
);',
an assetion stalled the execution:   "assert( pPager->journalOff==jSz );" in
pager.c

the stacked vaules at the broken time is :
pPager->journalOff= 1544
jSz= 1543
file size of contacts.db-journal is 1543 (checked from windows)

i guess the problems are related to file offset, reading, and writing. or
related to bugs of SQlite, i am not quite sure.

so, is there anyone can help me out?


best regards,

yang

[sqlite] journal-off assert

2006-08-24 Thread weiyang wang

hi,

i am trying to integrate sqlite into mobile platform, and porting layer,
like 'win_os.c' , have been created for that purpose.

the integrated sqlite works well on our mobile platform with the default
settings, but error come out when i try to tune the performance with 'pragma
cache_size = 1'.

what i have done is:

/* create a new database*/
   sqlite3_open("contacts.db", );

/*tune the cache_size for m */
sqlite3_exec(contactsdb,"pragma default_cache_size = 1" , callback, 0,
);

/*create a table */
   sqlite3_exec(contactsdb,"create table IF NOT EXISTS contacts (name
text,phone int)" , callback, 0, );

   /*insert values into the table, totally 250 entries*/
  for ( i< 250)
 {
  sqlite3_exec(("insert xxx,xxx");
 }


the symptom is :

after the size of the database increased to 3K, the prgram can not insert
entries into the table anymore. the error returned is ' The database disk
image is malformed'

i have checked the porting layer i have made, the read, write, and offset
operations seems correct.

then, i recompile the sqlite codes with SQLITE_DEBUG and add
'  sqlite3_exec(contactsdb,"PRAGMA vdbe_trace=ON" , callback, 0,
);',
an assetion stalled the execution:   "assert( pPager->journalOff==jSz );" in
pager.c

the stacked vaules at the broken time is :
pPager->journalOff= 1544
jSz= 1543
file size of contacts.db-journal is 1543 (checked from windows)

i guess the problems are related to file offset, reading, and writing. or
related to bugs of SQlite, i am not quite sure.

so, is there anyone can help me out?


best regards,

yang


Re: [sqlite] problem with application which uses sqlite

2006-08-24 Thread Martin Jenkins

renato71 wrote:

I am tryin to install KTU (KDE Translations Updated) and it needs sqlite.

I've tried to install on Mandriva free 2006, KDE 3.2. On first try to
configure KTU I got message that sqlite3 is not found.


As you suggest later in your message, this sounds like a bug in the KTU 
config scripts, so you're probably not going to get much joy here. If 
you look at the KTU page at http://www.kde-apps.org (the Administration, 
System Tools category) you'll see there was a similar dependency problem 
with svn, so that's probably the best place to ask.


In the meantime,

> If it is due to an error in KTU configure file, how do I fix it?

Have a look in config.log(sp?) to see where config thinks sqlite(3) 
lives (it might be hard coded to the wrong place) and check if there's a 
"--sqlite-dir=/path/to/sqlite" (or similar) option for ./configure.


HTH

Martin

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



[sqlite] problem with application which uses sqlite

2006-08-24 Thread renato71

Hi,

I am tryin to install KTU (KDE Translations Updated) and it needs sqlite.

I've tried to install on Mandriva free 2006, KDE 3.2. On first try to
configure KTU I got message that sqlite3 is not found. OK, so I dload sqlite
and installed it. I guess. Cos I still got the sam emessage durin KTU
configure.

I tried both as user, and as root. After dload of sqlite, I saved it to
/home/user, then I followed the procedure that is mostly described:
-entered dir
-mkdir bld
-cd bld
-../configure
-make
-sudo make install

I've tested sqlite and it works.

Afterwards, I endered ktu dir, and got the error while running ./configure,
from ktu-0.0.3 dir. Should I create bld dir as well, and configure from it?

I've tried usual configure-make-make install, but with same results. sqlite
apperantly works, but KTU during his confugure reports that sqlite is not
found.

If it is due to an error in KTU configure file, how do I fix it?

Thanks in advance!

Renato Pavicic
Croatia
-- 
View this message in context: 
http://www.nabble.com/problem-with-application-which-uses-sqlite-tf2156856.html#a5958197
Sent from the SQLite forum at Nabble.com.


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