You need a placeholder in the SQL in order to bind a value.
The following is untested but shows the sort of approach...
Unsigned char u8_ClassificationCode=1;
Unsigned short u16_Input=0x0061;
if ( sqlite3_prepare(
gpst_SqliteInstance,
"SELECT id, Name FROM MUSIC WHERE Name >= '?' LIMIT 1;",
-1,
&pst_SearchPrepareStmt,
0) != SQLITE_OK )
{
return SQLITE_DB_ERROR;
}
else
{
char sqlParam[ 1000 ];
sprintf( sqlParam, "%1d%c", u8_ClassificationCode, u16_Input );
sqlite3_bind_text16( pst_SearchPrepareStmt, 2, sqlParam, -1,
SQLITE_STATIC );
}
Rgds,
Simon
2008/2/28 Mahalakshmi.m <[EMAIL PROTECTED]>:
>
>
> Hi,
>
>
>
> My table looks like:
>
>
>
> Id Name
>
> 1 1aaa
>
> 2 01345
>
> 3 1asdf
>
>
>
>
>
> I want the statement to be like:
>
> "SELECT id, Name FROM MUSIC WHERE Name >= '1a' LIMIT 1;"
>
> But using prepare I could not able to get the desired statements.
>
> I want to bind unsigned short as text. i.e, If the Unsighed short is 0x0061
> I want to bind it as 'a'.
>
>
>
> My Prepare statement is as follows:
>
>
>
> Unsigned char u8_ClassificationCode=1;
>
> Unsigned short u16_Input=0x0061;
>
> if ( sqlite3_prepare(gpst_SqliteInstance,"SELECT id, Name FROM MUSIC WHERE
> Name >= '%d%c' LIMIT 1;",-1,&pst_SearchPrepareStmt,0)!= SQLITE_OK)
>
> {
>
> return SQLITE_DB_ERROR;
>
> }
>
> else
>
> {
>
> sqlite3_bind_int(pst_SearchPrepareStmt,1,u8_ClassificationCode);
>
> sqlite3_bind_text16(pst_SearchPrepareStmt,2,(char
> *)u16_Input,-1,SQLITE_STATIC);
>
> }
>
>
>
> For the above the return status of sqlite3_prepare is success but not
> properly binded.
>
>
>
> Please help me to solve this.
>
>
>
> Thanks & Regards,
>
> Mahalakshmi.M
>
>
>
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users