On Fri, Dec 2, 2016 at 6:56 PM, Igor Korot <ikoro...@gmail.com> wrote:
> Hi, ALL,
> I wrote following code in C++ (error checking removed for clarity):
>
> [code]
> const std::wstring &SQLiteDatabase::GetTableComments(const
> std::wstring &tableName, std::vector<std::wstring> &errorMsg)
> {
>     std::wstring comment = L"";
>     sqlite3_stmt *stmt = NULL;
>     std::wstring errorMessage;
>     std::wstring query = L"SELECT \"abt_cmnt\" FROM \"sys.abcattbl\"
> WHERE \"abt_tnam\" = ?;";
>     int res = sqlite3_prepare_v2( m_db,
> sqlite_pimpl->m_myconv.to_bytes( query.c_str() ).c_str(),
> query.length(), &stmt, 0 );
>     if( res == SQLITE_OK )
>     {
>         res = sqlite3_bind_text( stmt, 1,
> sqlite_pimpl->m_myconv.to_bytes( tableName.c_str() ).c_str(), -1,
> SQLITE_STATIC );
>         if( res == SQLITE_OK )
>         {
>             res = sqlite3_step( stmt );
>             if( res == SQLITE_ROW )
>             {
>                 comment = sqlite_pimpl->m_myconv.from_bytes( (const
> char *) sqlite3_column_text( stmt, 0 ) );
>             }
> [/code]
>
> The trouble is that sqlite3_step() returns 101 (SQLITE_DONE) and not
> 100 (SQLITE_ROW).
>
> Does anyone see an issue with this code:

Also just to clarify:

std::wstring_convert<std::codecvt_utf8<wchar_t> > m_myconv;

>
> Thank you.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to