當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ADORecordSet_array類代碼示例

本文整理匯總了PHP中ADORecordSet_array的典型用法代碼示例。如果您正苦於以下問題:PHP ADORecordSet_array類的具體用法?PHP ADORecordSet_array怎麽用?PHP ADORecordSet_array使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ADORecordSet_array類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: ADORecordSet_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

示例3: xmlrpcval2rs

/**
 * Given a well-formed xmlrpc struct object returns an AdoDB object
 *
 * @todo add some error checking on the input value
 */
function xmlrpcval2rs(&$xmlrpcval)
{
    $fields_array = array();
    $data_array = array();
    // rebuild column information
    $header = $xmlrpcval->structmem('header');
    $numfields = $header->structmem('fieldcount');
    $numfields = $numfields->scalarval();
    $numrecords = $header->structmem('recordcount');
    $numrecords = $numrecords->scalarval();
    $sqlstring = $header->structmem('sql');
    $sqlstring = $sqlstring->scalarval();
    $fieldinfo = $header->structmem('fieldinfo');
    for ($i = 0; $i < $numfields; $i++) {
        $temp = $fieldinfo->arraymem($i);
        $fld = new ADOFieldObject();
        while (list($key, $value) = $temp->structeach()) {
            if ($key == "name") {
                $fld->name = $value->scalarval();
            }
            if ($key == "type") {
                $fld->type = $value->scalarval();
            }
            if ($key == "max_length") {
                $fld->max_length = $value->scalarval();
            }
            if ($key == "not_null") {
                $fld->not_null = $value->scalarval();
            }
            if ($key == "has_default") {
                $fld->has_default = $value->scalarval();
            }
            if ($key == "default_value") {
                $fld->default_value = $value->scalarval();
            }
        }
        // while
        $fields_array[] = $fld;
    }
    // for
    // fetch recordset information into php array
    $body = $xmlrpcval->structmem('body');
    for ($i = 0; $i < $numrecords; $i++) {
        $data_array[$i] = array();
        $xmlrpcrs_row = $body->arraymem($i);
        for ($j = 0; $j < $numfields; $j++) {
            $temp = $xmlrpcrs_row->arraymem($j);
            $data_array[$i][$j] = $temp->scalarval();
        }
        // for j
    }
    // for i
    // finally build in-memory recordset object and return it
    $rs = new ADORecordSet_array();
    $rs->InitArrayFields($data_array, $fields_array);
    return $rs;
}
開發者ID:zsolt-molnar,項目名稱:TYPO3-4.5-trunk,代碼行數:62,代碼來源:toxmlrpc.inc.php

示例4: strpos


