用于测试插入中的参数(按数字)的 ODBC API 是否为标识列
我正在开发一种通过 ODBC 进行动态绑定的第三方语言产品,客户希望能够插入没有字段列表的绑定变量,即 INSERT INTO table VALUES(值),而不是 INSERT INTO table(列)VALUES(值) )。问题在于,在前一种情况下,对于 SQLServer 绑定变量,AUTO_INCRMENT (IDENTITY) 列不会被忽略,因此每个参数最终都会减一。我们的应用程序似乎没有在任何地方设置 IDENTITY_INSERT。我遇到了 SQLGetTypeInfo,它似乎为结果集提供了正确的答案,但这是一个 INSERT,因此没有结果集。有谁知道有一个等效的 API 可以针对 INSERT、UPDATE 等的绑定参数起作用吗?
我知道,我知道,让客户解决查询。我也会尝试一下,但我不确定它会飞。
感谢您提供的任何信息。
I work on a third party language product which does dynamic binding via ODBC and a customer is wanting to be able to insert bound variables without a field list, i.e. INSERT INTO table VALUES (values), not INSERT INTO table (columns) VALUES (values). The problem is that in the former case for SQLServer bind variables, the AUTO_INCREMENT (IDENTITY) columns are not ignored, so each parameter ends up off by one. It doesn't look like our app is setting IDENTITY_INSERT anywhere. I ran across SQLGetTypeInfo which appears to give the right answer for result sets, but this is an INSERT, hence, no result sets. Does anyone know of an equivalent API that will work against bind parameters for an INSERT, UPDATE etc?
I know, I know, have the customer fix the query. I'll try that too but I'm not sure it will fly.
Thanks for any info you might have.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以获取 SQL_DESC_AUTO_UNIQUE_VALUE 描述符字段。有关详细信息,请参阅此。
You can get at the SQL_DESC_AUTO_UNIQUE_VALUE descriptor field. See this for more info.