如何调试SQLite3中的绑定参数? [英] How to debug binding parameters in SQLite3?

查看:213
本文介绍了如何调试SQLite3中的绑定参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

其他问题中,我学习了如何正确地将参数绑定到准备好的SQL语句。但是,我发现如果我不绑定所有参数,sqlite3_step()返回与SQLITE_DONE。我宁愿认为这是一个错误。此外,我不知道这是否是我的代码中的错误的根源,因此我的问题的目的是了解如何调试SQLite在绑定过程中的行为:

In the other question I learned how to properly bind parameters to prepared SQL statements. However, I found out that sqlite3_step() returns with SQLITE_DONE if I don't bind all parameters. I would rather consider this to be an error. Furthermore, I do not know if this is the source of error in my code, hence my questions aim at understanding how to debug the behavior of SQLite during the binding process:


  1. 如何确定未设置哪些参数?

  2. 为了调试,我可以以某种方式看到带有绑定参数的语句吗?

  3. 如果不是所有参数都设置,SQLite为什么不使用SQLITE_NOT_ALL_PARAMETERS_SET或SQLITE_ERROR响应?


推荐答案


  1. 您未使用 sqlite3_bind _ *()设置的任何参数的默认值为NULL。

  1. Any parameters which you did not explicit set with sqlite3_bind_*() have the default value NULL.

这意味着所有参数总是设置的。

This implies that all parameters are always set.

没有读取参数值的函数;假设您知道这些值,因为您自己设置了这些值。

There is no function to read parameter values; it is assumed that you know the values because you've set them yourself.

这篇关于如何调试SQLite3中的绑定参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