In this chapter we discuss functions defined in the run-time environment that also users writing hooks could find useful.
When executing a hook, you can access some static functions of the
ERW class that can simplify your access to the
database. Note that all these functions stop the current script
and write to the log file in case of an error.
Logs a message if the current logging level is equal to or below the one specified in the main configuration file. Possible levels are ERW_DEBUG, ERW_INFO, ERW_WARNING and ERW_ERROR (the default). The first two parameters are usually filled using the PHP macros __FILE__ and __LINE__, respectively.
Quotes a string for SQL processing. Note that, when applied to an array of strings, it will quote by reference the whole array.
Undoes what EWR::quote() did (but works by value).
Executes the given query and returns the result. Database errors cause logging and immediate exit.
It is identical to ERW::query(), but it automatically prefixes its argument with "SELECT ", so you can write things like ERW::select("* from type");.
It is identical to ERW::select(), but it automatically returns the first row of the result set.
It is identical to ERW::getRow(), but it automatically returns the first column of the row. Very useful when you just want a single datum from the database.