- public function q($sql) {
-
- if((! $this->db) || (! $this->connected)) {
- throw new RuntimeException(t("There is no db connection. "));
- }
-
- if($this->mysqli) {
- $result = $this->db->query($sql);
- } else {
- $result = mysql_query($sql,$this->db);
- }
-
- //on debug mode or fail, the query is written to the log.
- //this won't work if logger can not read it's logging level
- //from the db.
- if($this->debug || FALSE === $result) {
-
- $mesg = '';
-
- if($result === false) {
- $mesg = 'false '.$this->error();
- } elseif($result === true) {
- $mesg = 'true';
- } else {
- if($this->mysqli) {
- $mesg = $result->num_rows . t(' results') . EOL;
- } else {
- $mesg = mysql_num_rows($result) . t(' results') . EOL;
- }
- }