Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/zend/Zend/Amf/Parse/Resource/MysqlResult.php
Go to the documentation of this file.
00001 <?php
00032 class Zend_Amf_Parse_Resource_MysqlResult
00033 {
00039     static public $fieldTypes = array(
00040         "int" => "int",
00041         "timestamp" => "int",
00042         "year" => "int",
00043         "real" => "float",
00044     );
00051     public function parse($resource) {
00052         $result = array();
00053         $fieldcnt = mysql_num_fields($resource);
00054         $fields_transform = array();
00055         for($i=0;$i<$fieldcnt;$i++) {
00056             $type = mysql_field_type($resource, $i);
00057             if(isset(self::$fieldTypes[$type])) {
00058                 $fields_transform[mysql_field_name($resource, $i)] = self::$fieldTypes[$type];
00059             }
00060         }
00061 
00062         while($row = mysql_fetch_object($resource)) {
00063             foreach($fields_transform as $fieldname => $fieldtype) {
00064                settype($row->$fieldname, $fieldtype);
00065             }
00066             $result[] = $row;
00067         }
00068         return $result;
00069     }
00070 }
 All Data Structures Namespaces Files Functions Variables Enumerations