Hi all,
    I create a table like this:
    "create table tbl1(ID integer primary key, age integer, name text)"
    insert a record: "insert into tbl1 values(1,25,'aaa')"
    I try to select like this:
        sqlite3_prepare(db, "select ?,?,? from tbl1 where ID=1", -1, &stat,
0);
        sqlite3_bind_text(stat, 1, "ID", -1, 0);
        sqlite3_bind_text(stat, 2, "age", -1, 0);
        sqlite3_bind_text(stat, 3, "name", -1, 0);
        rc = sqlite3_step(stat);
        if (SQLITE_ROW == rc)
        {
            ID =   sqlite3_column_int(stat,0);
            age = sqlite3_column_int(stat,1);
            name = ........;
        }
   The return value of sqlite3_step(stat) was SQLITE_ROW, but the values I
got were 0,
   why? I think maybe sqlite3_bind() can not bind the column name.

    The reson I try to select by "select ?,?,?.. from table where ..." but
not "select * from table where ..."
    was follow:
         I create a table with 200 columns, and get a total record llke
this:

           sqlite3_prepare(db, "select * from tbl1 where ID=id", -1, &stat,
0);
           sqlite3_step(stat);
           if (SQLITE_ROW == rc)           {
                 .......
                 ......   // get the values
          }

        I found the time use to get a record does not satisfy the
performance requirement,
        the sqlite3_prepare() occupied most of total select time,
        so I want to try some other ways to reduce the time of parse SQL
statement.

        Are therer  some good advices?
        Thanks very much!
           yoky
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to