//.........這裏部分代碼省略.........
                $rs->affectedrows = (int) $meta[3];
                $rs->insertid = $meta[4];
                return $rs;
            }
            # If detect timeout here return false, forcing a fresh query and new cache values
            #
            # Under high volume loads, we want only 1 thread/process to _write_file
            # so that we don't have 50 processes queueing to write the same data.
            #
            # We implement a probabilistic blocking write:
            #
            # -2 sec before timeout, give processes 1/16 chance of writing to file with blocking io
            # -1 sec after timeout give processes 1/4 chance of writing with blocking
            # +0 sec after timeout, give processes 100% chance writing with blocking
            if (sizeof($meta) > 1) {
                if ($timeout > 0) {
                    $tdiff = $meta[1] + $timeout - time();
                    if ($tdiff <= 2) {
                        switch ($tdiff) {
                            case 2:
                                if ((rand() & 0xf) == 0) {
                                    fclose($fp);
                                    $err = "Timeout 2";
                                    return false;
                                }
                                break;
                            case 1:
                                if ((rand() & 0x3) == 0) {
                                    fclose($fp);
                                    $err = "Timeout 1";
                                    return false;
                                }
                                break;
                            default:
                                fclose($fp);
                                $err = "Timeout 0";
                                return false;
                        }
                        // switch
                    }
                    // if check flush cache
                }
                // (timeout>0)
                $ttl = $meta[1];
            }
            $meta = false;
            $meta = fgetcsv($fp, 16000, ",");
            if (!$meta) {
                fclose($fp);
                $err = "Unexpected EOF 1";
                return false;
            }
        }
        // Get Column definitions
        $flds = array();
        foreach ($meta as $o) {
            $o2 = explode(':', $o);
            if (sizeof($o2) != 3) {
                $arr[] = $meta;
                $flds = false;
                break;
            }
            $fld = new ADOFieldObject();
            $fld->name = urldecode($o2[0]);
            $fld->type = $o2[1];
            $fld->max_length = $o2[2];
            $flds[] = $fld;
        }
    } else {
        fclose($fp);
        $err = "Recordset had unexpected EOF 2";
        return false;
    }
    // slurp in the data
    $MAXSIZE = 128000;
    $text = fread($fp, $MAXSIZE);
    $cnt = 1;
    while (strlen($text) == $MAXSIZE * $cnt) {
        $text .= fread($fp, $MAXSIZE);
        $cnt += 1;
    }
    fclose($fp);
    //print "<hr>";
    //print_r($text);
    //if (strlen($text) == 0) $arr = array();
    //else
    $arr = unserialize($text);
    //print_r($arr);
    if (!is_array($arr)) {
        $err = "Recordset had unexpected EOF (in serialized recordset)";
        if (get_magic_quotes_runtime()) {
            $err .= ". Magic Quotes Runtime should be disabled!";
        }
        return false;
    }
    $rs = new ADORecordSet_array();
    $rs->timeCreated = $ttl;
    $rs->InitArrayFields($arr, $flds);
    return $rs;
}
開發者ID:BackupTheBerlios,項目名稱:osiswebprinter,代碼行數:101,代碼來源:adodb-csvlib.inc.php

示例5: flock


//.........這裏部分代碼省略.........
                    fclose($fp);
                    return false;
                }
                fclose($fp);
                if ($timeout > 0) {
                    $err = ' Timeout for insert/update/delete illegal';
                    return false;
                }
                $val = 1;
                $rs = new ADORecordSet($val);
                $rs->EOF = true;
                $rs->_numOfFields = 0;
                $rs->sql = urldecode($meta[2]);
                $rs->affectedrows = (int) $meta[3];
                $rs->insertid = $meta[4];
                $rs->aa = '100';
                return $rs;
            }
            # Under high volume loads, we want only 1 thread/process to _write_file
            # so that we don't have 50 processes queueing to write the same data.
            # Would require probabilistic blocking write
            #
            # -2 sec before timeout, give processes 1/16 chance of writing to file with blocking io
            # -1 sec after timeout give processes 1/4 chance of writing with blocking
            # +0 sec after timeout, give processes 100% chance writing with blocking
            if (sizeof($meta) > 1) {
                if ($timeout > 0) {
                    $tdiff = $meta[1] + $timeout - time();
                    if ($tdiff <= 2) {
                        switch ($tdiff) {
                            case 2:
                                if ((rand() & 15) == 0) {
                                    fclose($fp);
                                    $err = "Timeout 2";
                                    return false;
                                }
                                break;
                            case 1:
                                if ((rand() & 3) == 0) {
                                    fclose($fp);
                                    $err = "Timeout 1";
                                    return false;
                                }
                                break;
                            default:
                                fclose($fp);
                                $err = "Timeout 0";
                                return false;
                        }
                        // switch
                    }
                    // if check flush cache
                }
                // (timeout>0)
                $ttl = $meta[1];
            }
            $meta = fgetcsv($fp, 8192, ",");
            if (!$meta) {
                fclose($fp);
                $err = "Unexpected EOF 1";
                return false;
            }
        }
        // Get Column definitions
        $flds = array();
        foreach ($meta as $o) {
            $o2 = explode(':', $o);
            if (sizeof($o2) != 3) {
                $arr[] = $meta;
                $flds = false;
                break;
            }
            $fld = new ADOFieldObject();
            $fld->name = urldecode($o2[0]);
            $fld->type = $o2[1];
            $fld->max_length = $o2[2];
            $flds[] = $fld;
        }
    } else {
        fclose($fp);
        $err = "Recordset had unexpected EOF 2";
        //print "$url ";print_r($meta);
        //die();
        return false;
    }
    // slurp in the data
    $text = fread($fp, MAX_BLOB_SIZE);
    fclose($fp);
    //$text = substr($text,0,44);
    $arr = @unserialize($text);
    //var_dump($arr);
    if (!is_array($arr)) {
        $err = "Recordset had unexpected EOF 3";
        return false;
    }
    $rs = new ADORecordSet_array();
    $rs->timeCreated = $ttl;
    $rs->InitArrayFields($arr, $flds);
    return $rs;
}
開發者ID:qoire,項目名稱:portal,代碼行數:101,代碼來源:adodb-csvlib.inc.php

