setFromRow($rs); return $t;'),$params ) ); } //-------------------------------------------------------------------- /** * returns array of BookValue */ function getAllBookValue( $orderBy ) { $params = array(); $sql = BookSelectBookValue ; if(!empty($orderBy)){ $sql = $sql . " order by " . $orderBy; } return pgdb_runSqlP($sql, create_function('$rs', '$t = new BookValue(); $t->setFromRow($rs); return $t;'),$params ); } //-------------------------------------------------------------------- function add( $value ) { $sql = "insert into Book ( " . "bookId " . ",title " . ",ISBN " . ",authorId " . ",publisherId " . ",status " . ",numCopies " . " ) values ( " . "nextval('Book_bookId_seq') " . ",? " . ",? " . ",? " . ",? " . ",? " . ",? " . ")"; $params = array(); $params[] = $value->getTitle(); $params[] = $value->getISBN(); $params[] = $value->getAuthorId(); $params[] = $value->getPublisherId(); $params[] = $value->getStatus(); $params[] = $value->getNumCopies(); pgdb_runSqlP($sql,null,$params); } //-------------------------------------------------------------------- function update( $value ) { $sql = "update Book set " . "title = ? " . ",ISBN = ? " . ",authorId = ? " . ",publisherId = ? " . ",status = ? " . ",numCopies = ? " . " where " . "bookId = ? " . ""; $params = array(); $params[] = $value->getTitle(); $params[] = $value->getISBN(); $params[] = $value->getAuthorId(); $params[] = $value->getPublisherId(); $params[] = $value->getStatus(); $params[] = $value->getNumCopies(); $params[] = $value->getBookId(); pgdb_runSqlP($sql,null,$params); } //-------------------------------------------------------------------- function delete( $bookId ) { $sql = "delete from Book where " . "bookId = ? " . ""; $params = array(); $params[] = $bookId; pgdb_runSqlP($sql,null,$params); } //-------------------------------------------------------------------- function getBookWithNamesValue( $bookId ) { $params = array(); $params[] = $bookId; $sql = BookSelectBookWithNamesValue . " and " . " Book1.bookId = ? " ; return pgdb_firstRow( pgdb_runSqlP($sql, create_function('$rs', '$t = new BookWithNamesValue(); $t->setFromRow($rs); return $t;'),$params ) ); } //-------------------------------------------------------------------- /** * returns array of BookWithNamesValue */ function getAllBookWithNamesValue( $orderBy ) { $params = array(); $sql = BookSelectBookWithNamesValue ; if(!empty($orderBy)){ $sql = $sql . " order by " . $orderBy; } return pgdb_runSqlP($sql, create_function('$rs', '$t = new BookWithNamesValue(); $t->setFromRow($rs); return $t;'),$params ); } //-------------------------------------------------------------------- /** * returns array of BookWithNamesValue */ function getAllByTitle( $title ,$orderBy ) { $params = array(); $params[] = $title; $sql = BookSelectBookWithNamesValue . " and " . " Book1.title = ?" ; if(!empty($orderBy)){ $sql = $sql . " order by " . $orderBy; } return pgdb_runSqlP($sql, create_function('$rs', '$t = new BookWithNamesValue(); $t->setFromRow($rs); return $t;'),$params ); } //-------------------------------------------------------------------- /** * returns array of BookWithNamesValue */ function getAllByAuthorName( $authorName ,$orderBy ) { $params = array(); $params[] = $authorName; $sql = BookSelectBookWithNamesValue . " and " . " Author1.name = ?" ; if(!empty($orderBy)){ $sql = $sql . " order by " . $orderBy; } return pgdb_runSqlP($sql, create_function('$rs', '$t = new BookWithNamesValue(); $t->setFromRow($rs); return $t;'),$params ); } //-------------------------------------------------------------------- function updateStatusByPublisher( $publisherId ,$newStatus ) { require_once("BookSSCustom.php"); return BookSSCustom::updateStatusByPublisher( $publisherId ,$newStatus ); } } // // ================================================================== // // WARNING : Do not edit this file by hand. This file was created // by SoProMach. Edit the definition files and re-generate to make // modifications. Making modifications to this file directly will // result in loss of work when the file is re-generated. // // ================================================================== ?>