问题
I'm using Windows Indexing search together with PHP to search inside thousands of files.
I got it working by using the PHP COM class:
$conn = new COM("ADODB.Connection") or die("Cannot start ADO");
$recordset = new COM("ADODB.Recordset");
$conn - > Open("Provider=Search.CollatorDSO;Extended Properties='Application=Windows';");
$recordset - > Open("SELECT System.ItemName, System.DateModified FROM SYSTEMINDEX WHERE DIRECTORY='file:C:/xxxx/' AND CONTAINS('xxxx')", $conn);
$recordset - > MoveFirst();
while (!$recordset - > EOF) {
echo $recordset - > Fields - > Item("System.ItemName") - > Value."\n";
$recordset - > MoveNext();
}
Now I would like to use the maxRecords property as used in Visual Basic to deal with ADO.
//Visual Basic usage of the property
objRecordSet.MaxRecords = 150
I don't know if there's any equivalent for the COM class in PHP and I couldn't find anything in the documentation.
回答1:
Have you tried this?
$recordset = new COM("ADODB.Recordset");
$recordset->MaxRecords = 150;
PHP's COM class is just a wrapper around COM in general (I think OLE Automation to be specific), and for the most part if a property or function is exposed to VBScript, it can be translated into PHP code directly.
来源:https://stackoverflow.com/questions/21832267/set-a-limit-maxrecords-property-for-windows-indexing-search-through-php-com