< Appendix: Query String Generation   (Previous) Table of Contents (Next)   Appendix: Unsetting Old Data >

Appendix: Query Execution

/**
 * Executes the query string provided.
 *
 * <p>Errors from attempts to create records with duplicate keys are ignored.
 * Minor errors generate an email.  Major errors shut down ST Parser.</p>
 *
 * @param   string    $Query  the query string to execute
 */
function runQuery($Query) {
    $Result =& $this->db->query($Query);

    if ( DB::isError($Result) ) {
        switch ( $Result->getMessage() ) {
            case 'DB Error: already exists':
                //  Generally means key duplicate.  No problem.
                break;

            case 'DB Error: syntax error':
            case 'DB Error: invalid':
            case 'DB Error: invalid date or time':
            case 'DB Error: invalid number':
                $this->Probs[] = $Result->getMessage() . "\n" . $this->db->last_query;
                break;

            default:
                $this->killProcess($Result->getMessage() . "\n" . $this->db->last_query);
        }
    }
}