使用PHP IBase,是否有任何方法可以在阅读几行后返回第一行(以避免重新提及数据库)
使用PHP IBase,Ibase_query获取了关系,几个函数可以从该关系中获取行,但是所有这些功能提取 下一行。
在Delphi中,我有能力返回第一行(dataset.first;
) - PHP IBase中是否有任何等效的?
我当然可以重新查询数据库,但是如果仍然可以访问原始关系,这似乎浪费了资源。
示例代码:
$table = ibase_query($sql);
$row = ibase_fetch_object($table);
while (!empty($row))
{
echo $row->ENTRYNO.'<br>';
$row = ibase_fetch_object($table);
}
//The missing functionality
$table.First;
//or maybe
$row = ibase_fetch_object($table,first);
//in which case of course the following line would be redundant
$row = ibase_fetch_object($table);
while (!empty($row))
{
//process record
$row = ibase_fetch_object($table);
}
With php ibase, ibase_query fetches the relation, several functions can then fetch rows from that relation, but all these functions extract the next row.
In Delphi I have the ability to return to the first row (DataSet.First;
) - is there any equivalent in PHP ibase?
I could of course re-query the database, but this seems a waste of resources if the original relation is still accessible.
Example code:
$table = ibase_query($sql);
$row = ibase_fetch_object($table);
while (!empty($row))
{
echo $row->ENTRYNO.'<br>';
$row = ibase_fetch_object($table);
}
//The missing functionality
$table.First;
//or maybe
$row = ibase_fetch_object($table,first);
//in which case of course the following line would be redundant
$row = ibase_fetch_object($table);
while (!empty($row))
{
//process record
$row = ibase_fetch_object($table);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
IBASE/FIREBIRD-PHP驱动程序只能向前获取。如果您想咨询较早的行,则需要以某种形式自己存储它们,或再次执行查询。
The ibase/firebird-php driver is only able to fetch forward. If you want to consult earlier rows, you will need to store them yourself in some form, or execute the query again.