- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我正尝试在 PHP 中使用 odbc_prepare 和 odbc_execute,如下所示:
$pstmt=odbc_prepare($odb_con,"select * from configured where param_name='?'");
$res=odbc_execute($pstmt,array('version'));
var_dump($res); //bool(true)
$row = odbc_fetch_array($pstmt);
var_dump($row); //bool(false)
第一个 var_dump 返回 true,因此执行成功,但没有返回任何行。 param_name = 'version' 确实存在一行。为什么没有返回行?
为了让事情变得有趣,我使用准备好的插入在 php 中运行了另一个非常简单的示例。
$pstmt=odbc_prepare($odb_con,"insert into tmp1 values(?,'?')");
这一行本身就在数据库中插入了一行!!当然这是错误的?输入的数据是第 1 列 = 空白,第 2 列 = ?
任何有关从哪里开始解决此问题的建议,我们将不胜感激,谢谢。
编辑:这是在 PHP 5.2.8 中
最佳答案
尝试从查询字符串中删除单引号并将它们添加到参数值本身:
$pstmt=odbc_prepare($odb_con,"select * from configured where param_name=?");
$res=odbc_execute($pstmt,array(" 'version'"));
var_dump($res); //bool(true)
$row = odbc_fetch_array($pstmt);
var_dump($row); //bool(false)
参数值开头的单个空格字符非常重要——如果没有空格,它会将变量视为文件路径。
来自 http://www.php.net/manual/en/function.odbc-execute.php :
If you wish to store a string which actually begins and ends with single quotes, you must add a space or other non-single-quote character to the beginning or end of the parameter, which will prevent the parameter from being taken as a file name.
关于php - PHP 中的 ODBC 准备语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5756369/
这个问题已经有答案了: what is the difference between OLE DB and ODBC data sources? (11 个回答) 已关闭10 年前。 OLEDB 和
我正在制作安装脚本并且我正在使用 ODBC,我如何自动将节点添加到 ODBC 数据源。 使用 Visual Studio 安装项目构建安装程序,但我能够为其运行任何脚本。 谢谢。 最佳答案 1) OD
所以我正在将一个旧的 filemaker 数据库传输到 MySQL,一些重复的字段给我带来了一些问题。我读过 ODBC 标准支持这些字段,只有当它们的类型是“文本”并且每个重复都与某个定界符( see
一个月前,我向一个哥们展示了如何使用 .NET 来查询 MySQL。它工作得很好,但他不明白为什么我们需要一个 MySQL 与 ODBC 结合的“驱动程序”。他认为 ODBC 就足够了。 当他问我为什
为什么 ODBC 很慢?底层架构是什么?有人可以对此多加关注> 最佳答案 一般来说(我的意思是 GENERAL)ODBC 驱动程序在混合中添加了另一层。它必须接受您的查询并将其转换为本地查询语言(本地
问题:我正在使用 AsteriskNow,它在 VirtualBox 中运行 asterisk 2.0 服务器。我想使用 ODBC 模块将 Asterisk 与 MySQL 数据库连接起来。但它失败了
我有一个名为“myodbc”的用户定义的 ODBC 连接,其中保存了用户名和密码。这是管理员为我创建的,因此我无法访问凭据。 如何在不传递凭据的情况下与 SAS 建立连接。我认为以下工作会,但我收到无
我最近发现 libname 语句对于访问驻留在 odbc 中的表非常方便。但我不知道如何访问那些具有两级名称的表。下面是一个例子。 我使用的旧代码(此代码有效): proc sql; conn
我们通常使用 MS Visual Foxpro v9.0 SP1、语言、表格和报告。但是,有时我们使用 ODBC 驱动程序连接到表。 ODBC 驱动程序是为 Foxpro v6 编写的,不支持某些嵌套
我第一次尝试在使用 PostgreSQL 9 的 Windows XP Pro 上打开一个程序。我收到一条错误消息: A problem was encountered while trying to
我有一个 spark 集群设置,并在我的数据集上尝试了 native scala 和 spark sql,该设置似乎在大多数情况下都有效。我有以下问题 从 ODBC/外部连接到集群,我应该期待什么?
我正在尝试为 Hive 设置 ODBC 连接。我按照以下步骤操作,但没有成功。 用户 DSN-->添加--> Hortonworks Hive ODBC 驱动程序--> 我提供了以下详细信息 主机:主
我找不到任何文档或示例。到目前为止,我可以成功连接,但是我不知道选择和返回数据的语法。 :odbc.start() {:ok, conn} = :odbc.connect('DSN=mydsn;UID
我正在阅读一篇有关数据透视缓存的 MS Excel 帮助文章,并想知道 OLE DB 和 ODBC 源 的含义 ...You should use the CommandText property i
从应用程序调用 SQLColAttribute 时出现 SQL_INVALID_HANDLE 错误(尝试与自行开发的 odbc 驱动程序通信)我不知道为什么句柄被声明为无效句柄,因为它是一个简单的结构
我有一个简单的 SQL,需要通过 ODBC 调用 RedShift。SQL是这样的 SELECT id as Tag From SomeView 这根本不起作用。它给了我错误 DataSource.E
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,
从应用程序调用 SQLColAttribute 时出现 SQL_INVALID_HANDLE 错误(尝试与自行开发的 odbc 驱动程序通信)我不知道为什么句柄被声明为无效句柄,因为它是一个简单的结构
我有一个简单的 SQL,需要通过 ODBC 调用 RedShift。SQL是这样的 SELECT id as Tag From SomeView 这根本不起作用。它给了我错误 DataSource.E
我正在尝试使用 BIML 生成自动暂存区域。源数据库为Progress,通过ODBC连接。 我正在使用以下演练: https://www.cathrinewilhelmsen.net/2015/07/
我是一名优秀的程序员,十分优秀!