On 17 November 2010 15:27, Jay A. Kreibich <j...@kreibi.ch> wrote:
> On Wed, Nov 17, 2010 at 10:20:22AM -0500, Chris Wolf scratched on the wall:
>> I am trying to familiarize myself with the lower-level routines for
>> queries, so started with the
>> example here:
>
>
>> not working - error 25, range erorr:
>>
>> ./client test.sqlite "select * from emp where ename = '?'" fred
>
>  This is not a place-holder.  This is a single-character
>  string-literal that consists of a question mark.
>
>  Lose the quotes.  The quotes are part of the string-literal
>  specification, not the value itself.  They're not needed for
>  place-holders.  Consider this statement if you were binding
>  a integer, or something other than a text value.
>
>   -j
>

Furthermore, in your binding, loop from 0 to argc-3 rather than argc

   for(j=0; j<argc-3; j++) {
//   for(j=0; j<argc; j++) {
     printf("%d: %s\n", j+1, argv[3+j]);
     if((rc = sqlite3_bind_text(pStmt, j+1, argv[3+j], -1,SQLITE_TRANSIENT))
       != SQLITE_OK) {
       fprintf(stderr, "%d: SQL error: %d - %s\n", __LINE__,
rc,sqlite3_errmsg(db));
       exit(1);
     }
   }


>
> --
> Jay A. Kreibich < J A Y  @  K R E I B I.C H >
>
> "Intelligence is like underwear: it is important that you have it,
>  but showing it to the wrong people has the tendency to make them
>  feel uncomfortable." -- Angela Johnson


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

Reply via email to