Re: [sqlite] Profile API: triggered only when sqlite3_step() returns DONE?

2011-05-05 Thread Marian Cascaval


>From: Guillaume BIENKOWSKI <guitre...@gmail.com>
To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
Sent: Thu, May 5, 2011 3:00:55 PM
Subject: Re: [sqlite] Profile API: triggered only when sqlite3_step() returns 
DONE?

>Okay we answered at the same time.

Indeed :)

>I have no problem concerning the retrieving of data, I use sqlite3_column()
to get the data I need. The callback I'm talking about is the *profiling*
callback, not the one you're thinking about (you're talking about the
callback you pass when using sqlite3_exec()).

>The problem is that the *profiling* function (that you register with
sqlite3_profile() ) gets called only when you step over to the end, to
retrieve all the records you wanted.
Since, in my case, I'm only interested in the first record, I don't step()
until the end, so the profiling function is never called.

I have no idea about the 'profile' thing, but since you want your statement to 
end (i.e. return SQLITE_DONE) after the first retrieved record, I recommend 
using 'LIMIT 1' in your query.

>Well, except when I accidentally try to retrieve a non-existent id, which I
have in my test cases. This time, the single step() I use directly returns
"SQLITE_DONE" and the profiling function is called.

>Anyway, what's disturbing is that I was expecting the function to be called
event if I don't step() until the end. Typically when I perform the
finalize() on my query.
>From what I see in the code, the profiling function is called in step(),
which I think is strange.

>Guillaume

>On Thu, May 5, 2011 at 1:52 PM, Marian Cascaval 
<mariancasca...@yahoo.com>wrote:

> Please, read once more the documentation:
>
> http://www.sqlite.org/cintro.html
>
>
> sqlite3_step() does not trigger any callback function, it only tells you if
> there's any data to retrieve.
>
> If you want to retrieve data, either use sqlite3_column() in your
> exemplified
> typical code, or use sqlite3_exec() - which triggers callback function.
>
>
>
> Marian Cascaval
>
>
>
>
>
> 
> From: Guillaume B <guitre...@gmail.com>
> To: sqlite-users@sqlite.org
> Sent: Thu, May 5, 2011 11:38:56 AM
> Subject: [sqlite] Profile API: triggered only when sqlite3_step() returns
> DONE?
>
> Hey guys,
>
> I'm trying to use the sqlite3_profile() function to monitor the delays
> of the requests I make in my application.
> I can see some of the statements in my trace, but it seems that not
> all the statements trigger the callback.
>
> Some context informations first:
> - sqlite3 is in version 3.6.0, running on an SH4 platform under linux
> - the code is in C/C++ and uses the sqlite3 API with the "v2" statements
>
> My typical code flow is something like that:
>
> - prepare a SELECT query
> - sqlite3_step(), make sure it returns SQLITE_ROW (I expect to get one
> record, and only one)
> - finalize()
>
> In this mode, I never see the callback triggered, or just in erroneous
> queries.
> I actually narrowed down that the callback is only called when
> sqlite3_step() *doesn't* return SQLITE_ROW, but rather SQLITE_DONE,
> which means it didn't find any record and is finished.
>
> Problem is, I only need to get one record out of the query, so I never
> call step() after my SQLITE_ROW again to make the function return
> SQLITE_DONE.
>
> My questions now:
>
> - Is the profiling callback triggered only when reaching the end of
> the query (<=> sqlite3_step() returns "DONE") ?
>
> - If yes, is it normal? Timing the request time should only be a
> matter on stepping once, since the whole query gets passed to the
> sqlite engine and successive steps should hit a cache or something
> (i'm extrapolating there...)?
> Or does the sqlite3 C API proceeds by... steps and then computes the
> total amount of time spent in successive sqlite3_step() calls?
>
> - Then wouldn't it be more convenient to place the callback trigger
> when one finalizes the query? So that even if we don't get all the
> records from the query (<=> don't call step() until we hit
> SQLITE_DONE), we still get a timing?
>
> Thanks to whoever answers :)
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Profile API: triggered only when sqlite3_step() returns DONE?

