Skip to content

Commit

Permalink
Removed some whitespace.
Browse files Browse the repository at this point in the history
  • Loading branch information
gabordemooij committed Dec 11, 2012
1 parent 655c981 commit fc64ee7
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 105 deletions.
2 changes: 1 addition & 1 deletion RedBean/Adapter/DBAdapter.php
Expand Up @@ -195,7 +195,7 @@ public function getAssoc( $sql, $aValues = array() ) {
*
* @return array $result scalar result set
*/
public function getCell( $sql, $aValues = array(), $noSignal = null ) {
public function getCell($sql, $aValues = array(), $noSignal = null) {
$this->sql = $sql;
if (!$noSignal) $this->signal('sql_exec', $this);
$arr = $this->db->getCol( $sql, $aValues );
Expand Down
2 changes: 1 addition & 1 deletion RedBean/BeanHelper/Facade.php
Expand Up @@ -40,4 +40,4 @@ public function getModelForBean(RedBean_OODBBean $bean) {
$obj->loadBean($bean);
return $obj;
}
}
}
1 change: 0 additions & 1 deletion RedBean/Observer.php
Expand Up @@ -12,7 +12,6 @@
* with this source code in the file license.txt.
*/
interface RedBean_Observer {

/**
* Part of the RedBean Observer Infrastructure.
* The on-event method is called by an observable once the
Expand Down
48 changes: 6 additions & 42 deletions RedBean/QueryWriter.php
Expand Up @@ -17,41 +17,28 @@
* - This is the interface for FLUID database drivers. Drivers intended to support
* just FROZEN mode should implement the IceWriter instead.
*
*
* copyright (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community.
* This source file is subject to the BSD/GPLv2 License that is bundled
* with this source code in the file license.txt.
*/
interface RedBean_QueryWriter {

/**
* QueryWriter Constant Identifier.
* Identifies a situation in which a table has not been found in
* the database.
* Query Writer constants.
* These constants are used to identify common SQL problems.
* These are used for FLUID-mode to determine whether we should throw
* an exception or not. In FLUID-mode some errors are allowed; for instance,
* if a column does not exist: C_SQLSTATE_NO_SUCH_COLUMN this is no reason
* to throw an error because in FLUID mode we build the schema on the fly..
*/
const C_SQLSTATE_NO_SUCH_TABLE = 1;

/**
* QueryWriter Constant Identifier.
* Identifies a situation in which a perticular column has not
* been found in the database.
*/
const C_SQLSTATE_NO_SUCH_COLUMN = 2;

/**
* QueryWriter Constant Identifier.
* Identifies a situation in which a perticular column has not
* been found in the database.
*/
const C_SQLSTATE_INTEGRITY_CONSTRAINT_VIOLATION = 3;

/**
* Returns the tables that are in the database.
*
* @return array $arrayOfTables list of tables
*/
public function getTables();

/**
* This method should create a table for the bean.
* This methods accepts a type and infers the corresponding table name.
Expand All @@ -61,7 +48,6 @@ public function getTables();
* @return void
*/
public function createTable($type);

/**
* Returns an array containing all the columns of the specified type.
* The format of the return array looks like this:
Expand All @@ -75,8 +61,6 @@ public function createTable($type);
* @return array $listOfColumns list of columns ($field=>$type)
*/
public function getColumns($type);


/**
* Returns the Column Type Code (integer) that corresponds
* to the given value type. This method is used to determine the minimum
Expand All @@ -87,7 +71,6 @@ public function getColumns($type);
* @return integer $type type
*/
public function scanType($value, $alsoScanSpecialForTypes=false);

/**
* This method should add a column to a table.
* This methods accepts a type and infers the corresponding table name.
Expand All @@ -100,7 +83,6 @@ public function scanType($value, $alsoScanSpecialForTypes=false);
*
*/
public function addColumn($type, $column, $field);

/**
* This method should return a data type constant based on the
* SQL type definition. This function is meant to compare column data
Expand All @@ -112,7 +94,6 @@ public function addColumn($type, $column, $field);
* @return integer $type
*/
public function code($typedescription);

/**
* This method should widen the column to the specified data type.
* This methods accepts a type and infers the corresponding table name.
Expand All @@ -124,7 +105,6 @@ public function code($typedescription);
* @return void
*/
public function widenColumn($type, $column, $datatype);

/**
* This method should update (or insert a record), it takes
* a table name, a list of update values ( $field => $value ) and an
Expand All @@ -140,8 +120,6 @@ public function widenColumn($type, $column, $datatype);
* @return integer $id the primary key ID value of the new record
*/
public function updateRecord($type, $updatevalues, $id=null);


/**
* This method should select a record. You should be able to provide a
* collection of conditions using the following format:
Expand All @@ -161,8 +139,6 @@ public function updateRecord($type, $updatevalues, $id=null);
* @return array $records selected records
*/
public function selectRecord($type, $conditions, $addSql = null, $delete = false, $inverse = false);


/**
* This method should add a UNIQUE constraint index to a table on columns $columns.
* This methods accepts a type and infers the corresponding table name.
Expand All @@ -173,8 +149,6 @@ public function selectRecord($type, $conditions, $addSql = null, $delete = false
* @return void
*/
public function addUniqueIndex($type,$columns);


/**
* This method should check whether the SQL state is in the list of specified states
* and returns true if it does appear in this list or false if it
Expand All @@ -188,7 +162,6 @@ public function addUniqueIndex($type,$columns);
* @return boolean $isInList
*/
public function sqlStateIn( $state, $list );

/**
* This method should remove all beans of a certain type.
* This methods accepts a type and infers the corresponding table name.
Expand All @@ -198,7 +171,6 @@ public function sqlStateIn( $state, $list );
* @return void
*/
public function wipe($type);

/**
* This method should count the number of beans of the given type.
* This methods accepts a type and infers the corresponding table name.
Expand All @@ -208,7 +180,6 @@ public function wipe($type);
* @return integer $numOfBeans number of beans found
*/
public function count($type);

/**
* This method should filter a column name so that it can
* be used safely in a query for a specific database.
Expand All @@ -219,7 +190,6 @@ public function count($type);
* @return string $clean the clean version of the column name
*/
public function safeColumn($name, $noQuotes = false);

/**
* This method should filter a type name so that it can
* be used safely in a query for a specific database. It actually
Expand All @@ -231,7 +201,6 @@ public function safeColumn($name, $noQuotes = false);
* @return string $tablename clean table name for use in query
*/
public function safeTable($name, $noQuotes = false);

/**
* This method should add a constraint. If one of the beans gets trashed
* the other, related bean should be removed as well.
Expand All @@ -242,7 +211,6 @@ public function safeTable($name, $noQuotes = false);
* @return void
*/
public function addConstraint( RedBean_OODBBean $bean1, RedBean_OODBBean $bean2 );

/**
* This method should add a foreign key from type and field to
* target type and target field.
Expand All @@ -261,8 +229,6 @@ public function addConstraint( RedBean_OODBBean $bean1, RedBean_OODBBean $bean2
* @return void
*/
public function addFK( $type, $targetType, $field, $targetField);


/**
* This method should add an index to a type and field with name
* $name.
Expand All @@ -275,13 +241,11 @@ public function addFK( $type, $targetType, $field, $targetField);
* @return void
*/
public function addIndex($type, $name, $column);

/**
* Returns a modified value from ScanType.
* Used for special types.
*
* @return mixed $value changed value
*/
public function getValue();

}
17 changes: 0 additions & 17 deletions RedBean/SQLHelper.php
Expand Up @@ -28,31 +28,26 @@
* with this source code in the file license.txt.
*/
class RedBean_SQLHelper {

/**
* Holds the database adapter for executing SQL queries.
* @var RedBean_Adapter
*/
protected $adapter;

/**
* Holds current mode
* @var boolean
*/
protected $capture = false;

/**
* Holds SQL until now
* @var string
*/
protected $sql = '';

/**
* Holds list of parameters for SQL Query
* @var array
*/
protected $params = array();

/**
* Constructor
*
Expand All @@ -61,7 +56,6 @@ class RedBean_SQLHelper {
public function __construct(RedBean_Adapter $adapter) {
$this->adapter = $adapter;
}

/**
* Magic method to construct SQL query
*
Expand All @@ -80,7 +74,6 @@ public function __call($funcName,$args=array()) {
return $this->adapter->getCell('SELECT '.$funcName.'('.implode(',',$args).')');
}
}

/**
* Begins SQL query
*
Expand All @@ -90,7 +83,6 @@ public function begin() {
$this->capture = true;
return $this;
}

/**
* Adds a value to the parameter list
*
Expand All @@ -102,7 +94,6 @@ public function put($param) {
$this->params[] = $param;
return $this;
}

/**
* Executes query and returns result
*
Expand All @@ -114,7 +105,6 @@ public function get($what='') {
$this->clear();
return $rs;
}

/**
* Clears the parameter list as well as the SQL query string.
*
Expand All @@ -126,7 +116,6 @@ public function clear() {
$this->capture = false; //turn off capture mode (issue #142)
return $this;
}

/**
* To explicitly add a piece of SQL.
*
Expand All @@ -140,8 +129,6 @@ public function addSQL($sql) {
return $this;
}
}


/**
* Returns query parts.
*
Expand All @@ -152,7 +139,6 @@ public function getQuery() {
$this->clear();
return $list;
}

/**
* Writes a '(' to the sql query.
*/
Expand All @@ -162,7 +148,6 @@ public function open() {
return $this;
}
}

/**
* Writes a ')' to the sql query.
*/
Expand All @@ -172,7 +157,6 @@ public function close() {
return $this;
}
}

/**
* Generates question mark slots for an array of values.
*
Expand All @@ -188,5 +172,4 @@ public function genSlots($array) {
return '';
}
}

}
14 changes: 0 additions & 14 deletions RedBean/Setup.php
Expand Up @@ -13,7 +13,6 @@
* with this source code in the file license.txt.
*/
class RedBean_Setup {

/**
* This method checks the DSN string. If the DSN string contains a
* database name that is not supported by RedBean yet then it will
Expand All @@ -39,23 +38,10 @@ private static function checkDSN($dsn) {
return true;
}
}


/**
* Generic Kickstart method.
* This is the generic kickstarter. It will prepare a database connection
* using the $dsn, the $username and the $password you provide.
* If $frozen is boolean TRUE it will start RedBean in frozen mode, meaning
* that the database cannot be altered. If RedBean is started in fluid mode
* it will adjust the schema of the database if it detects an
* incompatible bean.
* This method returns a RedBean_Toolbox $toolbox filled with a
* RedBean_Adapter, a RedBean_QueryWriter and most importantly a
* RedBean_OODB; the object database. To start storing beans in the database
* simply say: $redbean = $toolbox->getRedBean(); Now you have a reference
* to the RedBean object.
* Optionally instead of using $dsn you may use an existing PDO connection.
* Example: RedBean_Setup::kickstart($existingConnection, true);
*
* @param string|PDO $dsn Database Connection String (or PDO instance)
* @param string $username Username for database
Expand Down

0 comments on commit fc64ee7

Please sign in to comment.