Re: [sqlite] Bind Question -- Is this correct?

2018-07-03 Thread Simon Slavin
On 3 Jul 2018, at 4:22pm, Stephen Chrzanowski wrote: > V1: *datetime(date(current_timestamp,'localtime'),'+'||:StartTime||' > hours')))/60) MinutesSince9* > V2: *datetime(date(current_timestamp,'localtime'),'+:StartTime > hours')))/60) MinutesSince9 * > > I'm getting a failure with V2, and I'm a

[sqlite] Bind Question -- Is this correct?

2018-07-03 Thread Stephen Chrzanowski
I'm attempting to do a simple bind for an integer. The partial query is: V1: *datetime(date(current_timestamp,'localtime'),'+'||:StartTime||' hours')))/60) MinutesSince9* V2: *datetime(date(current_timestamp,'localtime'),'+:StartTime hours')))/60) MinutesSince9 * I'm getting a failure with V2, a

[sqlite] bind blob lifetime

2018-01-09 Thread Dave Milter
I have cycle like this: ```c const char sql[] = "INSERT INTO test (pk, geom) VALUES (?, ?)"; sqlite3_stmt *stmt; sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); for (...) { sqlite3_reset (stmt); sqlite3_clear_bindings (stmt); int blob_size = ..; unsign

Re: [sqlite] Bind Parameters Documentation

2013-08-20 Thread Richard Hipp
On Tue, Aug 20, 2013 at 9:24 AM, Filipe Oliveira wrote: > > From my point of view the documentation isn't according to the > implementation. Can anyone clarify? > Undocumented behavior is subject to change. You are advised to use only documented behavior. -- D. Richard Hipp d...@sqlite.org __

Re: [sqlite] Bind Parameters Documentation

2013-08-20 Thread Filipe Oliveira
On 08/12/2013 08:26 PM, Filipe Oliveira wrote: Hi, In parameters section of this page http://www.sqlite.org/lang_expr.html says that "A dollar-sign followed by an identifier name also holds a spot for a named parameter with the name $. The identifier name in this case can include one or

[sqlite] Bind Parameters Documentation

2013-08-12 Thread Filipe Oliveira
Hi, In parameters section of this page http://www.sqlite.org/lang_expr.html says that "A dollar-sign followed by an identifier name also holds a spot for a named parameter with the name $. The identifier name in this case can include one or more occurrences of "::" ...". It gave me the

Re: [sqlite] bind field name?

2013-05-14 Thread Igor Tandetnik
On 5/14/2013 7:47 PM, E. Timothy Uy wrote: Hi, is it possible to bind a field name to a sqlite query? For example, WHERE @field1 > @param1 No. A parameter may only appear where a literal would be allowed. -- Igor Tandetnik ___ sqlite-users mailing

[sqlite] bind field name?

2013-05-14 Thread E. Timothy Uy
Hi, is it possible to bind a field name to a sqlite query? For example, WHERE @field1 > @param1 ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] bind or column index out of range

2011-02-10 Thread Jay A. Kreibich
On Thu, Feb 10, 2011 at 11:24:34PM -0200, Fabr?cio Cruz Casarini scratched on the wall: > Guys, > > I am developing an application in php-gtk and I'm using sqlite3. > > I'm accessing the database using adodb class. > > Whenever I try to add a record to the table empty get the error "bind or > c

[sqlite] bind or column index out of range

2011-02-10 Thread Fabrício Cruz Casarini
Guys, I am developing an application in php-gtk and I'm using sqlite3. I'm accessing the database using adodb class. Whenever I try to add a record to the table empty get the error "bind or column index out of range". What is the solution to this problem? []'s Fabrício Cruz Casarini _

Re: [sqlite] bind for sub-queries

2010-01-03 Thread Mathieu SCHROETER
Jay A. Kreibich a écrit : > On Sun, Jan 03, 2010 at 10:47:01AM +0100, Mathieu SCHROETER scratched on the > wall: >> Hello, >> >> I've a simple question about the bind functions. If it can >> be realistic to have in the future, a way to bind a sub-query >> in a query? > > Doubtful. Sub-queries

Re: [sqlite] bind for sub-queries

2010-01-03 Thread Jay A. Kreibich
On Sun, Jan 03, 2010 at 10:47:01AM +0100, Mathieu SCHROETER scratched on the wall: > Hello, > > I've a simple question about the bind functions. If it can > be realistic to have in the future, a way to bind a sub-query > in a query? Doubtful. Sub-queries are a syntactical thing and exist beca

[sqlite] bind for sub-queries

2010-01-03 Thread Mathieu SCHROETER
Hello, I've a simple question about the bind functions. If it can be realistic to have in the future, a way to bind a sub-query in a query? I create queries with a number of sub-queries which depends of the user. Then, if all sub-queries can be prepared independently of the main query, it sugges

Re: [sqlite] Bind arguments for insert and not null columns with default values

2008-06-03 Thread Jay A. Kreibich
On Tue, Jun 03, 2008 at 02:27:01PM -0600, Dennis Cote scratched on the wall: > Jay A. Kreibich wrote: > > > > That, or something like sqlite3_clear_bindings() that actually > > *clears* the bindings (e.g. whatever state they are in just after a > > prepare), and not just sets them to an explicit

Re: [sqlite] Bind arguments for insert and not null columns with default values

2008-06-03 Thread Stephen Oberholtzer
On Tue, Jun 3, 2008 at 5:09 PM, Alex Katebi <[EMAIL PROTECTED]> wrote: > It would be nice to be able to revert back to the default value for a > column. I don't think SQLite support this right now. > The closest thing I found is "pragma table_info(foo)". If you prepare this > and then grab the dfl

Re: [sqlite] Bind arguments for insert and not null columns with default values

2008-06-03 Thread Alex Katebi
It would be nice to be able to revert back to the default value for a column. I don't think SQLite support this right now. The closest thing I found is "pragma table_info(foo)". If you prepare this and then grab the dflt_value for your column. On Tue, May 20, 2008 at 2:33 PM, Jeff Hamilton <[EMAIL

Re: [sqlite] Bind arguments for insert and not null columns with default values

2008-06-03 Thread Dennis Cote
Jay A. Kreibich wrote: > > That, or something like sqlite3_clear_bindings() that actually > *clears* the bindings (e.g. whatever state they are in just after a > prepare), and not just sets them to an explicit NULL, as the current > function does. > Jay, That wouldn't help. The default

Re: [sqlite] Bind arguments for insert and not null columns with default values

2008-06-03 Thread Jay A. Kreibich
On Tue, Jun 03, 2008 at 02:51:57PM -0500, Jeff Hamilton scratched on the wall: > On Tue, May 20, 2008 at 2:56 PM, D. Richard Hipp <[EMAIL PROTECTED]> wrote: > > OK. How about: > > > > INSERT INTO foo(bar) VALUES(coalesce(?,'default-value')); > > This approach is working well for us, but as De

Re: [sqlite] Bind arguments for insert and not null columns with default values

2008-06-03 Thread Jeff Hamilton
On Tue, May 20, 2008 at 2:56 PM, D. Richard Hipp <[EMAIL PROTECTED]> wrote: > OK. How about: > > INSERT INTO foo(bar) VALUES(coalesce(?,'default-value')); This approach is working well for us, but as Dennis pointed out it won't work for all situations. I wonder if it's worth adding something

Re: [sqlite] Bind arguments for insert and not null columns with default values

2008-05-22 Thread Dennis Cote
Eric Minbiole wrote: >> I have a table like this >> >> CREATE TABLE foo (bar TEXT NOT NULL DEFAULT 'default_value'); >> >> and I'd like to create a reusable statement to do inserts into foo, like >> this: >> >> INSERT INTO foo (bar) VALUES (?); >> >> Sometimes I have values for bar and sometimes I

Re: [sqlite] Bind arguments for insert and not null columns with default values

2008-05-20 Thread D. Richard Hipp
On May 20, 2008, at 3:40 PM, Jeff Hamilton wrote: > This works in the simple case that I described, but in practice I'd > like to use the pattern on more complex tables that have existing > uniqueness constraints. Using REPLACE INTO will get in the way of > those constraints. > OK. How about:

Re: [sqlite] Bind arguments for insert and not null columns with default values

2008-05-20 Thread Jeff Hamilton
This works in the simple case that I described, but in practice I'd like to use the pattern on more complex tables that have existing uniqueness constraints. Using REPLACE INTO will get in the way of those constraints. Regarding multiple statements, the tables I'd like to use this pattern on have

Re: [sqlite] Bind arguments for insert and not null columns with default values

2008-05-20 Thread Eric Minbiole
> I have a table like this > > CREATE TABLE foo (bar TEXT NOT NULL DEFAULT 'default_value'); > > and I'd like to create a reusable statement to do inserts into foo, like this: > > INSERT INTO foo (bar) VALUES (?); > > Sometimes I have values for bar and sometimes I don't and want the > default.

Re: [sqlite] Bind arguments for insert and not null columns with default values

2008-05-20 Thread Jay A. Kreibich
On Tue, May 20, 2008 at 11:33:04AM -0700, Jeff Hamilton scratched on the wall: > Hi all, > > I have a table like this > > CREATE TABLE foo (bar TEXT NOT NULL DEFAULT 'default_value'); > > and I'd like to create a reusable statement to do inserts into foo, like this: > > INSERT INTO foo (bar) VA

Re: [sqlite] Bind arguments for insert and not null columns with default values

2008-05-20 Thread D. Richard Hipp
On May 20, 2008, at 2:33 PM, Jeff Hamilton wrote: > Hi all, > > I have a table like this > > CREATE TABLE foo (bar TEXT NOT NULL DEFAULT 'default_value'); > > and I'd like to create a reusable statement to do inserts into foo, > like this: > > INSERT INTO foo (bar) VALUES (?); > > Sometimes I h

[sqlite] Bind arguments for insert and not null columns with default values

2008-05-20 Thread Jeff Hamilton
Hi all, I have a table like this CREATE TABLE foo (bar TEXT NOT NULL DEFAULT 'default_value'); and I'd like to create a reusable statement to do inserts into foo, like this: INSERT INTO foo (bar) VALUES (?); Sometimes I have values for bar and sometimes I don't and want the default. Is there a

Re: [sqlite] bind with select?

2006-10-20 Thread Jay Sprenkle
On 10/16/06, Dave Dyer <[EMAIL PROTECTED]> wrote: I can't find an example, but it seems like there ought to be syntax to use bind to inline selection variables, instead of having to have a callback function. Something like: char *forval,*barval; sqlite_prepare(db,"select ?foo,?bar from table

Re: [sqlite] bind with select?

2006-10-17 Thread Dennis Cote
Dave Dyer wrote: I can't find an example, but it seems like there ought to be syntax to use bind to inline selection variables, instead of having to have a callback function. Something like: char *forval,*barval; sqlite_prepare(db,"select ?foo,?bar from table"); sqlite_bind("?foo",&fooval);

[sqlite] bind with select?

2006-10-16 Thread Dave Dyer
I can't find an example, but it seems like there ought to be syntax to use bind to inline selection variables, instead of having to have a callback function. Something like: char *forval,*barval; sqlite_prepare(db,"select ?foo,?bar from table"); sqlite_bind("?foo",&fooval); sqlite_bind("?ba

Re: [sqlite] Bind

2006-09-21 Thread Dennis Cote
chetana bhargav wrote: Sorry that I put my question wrongly, actually my question was, if before a step function is called, can I change the value that is bounded as many times as possible, and will the Step function only consider the value that was bounded last. Chetana, Yes, that

Re: [sqlite] Bind

2006-09-21 Thread chetana bhargav
Hi Dennis, Sorry that I put my question wrongly, actually my question was, if before a step function is called, can I change the value that is bounded as many times as possible, and will the Step function only consider the value that was bounded last. . Chetana... Dennis Cote <[EM

Re: [sqlite] Bind

2006-09-21 Thread Dennis Cote
chetana bhargav wrote: I am just wondering what will happen, if I bind a column with null intially, but later in my path if I bind some integer value, which value will be considered while excuting step function. Note its on the same prepared statement and before doing a reset of the statemen

[sqlite] Bind

2006-09-21 Thread chetana bhargav
Hi, I am just wondering what will happen, if I bind a column with null intially, but later in my path if I bind some integer value, which value will be considered while excuting step function. Note its on the same prepared statement and before doing a reset of the statement. . Chet

RE: [sqlite] "bind or column index out of range" when using :AAA notation?

2006-03-18 Thread Boris Popov
: Saturday, March 18, 2006 8:49 PM To: sqlite-users@sqlite.org Subject: [sqlite] "bind or column index out of range" when using :AAA notation? In the following prepared statement, SELECT * FROM STUFF WHERE ID = :2 OR ID = :17 Trying to determine index of ":17" via sqlite3_bind_parame

[sqlite] "bind or column index out of range" when using :AAA notation?

2006-03-18 Thread Boris Popov
In the following prepared statement, SELECT * FROM STUFF WHERE ID = :2 OR ID = :17 Trying to determine index of ":17" via sqlite3_bind_parameter_index results in 'bind or column index out of range' exception. Am I misreading the docs again? ;) Quote: "... one or more literals can be replace by a

Re: [sqlite] Bind Blob in Version 2 Api

2005-03-22 Thread Marcel Strittmatter
Is there an similiar function to version 2 API to sqlite3_bind_blob function? Version 2 doesn't handle blobs. You must store blobs as encoded strings. Look at the file src/enocde.c to see how to encode strings. Marcel

[sqlite] Bind Blob in Version 2 Api

2005-03-22 Thread Vitor Serra Mori
Is there an similiar function to version 2 API to sqlite3_bind_blob function ? Thanks Vitor

Re: [sqlite] bind variables

2004-08-24 Thread D. Richard Hipp
Darren Duncan wrote: ::= This change has been checked in to the CVS repository. -- D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565

Re: [sqlite] bind variables

2004-08-24 Thread Darren Duncan
Okay Richard, I now have a more specific/official answer. The SQL-2003 02 Foundation (2003-09) document that I referred you to says on its page 152 (part of 5.4 "Names and identifiers", p151) this: ::= The portion is also used by, and often entirely comprises, things like table and co

Re: [sqlite] bind variables

2004-08-24 Thread Matt Wilson
On Tue, Aug 24, 2004 at 07:10:55PM -0700, Darren Duncan wrote: > > Meanwhile, look here: http://www.wiscorp.com/SQLStandards.html ISO/IEC 9075-2:2003 (E) (DRAFT) 5.4 Names and identifiers ::= Also see 4.29 "Host parameters" all in 5WD-02-Foundation-2003-09.pdf Cheers, Matt

Re: [sqlite] bind variables

2004-08-24 Thread Darren Duncan
At 9:20 PM -0400 8/24/04, D. Richard Hipp wrote: Darren Duncan wrote: It would help me and a lot of other people the most if you simply supported the ":foo" format for named bind variables. Perhaps someone can enlighten me as to exactly what that format is? A colon followed by any number of alph

Re: [sqlite] bind variables

2004-08-24 Thread D. Richard Hipp
Darren Duncan wrote: It would help me and a lot of other people the most if you simply supported the ":foo" format for named bind variables. Perhaps someone can enlighten me as to exactly what that format is? A colon followed by any number of alphanumerics? What about underscores? Does there ne

Re: [sqlite] bind variables

2004-08-24 Thread Darren Duncan
It would help me and a lot of other people the most if you simply supported the ":foo" format for named bind variables. Not only is this format standard in many databases including Oracle, but as far as I know the ANSI/ISO SQL standard also defines this as a standard format. Generally speakin

Re: [sqlite] bind variables

2004-08-24 Thread Andrew Piskorski
On Tue, Aug 24, 2004 at 03:15:30PM -0400, Andrew Piskorski wrote: > Btw, I've used these database APIs and know that they all use ':' to > indicate a named bind variable which then maps to a Tcl variable, in > very much the same scheme you've explained above: > > - AOLserver's Oracle and PostgreS

Re: [sqlite] bind variables

2004-08-24 Thread Matt Wilson
On Tue, Aug 24, 2004 at 03:15:30PM -0400, Andrew Piskorski wrote: > > Btw, I've used these database APIs and know that they all use ':' to > indicate a named bind variable which then maps to a Tcl variable, in > very much the same scheme you've explained above: Using : to name the variable would

Re: [sqlite] bind variables

2004-08-24 Thread D. Richard Hipp
Andrew Piskorski wrote: On Tue, Aug 24, 2004 at 02:55:51PM -0400, D. Richard Hipp wrote: In this way, I get to specify TCL variables directly in the SQL statement, not as parameters added to the end. For example: db eval {UPDATE t1 SET value=$bigblob WHERE rowid=$id} Dr. Hipp, this is a great

[sqlite] bind variables

2004-08-24 Thread Andrew Piskorski
On Tue, Aug 24, 2004 at 02:55:51PM -0400, D. Richard Hipp wrote: > In this way, I get to specify TCL variables directly in the > SQL statement, not as parameters added to the end. For > example: > >db eval {UPDATE t1 SET value=$bigblob WHERE rowid=$id} Dr. Hipp, this is a great little featu