trimmed comment bloat. returning boolean on eloquent save.

This commit is contained in:
Taylor Otwell
2011-06-10 12:43:09 -05:00
parent b66be283d4
commit f7bb0c5510
43 changed files with 178 additions and 730 deletions

View File

@@ -10,30 +10,18 @@ class Compiler {
*/
public static function select($query)
{
// ---------------------------------------------------
// Add the SELECT, FROM, and WHERE clauses.
// ---------------------------------------------------
$sql = $query->select.' '.$query->from.' '.$query->where;
// ---------------------------------------------------
// Add the ORDER BY clause.
// ---------------------------------------------------
if (count($query->orderings) > 0)
{
$sql .= ' ORDER BY '.implode(', ', $query->orderings);
}
// ---------------------------------------------------
// Add the LIMIT.
// ---------------------------------------------------
if ( ! is_null($query->limit))
{
$sql .= ' LIMIT '.$query->limit;
}
// ---------------------------------------------------
// Add the OFFSET.
// ---------------------------------------------------
if ( ! is_null($query->offset))
{
$sql .= ' OFFSET '.$query->offset;
@@ -51,9 +39,6 @@ class Compiler {
*/
public static function insert($query, $values)
{
// ---------------------------------------------------
// Start the query. Add the table name.
// ---------------------------------------------------
$sql = 'INSERT INTO '.$query->table.' (';
// ---------------------------------------------------
@@ -66,9 +51,6 @@ class Compiler {
$columns[] = $query->wrap($column);
}
// ---------------------------------------------------
// Concatenate the column names and values.
// ---------------------------------------------------
return $sql .= implode(', ', $columns).') VALUES ('.$query->parameterize($values).')';
}
@@ -81,13 +63,10 @@ class Compiler {
*/
public static function update($query, $values)
{
// ---------------------------------------------------
// Start the query. Add the table name.
// ---------------------------------------------------
$sql = 'UPDATE '.$query->table.' SET ';
// ---------------------------------------------------
// Wrap each column name in keyword identifiers.
// Add each column set the query.
// ---------------------------------------------------
$columns = array();
@@ -96,9 +75,6 @@ class Compiler {
$columns[] = $query->wrap($column).' = ?';
}
// ---------------------------------------------------
// Concatenate the column names and the WHERE clause.
// ---------------------------------------------------
return $sql .= implode(', ', $columns).' '.$query->where;
}