Created
December 22, 2011 11:13
-
-
Save alOneh/1509940 to your computer and use it in GitHub Desktop.
Script that use OnlineSchemaChange of Facebook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// do online schema change | |
$alter = "ALTER TABLE ".$tableName." ADD ".$description ."; | |
try { | |
$osc = new OnlineSchemaChange($sock, $user, $pwd, $db, null, $alter); | |
// Return true on success or false on failure | |
return $osc->execute(); | |
} catch (Exception $e) { | |
// exception raises only if cleanup fails | |
// In that case calls OSC again with FORCE_CLEANUP. | |
if (!empty($osc)) { | |
$osc->forceCleanup(); | |
} else { | |
echo "Caught OSC constructor exception: ".$e->getMessage(). "\n"; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment