Re: [sqlite] Binding an order by

2017-10-05 Thread Stephen Chrzanowski
Interesting idea, and one for the books, but, in this case, the sort order is complicated by nothing being fixed. The primary sort concern is whether I'm grouping priorities of the tickets together or not. If grouped, the priority order is considered first [ order by Priority=0,Priority, ]. If

Re: [sqlite] Binding an order by

2017-10-05 Thread Simon Slavin
On 5 Oct 2017, at 7:59pm, Stephen Chrzanowski wrote: > No. The user (Me) can only select the order through popups, not by > entering a string. I understand the concern, but, depending on what the > user selects, the code will generate the string based on the users click.

Re: [sqlite] Binding an order by

2017-10-05 Thread Jim Morris
What you may be able to do is to use a case statement(s) which uses a bound variable to either a column or dummy E.g order by case orderControlValue = 1 then column1 else "" end, ... On 10/5/2017 11:51 AM, Igor Tandetnik wrote: On 10/5/2017 2:45 PM, Stephen Chrzanowski wrote: Given the

Re: [sqlite] Binding an order by

2017-10-05 Thread Stephen Chrzanowski
No. The user (Me) can only select the order through popups, not by entering a string. I understand the concern, but, depending on what the user selects, the code will generate the string based on the users click. On Thu, Oct 5, 2017 at 2:52 PM, Simon Slavin wrote: > > >

Re: [sqlite] Binding an order by

2017-10-05 Thread Simon Slavin
On 5 Oct 2017, at 7:45pm, Stephen Chrzanowski wrote: > I wanted to bind :OrderBy with field names and conditions based on user > preferences Binding is to values, not to column names. If you have one ORDER BY parameter, you can only bind it to a value. If you want a

Re: [sqlite] Binding an order by

2017-10-05 Thread Stephen Chrzanowski
That's all I needed to know. Thanks. On Thu, Oct 5, 2017 at 2:52 PM, Gwendal Roué wrote: > > > Le 5 oct. 2017 à 20:45, Stephen Chrzanowski a > écrit : > > > > Given the query: > > > > select EventID, Airline, ContactInfo,TicketID,CreateDate from

Re: [sqlite] Binding an order by

2017-10-05 Thread Gwendal Roué
> Le 5 oct. 2017 à 20:45, Stephen Chrzanowski a écrit : > > Given the query: > > select EventID, Airline, ContactInfo,TicketID,CreateDate from tEvents where > Resolved=:Resolved order by :OrderBy > > I wanted to bind :OrderBy with field names and conditions based on user

Re: [sqlite] Binding an order by

2017-10-05 Thread Igor Tandetnik
On 10/5/2017 2:45 PM, Stephen Chrzanowski wrote: Given the query: select EventID, Airline, ContactInfo,TicketID,CreateDate from tEvents where Resolved=:Resolved order by :OrderBy I wanted to bind :OrderBy with field names You can't. A bound parameter can only appear where a literal is

[sqlite] Binding an order by

2017-10-05 Thread Stephen Chrzanowski
Given the query: select EventID, Airline, ContactInfo,TicketID,CreateDate from tEvents where Resolved=:Resolved order by :OrderBy I wanted to bind :OrderBy with field names and conditions based on user preferences, but I think the bind converted my order rules into a string and ordered my

Re: [sqlite] binding multiple values in a query

2015-02-12 Thread Paul
I just want to inject my $.05. As for me, binding an array or table is very well aligns with a syntax of WITH clause. So example query might look like: WITH array(x) AS ?001 SELECT x FROM array Or WITH my_table(x, y, z) AS ?001 SELECT * FROM my_table

Re: [sqlite] binding multiple values in a query

2015-02-12 Thread Scott Robison
On Feb 12, 2015 1:26 AM, "Dominique Devienne" wrote: > > We fill the collection client-side, bind it, execute that 1 statement, and > get back many rows, all in a single round-trip to the server (thanks to > prefetching on the select side). Mind you, this is not nearly as

Re: [sqlite] binding multiple values in a query

2015-02-12 Thread Dominique Devienne
On Thu, Feb 12, 2015 at 2:04 AM, Richard Hipp wrote: > On 2/11/15, Igor Tandetnik wrote: > > On 2/11/2015 5:46 PM, Jono Poff wrote: > >> I wonder if anybody could give me a simple example in C to bind an array > >> of values to a prepared statement? > >>> >

Re: [sqlite] binding multiple values in a query

2015-02-11 Thread Richard Hipp
On 2/11/15, Igor Tandetnik wrote: > On 2/11/2015 5:46 PM, Jono Poff wrote: >> I wonder if anybody could give me a simple example in C to bind an array >> of values to a prepared statement? >>> > These approaches use stock capabilities of SQLite and don't require > heroic

Re: [sqlite] binding multiple values in a query

2015-02-11 Thread Igor Tandetnik
On 2/11/2015 5:46 PM, Jono Poff wrote: I wonder if anybody could give me a simple example in C to bind an array of values to a prepared statement? The effect I'm looking for is sqlite3_stmt* stmt = Compile(db, "select * in Things where thing1 in ( );");

Re: [sqlite] binding multiple values in a query

2015-02-11 Thread Jono Poff
Gr really? Thanks for the quick response tho! I'm already building it from source so I'll investigate! Cheers, Jono On 12/02/2015 11:53 a.m., Peter Aronson wrote: You can't do that in standard SQLite -- you can only bind single values. However, if you download the full source

Re: [sqlite] binding multiple values in a query

2015-02-11 Thread Peter Aronson
You can't do that in standard SQLite -- you can only bind single values. However, if you download the full source package (as opposed to the amalgamation) of SQLite, there are a pair of files under src, test_intarray.c and test_intarray.h, which implement a virtual table that would let you do

[sqlite] binding multiple values in a query

2015-02-11 Thread Jono Poff
Hi, I wonder if anybody could give me a simple example in C to bind an array of values to a prepared statement? The effect I'm looking for is sqlite3_stmt* stmt = Compile(db, "select * in Things where thing1 in ( );"); sqlite3_bind_???(stmt,0 ,); Cheers,

Re: [sqlite] SQLITE Binding Issue when using [] brackets

2012-04-02 Thread Igor Tandetnik
On 4/1/2012 4:23 PM, ap wrote: http://sqlite.org/c3ref/bind_blob.html Brackets are recommended for attribute names in some cases, it seems the binding for :VVV does not permit :[VVV]. Is this the case? This is the case. Parameter names must be proper identifiers. recdct {'[c1]': 1,

Re: [sqlite] SQLITE Binding Issue when using [] brackets

2012-04-02 Thread Simon Davies
On 1 April 2012 21:23, ap wrote: > > http://sqlite.org/c3ref/bind_blob.html > > Brackets are recommended for attribute names in some cases, it seems the > binding for :VVV does not permit :[VVV]. Is this the case? Square brackets are a quoting mechanism for identifiers

[sqlite] SQLITE Binding Issue when using [] brackets

2012-04-02 Thread ap
http://sqlite.org/c3ref/bind_blob.html Brackets are recommended for attribute names in some cases, it seems the binding for :VVV does not permit :[VVV]. Is this the case? I prefer the dictionary binding if possible. Normally no issues, however when I introduce brackets there may be an issue.

Re: [sqlite] Binding C for numeric type

2011-12-19 Thread Alexandre K
Well, when I quiclky read the paragraph about types I understood that they were existing... In fact not, so I completly agree with your solution, It seems to be the best one to allow comparison or sum. I will save the 'cents' in integer and do multiplication and division and you said. Thanks for

Re: [sqlite] Binding C for numeric type

2011-12-19 Thread Simon Slavin
On 19 Dec 2011, at 7:18pm, Alexandre K wrote: > @Simon : Do you mean to store as integer or string whereas the Numeric > (x,y) column type exists, in order to have a nice binding in C ? The numeric (x,y) column type does not exist. SQLite supports only the following five types:

Re: [sqlite] Binding C for numeric type

2011-12-19 Thread Alexandre K
> Thanks Sean and Simon :) @Seam : The library seems interesting, but I would not use an external library, as I use C as interface for Ada. @Simon : Do you mean to store as integer or string whereas the Numeric (x,y) column type exists, in order to have a nice binding in C ? It's sure that I

Re: [sqlite] Binding C for numeric type

2011-12-19 Thread Simon Slavin
On 19 Dec 2011, at 4:38pm, Alexandre K wrote: > I have a question about C binding for sqlite. I have seen those for > integer, float... but I was wondering how to deal with a NUMERIC (x, y) > type ? > We can't use float or double, we could loose precision, so maybe with a > string ? There are

Re: [sqlite] Binding C for numeric type

2011-12-19 Thread Sean Pieper
there if not. . . http://www.mpfr.org/ -sean -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Alexandre K Sent: Monday, December 19, 2011 8:39 AM To: sqlite-users@sqlite.org Subject: [sqlite] Binding C for numeric type Hi everone ! I have

[sqlite] Binding C for numeric type

2011-12-19 Thread Alexandre K
Hi everone ! I have a question about C binding for sqlite. I have seen those for integer, float... but I was wondering how to deal with a NUMERIC (x, y) type ? We can't use float or double, we could loose precision, so maybe with a string ? If someone has a solution, I will really help me. Thanks

Re: [sqlite] binding an IN

2010-07-12 Thread Richard Hipp
Have you looked at the "test_intarray" code. http://www.sqlite.org/src/artifact/489edb9068bb926583445cb02589344961054207 On Sun, Jul 11, 2010 at 9:42 PM, Sam Carleton wrote: > Is there any way to bind to this query? > > SELECT * FROM table WHERE tableId IN ( ? ); > >

Re: [sqlite] binding an IN

2010-07-12 Thread Igor Sereda
We have a similar task and we solve it by using a statement with lots of parameters SELECT * FROM table WHERE tableId IN (?, ?, ?, ?, ) The number of "?", let's call it N, is fixed, and set to ~100 -- tuned by measuring performance. When the actual number of parameters is less

Re: [sqlite] binding an IN

2010-07-11 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 07/11/2010 10:36 PM, zeal wrote: > how about (tableId=? or tableId=? or tableId=? or tableId=?) > just convert IN to or. Jay already mentioned that approach. The downside is you have to know how big the list is in advance and construct SQL text

Re: [sqlite] binding an IN

2010-07-11 Thread zeal
ite-users@sqlite.org> Subject: Re: [sqlite] binding an IN > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 07/11/2010 06:42 PM, Sam Carleton wrote: >> Is there any way to bind to this query? >> >> SELECT * FROM table WHERE tableId IN ( ? ); >> >&g

Re: [sqlite] binding an IN

2010-07-11 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 07/11/2010 06:42 PM, Sam Carleton wrote: > Is there any way to bind to this query? > > SELECT * FROM table WHERE tableId IN ( ? ); > > Where ? should be 1,2,3,4 There is no C api that allows for binding a list so you'll have to pick an

Re: [sqlite] binding an IN

2010-07-11 Thread Simon Slavin
On 12 Jul 2010, at 2:42am, Sam Carleton wrote: > Is there any way to bind to this query? > > SELECT * FROM table WHERE tableId IN ( ? ); > > Where ? should be 1,2,3,4 I think the simplest way to do that would be to use GLOB. Not very elegant but it should work.

Re: [sqlite] binding an IN

2010-07-11 Thread Jay A. Kreibich
On Sun, Jul 11, 2010 at 09:42:41PM -0400, Sam Carleton scratched on the wall: > Is there any way to bind to this query? > > SELECT * FROM table WHERE tableId IN ( ? ); > > Where ? should be 1,2,3,4 You can do IN ( ?, ?, ?, ? ), but I'm guessing that's not the answer you're looking for.

[sqlite] binding an IN

2010-07-11 Thread Sam Carleton
Is there any way to bind to this query? SELECT * FROM table WHERE tableId IN ( ? ); Where ? should be 1,2,3,4 ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Binding parameters to prepared statements

2009-08-25 Thread John Elrick
>> Although quotes can be used, they are not needed when the table and >> field names contain all valid characters. I simply saw no value in >> adding them, and they did seem to unnecessarily complicate the text. >> >> > It also says on http://www.sqlite.org/lang_keywords.html

Re: [sqlite] Binding parameters to prepared statements

2009-08-25 Thread Jay A. Kreibich
On Tue, Aug 25, 2009 at 11:19:17AM -0400, Angus March scratched on the wall: > It also says on http://www.sqlite.org/lang_keywords.html that in > case you use a name that one day becomes a keyword you should always use > quotes. It is also quite specific about which quotes to use:

Re: [sqlite] Binding parameters to prepared statements

