public static function execute($json, $use = null)
{
// Finds a word that is at the beginning, in quotation marks or not
$match = null;
preg_match('~["]?([[:alnum:]]+)["]?[\\s\\n\\r\\t]{0,}?:~', $json, $match);
try {
// Checks the word if found, is among the allowed commands for execution
$command = $match[1];
if (!in_array($command, array('insert', 'update', 'delete', 'query'))) {
throw new \PDOException(self::$exception['not-implemented'] . ' PDO4You::' . $command . '()');
} else {
return self::executeQuery($json, $command, $use);
}
} catch (\PDOException $e) {
self::stackTrace($e, false);
}
}