/** * Returns an instance of Netsuite_Db_Db * @static * @access public * @return Netsuite_Db_Db Provides a fluent interface */ public static function getInstance() { if (null === self::$_instance) { self::$_instance = new self(); } return self::$_instance; }
/** * Logs System Exceptions to DataBase * * @param object $exception * @access public * @return void */ public static function logError($exception) { try { $connection = Netsuite_Db_Db::getInstance(); $sth = $connection->prepare(Netsuite_Db_Query::getQuery('LOG_ERROR')); if (!$sth) { throw new Exception(explode(',', $sth->errorInfo())); } $sth->execute(array(':message' => $exception->getMessage(), ':file' => $exception->getFile(), ':line' => $exception->getLine(), ':trace' => $exception->getTraceAsString())); } catch (Exception $e) { var_dump($e); } }