2009-08-25 Thread Angus March
John Elrick wrote: > Angus March wrote: > >> John Elrick wrote: >> >> >>> Angus March wrote: >>> >>> >>> I'm trying to make a prepared statement and bind parameters to it, but the documentation is very confusing. This is the statement I'm trying to prepare:

Re: [sqlite] Binding parameters to prepared statements

2009-08-25 Thread John Elrick
Angus March wrote: > John Elrick wrote: > >> Angus March wrote: >> >> >>> I'm trying to make a prepared statement and bind parameters to it, but >>> the documentation is very confusing. This is the statement I'm trying to >>> prepare: >>> UPDATE 'KEYS' SET 'IVAndKey'=:VVV WHERE

Re: [sqlite] Binding parameters to prepared statements

2009-08-25 Thread Angus March
John Elrick wrote: > Angus March wrote: > >> I'm trying to make a prepared statement and bind parameters to it, but >> the documentation is very confusing. This is the statement I'm trying to >> prepare: >> UPDATE 'KEYS' SET 'IVAndKey'=:VVV WHERE "ItemID"=?NNN >> Where IVAndKey is a BLOB and

Re: [sqlite] Binding parameters to prepared statements

2009-08-25 Thread Angus March
Pavel Ivanov wrote: >> UPDATE 'KEYS' SET 'IVAndKey'=:VVV WHERE "ItemID"=?NNN >> Where IVAndKey is a BLOB and ItemID is an INTEGER and the primary key >> for the table. I'm told that there is a syntax error near "NNN". >> > > You have actually used some number instead NNN and wrote it here

Re: [sqlite] Binding parameters to prepared statements

2009-08-25 Thread John Elrick
Angus March wrote: > I'm trying to make a prepared statement and bind parameters to it, but > the documentation is very confusing. This is the statement I'm trying to > prepare: > UPDATE 'KEYS' SET 'IVAndKey'=:VVV WHERE "ItemID"=?NNN > Where IVAndKey is a BLOB and ItemID is an INTEGER and the

Re: [sqlite] Binding parameters to prepared statements

2009-08-25 Thread Pavel Ivanov
> UPDATE 'KEYS' SET 'IVAndKey'=:VVV WHERE "ItemID"=?NNN > Where IVAndKey is a BLOB and ItemID is an INTEGER and the primary key > for the table. I'm told that there is a syntax error near "NNN". You have actually used some number instead NNN and wrote it here just for abstract example, haven't

[sqlite] Binding parameters to prepared statements

2009-08-25 Thread Angus March
I'm trying to make a prepared statement and bind parameters to it, but the documentation is very confusing. This is the statement I'm trying to prepare: UPDATE 'KEYS' SET 'IVAndKey'=:VVV WHERE "ItemID"=?NNN Where IVAndKey is a BLOB and ItemID is an INTEGER and the primary key for the table. I'm

Re: [sqlite] Python sqlite binding: commit inside select loop

2009-06-30 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jim Wilcoxson wrote: > I did some checking on the pysqlite mailing list. Apparently the > change to reset all cursors before commit is recent, and the reason is > that pysqlite or sqlite itself would return bogus rows. It is pysqlite returning the

Re: [sqlite] Python sqlite binding: commit inside select loop

2009-06-30 Thread Jim Wilcoxson
I did some checking on the pysqlite mailing list. Apparently the change to reset all cursors before commit is recent, and the reason is that pysqlite or sqlite itself would return bogus rows. There is an example here: http://article.gmane.org/gmane.comp.python.db.pysqlite.user/2217 Returning

Re: [sqlite] Python sqlite binding: commit inside select loop

2009-06-30 Thread Jim Wilcoxson
Thanks for the comments and explanations everyone - much appreciated. It seems there are a few alternatives I can check out. Jim On 6/30/09, Roger Binns wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Jim Wilcoxson wrote: >> I guess I am a bit confused. Igor

Re: [sqlite] Python sqlite binding: commit inside select loop

2009-06-30 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jim Wilcoxson wrote: > I guess I am a bit confused. Igor says it's not possible, but Roger > says my example works. For the exact code you were running the error message came from pysqlite and not from SQLite. Other posters are not aware of the

Re: [sqlite] Python sqlite binding: commit inside select loop

