0

I have stored my images in sqlite database.. i am reading the datas from db using the following query...but the "select"query not working ...if anyone knows,pls help me to resolve..

const char *phssqlStatement="select fld_image ,fld_path from tbl_image where fld_path like ?";
        sqlite3_stmt *phscompiledStatement;

        sqlite3_prepare_v2(database, phssqlStatement, -1, &phscompiledStatement, NULL);
        printf( "could not prepare statemnt: %s\n", sqlite3_errmsg(database));
        //sqlite3_bind_text(compiledStatement,1,[str_imgname1_site UTF8String],250, SQLITE_TRANSIENT);
        //sqlite3_bind_text(phscompiledStatement,1,[zoomedImageURL UTF8String],350,SQLITE_STATIC);
         sqlite3_bind_text(phscompiledStatement, 1, [zoomedImageURL UTF8String],350, SQLITE_TRANSIENT);
0

2 Answers 2

1

You forgot to number your input var like this:

const char *phssqlStatement="select fld_image ,fld_path from tbl_image where fld_path like ?1";
Sign up to request clarification or add additional context in comments.

1 Comment

Try like this: const char *phssqlStatement="select fld_image ,fld_path from tbl_image where fld_path like '?1'";
0

Your SQLite query should be more like:

const char *phssqlStatement="select fld_image ,fld_path from tbl_image where fld_path like '%?%'";

Hope this works for you.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.