Permalink
Browse files

Code Formatting

  • Loading branch information...
1 parent 0fe4c30 commit 655c981bd51b068423f019abff8b3ad7ff975a20 @gabordemooij committed Dec 3, 2012
View
@@ -13,21 +13,18 @@
*
*/
interface RedBean_Adapter {
-
/**
* Returns the latest SQL statement
*
* @return string $SQLString SQLString
*/
public function getSQL();
-
/**
* Escapes a value for usage in an SQL statement
*
* @param string $sqlvalue value
*/
public function escape( $sqlvalue );
-
/**
* Executes an SQL Statement using an array of values to bind
* If $noevent is TRUE then this function will not signal its
@@ -39,7 +36,6 @@ public function escape( $sqlvalue );
* @param boolean $noevent no event firing
*/
public function exec( $sql , $aValues=array(), $noevent=false);
-
/**
* Executes an SQL Query and returns a resultset.
* This method returns a multi dimensional resultset similar to getAll
@@ -50,7 +46,6 @@ public function exec( $sql , $aValues=array(), $noevent=false);
* @param array $aValues values
*/
public function get( $sql, $aValues = array() );
-
/**
* Executes an SQL Query and returns a resultset.
* This method returns a single row (one array) resultset.
@@ -63,7 +58,6 @@ public function get( $sql, $aValues = array() );
* @return array $aMultiDimArray row
*/
public function getRow( $sql, $aValues = array() );
-
/**
* Executes an SQL Query and returns a resultset.
* This method returns a single column (one array) resultset.
@@ -76,7 +70,6 @@ public function getRow( $sql, $aValues = array() );
* @return array $aSingleDimArray column
*/
public function getCol( $sql, $aValues = array() );
-
/**
* Executes an SQL Query and returns a resultset.
* This method returns a single cell, a scalar value as the resultset.
@@ -89,7 +82,6 @@ public function getCol( $sql, $aValues = array() );
* @return string $sSingleValue value from cell
*/
public function getCell( $sql, $aValues = array() );
-
/**
* Executes the SQL query specified in $sql and takes
* the first two columns of the resultset. This function transforms the
@@ -104,22 +96,19 @@ public function getCell( $sql, $aValues = array() );
* @return array $associativeArray associative array result set
*/
public function getAssoc( $sql, $values = array() );
-
/**
* Returns the latest insert ID.
*
* @return integer $id primary key ID
*/
public function getInsertID();
-
/**
* Returns the number of rows that have been
* affected by the last update statement.
*
* @return integer $count number of rows affected
*/
public function getAffectedRows();
-
/**
* Returns the original database resource. This is useful if you want to
* perform operations on the driver directly instead of working with the
@@ -129,31 +118,26 @@ public function getAffectedRows();
* @return object $driver driver
*/
public function getDatabase();
-
/**
* This method is part of the RedBean Transaction Management
* mechanisms.
* Starts a transaction.
*/
public function startTransaction();
-
/**
* This method is part of the RedBean Transaction Management
* mechanisms.
* Commits the transaction.
*/
public function commit();
-
/**
* This method is part of the RedBean Transaction Management
* mechanisms.
* Rolls back the transaction.
*/
public function rollback();
-
/**
* Closes database connection.
*/
public function close();
-
}
@@ -11,20 +11,16 @@
* with this source code in the file license.txt.
*/
class RedBean_Adapter_DBAdapter extends RedBean_Observable implements RedBean_Adapter {
-
/**
* ADODB compatible class
* @var RedBean_Driver
*/
private $db = null;
-
/**
* Contains SQL snippet
* @var string
*/
private $sql = '';
-
-
/**
* Constructor.
* Creates an instance of the RedBean Adapter Class.
@@ -36,7 +32,6 @@ class RedBean_Adapter_DBAdapter extends RedBean_Observable implements RedBean_Ad
public function __construct($database) {
$this->db = $database;
}
-
/**
* Returns the latest SQL Statement.
* This method returns the most recently executed SQL statement string.
@@ -47,7 +42,6 @@ public function __construct($database) {
public function getSQL() {
return $this->sql;
}
-
/**
* Escapes a string for use in a Query.
* This method escapes the value argument using the native
@@ -60,7 +54,6 @@ public function getSQL() {
public function escape( $sqlvalue ) {
return $this->db->Escape($sqlvalue);
}
-
/**
* Executes SQL code; any query without
* returning a resultset.
@@ -85,7 +78,6 @@ public function exec( $sql , $aValues=array(), $noevent=false) {
}
return $this->db->Execute( $sql, $aValues );
}
-
/**
* Multi array SQL fetch. Fetches a multi dimensional array.
* This function allows you to provide an array with values to bind
@@ -106,7 +98,6 @@ public function get( $sql, $aValues = array() ) {
$this->signal('sql_exec', $this);
return $this->db->GetAll( $sql,$aValues );
}
-
/**
* Executes SQL and fetches a single row.
* This function allows you to provide an array with values to bind
@@ -127,7 +118,6 @@ public function getRow( $sql, $aValues = array() ) {
$this->signal('sql_exec', $this);
return $this->db->GetRow( $sql,$aValues );
}
-
/**
* Executes SQL and returns a one dimensional array result set.
* This function rotates the result matrix to obtain a column result set.
@@ -149,8 +139,6 @@ public function getCol( $sql, $aValues = array() ) {
$this->signal('sql_exec', $this);
return $this->db->GetCol( $sql,$aValues );
}
-
-
/**
* Executes an SQL Query and fetches the first two columns only.
* Then this function builds an associative array using the first
@@ -192,8 +180,6 @@ public function getAssoc( $sql, $aValues = array() ) {
}
return $assoc;
}
-
-
/**
* Retrieves a single cell.
* This function allows you to provide an array with values to bind
@@ -209,14 +195,12 @@ public function getAssoc( $sql, $aValues = array() ) {
*
* @return array $result scalar result set
*/
-
public function getCell( $sql, $aValues = array(), $noSignal = null ) {
$this->sql = $sql;
if (!$noSignal) $this->signal('sql_exec', $this);
$arr = $this->db->getCol( $sql, $aValues );
if ($arr && is_array($arr)) return ($arr[0]); else return false;
}
-
/**
* Returns latest insert id, most recently inserted id.
* Following an insert-SQL statement this method will return the most recently
@@ -227,7 +211,6 @@ public function getCell( $sql, $aValues = array(), $noSignal = null ) {
public function getInsertID() {
return $this->db->getInsertID();
}
-
/**
* Returns number of affected rows.
* Returns the number of rows that have been affected by the most recent
@@ -238,7 +221,6 @@ public function getInsertID() {
public function getAffectedRows() {
return $this->db->Affected_Rows();
}
-
/**
* Unwrap the original database object.
* Returns the database driver instance. For instance this can be
@@ -249,7 +231,6 @@ public function getAffectedRows() {
public function getDatabase() {
return $this->db;
}
-
/**
* Transactions.
* Part of the transaction management infrastructure of RedBeanPHP.
@@ -260,7 +241,6 @@ public function getDatabase() {
public function startTransaction() {
return $this->db->StartTrans();
}
-
/**
* Transactions.
* Part of the transaction management infrastructure of RedBeanPHP.
@@ -271,7 +251,6 @@ public function startTransaction() {
public function commit() {
return $this->db->CommitTrans();
}
-
/**
* Transactions.
* Part of the transaction management infrastructure of RedBeanPHP.
@@ -283,11 +262,10 @@ public function commit() {
public function rollback() {
return $this->db->FailTrans();
}
-
/**
* Closes the database connection.
*/
public function close() {
$this->db->close();
}
-}
+}
Oops, something went wrong.

0 comments on commit 655c981

Please sign in to comment.