2009-06-30 Thread Jim Wilcoxson
I guess I am a bit confused. Igor says it's not possible, but Roger says my example works. One other point of confusion is that sometimes an interface layer will grab all or a bunch of the rows after a select, even though it may hand them to upper layers one row at a time. For example, with

Re: [sqlite] Python sqlite binding: commit inside select loop

2009-06-30 Thread Marcus Grimm
thank you very much Richard! very interesting to get some info about these rather internal issues. This gives us a good background to review some potential dangerous loops. Your hint with the temp table is extremely useful. Best wishes Marcus Grimm > > On Jun 30, 2009, at 2:34 PM, Marcus Grimm

Re: [sqlite] Python sqlite binding: commit inside select loop

2009-06-30 Thread Marcus Grimm
> Marcus Grimm wrote: >> what is possible I guess would be to start a transaction >> inside the loop, do something, and commit and procced >> with stepping > > No, this is not possible either. By starting the select, you also start > an implicit transaction. SQLite

Re: [sqlite] Python sqlite binding: commit inside select loop

2009-06-30 Thread D. Richard Hipp
On Jun 30, 2009, at 2:34 PM, Marcus Grimm wrote: > > I'm not sure what will happend if you for example > delete a table row that would be the next row that > sqlite3_step would see, but doing so to me sounds > a bad approach anyhow. The official policy is that if you modify a table (via INSERT,

Re: [sqlite] Python sqlite binding: commit inside select loop

2009-06-30 Thread Igor Tandetnik
Marcus Grimm wrote: > what is possible I guess would be to start a transaction > inside the loop, do something, and commit and procced > with stepping No, this is not possible either. By starting the select, you also start an implicit transaction. SQLite doesn't support

Re: [sqlite] Python sqlite binding: commit inside select loop

2009-06-30 Thread Marcus Grimm
> Marcus Grimm wrote: >> I'm a bit confused about Igors replies because >> you can very well do a select, step throu the >> results and even delete or update the table row that you >> are currently inspecting and procceed with stepping. > > ... but you cannot COMMIT your

Re: [sqlite] Python sqlite binding: commit inside select loop

2009-06-30 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jim Wilcoxson wrote: > With the Python bindings, an error occurs > because a commit resets all pending select statements. Note that there are some constraints about how SQLite works detailed by Igor, but in this particular case you are being stymied

Re: [sqlite] Python sqlite binding: commit inside select loop

2009-06-30 Thread Igor Tandetnik
Marcus Grimm wrote: > I'm a bit confused about Igors replies because > you can very well do a select, step throu the > results and even delete or update the table row that you > are currently inspecting and procceed with stepping. ... but you cannot COMMIT your changes

Re: [sqlite] Python sqlite binding: commit inside select loop

2009-06-30 Thread Marcus Grimm
I'm a bit confused about Igors replies because you can very well do a select, step throu the results and even delete or update the table row that you are currently inspecting and procceed with stepping. As long as you use the same database connection for this. I'm not sure what will happend if

Re: [sqlite] Python sqlite binding: commit inside select loop

2009-06-30 Thread Igor Tandetnik
Jim Wilcoxson wrote: > I'm using the Python sqlite3 (pysqlite) bindings. I'd like to be able > to do a select, and while fetching those rows and inserting new ones, > periodically do a commit. You can't do this with SQLite. Commit fails if there are outstanding statements. >

[sqlite] Python sqlite binding: commit inside select loop

2009-06-30 Thread Jim Wilcoxson
I'm using the Python sqlite3 (pysqlite) bindings. I'd like to be able to do a select, and while fetching those rows and inserting new ones, periodically do a commit. With the Python bindings, an error occurs because a commit resets all pending select statements. Here is an example showing the

[sqlite] binding parameters

2009-03-05 Thread meerkat
Hello, I am trying to use parameters in a simple sql query for sqlite. I have tried: var $this_main_detail_id ="34115441312108"; var tbl = $('notes'); while(tbl.rows.length > 0) tbl.deleteRow(-1); //var sql = "SELECT main_detail_id FROM main_detail WHERE

Re: [sqlite] Binding with Views

2009-01-22 Thread Jay A. Kreibich
On Thu, Jan 22, 2009 at 09:55:06AM +, Ed Hawke scratched on the wall: > Hi all, > > I have an SQL application that relies on using views to allow a user to > make an array of choices to filter down the information returned to them > from multiple tables, without having to code complex

[sqlite] Binding with Views

2009-01-22 Thread Ed Hawke
Hi all, I have an SQL application that relies on using views to allow a user to make an array of choices to filter down the information returned to them from multiple tables, without having to code complex statements to take into account the order in which they need to be applied. To speed up

Re: [sqlite] Binding Date value in Prepare/bind

2008-06-06 Thread Igor Tandetnik
"Bharath Booshan L" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > We have developed an App that was written for Version 3.1.3 available > in > Mac OS 10.4. > Now I have to move all the sqlite_exec to prepare/step/finalize > methods, > but as per the documents, it says 'use of

Re: [sqlite] Binding Date value in Prepare/bind

2008-06-06 Thread Bharath Booshan L
Thanks Igor, >> I am asking this because julianday(date('1984-03-03')) = >> julianday('1984-03-03'). Right? > > Right. In fact, date('1984-03-03') is a no-op: the result of > date('1984-03-03') is simply '1984-03-03'. Though I fail to see how this > fact is relevant to your original question.

Re: [sqlite] Binding Date value in Prepare/bind

2008-06-06 Thread Igor Tandetnik
"Bharath Booshan L" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 1. Can I use sqlite3_prepare_v2 in Version 3.1.3? No. It was introduced in v3.3.9 > 2. How do I bind date values using prepare/bind methods? SQLite doesn't have dedicated date or time types. You may choose to

[sqlite] Binding Date value in Prepare/bind

2008-06-06 Thread Bharath Booshan L
Hello SQLite users, I have two questions, could anyone please help me out. 1. Can I use sqlite3_prepare_v2 in Version 3.1.3? 2. How do I bind date values using prepare/bind methods? Eg: INSERT INTO TABLE Info(Name,DOB) values('XYZ',julianday('1984-03-03')); For above example I can write a

[sqlite] binding to parameters in PRAGMA statements doesn't work

2008-03-12 Thread William Bardwell
Although it is certainly not a critical thing, it would be nice if binding a table-name parameter in a PRAGMA statement worked. executing "PRAGMA table_info (?)" produces a SYNTAX error. William Bardwell [EMAIL PROTECTED] ___ sqlite-users mailing list

Re: [sqlite] binding to missing indexes with ?NNN parameters is odd

2008-03-05 Thread Dennis Cote
William Bardwell wrote: > If I have parameters like "?3, ?" then the parameter count is 4, > but I can still bind to indexes 1 and 2. Is this on purpose? > Is this a good thing? > Yes, its on purpose. You only need to use the ?n form if you want to use the same parameter in multiple locations

Re: [sqlite] Binding values for IN ?

2008-03-05 Thread Dennis Cote
Michael Schlenker wrote: > > n is an integer primary key..., is LIMIT better than a where condition in > that case? > No. Looking at the explain output it looks like six of one half dozen of the other. Dennis Cote ___ sqlite-users mailing list

[sqlite] binding to missing indexes with ?NNN parameters is odd

2008-03-05 Thread William Bardwell
If I have parameters like "?3, ?" then the parameter count is 4, but I can still bind to indexes 1 and 2. Is this on purpose? Is this a good thing? Is there any way to detect that the missing indexes are missing, parameter_index and parameter_name don't provide any indication? Thanks. William

Re: [sqlite] Binding values for IN ?

2008-03-05 Thread Michael Schlenker
Dennis Cote schrieb: > Michael Schlenker wrote: > >> Basically i have to check a larger number (might be around 10.000 or more, >> but usually far less) of ids against my (incomplete) metadata catalogue to >> find out if those ids are locally available or need to be fetched from a >> remote

Re: [sqlite] Binding values for IN ?

2008-03-05 Thread Dennis Cote
Michael Schlenker wrote: > > I now got it working with a pivot table, which worked nice because i have > fixed length ids > >(SELECT substr(?,(n-1)*16,n*16) FROM pivot WHERE n <= ?) Michael, That's a nice trick. I'll have to remember that. > Basically i have to check a larger number

Re: [sqlite] Binding values for IN ?

2008-03-05 Thread Michael Schlenker
Dennis Cote schrieb: > Michael Schlenker wrote: >> Or would i have to create a dynamic query with appropriate number of bind >> variables myself and have to pay the price of reparsing each time? >> >> # like this >> values = [uuid1,uuid2] >> binders = ",".join("?"*len(values)) >>