2011-05-05 Thread Marian Cascaval
Please, read once more the documentation:

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


sqlite3_step() does not trigger any callback function, it only tells you if 
there's any data to retrieve.

If you want to retrieve data, either use sqlite3_column() in your exemplified 
typical code, or use sqlite3_exec() - which triggers callback function.



Marian Cascaval






From: Guillaume B <guitre...@gmail.com>
To: sqlite-users@sqlite.org
Sent: Thu, May 5, 2011 11:38:56 AM
Subject: [sqlite] Profile API: triggered only when sqlite3_step() returns DONE?

Hey guys,

I'm trying to use the sqlite3_profile() function to monitor the delays
of the requests I make in my application.
I can see some of the statements in my trace, but it seems that not
all the statements trigger the callback.

Some context informations first:
- sqlite3 is in version 3.6.0, running on an SH4 platform under linux
- the code is in C/C++ and uses the sqlite3 API with the "v2" statements

My typical code flow is something like that:

- prepare a SELECT query
- sqlite3_step(), make sure it returns SQLITE_ROW (I expect to get one
record, and only one)
- finalize()

In this mode, I never see the callback triggered, or just in erroneous queries.
I actually narrowed down that the callback is only called when
sqlite3_step() *doesn't* return SQLITE_ROW, but rather SQLITE_DONE,
which means it didn't find any record and is finished.

Problem is, I only need to get one record out of the query, so I never
call step() after my SQLITE_ROW again to make the function return
SQLITE_DONE.

My questions now:

- Is the profiling callback triggered only when reaching the end of
the query (<=> sqlite3_step() returns "DONE") ?

- If yes, is it normal? Timing the request time should only be a
matter on stepping once, since the whole query gets passed to the
sqlite engine and successive steps should hit a cache or something
(i'm extrapolating there...)?
Or does the sqlite3 C API proceeds by... steps and then computes the
total amount of time spent in successive sqlite3_step() calls?

- Then wouldn't it be more convenient to place the callback trigger
when one finalizes the query? So that even if we don't get all the
records from the query (<=> don't call step() until we hit
SQLITE_DONE), we still get a timing?

Thanks to whoever answers :)
___
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] date field with default current date

2011-04-22 Thread Marian Cascaval






From: Fabio Spadaro <fabiolinos...@gmail.com>
To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
Sent: Fri, April 22, 2011 12:46:53 PM
Subject: Re: [sqlite] date field with default current date


>In my system is set up with 11:35:07 while I am in the data 9:37:30
>Why?

What is the difference between your system time and UTC?




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


Re: [sqlite] GROUP BY Problem

2011-04-08 Thread Marian Cascaval




From: Pete <p...@mollysrevenge.com>
To: sqlite-users@sqlite.org
Sent: Fri, April 8, 2011 3:31:05 AM
Subject: [sqlite] GROUP BY Problem


>SELECT c1,c2,sum(t2.c3),count(t3.c4) FROM t1 LEFT JOIN t2 on t2.key2=t1.key1
>LEFT JOIN t3.key3=t1.key1 GROUP BY t1.key1

Shouldn't the second JOIN be 

LEFT JOIN t3 ON t3.key3=t1.key1 ?


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


Re: [sqlite] read full txt file in one record

2011-04-06 Thread Marian Cascaval




From: Gert Van Assche 
To: sqlite-users@sqlite.org
Sent: Wed, April 6, 2011 12:08:47 AM
Subject: [sqlite] read full txt file in one record

>Dear all,

>what would be the best way to read a full txt file into one record?

Until the experts reply to this, I'll try my cumbersome solution:
(I am no expert, but I tried to find a walk around which worked for me)

1. In every text file: replace (with a hex editor) the hex sequence "0D 0A" 
(this is the CR + LF code ) with any other tow ASCII chars that you know for 
sure they won't appear in the text files (i.e. "~~").
2.  .import FILE TABLE
3. edit the database file with a hex editor, replacing "~~" with "0D 0A".

To test it:
SELECT rowid, your_text_data_column FROM your_table;


Hopes it helps .. somehow.



>Now, when I use
 .import FILE TABLE
>I have every line on a record.

>I need all lines of one file on one record.
>The next record I need to fill with all lines of another file.

>thanks for your advise.

>Gert
___
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] bug with sqlite

2011-03-29 Thread Marian Cascaval
Windows doesn't allow "con" named fodlers or files.



Marian Cascaval





From: Felix Zimmermann <fea...@yahoo.de>
To: sqlite-users@sqlite.org
Sent: Mon, March 28, 2011 10:26:59 PM
Subject: [sqlite] bug with sqlite

hi
why isnt it possible to create a database file with the name "con" ? i just 
doesnt work. no matter what file extension im taking.

regrets
Felix
___
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] sqlite3_close( ) error

2011-03-24 Thread Marian Cascaval






From: Simon Slavin <slav...@bigfraud.org>
To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
Sent: Thu, March 24, 2011 5:39:58 AM
Subject: Re: [sqlite] sqlite3_close( )  error


On 24 Mar 2011, at 3:06am, Zaryab M. Munir wrote:



>By the way, to whoever understands the code on the web page.  Why does one 
>function simply check the return value as a boolean '( rc )' but the other 
>function check by explicitly comparing with SQLITE_OK ?  I have no complaint 
>about either, and using both does demonstrate that they are both okay, I just 
>wonder if there is something there I am not seeing.


rc is INT as sqlite3_open() returns an INT.
SQLITE_OK is defined as 0 in 'sqlite3.h',
so both are checked as boolean.


Marian Cascaval



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


Re: [sqlite] Compiler warnings in R-Tree code under Visual Studio Express

2011-02-18 Thread Marian Cascaval
I'm suspecting there's something wrong with Studio Express C++.
I use both 2008 and 2010 and I notice on 2008 that the IDE loses track of code 
in case of large source files. Sometimes comments that should have a certain 
colour have a different one and so on.

For example, the first warning at line 120736 there is a variable 'area' which 
is of type 'float' defined just 3 lines above. Yet in the line at 120736:

area = area * (DCOORD(p->aCoord[ii+1]) - DCOORD(p->aCoord[ii]));

the IntelliSense shows that the second instance of 'area' is of type 'int'.

To prove this is a problem specific only to Microsoft's IDEs, could you give 
the 
simplest code example (with SQLITE_ENABLE_RTREE=1) to compile it and see if we 
get different results with the warnings?



Marian Cascaval





From: Afriza N. Arief <afriza...@gmail.com>
To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
Sent: Thu, February 17, 2011 7:26:33 AM
Subject: [sqlite] Compiler warnings in R-Tree code under Visual Studio Express

Hi,

Microsoft Visual Studio Express C++ is available for free from
http://www.microsoft.com/express/Downloads/#2010-Visual-CPP

I tried to compile SQLite 3.7.5 with SQLITE_ENABLE_RTREE=1 and got the
following warnings:

sqlite3.c(120736): warning C4244: '=' : conversion from 'double' to 'float',
possible loss of data
sqlite3.c(120749): warning C4244: '+=' : conversion from 'double' to
'float', possible loss of data
sqlite3.c(120834): warning C4244: '=' : conversion from 'double' to 'float',
possible loss of data
sqlite3.c(121803): warning C4244: '+=' : conversion from 'double' to
'float', possible loss of data
sqlite3.c(121804): warning C4244: '+=' : conversion from 'double' to
'float', possible loss of data
sqlite3.c(121808): warning C4244: '=' : conversion from 'double' to 'float',
possible loss of data
sqlite3.c(121815): warning C4244: 'initializing' : conversion from 'double'
to 'float', possible loss of data
sqlite3.c(121914): warning C4244: 'function' : conversion from 'i64' to
'int', possible loss of data
sqlite3.c(121917): warning C4244: 'function' : conversion from 'i64' to
'int', possible loss of data

Thank you,

Afriza N. Arief
___
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] Second sqlite3_prepare_v2() call fails on iOS path-based databases

2011-02-01 Thread Marian Cascaval
Since this topic has lead to different sub-topic I dare ask a question (I'm a 
beginner both in C++ and, Oh boy, in SQLite too).

Tito, do you really need the 5th argument in sqlite3_prepare_v2() i.e. 
""?
>From what I understand from your code, there's only one SQL statement to be 
prepared, so there would be no need for the supposedly next SQL statement.
Do you reuse (reset) these statements?
I was under the impression that the 5th argument is used when the SQL statement 
string contains more than one SQL statement.

Thanks for your patience if I misunderstood something .. or all.



Marian Cascaval





From: Tito Ciuro <tci...@mac.com>
To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
Sent: Mon, January 31, 2011 9:38:57 PM
Subject: [sqlite] Second sqlite3_prepare_v2() call fails on iOS path-based 
databases


// Build the first statement
sqlite3_stmt *oneStatement = NULL;
const char *oneSQL = [[NSString stringWithFormat:@"INSERT INTO %@(%@, %@, 
%@, %@) VALUES (?,?,?,?);", NSFValues, NSFKey, NSFAttribute, NSFValue, 
NSFDatatype]UTF8String];
int statusOne = sqlite3_prepare_v2(db, oneSQL, (int)strlen(oneSQL), 
, );










___
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] LAST() function not supported

2011-01-29 Thread Marian Cascaval
Thanks for the professional explanation.
I think I begin to see the importance of specificity of database query.

Nevertheless, I found another info source on LAST() function:

http://www.codesnout.com/SQLSample/SQL-LAST.php

They also say "The LAST() function is not supported by certain databases.".

It seems to me this function is a kind of wrapper which is valid for tables 
with 
a primary key.
But I assume a pro would not use it anyway since LAST() it's not a general SQL 
function.
As far as I could figure, this function is not a defined function in the SQL92 
standard.



Marian Cascaval





From: Puneet Kishor <punk.k...@gmail.com>
To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
Sent: Sat, January 29, 2011 11:12:52 PM
Subject: Re: [sqlite] LAST() function not supported


On Saturday, January 29, 2011 at 3:03 PM, Marian Cascaval wrote:

> Here's the info source on LAST() function:
> 
> http://www.w3schools.com/sql/sql_func_last.asp
> 
> 
> 
> I needed to retrieve the last row from a table.
> And the example (the workaround tip) in the above link solved my issue.
> 
> 
> 
> 


While the "workaround" solved your problem, the workaround *is* the right way 
to 
solve the problem. Their original solution is absolutely goofy. From their 
docs, 
"The LAST() function returns the last value of the selected column." That 
sentence makes absolutely no sense. What does "last value of the selected 
column" mean? We happen to now know that they mean the last row in the result 
set. But, why not just say that?


Their proposed solution is absolutely out of whack -- SELECT LAST(OrderPrice) 
AS 
LastOrderPrice FROM Orders


Note that a SQL result set doesn't have a concept of first or last unless you 
impose an order on it using the ORDER BY clause. Interestingly, they don't say 
which databases support this LAST() function. I have not come across, yet, any 
database that supports a LAST() function the way they say it should.


In other words, rest assured, LIMIT 1 is indeed the correct way to restrict the 
result set to one row. However, if you want the "last" row, you have to tell 
your database program what you mean by last. You do so by specifying ORDER BY 
. Then, you can take the last or the first by using LIMIT 
properly. For example, if the orders were to be ordered by, say, the OrderDate, 
and you wanted the earliest date, you could do


SELECT OrderPrice FROM Orders ORBER BY OrderDate LIMIT 1;


If you wanted the latest order, you could do


SELECT OrderPrice FROM Orders ORDER BY DESC OrderDate LIMIT 1;


Hope this helps.




> 
> 
> From: Puneet Kishor <punk.k...@gmail.com>
> To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
> Sent: Sat, January 29, 2011 10:47:44 PM
> Subject: Re: [sqlite] LAST() function not supported
> 
> 
> 
> 
> On Saturday, January 29, 2011 at 2:38 PM, Marian Cascaval wrote:
> 
> 
> > Hi!
> > 
> > Is LAST() function going to be supported?
> > 
> > Or will the "SELECT ... FROM ... ORDER BY ... DESC LIMIT 1" workaround 
> > always 
>
> > be 
> > 
> > enough?
> > 
> > 
> 
> 
> Where did you get information on this "LAST()" function?
> 
> 
> 
> > My concern is if there might be any speed improvement if LAST() function 
> > were 
>
> > to 
> > 
> > be implemented, comparing to the workaround.
> > 
> > 
> You are possibly confusing how a function works vs. the SQL syntax. A 
> function 

> acts on a column or an expression for every row in the result set. It doesn't 
> modify the number of rows in a result set. On the other hand, the LIMIT 
> clause 

> does nothing to the entries that have been retrieved. Instead, it throttles 
> the 
>
> size of the result set, that is, it controls the number of rows in the result 
> set.
> 
> 
> 
> 
> -- 
> Puneet Kishor
> Sent with Sparrow 
> 
> 
> 
> 
> 




___
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] LAST() function not supported

2011-01-29 Thread Marian Cascaval
As I see it,from the point of view of just retrieving the last row from a 
table, 
no ORDER BY is necessary thus saving processor time.






From: Nicolas Williams <nicolas.willi...@oracle.com>
To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
Sent: Sat, January 29, 2011 10:51:30 PM
Subject: Re: [sqlite] LAST() function not supported

On Sat, Jan 29, 2011 at 12:38:37PM -0800, Marian Cascaval wrote:
> Hi!
> 
> Is LAST() function going to be supported?
> 
> Or will the "SELECT ... FROM ... ORDER BY ... DESC LIMIT 1" workaround always 
>be 
>
> enough?
> 
> My concern is if there might be any speed improvement if LAST() function were 
>to 
>
> be implemented, comparing to the workaround.

Use EXPLAIN QUERY PLAN...

If there's enough indices to satisfy all the ORDER BY expressions then
how could a "last()" function do any better?  For that matter, if there
aren't enough indices to satisfy all the ORDER BY expressions then how
could a "last()" function do any better?  What optimization could such a
function implement that the query optimizer couldn't?  Syntactically
speaking, there's no additional information in "last()" -- it's just
syntactic sugar.

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] LAST() function not supported

2011-01-29 Thread Marian Cascaval
Here's the info source on LAST() function:

http://www.w3schools.com/sql/sql_func_last.asp



I needed to retrieve the last row from a table.
And the example (the workaround tip) in the above link solved my issue.





From: Puneet Kishor <punk.k...@gmail.com>
To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
Sent: Sat, January 29, 2011 10:47:44 PM
Subject: Re: [sqlite] LAST() function not supported




On Saturday, January 29, 2011 at 2:38 PM, Marian Cascaval wrote:

> Hi!
> 
> Is LAST() function going to be supported?
> 
> Or will the "SELECT ... FROM ... ORDER BY ... DESC LIMIT 1" workaround always 
>be 
>
> enough?
> 
> 
> 
> 


Where did you get information on this "LAST()" function?


> My concern is if there might be any speed improvement if LAST() function were 
>to 
>
> be implemented, comparing to the workaround.
> 
> 
> 
> 
> 
You are possibly confusing how a function works vs. the SQL syntax. A function 
acts on a column or an expression for every row in the result set. It doesn't 
modify the number of rows in a result set. On the other hand, the LIMIT clause 
does nothing to the entries that have been retrieved. Instead, it throttles the 
size of the result set, that is, it controls the number of rows in the result 
set.




-- 
Puneet Kishor
Sent with Sparrow 




___
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] LAST() function not supported

2011-01-29 Thread Marian Cascaval
Hi!

Is LAST() function going to be supported?

Or will the "SELECT ... FROM ... ORDER BY ... DESC LIMIT 1" workaround always 
be 
enough?

My concern is if there might be any speed improvement if LAST() function were 
to 
be implemented, comparing to the workaround.



Marian Cascaval



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


Re: [sqlite] how to create sqlite3_value structure to be used with sqlite3_bind_value()?

2011-01-26 Thread Marian Cascaval
I'm no expert either in C or in SQLite but what Igor is pointing out is 
extremely important, because I have noticed myself the benefit of using 
sqlite3_prepare_v2() and sqlite3_reset() instead of just using sqlite3_exec() 
within iterations. And this is what SQLite documentation is talking about.

The speed optimization in my C++ program was incredible and the code structure 
was like this (just like Igor's recommendations):

sqlite3_exec(... "BEGIN TRANSACTION" ...);
sqlite3_prepare_v2();
for (int i=0; i<100; i++){
sqlite3_reset();
sqlite3_bind_int();
sqlite3_step();
}
sqlite3_exec(... "COMMIT TRANSACTION" ...);


Sorry if this is too basic and you already knew it, but I felt like sharing my 
basic knowledge :P




Marian Cascaval






From: Igor Tandetnik <itandet...@mvps.org>
To: sqlite-users@sqlite.org
Sent: Wed, January 26, 2011 2:51:38 PM
Subject: Re: [sqlite] how to create sqlite3_value structure to be used with 
sqlite3_bind_value()?

Bella Chan <bella.c...@synopsys.com> wrote:
> I am surprised to see that C is slower than Perl when inserting lots of data 
>into DB sequentially as I have 100 columns in a row
> so I have been making 100 bind_int calls while Perl I only need to do execute 
>once.

You are doing something wrong. Are you re-preparing the statement for each row, 
by any chance? Are you grouping your inserts within a transaction? Show some 
code.

> Trying to see if I can use bind_value()
> instead but no clue ho to create the sqlite3_value structure.

sqlite3_bind_value is only useful inside custom functions. In any case, your 
problem lies elsewhere.
-- 
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] SQLite version 3.7.5 - code freeze

2011-01-24 Thread Marian Cascaval
Here's a first documentation typo:

http://www.sqlite.org/draft/c3ref/mprintf.html
"_In_ sqlite3_snprintf() routine is similar to "snprintf()" from the standard C 
library."
It should be "_The_ sqlite3_snprintf() routine is similar to ...".



Marian Cascaval





From: Richard Hipp <d...@sqlite.org>
To: sqlite-...@sqlite.org; General Discussion of SQLite Database 
<sqlite-users@sqlite.org>
Sent: Mon, January 24, 2011 8:12:44 PM
Subject: [sqlite] SQLite version 3.7.5 - code freeze

The current plan is to release SQLite version 3.7.5 on Wednesday of next
week 2011-02-02.  Please see draft release notes here:

  http://www.sqlite.org/draft/releaselog/3_7_5.html

You can download a snapshot of the latest SQLite amalgamation from here:

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

Unless serious problems or omissions are found, there will be no further
code changes prior to the release of version 3.7.5, except to address
whatever minor documentation errors, compiler warnings, or other nuisance
issues that come up during release testing.

Your help in identifying potential problems prior to the release of version
3.7.5 is appreciated.  Please download and test the snapshot shown above in
your applications and let us now (quickly) of any issues you encounter.

As soon as version 3.7.5 is released, our plan is to merge in several other
changes that currently reside in branches of the source three:

   *  A blocking version of PRAGMA wal_checkpoint that guarantees that the
WAL file will reset
   *  Enhancements to the foreign-key checking logic
   *  Enhancements to the query planner

I'll be asking you to download and test new snapshots after these merges
occur in early February.  But for now, we want version 3.7.5 to be very
stable, so please do test as soon as you can and give us feedback right
away.

Thanks!

-- 
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


[sqlite] Documentation typos - part no.3

2011-01-20 Thread Marian Cascaval
Hi!

Again, some more Documentation typos
with some fun while we're at it:

1.
http://www.sqlite.org/c3ref/intro.html
"These pages _defined_ the C-language interface to SQLite."
Good old days!

2.
http://www.sqlite.org/quickstart.html
"... sqlite3_exec() on line _27_ ..."
Most C++ editors insist on _28_.

