public function insertRecord($tablename, $parameters, $ignore = false)
    {
        if (empty($parameters))
            throw new DatabaseException('insertRecord: no parameters.');

        $insert_fields = array();
        $insert_values = array();

        foreach ($parameters as $name => $value) {
            $insert_fields[] = $name;
            $insert_values[] = $this->quote($value);
        }

        $sql = "INSERT ".( $ignore ? "IGNORE " : "") . "INTO  ".
                 $tablename . " (" . implode(",", $insert_fields) .
                ") VALUES (".
                implode(",", $insert_values) . ")";

        return $this->write($sql);
    }