Re: [sqlite] Binding values for IN ?

2008-03-05 Thread Dennis Cote
Michael Schlenker wrote: > > Or would i have to create a dynamic query with appropriate number of bind > variables myself and have to pay the price of reparsing each time? > > # like this > values = [uuid1,uuid2] > binders = ",".join("?"*len(values)) > cursor.execute("SELECT * FROM t WHERE uuid

Re: [sqlite] Binding values for IN ?

2008-03-05 Thread Brad Stiles
> I also had some rather complex piece of SQL from "The Art of SQL", which > took a string and dissected it in place with subqueries and a join to a > pivot table, but wondered if there was an easier way to do it? If you already have that information in an array in your application code, it

Re: [sqlite] Binding values for IN ?

2008-03-05 Thread P Kishor
On 3/5/08, Michael Schlenker <[EMAIL PROTECTED]> wrote: > Hi all, > > i have some queries using IN, e.g. > > SELECT * FROM t WHERE uuid IN (...); > > (uuid is a blob field storing uuids btw.) > > Is there a way to use bind variables for this, e.g. something like this: > (python wrapper, this

Re: [sqlite] Binding vs No Binding

2007-07-12 Thread Teg
Hello Nathan, Thursday, July 12, 2007, 4:30:13 PM, you wrote: NB> I have been trying see just how fast I can get SQlite to run, so I have NB> been playing with binding data to pre-compiled statements versus having NB> to prepare each statement individually. So far, I have not seen a huge NB>

RE: [sqlite] Binding vs No Binding

2007-07-12 Thread Samuel R. Neff
is in the Washington D.C. metro area. If interested contact [EMAIL PROTECTED] -Original Message- From: Nathan Biggs [mailto:[EMAIL PROTECTED] Sent: Thursday, July 12, 2007 4:30 PM To: SQLITE Subject: [sqlite] Binding vs No Binding I have been trying see just how fast I can get SQlite to run, so I

[sqlite] Binding vs No Binding

2007-07-12 Thread Nathan Biggs
I have been trying see just how fast I can get SQlite to run, so I have been playing with binding data to pre-compiled statements versus having to prepare each statement individually. So far, I have not seen a huge performance increase between the two. I expected the pre-compiled statements

Re: [sqlite] binding paramters for SELECT

2006-08-07 Thread Nemanja Corlija
On 8/8/06, Dixon <[EMAIL PROTECTED]> wrote: I have prepared the following wide text string: L"SELECT ROWID FROM indext WHERE state='1' AND clientName='?' ORDER BY size DESC" with sqlite3_prepare16, I then call sqlite3_bind_parameter_count on the resulting statement. I get 0 back

Re: [sqlite] binding ORDER BY

2005-09-19 Thread D. Richard Hipp
On Mon, 2005-09-19 at 09:42 -0500, [EMAIL PROTECTED] wrote: > I am trying to 'ORDER BY ?' in my query because I would like to bind the > order by criteria later in my code. This always fails on sqlite3_prepare() > with an error, "ORDER BY terms must be non-integer constants". Do you have > any

[sqlite] binding ORDER BY

2005-09-19 Thread njhinder
I am trying to 'ORDER BY ?' in my query because I would like to bind the order by criteria later in my code. This always fails on sqlite3_prepare() with an error, "ORDER BY terms must be non-integer constants". Do you have any suggestions on how I can use a variable in my ORDER BY clause?

RE: [sqlite] Binding a column name?

2005-07-11 Thread D. Richard Hipp
On Mon, 2005-07-11 at 10:32 -0700, Brown, Dave wrote: > Wait - what if AUTOVACUUM is set on the database, and I'm the only one doing > inserts/deletes? Will I still need to sqlite3_prepare() my statements again > if auto-vacuum is on? > AUTOVACUUM does *not* invalidate prepared statements -

RE: [sqlite] Binding a column name?

2005-07-11 Thread Tim McDaniel
> -Original Message- > From: D. Richard Hipp [mailto:[EMAIL PROTECTED] > Sent: Sunday, July 10, 2005 6:01 PM > To: sqlite-users@sqlite.org > Subject: RE: [sqlite] Binding a column name? > > On Sun, 2005-07-10 at 15:34 -0700, Tim McDaniel wrote: > > > >

RE: [sqlite] Binding a column name?

2005-07-11 Thread Brown, Dave
To: sqlite-users@sqlite.org Subject: RE: [sqlite] Binding a column name? On Sun, 2005-07-10 at 00:23 -0700, Brown, Dave wrote: > That is what I do. But that also means I have to call sqlite_prepare() > each time, instead of just once. I was originally hoping I could > prepare() once and

RE: [sqlite] Binding a column name?

2005-07-10 Thread D. Richard Hipp
On Sun, 2005-07-10 at 15:34 -0700, Tim McDaniel wrote: > > > > If another thread or process VACUUMs the database or creates > > a new table or makes any other structure changes to the > > database file, all of your prepared statements will be > > invalided and you will have to rerun

RE: [sqlite] Binding a column name?

2005-07-10 Thread Tim McDaniel
> -Original Message- > From: D. Richard Hipp [mailto:[EMAIL PROTECTED] > Sent: Sunday, July 10, 2005 6:12 AM > To: sqlite-users@sqlite.org > Subject: RE: [sqlite] Binding a column name? > > On Sun, 2005-07-10 at 00:23 -0700, Brown, Dave wrote: > > That is what

RE: [sqlite] Binding a column name?

2005-07-10 Thread Brown, Dave
Yes, actually I'm doing that already. Thanks! -Dave -Original Message- From: D. Richard Hipp [mailto:[EMAIL PROTECTED] Sent: Sunday, July 10, 2005 4:12 AM To: sqlite-users@sqlite.org Subject: RE: [sqlite] Binding a column name? On Sun, 2005-07-10 at 00:23 -0700, Brown, Dave wrote

RE: [sqlite] Binding a column name?

2005-07-10 Thread D. Richard Hipp
On Sun, 2005-07-10 at 00:23 -0700, Brown, Dave wrote: > That is what I do. But that also means I have to call sqlite_prepare() each > time, instead of just once. I was originally hoping I could prepare() once > and just bind. > If another thread or process VACUUMs the database or creates a new

RE: [sqlite] Binding a column name?

2005-07-10 Thread Brown, Dave
-users@sqlite.org Subject: Re: [sqlite] Binding a column name? Hi, Why not construct the SQL statement dynamically in the C/C++ code? That way your statement(s) would have variable column names before compilation. Eugene Wee Brown, Dave wrote: > Actually I doubt it can - since without the column n

Re: [sqlite] Binding a column name?

2005-07-10 Thread Eugene Wee
, right? -Dave -Original Message- From: Brown, Dave [mailto:[EMAIL PROTECTED] Sent: Saturday, July 09, 2005 8:46 PM To: sqlite-users@sqlite.org Subject: [sqlite] Binding a column name? Is it possible for a bind variable to be a column name? I'd like to make a query which is: select from

RE: [sqlite] Binding a column name?

2005-07-10 Thread Dan Kennedy
> Actually I doubt it can - since without the column name it can't create the > prepared statement byte code, right? Right. It can't be done. > > Is it possible for a bind variable to be a column name? I'd like to make a > query which is: > > select from MyTable; > > and I'd like the

RE: [sqlite] Binding a column name?

2005-07-09 Thread Brown, Dave
Actually I doubt it can - since without the column name it can't create the prepared statement byte code, right? -Dave -Original Message- From: Brown, Dave [mailto:[EMAIL PROTECTED] Sent: Saturday, July 09, 2005 8:46 PM To: sqlite-users@sqlite.org Subject: [sqlite] Binding a column

[sqlite] Binding a column name?

2005-07-09 Thread Brown, Dave
Is it possible for a bind variable to be a column name? I'd like to make a query which is: select from MyTable; and I'd like the column_name to be a bind variable. This doesn't work using the straight sqlite3_bind_text() call on the statement "select ? from MyTable;", which treats the column

Re: [sqlite] Sqlite Binding

2004-12-01 Thread D. Richard Hipp
Randall Fox wrote: > [I]s there any chance of allowing the '?' use in a create table > statement as well? For binding of default values of a particular > column. > Not much. Recall that SQLite stores the original text of the CREATE TABLE statement in the SQLITE_MASTER table and reparses that