php - 查询windows索引时出错:传递给系统调用的数据区太小
问题描述
我在服务器 2019 pc 上查询 windows 索引时遇到问题。
我正在尝试使用 SQL 和 adodb 连接查询系统索引。当我使用contain
运算符时,代码可以工作,但是当我使用like
运算符时,它会引发错误。
index.php 文件中的代码是:
<?php
$conn = new COM("ADODB.Connection",null,CP_UTF8) or die("Cannot start ADO");
$recordset = new COM("ADODB.Recordset");
$conn->Open("Provider=Search.CollatorDSO.1;Extended Properties='Application=Windows';");
?>
<!DOCTYPE html>
<html lang="el">
<head>
<meta http-equiv="content-type" content="text/html">
<meta charset="utf-8">
<title>Index Search</title>
</head>
<body>
<h2 style="text-align: center;">ΑΝΑΖΗΤΗΣΗ</h2>
<div class="srchcontainer">
<form action="" method="post">
Γράψε λεκτικό: <input type="text" name="term" />
<input type="submit" value="Αναζήτηση" />
<br><br>
Πλήθος αποτελεσμάτων: <input type="number" name="resultNumber" value="<?php echo
$_POST['resultNumber'];?>"/>
</form>
</div>
<ol>
<?php
if(!empty($_POST['resultNumber'])){
$resultNumber=$_POST['resultNumber'];}
else {
$resultNumber=10;}
if(!empty($_POST['term'])){
$term = iconv('UTF-8','ISO-8859-7',$_POST['term']);
//$recordset->Open("SELECT top ".$resultNumber." System.itemPathDisplay FROM SYSTEMINDEX WHERE CONTAINS ('".$term."*')", $conn); this is working but i need the like operator
$recordset->Open("SELECT top ".$resultNumber." System.itemPathDisplay FROM SYSTEMINDEX WHERE System.itemName like '%".$term."%'",$conn); // here is the problem with the like operator
if(!$recordset->EOF) $recordset->Movefirst(); //here is the line that breaks
while(!$recordset->EOF) {
$viewfile=iconv('ISO-8859-7','UTF-8',$recordset->Fields->Item('System.ItemPathDisplay')->Value);
echo '<li><a href="'.$viewfile.'">'.$viewfile.'</a></li>';
$recordset->MoveNext();
}
$recordset->close();
}
?>
</ol></div>
</body>
</html>
错误是:
有人知道为什么不能使用 like 运算符吗?或者我怎么能研究这个错误?
操作系统:Windows 服务器 2019,
使用最新 laragon 创建的本地服务器
谢谢你。
解决方案
推荐阅读
- html - 使用 ASP.NET 显示或下载保存在 SQL Server 中的文档
- javascript - 为什么 package.json 不使用 .npmrc 文件中的预定义值?
- boolean-logic - 布尔检查 datetime.now() 是否在元组列表中任何元组的值之间
- javascript - 如何在 JS 插件中现有的之上添加转换
- java - 将 Google 日历中的数据提取到 Java 中
- ios - 见下图,为什么两个标签(棕色)的组合高度与标签(红色)的高度不同?
- python - 从 Visual Studio Code 的 power shell 运行 Anaconda 命令
- python-3.x - 如何在 Keras 中找到错误的预测?
- javascript - jquery单击更改列表元素的类
- c - 获取错误代码:collect2.exe: error: ld returned 1 exit status