示例6: array

 function &_rs2rs(&$rs, $nrows = -1, $offset = -1)
 {
     $arr =& $rs->GetArrayLimit($nrows, $offset);
     $flds = array();
     for ($i = 0, $max = $rs->FieldCount(); $i < $max; $i++) {
         $flds[] =& $rs->FetchField($i);
     }
     $rs->Close();
     $rs2 = new ADORecordSet_array();
     $rs2->InitArrayFields($arr, $flds);
     return $rs2;
 }
開發者ID:qoire,項目名稱:portal,代碼行數:12,代碼來源:adodb.inc.php

示例7: csv2rs


//.........這裏部分代碼省略.........
                                    $err = "Timeout 3";
                                    return false;
                                }
                                break;
                            case 2:
                                if ((rand() & 15) == 0) {
                                    fclose($fp);
                                    $err = "Timeout 2";
                                    return false;
                                }
                                break;
                            case 1:
                                if ((rand() & 3) == 0) {
                                    fclose($fp);
                                    $err = "Timeout 1";
                                    return false;
                                }
                                break;
                            default:
                                fclose($fp);
                                $err = "Timeout 0";
                                return false;
                        }
                        // switch
                    }
                    // if check flush cache
                }
                // (timeout>0)
                $ttl = $meta[1];
            }
            //================================================
            // new cache format - use serialize extensively...
            if ($meta[0] === '====1') {
                // slurp in the data
                $MAXSIZE = 128000;
                $text = fread($fp, $MAXSIZE);
                if (strlen($text)) {
                    while ($txt = fread($fp, $MAXSIZE)) {
                        $text .= $txt;
                    }
                }
                fclose($fp);
                $rs = unserialize($text);
                if (is_object($rs)) {
                    $rs->timeCreated = $ttl;
                } else {
                    $err = "Unable to unserialize recordset";
                    //echo htmlspecialchars($text),' !--END--!<p>';
                }
                return $rs;
            }
            $meta = false;
            $meta = fgetcsv($fp, 32000, ",");
            if (!$meta) {
                fclose($fp);
                $err = "Unexpected EOF 1";
                return false;
            }
        }
        // Get Column definitions
        $flds = array();
        foreach ($meta as $o) {
            $o2 = explode(':', $o);
            if (sizeof($o2) != 3) {
                $arr[] = $meta;
                $flds = false;
                break;
            }
            $fld = new ADOFieldObject();
            $fld->name = urldecode($o2[0]);
            $fld->type = $o2[1];
            $fld->max_length = $o2[2];
            $flds[] = $fld;
        }
    } else {
        fclose($fp);
        $err = "Recordset had unexpected EOF 2";
        return false;
    }
    // slurp in the data
    $MAXSIZE = 128000;
    $text = '';
    while ($txt = fread($fp, $MAXSIZE)) {
        $text .= $txt;
    }
    fclose($fp);
    @($arr = unserialize($text));
    //var_dump($arr);
    if (!is_array($arr)) {
        $err = "Recordset had unexpected EOF (in serialized recordset)";
        if (get_magic_quotes_runtime()) {
            $err .= ". Magic Quotes Runtime should be disabled!";
        }
        return false;
    }
    $rs = new ADORecordSet_array();
    $rs->timeCreated = $ttl;
    $rs->InitArrayFields($arr, $flds);
    return $rs;
}
開發者ID:johnfelipe,項目名稱:orfeo,代碼行數:101,代碼來源:adodb-csvlib.inc.php

