Hi,

I am trying to insert records into a rtree table using prepared statements.
The table
is defined like this:

CREATE VIRTUAL TABLE points_index USING rtree(id, x, y);

I successfully populate the table containing geometries/attributes using
prepared stmt's.

Inserting values into the points_index table via command prompt works fine,
but I cant seem
to get prepared statements to work:


  char *sql_idx = "INSERT INTO points_index VALUES (?, ?, ?);";
  sqlite3_stmt *stmt_idx = NULL;
  const char *tail = NULL;
  rc = sqlite3_prepare(db, sql, strlen(sql_idx), &stmt_idx, &tail);
  if( rc!=SQLITE_OK )
    return sqlerror(db);

  for(i=0; i<1000000; i++)
  {
    /* Insert into index*/
    rc = sqlite3_bind_int(stmt_idx, 1, i);
    if( rc!=SQLITE_OK )
      return sqlerror(db);
    rc = sqlite3_bind_double(stmt_idx, 2, blob.x);
    if( rc!=SQLITE_OK )
      return sqlerror(db);
    rc = sqlite3_bind_double(stmt_idx, 3, blob.y);
    if( rc!=SQLITE_OK )
      return sqlerror(db);
    if (sqlite3_step(stmt_idx) != SQLITE_DONE)
      return sqlerror(db);
    sqlite3_reset(stmt_idx);
  }


The first two binds runs fine, but binding the blob.y yields
"SQL error: bind or column index out of range"

Let me know if I left out important details.

Regards,


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

Reply via email to