Skip to content

Instantly share code, notes, and snippets.

@oojacoboo
Created September 26, 2012 04:32
Show Gist options
  • Save oojacoboo/3786045 to your computer and use it in GitHub Desktop.
Save oojacoboo/3786045 to your computer and use it in GitHub Desktop.
public function truncateTables($connection = null) {
if(!$connection)
$connection = $this->con;
$tables = $this->getTables();
foreach($tables as $table) {
//truncate data from this table
$sql = "DELETE FROM [" . $table . "]";
//use the instantiated db connection to process the query
$stmt = $connection->prepare($sql);
$result = $stmt->execute();
\Debug::toLog($result);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment