$result = dibi::query('SELECT * FROM [table]');
$row = $result->fetch();
$value = $result->fetchSingle();
$table = $result->fetchAll();
$pairs = $result->fetchPairs();
$assoc = $result->fetchAssoc('col1');
$assoc = $result->fetchAssoc('col1[]col2->col3');
unset($result);
파일 보기
프로젝트 열기: dg/dibi
1 사용 예제들
메소드 | 설명 | |
---|---|---|
__construct ( $driver ) | ||
count ( ) : integer | Required by the Countable interface. | |
dump ( ) : void | Displays complete result set as HTML or text table for debug purposes. | |
fetch ( ) : |
Fetches the row at current position, process optional type conversion. | |
fetchAll ( $offset = NULL, $limit = NULL ) : |
Fetches all records from table. | |
fetchAssoc ( $assoc ) : array | Fetches all records from table and returns associative tree. | |
fetchPairs ( $key = NULL, $value = NULL ) : array | Fetches all records from table like $key => $value pairs. | |
fetchSingle ( ) : mixed | Like fetch(), but returns only first field. | |
free ( ) : void | Frees the resources allocated for this result set. | |
getColumns ( ) : Dibi\Reflection\Column[] | ||
getFormat ( $type ) : string | Returns data format. | |
getInfo ( ) : Dibi\Reflection\Result | Returns a meta information about the current result set. | |
getIterator ( ) : dibi\ResultIterator | Required by the IteratorAggregate interface. | |
getResource ( ) | ||
getResultDriver ( ) : dibi\ResultDriver | Safe access to property $driver. | |
getRowClass ( ) : string | Returns fetched object class name. | |
getRowCount ( ) : integer | Returns the number of rows in a result set. | |
getType ( $col ) : string | Returns column type. | |
seek ( $row ) : boolean | Moves cursor position without fetching row. | |
setFormat ( $type, $format ) : self | Sets data format. | |
setRowClass ( $class ) : self | Set fetched object class. This class should extend the Row class. | |
setRowFactory ( callable $callback ) : self | Set a factory to create fetched object instances. These should extend the Row class. | |
setType ( $col, $type ) : self | Define column type. |
메소드 | 설명 | |
---|---|---|
detectTypes ( ) : void | Autodetect column types. | |
normalize ( array &$row ) : void | Converts values to specified type and format. | |
oldFetchAssoc ( $assoc ) |
final public fetch ( ) : |
||
리턴 | array on success, FALSE if no next record |
final public fetchAll ( $offset = NULL, $limit = NULL ) : |
||
리턴 |
final public fetchAssoc ( $assoc ) : array | ||
리턴 | array |
final public fetchPairs ( $key = NULL, $value = NULL ) : array | ||
리턴 | array |
final public fetchSingle ( ) : mixed | ||
리턴 | mixed | value on success, FALSE if no next record |
final public getColumns ( ) : Dibi\Reflection\Column[] | ||
리턴 | Dibi\Reflection\Column[] |
public getInfo ( ) : Dibi\Reflection\Result | ||
리턴 | Dibi\Reflection\Result |
final public getIterator ( ) : dibi\ResultIterator | ||
리턴 | dibi\ResultIterator |
final public getResultDriver ( ) : dibi\ResultDriver | ||
리턴 | dibi\ResultDriver |
final public getRowCount ( ) : integer | ||
리턴 | integer |
public setRowClass ( $class ) : self | ||
리턴 | self |
public setRowFactory ( callable $callback ) : self | ||
$callback | callable | |
리턴 | self |