示例8: UnixTimeStamp

 static function UnixTimeStamp($v)
 {
     global $ADODB_sybase_mths;
     //11.02.2001 Toni Tunkkari toni.tunkkari@finebyte.com
     //Changed [0-9] to [0-9 ] in day conversion
     if (!preg_match("/([A-Za-z]{3})[-/\\. ]([0-9 ]{1,2})[-/\\. ]([0-9]{4}) +([0-9]{1,2}):([0-9]{1,2}) *([apAP]{0,1})/", $v, $rr)) {
         return parent::UnixTimeStamp($v);
     }
     if ($rr[3] <= TIMESTAMP_FIRST_YEAR) {
         return 0;
     }
     $themth = substr(strtoupper($rr[1]), 0, 3);
     $themth = $ADODB_sybase_mths[$themth];
     if ($themth <= 0) {
         return false;
     }
     switch (strtoupper($rr[6])) {
         case 'P':
             if ($rr[4] < 12) {
                 $rr[4] += 12;
             }
             break;
         case 'A':
             if ($rr[4] == 12) {
                 $rr[4] = 0;
             }
             break;
         default:
             break;
     }
     // h-m-s-MM-DD-YY
     return adodb_mktime($rr[4], $rr[5], 0, $themth, $rr[2], $rr[3]);
 }
開發者ID:ceryxSeidor,項目名稱:ProyectoPruebaWSV2,代碼行數:33,代碼來源:adodb-sybase.inc.php

示例9: UnixTimeStamp

 function UnixTimeStamp($v)
 {
     if (is_numeric(substr($v, 0, 1)) && ADODB_PHPVER >= 0x4200) {
         return parent::UnixTimeStamp($v);
     }
     global $ADODB_mssql_mths, $ADODB_mssql_date_order;
     //Dec 30 2000 12:00AM
     if ($ADODB_mssql_date_order == 'dmy') {
         if (!preg_match("|^([0-9]{1,2})[-/\\. ]+([A-Za-z]{3})[-/\\. ]+([0-9]{4}) +([0-9]{1,2}):([0-9]{1,2}) *([apAP]{0,1})|", $v, $rr)) {
             return parent::UnixTimeStamp($v);
         }
         if ($rr[3] <= TIMESTAMP_FIRST_YEAR) {
             return 0;
         }
         $theday = $rr[1];
         $themth = substr(strtoupper($rr[2]), 0, 3);
     } else {
         if (!preg_match("|^([A-Za-z]{3})[-/\\. ]+([0-9]{1,2})[-/\\. ]+([0-9]{4}) +([0-9]{1,2}):([0-9]{1,2}) *([apAP]{0,1})|", $v, $rr)) {
             return parent::UnixTimeStamp($v);
         }
         if ($rr[3] <= TIMESTAMP_FIRST_YEAR) {
             return 0;
         }
         $theday = $rr[2];
         $themth = substr(strtoupper($rr[1]), 0, 3);
     }
     $themth = $ADODB_mssql_mths[$themth];
     if ($themth <= 0) {
         return false;
     }
     switch (strtoupper($rr[6])) {
         case 'P':
             if ($rr[4] < 12) {
                 $rr[4] += 12;
             }
             break;
         case 'A':
             if ($rr[4] == 12) {
                 $rr[4] = 0;
             }
             break;
         default:
             break;
     }
     // h-m-s-MM-DD-YY
     return mktime($rr[4], $rr[5], 0, $themth, $theday, $rr[3]);
 }
開發者ID:johnfelipe,項目名稱:orfeo,代碼行數:47,代碼來源:adodb-mssql.inc.php

示例10:

 function __construct(&$conn, $mode = false)
 {
     parent::__construct();
     $this->InitArray($conn->_rezarray, $conn->_reztypes, $conn->_reznames);
     $conn->_rezarray = false;
 }
開發者ID:spring,項目名稱:spring-website,代碼行數:6,代碼來源:adodb-text.inc.php

示例11:

 function __construct($id = -1, $mode = false)
 {
     parent::__construct($id, $mode);
 }
開發者ID:evltuma,項目名稱:moodle,代碼行數:4,代碼來源:adodb-mysqli.inc.php


注:本文中的ADORecordSet_array類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。