""Severin Müller"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> ""Severin Müller"" <[EMAIL PROTECTED]> >> wrote in message >> news:[EMAIL PROTECTED] >>> int func(void) >>> { >>> // database is open and the select statement is executed >>> // this is the query: char *sql = "SELECT 'protect' FROM >>> 'test_db');"; >> >> You should get an error here. If you don't, the statement you >> actually run differs from the one you show. > > Neither. No Error, and it's axactly the statement i'm passing
You sure? Complete with unmatched closing parenthesis? Yes, I see that SQLite manages to accept a string literal in the FROM clause, and interpret it as a table name. This is not valid SQL, SQLite seems to accept it as an extension. In any case, the statement likely doesn't do what you think it's doing. It returns a resultset with the literal string 'protect' repeated for each row in the table test_db. I guess you wanted to select a column named protect: in this case, just drop the quotes: select protect from test_db; Or, if you insist, use double quotes (though they are unnecessary in this case): select "protect" from "test_db"; >>> { >>> if((rc=sqlite3_bind_int(oStmt,0,result))==SQLITE_OK) >> >> You don't have any parameter placeholders in your statement. What >> exactly are you binding here? > > That's what i'm asking. I don't understand what todo with this call > at all. That rather depends on what you are trying to achieve, which I believe you've never explained. For description of SQL parameters, see http://sqlite.org/c3ref/bind_blob.html To retrieve individual fields from the resultset, use sqlite3_column_* API: http://sqlite.org/c3ref/column_blob.html >> The variable 'result' is never modified in your code. What do you >> expect to see in it, other than its initial value of zero? > > i thought the variable result was changed to it's value in the > sqlite3_bind_in function. sqlite3_bind_int takes its 'int' parameter by value. It can't possibly modify it. Again, sqlite3_bind_* is for setting statement parameters. To retrieve values from resultset, use sqlite3_column_* Igor Tandetnik
_______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users