On 2/8/16, L?szl? Zolt?n Buza <buzalz at gmail.com> wrote:
> Hello,
>
>
>
> Today, i ?ve used the following expression, but I?ve got unexpected results:
>
> ((@korte % 2) + 1))
>
>
>
> I binded ?@korte? to 5 as integer, using sqlite3_bind_parameter_index and
> sqlite3_bind_int.
>
> And I?ve got 6 as result, instead of 2.
>

I get 2 when I try it:

#include "sqlite3.h"
#include <stdio.h>
int main(int argc, char **argv){
  sqlite3 *db;
  sqlite3_stmt *pStmt;
  sqlite3_open(":memory:", &db);
  sqlite3_prepare_v2(db, "SELECT ((@korte%2)+1);", -1, &pStmt, 0);
  sqlite3_bind_int(pStmt, sqlite3_bind_parameter_index(pStmt, "@korte"), 5);
  sqlite3_step(pStmt);
  printf("result = %d\n", sqlite3_column_int(pStmt, 0));
  return 0;
}


-- 
D. Richard Hipp
drh at sqlite.org

Reply via email to