function affectedRows() { return mysql_affected_rows( $this->mConn ); }
/**#@-*/ // end of template : @param $result
-
/**
* Simple UPDATE wrapper
* Usually aborts on failure
* If errors are explicitly ignored, returns success
+ *
+ * This function exists for historical reasons, Database::update() has a more standard
+ * calling convention and feature set
*/
function set( $table, $var, $value, $cond, $fname = 'Database::set' )
{
*/
function selectDB( $db ) {
$this->mDBname = $db;
- mysql_select_db( $db, $this->mConn );
+ return mysql_select_db( $db, $this->mConn );
}
/**
$rows = array( $rows );
}
- $sql = "REPLACE INTO $table (" . implode( ',', array_flip( $rows[0] ) ) .') VALUES ';
+ $sql = "REPLACE INTO $table (" . implode( ',', array_keys( $rows[0] ) ) .') VALUES ';
$first = true;
foreach ( $rows as $row ) {
if ( $first ) {
return ' LIMIT '.(is_numeric($offset)?"{$offset},":"")."{$limit} ";
}
+ /**
+ * Returns an SQL expression for a simple conditional.
+ * Uses IF on MySQL.
+ *
+ * @param string $cond SQL expression which will result in a boolean value
+ * @param string $trueVal SQL expression to return if true
+ * @param string $falseVal SQL expression to return if false
+ * @return string SQL fragment
+ */
+ function conditional( $cond, $trueVal, $falseVal ) {
+ return " IF($cond, $trueVal, $falseVal) ";
+ }
+
/**
* @todo document
*/
return new ResultWrapper( $this, $result );
}
}
+
+ /**
+ * Return aggregated value alias
+ */
+ function aggregateValue ($valuedata,$valuename='value') {
+ return $valuename;
+ }
+
+ /**
+ * @return string wikitext of a link to the server software's web site
+ */
+ function getSoftwareLink() {
+ return "[http://www.mysql.com/ MySQL]";
+ }
+
+ /**
+ * @return string Version information from the database
+ */
+ function getServerVersion() {
+ return mysql_get_server_info();
+ }
}
/**