本文整理汇总了PHP中ADORecordSet_array::InitArray方法的典型用法代码示例。如果您正苦于以下问题:PHP ADORecordSet_array::InitArray方法的具体用法?PHP ADORecordSet_array::InitArray怎么用?PHP ADORecordSet_array::InitArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ADORecordSet_array
的用法示例。
在下文中一共展示了ADORecordSet_array::InitArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<?php
include_once '../adodb.inc.php';
$rs = new ADORecordSet_array();
$array = array(array('Name', 'Age'), array('John', '12'), array('Jill', '8'), array('Bill', '49'));
$typearr = array('C', 'I');
$rs->InitArray($array, $typearr);
while (!$rs->EOF) {
print_r($rs->fields);
echo "<br>";
$rs->MoveNext();
}
echo "<hr> 1 Seek<br>";
$rs->Move(1);
while (!$rs->EOF) {
print_r($rs->fields);
echo "<br>";
$rs->MoveNext();
}
echo "<hr> 2 Seek<br>";
$rs->Move(2);
while (!$rs->EOF) {
print_r($rs->fields);
echo "<br>";
$rs->MoveNext();
}
echo "<hr> 3 Seek<br>";
$rs->Move(3);
while (!$rs->EOF) {
print_r($rs->fields);
echo "<br>";
示例2: test_find_on_association_with_conditions_array_sql
public function test_find_on_association_with_conditions_array_sql()
{
$this->installAndIncludeModels(array('Friend' => 'id,name'));
$Mary =& $this->Friend->create(array('name' => 'Mary'));
$Mary->friend->add($this->Friend->create(array('name' => 'James')));
//$db = new AkDbAdapter(array()); // no conection details, we're using a Mock
Mock::generate('ADOConnection');
$connection = new MockADOConnection();
$result = new ADORecordSet_array(-1);
$result->InitArray(array(array('id' => 1, 'name' => 'James')), array('id' => 'I', 'name' => 'C'));
$connection->setReturnValue('Execute', $result);
if ($Mary->_db->type() == 'sqlite') {
$connection->expectAt(0, 'Execute', array('SELECT friends.* FROM friends LEFT OUTER JOIN friends_friends AS _FriendFriend ON _FriendFriend.related_id = friends.id LEFT OUTER JOIN friends AS _Friend ON _FriendFriend.friend_id = _Friend.id WHERE (friends.name = ?) AND (_FriendFriend.friend_id LIKE 1) AND 1', array('James')));
} else {
$connection->expectAt(0, 'Execute', array('SELECT friends.* FROM friends LEFT OUTER JOIN friends_friends AS _FriendFriend ON _FriendFriend.related_id = friends.id LEFT OUTER JOIN friends AS _Friend ON _FriendFriend.friend_id = _Friend.id WHERE (friends.name = ?) AND (_FriendFriend.friend_id = 1)', array('James')));
}
$oldConnection = $Mary->_db->connection;
$Mary->_db->connection =& $connection;
//$Mary->_db = $db;
$Mary->friend->find(array('conditions' => array('name = ?', 'James')));
$Mary->_db->connection = $oldConnection;
}