<tfoot id='o63pi'></tfoot>
    <bdo id='o63pi'></bdo><ul id='o63pi'></ul>
    1. <legend id='o63pi'><style id='o63pi'><dir id='o63pi'><q id='o63pi'></q></dir></style></legend>

    2. <i id='o63pi'><tr id='o63pi'><dt id='o63pi'><q id='o63pi'><span id='o63pi'><b id='o63pi'><form id='o63pi'><ins id='o63pi'></ins><ul id='o63pi'></ul><sub id='o63pi'></sub></form><legend id='o63pi'></legend><bdo id='o63pi'><pre id='o63pi'><center id='o63pi'></center></pre></bdo></b><th id='o63pi'></th></span></q></dt></tr></i><div id='o63pi'><tfoot id='o63pi'></tfoot><dl id='o63pi'><fieldset id='o63pi'></fieldset></dl></div>

      <small id='o63pi'></small><noframes id='o63pi'>

        我可以在 sqlite3 中使用表名的参数吗?

        Can I use parameters for the table name in sqlite3?(我可以在 sqlite3 中使用表名的参数吗?)

        <small id='1uFLh'></small><noframes id='1uFLh'>

      1. <i id='1uFLh'><tr id='1uFLh'><dt id='1uFLh'><q id='1uFLh'><span id='1uFLh'><b id='1uFLh'><form id='1uFLh'><ins id='1uFLh'></ins><ul id='1uFLh'></ul><sub id='1uFLh'></sub></form><legend id='1uFLh'></legend><bdo id='1uFLh'><pre id='1uFLh'><center id='1uFLh'></center></pre></bdo></b><th id='1uFLh'></th></span></q></dt></tr></i><div id='1uFLh'><tfoot id='1uFLh'></tfoot><dl id='1uFLh'><fieldset id='1uFLh'></fieldset></dl></div>
            <tbody id='1uFLh'></tbody>
          <tfoot id='1uFLh'></tfoot>
            <legend id='1uFLh'><style id='1uFLh'><dir id='1uFLh'><q id='1uFLh'></q></dir></style></legend>
              <bdo id='1uFLh'></bdo><ul id='1uFLh'></ul>

                  本文介绍了我可以在 sqlite3 中使用表名的参数吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我对 sqlite3 参数有一些奇怪的感觉,我想向您公开.

                  I'm having some strange feeling abour sqlite3 parameters that I would like to expose to you.

                  这是我的查询和失败消息:

                  This is my query and the fail message :

                  #query
                  'SELECT id FROM ? WHERE key = ? AND (userid = '0' OR userid = ?) ORDER BY userid DESC LIMIT 1;'
                  #error message, fails when calling sqlite3_prepare()
                  error: 'near "?": syntax error'
                  

                  在我的代码中它看起来像:

                  In my code it looks like:

                  // Query is a helper class, at creation it does an sqlite3_preprare()
                  Query q("SELECT id FROM ? WHERE key = ? AND (userid = 0 OR userid = ?) ORDER BY userid DESC LIMIT 1;");
                  // bind arguments
                  q.bindString(1, _db_name.c_str() ); // class member, the table name
                  q.bindString(2, key.c_str()); // function argument (std::string)
                  q.bindInt   (3, currentID); // function argument (int)
                  q.execute();
                  

                  感觉表名不能用sqlite参数,但是在Sqlite3 C API.

                  I have the feeling that I can't use sqlite parameters for the table name, but I can't find the confirmation in the Sqlite3 C API.

                  你知道我的查询有什么问题吗?
                  在准备查询之前,我是否必须预处理我的 SQL 语句以包含表名?

                  Do you know what's wrong with my query?
                  Do I have to pre-process my SQL statement to include the table name before preparing the query?

                  推荐答案

                  Ooookay,应该更彻底地了解 SO.

                  Ooookay, should have looked more thoroughly on SO.

                  答案:
                  - SQLite 参数 - 不允许表名作为参数
                  - sqlite中的变量表名

                  它们适用于 Python,但我想这同样适用于 C++.

                  They are meant for Python, but I guess the same applies for C++.

                  tl;dr:

                  您不能将表名作为参数传递.
                  如果有人在 SQLite 文档中有我对此进行确认的链接,我很乐意接受答案.

                  You can't pass the table name as a parameter.
                  If anyone have a link in the SQLite documentation where I have the confirmation of this, I'll gladly accept the answer.

                  这篇关于我可以在 sqlite3 中使用表名的参数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Building a comma separated list?(建立一个逗号分隔的列表?)
                  Errors in SQL Server while importing CSV file despite varchar(MAX) being used for each column(尽管每列都使用了 varchar(MAX),但在导入 CSV 文件时 SQL Server 中出现错误)
                  How can I import an Excel file into SQL Server?(如何将 Excel 文件导入 SQL Server?)
                  Export table to file with column headers (column names) using the bcp utility and SQL Server 2008(使用 bcp 实用程序和 SQL Server 2008 将表导出到带有列标题(列名称)的文件)
                  Concat field value to string in SQL Server(将字段值连接到 SQL Server 中的字符串)
                  SQL Server Bulk insert of CSV file with inconsistent quotes(SQL Server 批量插入带有不一致引号的 CSV 文件)
                  <legend id='DsGNn'><style id='DsGNn'><dir id='DsGNn'><q id='DsGNn'></q></dir></style></legend>
                1. <i id='DsGNn'><tr id='DsGNn'><dt id='DsGNn'><q id='DsGNn'><span id='DsGNn'><b id='DsGNn'><form id='DsGNn'><ins id='DsGNn'></ins><ul id='DsGNn'></ul><sub id='DsGNn'></sub></form><legend id='DsGNn'></legend><bdo id='DsGNn'><pre id='DsGNn'><center id='DsGNn'></center></pre></bdo></b><th id='DsGNn'></th></span></q></dt></tr></i><div id='DsGNn'><tfoot id='DsGNn'></tfoot><dl id='DsGNn'><fieldset id='DsGNn'></fieldset></dl></div>
                    <tbody id='DsGNn'></tbody>
                  • <bdo id='DsGNn'></bdo><ul id='DsGNn'></ul>
                  • <tfoot id='DsGNn'></tfoot>

                          • <small id='DsGNn'></small><noframes id='DsGNn'>