| @@ 7496-7526 (lines=31) @@ | ||
| 7493 | * @return OODBBean |
|
| 7494 | * |
|
| 7495 | */ |
|
| 7496 | public function load( $type, $id ) |
|
| 7497 | { |
|
| 7498 | $bean = $this->dispense( $type ); |
|
| 7499 | if ( isset( $this->stash[$this->nesting][$id] ) ) { |
|
| 7500 | $row = $this->stash[$this->nesting][$id]; |
|
| 7501 | } else { |
|
| 7502 | try { |
|
| 7503 | $rows = $this->writer->queryRecord( $type, array( 'id' => array( $id ) ) ); |
|
| 7504 | } catch ( SQLException $exception ) { |
|
| 7505 | if ( $this->writer->sqlStateIn( $exception->getSQLState(), |
|
| 7506 | array( |
|
| 7507 | QueryWriter::C_SQLSTATE_NO_SUCH_COLUMN, |
|
| 7508 | QueryWriter::C_SQLSTATE_NO_SUCH_TABLE ) |
|
| 7509 | ) |
|
| 7510 | ) { |
|
| 7511 | $rows = 0; |
|
| 7512 | ||
| 7513 | } |
|
| 7514 | } |
|
| 7515 | if ( empty( $rows ) ) { |
|
| 7516 | return $bean; |
|
| 7517 | } |
|
| 7518 | $row = array_pop( $rows ); |
|
| 7519 | } |
|
| 7520 | $bean->importRow( $row ); |
|
| 7521 | $this->nesting++; |
|
| 7522 | $this->oodb->signal( 'open', $bean ); |
|
| 7523 | $this->nesting--; |
|
| 7524 | ||
| 7525 | return $bean->setMeta( 'tainted', FALSE ); |
|
| 7526 | } |
|
| 7527 | } |
|
| 7528 | } |
|
| 7529 | ||
| @@ 7698-7727 (lines=30) @@ | ||
| 7695 | * @return OODBBean |
|
| 7696 | * |
|
| 7697 | */ |
|
| 7698 | public function load( $type, $id ) |
|
| 7699 | { |
|
| 7700 | $bean = $this->dispense( $type ); |
|
| 7701 | if ( isset( $this->stash[$this->nesting][$id] ) ) { |
|
| 7702 | $row = $this->stash[$this->nesting][$id]; |
|
| 7703 | } else { |
|
| 7704 | try { |
|
| 7705 | $rows = $this->writer->queryRecord( $type, array( 'id' => array( $id ) ) ); |
|
| 7706 | } catch ( SQLException $exception ) { |
|
| 7707 | if ( $this->writer->sqlStateIn( $exception->getSQLState(), |
|
| 7708 | array( |
|
| 7709 | QueryWriter::C_SQLSTATE_NO_SUCH_COLUMN, |
|
| 7710 | QueryWriter::C_SQLSTATE_NO_SUCH_TABLE ) |
|
| 7711 | ) |
|
| 7712 | ) { |
|
| 7713 | throw $exception; //only throw if frozen |
|
| 7714 | } |
|
| 7715 | } |
|
| 7716 | if ( empty( $rows ) ) { |
|
| 7717 | return $bean; |
|
| 7718 | } |
|
| 7719 | $row = array_pop( $rows ); |
|
| 7720 | } |
|
| 7721 | $bean->importRow( $row ); |
|
| 7722 | $this->nesting++; |
|
| 7723 | $this->oodb->signal( 'open', $bean ); |
|
| 7724 | $this->nesting--; |
|
| 7725 | ||
| 7726 | return $bean->setMeta( 'tainted', FALSE ); |
|
| 7727 | } |
|
| 7728 | } |
|
| 7729 | } |
|
| 7730 | ||