Sqlite doesn't find row _only_ when binding takes places in another function

前端 未结 2 1282
Happy的楠姐
Happy的楠姐 2021-01-25 15:37

So I wrote myself a little wrapper function to make a prepared statement for me:

sqlite3_stmt* Gladiateur::run_query_unfinalized(string query, vector

        
2条回答
  •  鱼传尺愫
    2021-01-25 16:09

    Gladiateur::run_query_unfinalized(string query, vector inputs)

    The vector inputs is a copy, and it ceases to exist when the function returns.

    Perhaps you should change it to:

    Gladiateur::run_query_unfinalized(const string& query, const vector& inputs)
    

    With a reference, the c_str should survive to do what you want to get done.

提交回复
热议问题