3.
http://www.sqlite.org/quickstart.html
"... and sqlite3_close() on line _31_ ..."
Not to mention _33_.

4.
http://www.sqlite.org/cintro.html
"The "sqlite3_column()" shown in the list is _place holders_  for an entire 
_families_ of ..."
Further down the page the truth is revealed: "... is really _a 
place-holder_ 
for an entire _family_ of ..."

5.
http://www.sqlite.org/cintro.html
"However, the SQLite allows the same prepared statement _to_ evaluated multiple 
times."
To be, or not _to be_: that is the .. query.

6.
http://www.sqlite.org/cintro.html
"_These_ is accomplished using the following routines:"
Know what? Is hard to make fun of every typo I find. I'm not that 
resourceful. Couldn't find any jokes for _This_ one.

7.
http://www.sqlite.org/cintro.html
"SQLite includes _interface_ that can be used to extend its functionality. Such 
routines include:"
The textual construction _faces_ a  lack of plural.

8.
http://www.sqlite.org/cintro.html
"The sqlite3_create_collation() interface is used to create ... The 
sqlite3_create_module() interface is used __ register ..."
It used _to_ be correct in the first sentence but not anymore in the second.


.. and the last one, which I hope is taken as a joke and nothing more (by the 
way, thank you again Mr.Hipp for making easy, even for non-programmers, to use 
SQL statements from within C++ code):


9.
http://www.sqlite.org/cintro.html
"A complete list of functions that form the SQLite application _program_ 
interface ..."
Who wrote this definitely doesn't like _programming_ ;)




Marian Cascaval



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


Re: [sqlite] sqlite3_open_v2 somewhat misses the point

2011-01-13 Thread Marian Cascaval
Uhm... so you've figured I'm not an English teacher either.

That's why a team is good for: correcting each other's typos :)




Marian Cascaval





From: Puneet Kishor <punk.k...@gmail.com>
To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
Sent: Thu, January 13, 2011 11:21:11 PM
Subject: Re: [sqlite] sqlite3_open_v2 somewhat misses the point

Since you *are* correcting typos in the documentation (and have good 
humor about you while doing so) ...

Marian Cascaval wrote:
> I'm not a programmer, so just bare with me please..

... that would require Richard to get personal with you. You probably 
want to change the above to

"I'm not a programmer, so just _bear_ with me please."


-- 
Puneet Kishor
___
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] sqlite3_open_v2 somewhat misses the point

2011-01-13 Thread Marian Cascaval
Hi again fellows SQLiters and thank you Mr. Hipp for this great C code!


I was under the impression that sqlite3_open_v2 allows you to know for sure if 
the database is or isn't opened successfully when using the 
SQLITE_OPEN_READWRITE flag.

But when the first argument to sqlite3_open_v2 is NULL, the function returns 
SQLITE_OK, counter to my logic. Of course, subsequent error messages appear 
from 
trying to execute SQL statements on a non-existent database, but the point is 
the error comes too late and not at the appropriate time i.e. the opening of 
database.

So, I conclude it's the programmer's job to test, prior to executing 
sqlite3_open_v2, if there's a database to open at all (for example testing the 
value of argc from 'int main(int argc, char **argv)' where argv would be the 
database path).

Is the returning of SQLITE_OK from sqlite3_open_v2(NULL, _, 
SQLITE_OPEN_READWRITE, _) an intended feature?

If so, then I think this info could be useful to have it mentioned in the 
sqlite3_open Documentation under SQLITE_OPEN_READWRITE:
http://www.sqlite.org/c3ref/open.html

I think it should go like this:
"In either case the database must already exist, otherwise an error is returned 
_, except when first parameter is NULL_."


I'm not a programmer, so just bare with me please..




Marian Cascaval


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


[sqlite] Documentation typos - part no.2

2011-01-13 Thread Marian Cascaval
Hi!

Some more Documentation typos:

1.
http://www.sqlite.org/pragma.html#pragma_synchronous
"... will not corrupt the _dartbase_."
 It should be either _dartboard_ or _database_ but I'd stick with the 
