本文整理汇总了PHP中OC_DB::insertId方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_DB::insertId方法的具体用法?PHP OC_DB::insertId怎么用?PHP OC_DB::insertId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_DB
的用法示例。
在下文中一共展示了OC_DB::insertId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareFileCache
/**
* prepare file cache for testRemoveBrokenShares()
*/
private function prepareFileCache()
{
// some previous tests didn't clean up and therefore this has to be done here
// FIXME: DIRTY HACK - TODO: find tests, that don't clean up and fix it there
$this->tearDown();
// add items except one - because this is the test case for the broken share table
$addItems = \OC_DB::prepare('INSERT INTO `*PREFIX*filecache` (`storage`, `path_hash`, ' . '`parent`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`) ' . 'VALUES (1, ?, 1, 1, 1, 1, 1, 1)');
$items = array(1, 3);
$fileIds = array();
foreach ($items as $item) {
// the number is used as path_hash
$addItems->execute(array($item));
$fileIds[] = \OC_DB::insertId('*PREFIX*filecache');
}
$addShares = \OC_DB::prepare('INSERT INTO `*PREFIX*share` (`file_source`, `item_type`, `uid_owner`) VALUES (?, \'file\', 1)');
// the number is used as item_source
$addShares->execute(array($fileIds[0]));
$addShares->execute(array(200));
// id of "deleted" file
$addShares->execute(array($fileIds[1]));
// add a few unrelated shares, calendar share that must be left untouched
$addShares = \OC_DB::prepare('INSERT INTO `*PREFIX*share` (`item_source`, `item_type`, `uid_owner`) VALUES (?, \'calendar\', 1)');
// the number is used as item_source
$addShares->execute(array(999));
}