Permalink
Browse files

#542: Fix return values of queries that don't have any logical results.

  • Loading branch information...
1 parent d0ec080 commit de83012c3db0768fd22cb4bf7731672c0369b2f8 @franzliedke franzliedke committed Feb 13, 2012
Showing with 36 additions and 38 deletions.
  1. +17 −19 src/Database/Adapter.php
  2. +4 −4 src/Database/Adapter/MySQL.php
  3. +6 −6 src/Database/Adapter/PgSQL.php
  4. +9 −9 src/Database/Adapter/SQLite.php
View
@@ -612,7 +612,7 @@ public function runReplace(query\Replace $query, array $params = array())
* Compile and run a TRUNCATE query.
*
* @param query\Truncate $query
- * @return string
+ * @return void
* @throws \Exception
* @throws \PDOException
*/
@@ -623,14 +623,14 @@ public function runTruncate(query\Truncate $query)
throw new \Exception('A TRUNCATE query must have a table specified.');
$sql = 'TRUNCATE TABLE '.$table;
- return $this->exec($sql);
+ $this->exec($sql);
}
/**
* Compile and run a CREATE TABLE query.
*
* @param query\CreateTable $query
- * @return string
+ * @return void
* @throws \Exception
* @throws \PDOException
*/
@@ -656,7 +656,7 @@ public function runCreateTable(query\CreateTable $query)
$sql .= ')';
- $result = $this->exec($sql);
+ $this->exec($sql);
if (!empty($query->indices))
{
@@ -670,15 +670,13 @@ public function runCreateTable(query\CreateTable $query)
$q->run();
}
}
-
- return $result;
}
/**
* Compile and run a RENAME TABLE query.
*
* @param query\RenameTable $query
- * @return string
+ * @return void
* @throws \Exception
* @throws \PDOException
*/
@@ -693,14 +691,14 @@ public function runRenameTable(query\RenameTable $query)
throw new \Exception('A RENAME TABLE query must have a new table name specified.');
$sql = 'ALTER TABLE '.$table.' RENAME TO '.$new_name;
- return $this->exec($sql);
+ $this->exec($sql);
}
/**
* Compile and run a DROP TABLE query.
*
* @param query\DropTable $query
- * @return string
+ * @return void
* @throws \Exception
* @throws \PDOException
*/
@@ -711,7 +709,7 @@ public function runDropTable(query\DropTable $query)
throw new \Exception('A DROP TABLE query must have a table specified.');
$sql = 'DROP TABLE '.$table;
- return $this->exec($sql);
+ $this->exec($sql);
}
/**
@@ -736,7 +734,7 @@ public function runTableExists(query\TableExists $query)
* Compile and run an ADD FIELD query.
*
* @param query\AddField $query
- * @return string
+ * @return void
* @throws \Exception
* @throws \PDOException
*/
@@ -752,14 +750,14 @@ public function runAddField(query\AddField $query)
$field = $this->compileColumnDefinition($query->field);
$sql = 'ALTER TABLE '.$table.' ADD COLUMN '.$field;
- return $this->exec($sql);
+ $this->exec($sql);
}
/**
* Compile and run an ALTER FIELD query.
*
* @param query\AlterField $query
- * @return string
+ * @return void
* @throws \Exception
* @throws \PDOException
*/
@@ -775,14 +773,14 @@ public function runAlterField(query\AlterField $query)
$field = $this->compileColumnDefinition($query->field);
$sql = 'ALTER TABLE '.$table.' MODIFY '.$query->field->name.' '.$field;
- return $this->exec($sql);
+ $this->exec($sql);
}
/**
* Compile and run a DROP FIELD query.
*
* @param query\DropField $query
- * @return string
+ * @return void
* @throws \Exception
* @throws \PDOException
*/
@@ -796,7 +794,7 @@ public function runDropField(query\DropField $query)
throw new \Exception('A DROP FIELD query must have a field specified.');
$sql = 'ALTER TABLE '.$table.' DROP '.$query->field;
- return $this->exec($sql);
+ $this->exec($sql);
}
/**
@@ -841,14 +839,14 @@ public function runAddIndex(query\AddIndex $query)
throw new \Exception('An ADD INDEX query must have at least one field specified.');
$sql = 'ALTER TABLE '.$table.' ADD '.($query->unique ? 'UNIQUE ' : '').'INDEX '.$table.'_'.$query->index.' ('.implode(',', array_keys($query->fields)).')';
- return $this->exec($sql);
+ $this->exec($sql);
}
/**
* Compile and run a DROP INDEX query.
*
* @param query\DropIndex $query
- * @return string
+ * @return void
* @throws \Exception
* @throws \PDOException
*/
@@ -862,7 +860,7 @@ public function runDropIndex(query\DropIndex $query)
throw new \Exception('A DROP INDEX query must have an index specified.');
$sql = 'ALTER TABLE '.$table.' DROP INDEX '.$table.'_'.$query->index;
- return $this->exec($sql);
+ $this->exec($sql);
}
/**
@@ -82,7 +82,7 @@ public function generateDsn()
* Compile and run a CREATE TABLE query.
*
* @param query\CreateTable $query
- * @return string
+ * @return void
* @throws \Exception
* @throws \PDOException
*/
@@ -124,14 +124,14 @@ public function runCreateTable(\fluxbb\database\query\CreateTable $query)
if (!empty($this->charset))
$sql .= ' CHARSET = '.$this->quote($this->charset);
- return $this->exec($sql);
+ $this->exec($sql);
}
/**
* Compile and run an ADD INDEX query.
*
* @param query\AddIndex $query
- * @return string
+ * @return void
* @throws \Exception
* @throws \PDOException
*/
@@ -148,7 +148,7 @@ public function runAddIndex(\fluxbb\database\query\AddIndex $query)
throw new \Exception('An ADD INDEX query must have at least one field specified.');
$sql = 'ALTER TABLE '.$table.' ADD '.($query->unique ? 'UNIQUE ' : '').'INDEX '.$table.'_'.$query->index.' ('.implode(',', $query->fields).')';
- return $this->exec($sql);
+ $this->exec($sql);
}
/**
@@ -113,7 +113,7 @@ public function runReplace(\fluxbb\database\query\Replace $query, array $params
* Compile and run a TRUNCATE query.
*
* @param query\Truncate $query
- * @return string
+ * @return void
* @throws \Exception
* @throws \PDOException
*/
@@ -149,7 +149,7 @@ public function runTableExists(\fluxbb\database\query\TableExists $query)
* Compile and run an ALTER FIELD query.
*
* @param query\AlterField $query
- * @return string
+ * @return void
* @throws \Exception
* @throws \PDOException
*/
@@ -178,7 +178,7 @@ public function runAlterField(\fluxbb\database\query\AlterField $query)
$q->usePrefix = false;
$q->run();
- return $this->exec('ALTER TABLE '.$table.' RENAME COLUMN '.$query->field->name.'_t'.$now.' TO '.$query->field->name);
+ $this->exec('ALTER TABLE '.$table.' RENAME COLUMN '.$query->field->name.'_t'.$now.' TO '.$query->field->name);
}
/**
@@ -206,7 +206,7 @@ public function runFieldExists(\fluxbb\database\query\FieldExists $query)
* Compile and run an ADD INDEX query.
*
* @param query\AddIndex $query
- * @return string
+ * @return void
* @throws \Exception
* @throws \PDOException
*/
@@ -223,14 +223,14 @@ public function runAddIndex(\fluxbb\database\query\AddIndex $query)
throw new \Exception('An ADD INDEX query must have at least one field specified.');
$sql = 'CREATE '.($query->unique ? 'UNIQUE ' : '').'INDEX '.$table.'_'.$query->index.' ON '.$table.' ('.implode(',', $query->fields).')';
- return $this->exec($sql);
+ $this->exec($sql);
}
/**
* Compile and run a DROP INDEX query.
*
* @param query\DropIndex $query
- * @return string
+ * @return void
* @throws \Exception
* @throws \PDOException
*/
@@ -58,7 +58,7 @@ public function setCharset($charset)
* Compile and run a TRUNCATE query.
*
* @param query\Truncate $query
- * @return string
+ * @return void
* @throws \Exception
* @throws \PDOException
*/
@@ -72,14 +72,14 @@ public function runTruncate(\fluxbb\database\query\Truncate $query)
$sql = 'DELETE FROM sqlite_sequence WHERE name = '.$this->quote($table).';';
$sql .= 'DELETE FROM '.$table;
- return $this->exec($sql);
+ $this->exec($sql);
}
/**
* Compile and run a CREATE TABLE query.
*
* @param query\CreateTable $query
- * @return string
+ * @return void
* @throws \Exception
* @throws \PDOException
*/
@@ -164,7 +164,7 @@ public function runAlterField(\fluxbb\database\query\AlterField $query)
* Compile and run a DROP FIELD query.
*
* @param query\DropField $query
- * @return string
+ * @return void
* @throws \Exception
* @throws \PDOException
*/
@@ -230,7 +230,7 @@ public function runDropField(\fluxbb\database\query\DropField $query)
// Copy content back
$this->exec('INSERT INTO '.$query->getTable().' SELECT '.implode(', ', $new_columns).' FROM '.$query->getTable().'_t'.$now);
- return $this->exec('DROP TABLE '.$query->getTable().'_t'.$now);
+ $this->exec('DROP TABLE '.$query->getTable().'_t'.$now);
}
/**
@@ -265,7 +265,7 @@ public function runFieldExists(\fluxbb\database\query\FieldExists $query)
* Compile and run an ADD INDEX query.
*
* @param query\AddIndex $query
- * @return string
+ * @return void
* @throws \Exception
* @throws \PDOException
*/
@@ -282,14 +282,14 @@ public function runAddIndex(\fluxbb\database\query\AddIndex $query)
throw new \Exception('An ADD INDEX query must have at least one field specified.');
$sql = 'CREATE '.($query->unique ? 'UNIQUE ' : '').'INDEX '.$table.'_'.$query->index.' ON '.$table.'('.implode(',', $query->fields).')';
- return $this->exec($sql);
+ $this->exec($sql);
}
/**
* Compile and run a DROP INDEX query.
*
* @param query\DropIndex $query
- * @return string
+ * @return void
* @throws \Exception
* @throws \PDOException
*/
@@ -303,7 +303,7 @@ public function runDropIndex(\fluxbb\database\query\DropIndex $query)
throw new \Exception('A DROP INDEX query must have an index specified.');
$sql = 'DROP INDEX '.$table.'_'.$query->index;
- return $this->exec($sql);
+ $this->exec($sql);
}
/**

0 comments on commit de83012

Please sign in to comment.