latter 
;).

2.
http://www.sqlite.org/c3ref/open.html
"... and _is creates it_ if it does not already exist."
 It should be either _is created_ or _creates it_.
It's clear the author had these two ideas in mind and amalgamated them ;).



I can drop the jokes next time if solemnity is required here.


Marian Cascaval


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


Re: [sqlite] How SQLite manages result of a SELECT query?

2011-01-13 Thread Marian Cascaval
Hi!

As far as I understandd, sqlite3_step() does not fetch any data but returns 
SQLITE_ROW. If this is the case, then use sqlite3_column() to fetch the actual 
data.



Marian Cascaval





From: Sunil Bhardwaj <sbhard...@ipolicynetworks.com>
To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
Sent: Thu, January 13, 2011 12:42:46 PM
Subject: Re: [sqlite] How SQLite manages result of a SELECT query?

Hi


Let me rephrase my question.

We are using in-memory db.

When we do "execQuery":
1. Does sqlite fetches complete result of query and keep it in separate memory
2. OR Does sqlite fetches result of query in chunks, when we use "sqlite3_step" 
and keep it in separate memory
3. OR Does sqlite fetches records one by one, when we use "sqlite3_step"

Please help us to understand, how can we use it efficiently. 

Thanks
Sunil Bhardwaj
Ext. 1125 (0120-2567001)
9818868910

-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Ian Hardingham
Sent: Thursday, January 13, 2011 4:07 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] How SQLite manages result of a SELECT query?

That seems like kind of a broad question.

On 13/01/2011 10:33, Sunil Bhardwaj wrote:
> Hi
>
> Please help us to understand, how SQLite manages result of a SELECT query:
> - We are using in-memory db,
> -
> - When we do "execQuery", what operations are internally done in SQLite
>
> Thanks
> Sunil Bhardwaj
> Ext. 1125 (0120-2567001)
> 9818868910
>
> -Original Message-
> From: sqlite-users-boun...@sqlite.org 
> [mailto:sqlite-users-boun...@sqlite.org] 
>On Behalf Of Madhurima .
> Sent: Thursday, January 13, 2011 3:30 PM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] partitioning SQLite database
>
> I am working on embedded system and the device has linux kernel with sqlite 
>database. Wanted to know if the sqlite database can be partitioned with secure 
>and normal partitions.
>
> How can the encryption be achieved for sqlite database file in linux.
>
>
> -Original Message-
> From: sqlite-users-boun...@sqlite.org 
> [mailto:sqlite-users-boun...@sqlite.org] 
>On Behalf Of Simon Slavin
> Sent: Thursday, January 13, 2011 3:18 PM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] partitioning SQLite database
>
>
> On 13 Jan 2011, at 6:08am, Madhurima . wrote:
>
>> Is it possible to have partition in SQLite database?
> The word 'partition' is used for more than one meaning.  You might be talking 
>about spreading the data about, or grouping results from a SELECT command.  
>Could you give an example or a reference to documentation ?
>
> Simon.
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
> "DISCLAIMER: This message is proprietary to Aricent and is intended solely 
> for 
>the use of the individual to whom it is addressed. It may contain privileged 
>or 
>confidential information and should not be circulated or used for any purpose 
>other than for what it is intended. If you have received this message in 
>error, 
>please notify the originator immediately. If you are not the intended 
>recipient, 
>you are notified that you are strictly prohibited from using, copying, 
>altering, 
>or disclosing the contents of this message. Aricent accepts no responsibility 
>for loss or damage arising from the use of the information transmitted by this 
>email including damage from virus."
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

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



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


[sqlite] PRAGMA Documentation typo

2011-01-12 Thread Marian Cascaval
Hi!

There's a typo in thePRAGMA Statementsdocumentation page:
http://www.sqlite.org/pragma.html#toc

The original text:
"... and are only available _which_ SQLite is compiled..."

Instead of _which_ should be _when_.

This is a trivial documentation typo and I've identified quite a few of them.
Should I continue reporting this kind of typos or not?

Thank you.


Marian Cascaval



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