当前位置: 首页>>代码示例>>PHP>>正文


PHP ADORecordSet_array::InitArray方法代码示例

本文整理汇总了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>";
开发者ID:hetznerZA,项目名称:ipplan,代码行数:31,代码来源:test_rs_array.php

示例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;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:22,代码来源:AkHasAndBelongsToMany.php


注:本文中的ADORecordSet_array::InitArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。