123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510 |
- <?php
- /**
- * Copyright (C) 2008, 2009 Michael Nowak
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- **/
- class DatabaseNo extends Database
- {
- static $instance;
- static function getInstance() {
- if ( !isset( self::$instance ) ) {
- self::$instance = new self();
- }
- return self::$instance;
- }
- #------------------------------------------------------------------------------
- # Accessors
- #------------------------------------------------------------------------------
- function failFunction( $function = NULL ) {
- return null;
- }
- function setOutputPage( $out ) {
- return null;
- }
- function debug( $debug = NULL ) {
- return null;
- }
- function bufferResults( $buffer = NULL ) {
- return null;
- }
- function ignoreErrors( $ignoreErrors = NULL ) {
- return true;
- }
- function trxLevel( $level = NULL ) {
- return 0;
- }
- function errorCount( $count = NULL ) {
- return 0;
- }
- function getLBInfo( $name = NULL ) {
- return true;
- }
- function setLBInfo( $name, $value = NULL ) {
- return true;
- }
- function cascadingDeletes() {
- return false;
- }
- function cleanupTriggers() {
- return false;
- }
- function strictIPs() {
- return false;
- }
- function realTimestamps() {
- return false;
- }
- function implicitGroupby() {
- return true;
- }
- function implicitOrderby() {
- return true;
- }
- function searchableIPs() {
- return false;
- }
- function functionalIndexes() {
- return false;
- }
- function lastQuery() {
- return true;
- }
- function isOpen() {
- return true;
- }
- function setFlag( $flag ) {
- return true;
- }
- function clearFlag( $flag ) {
- return true;
- }
- function getFlag( $flag ) {
- return true;
- }
- function getProperty( $name ) {
- return true;
- }
- function __construct( $server = false, $user = false, $password = false, $dbName = false,
- $failFunction = false, $flags = 0, $tablePrefix = 'get from global' ) {
- null;
- }
- static function newFromParams( $server, $user, $password, $dbName, $failFunction = false, $flags = 0 ) {
- return new Database( $server, $user, $password, $dbName, $failFunction, $flags );
- }
- function open( $server, $user, $password, $dbName ) {
- return true;
- }
- function close() {
- return true;
- }
- function reportConnectionError( $error = 'Unknown error' ) {
- return null;
- }
- public function query( $sql, $fname = '', $tempIgnore = false ) {
- return null;
- }
- function doQuery( $sql ) {
- return true;
- }
- function reportQueryError( $error, $errno, $sql, $fname, $tempIgnore = false ) {
- return null;
- }
- function prepare( $sql, $func = 'Database::prepare' ) {
- return null;
- }
- function freePrepared( $prepared ) {
- return null;
- }
- function execute( $prepared, $args = null ) {
- return true;
- }
- function safeQuery( $query, $args = null ) {
- return true;
- }
- function fillPrepared( $preparedQuery, $args ) {
- return true;
- }
- function fillPreparedArg( $matches ) {
- return true;
- }
- function freeResult( $res ) {
- return null;
- }
- function fetchObject( $res ) {
- return null;
- }
- function fetchRow( $res ) {
- return null;
- }
- function numRows( $res ) {
- return 0;
- }
- function numFields( $res ) {
- return 0;
- }
- function fieldName( $res, $n ) {
- return true;
- }
- function insertId() {
- return null;
- }
- function dataSeek( $res, $row ) {
- return true;
- }
- function lastErrno() {
- return null;
- }
- function lastError() {
- return null;
- }
- function affectedRows() {
- return 0;
- }
- function set( $table, $var, $value, $cond, $fname = 'Database::set' ) {
- return null;
- }
- function selectField( $table, $var, $cond='', $fname = 'Database::selectField', $options = array() ) {
- return null;
- }
- function makeSelectOptions( $options ) {
- return null;
- }
- /*
- function select( $table, $vars, $conds='', $fname = 'Database::select', $options = array() ) {
- if ( $this->isWriteQuery( $sql ) ) {
- return null;
- } else {
- return new ResultWrapper ( $this , null );
- }
- }
- */
- function selectRow( $table, $vars, $conds, $fname = 'Database::selectRow', $options = array() ) {
- return null;
- }
- function estimateRowCount( $table, $vars='*', $conds='', $fname = 'Database::estimateRowCount', $options = array() ) {
- return 0;
- }
- static function generalizeSQL( $sql ) {
- return null;
- }
- function fieldExists( $table, $field, $fname = 'Database::fieldExists' ) {
- return null;
- }
- function indexExists( $table, $index, $fname = 'Database::indexExists' ) {
- return null;
- }
- function indexInfo( $table, $index, $fname = 'Database::indexInfo' ) {
- return null;
- }
- function tableExists( $table ) {
- return null;
- }
- function fieldInfo( $table, $field ) {
- return null;
- }
- function fieldType( $res, $index ) {
- return null;
- }
- function indexUnique( $table, $index ) {
- return null;
- }
- function insert( $table, $a, $fname = 'Database::insert', $options = array() ) {
- return null;
- }
- function makeUpdateOptions( $options ) {
- return null;
- }
- function update( $table, $values, $conds, $fname = 'Database::update', $options = array() ) {
- return null;
- }
- function makeList( $a, $mode = LIST_COMMA ) {
- return null;
- }
- function selectDB( $db ) {
- return null;
- }
- function tableName( $name ) {
- return null;
- }
- public function tableNames() {
- return null;
- }
- public function tableNamesN() {
- return null;
- }
- function tableNamesWithUseIndex( $tables, $use_index ) {
- return null;
- }
- function strencode( $s ) {
- return true;
- }
- function addQuotes( $s ) {
- return true;
- }
- function escapeLike( $s ) {
- return true;
- }
- function nextSequenceValue( $seqName ) {
- return null;
- }
- function useIndexClause( $index ) {
- return true;
- }
- function replace( $table, $uniqueIndexes, $rows, $fname = 'Database::replace' ) {
- return null;
- }
- function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, $fname = 'Database::deleteJoin' ) {
- return null;
- }
- function textFieldSize( $table, $field ) {
- return null;
- }
- function lowPriorityOption() {
- }
- function delete( $table, $conds, $fname = 'Database::delete' ) {
- return true;
- }
- function insertSelect( $destTable, $srcTable, $varMap, $conds, $fname = 'Database::insertSelect',
- $insertOptions = array(), $selectOptions = array() )
- {
- return null;
- }
- function limitResult($sql, $limit, $offset=false) {
- return null;
- }
- function limitResultForUpdate($sql, $num) {
- return null;
- }
- function conditional( $cond, $trueVal, $falseVal ) {
- return null;
- }
- function wasDeadlock() {
- return null;
- }
- function deadlockLoop() {
- return null;
- }
- function masterPosWait( $file, $pos, $timeout ) {
- return null;
- }
- function getSlavePos() {
- return null;
- }
- function getMasterPos() {
- return null;
- }
- function begin( $fname = 'Database::begin' ) {
- }
- function commit( $fname = 'Database::commit' ) {
- }
- function rollback( $fname = 'Database::rollback' ) {
- }
- function immediateBegin( $fname = 'Database::immediateBegin' ) {
- }
- function immediateCommit( $fname = 'Database::immediateCommit' ) {
- }
- function timestamp( $ts=0 ) {
- }
- function timestampOrNull( $ts = null ) {
- }
- function resultObject( $result ) {
- }
- function aggregateValue ($valuedata,$valuename='value') {
- }
- function getSoftwareLink() {
- return "[http://www.mysql.com/ MySQL]";
- }
- function getServerVersion() {
- }
- function ping() {
- return true;
- }
- function getLag() {
- return 0;
- }
- function getStatus($which="%") {
- return true;
- }
- function maxListLen() {
- return 0;
- }
- function encodeBlob($b) {
- return $b;
- }
- function decodeBlob($b) {
- return $b;
- }
- public function setTimeout( $timeout ) {
- }
- function sourceFile( $filename, $lineCallback = false, $resultCallback = false ) {
- return null;
- }
- function sourceStream( $fp, $lineCallback = false, $resultCallback = false ) {
- return true;
- }
- protected function replaceVars( $ins ) {
- return true;
- }
- protected function tableNameCallback( $matches ) {
- }
- /*
- * Build a concatenation list to feed into a SQL query
- */
- function buildConcat( $stringList ) {
- return true;
- }
- }
- /**
- * Disable all types of databases (excluding Mysql) by replacing they classes with this one
- **/
- class DatabaseIbm_db2 extends DatabaseNo
- {}
- class DatabaseOracle extends DatabaseNo
- {}
- class DatabasePostgres extends DatabaseNo
- {}
- class DatabaseMssql extends DatabaseNo
- {}
- class DatabaseSqlite extends DatabaseNo
- {}
|