public function testLoggerPrint() { $logger = new SimpleLogger(); $this->connection->setLogger($logger); $this->assertFalse($logger->isPrint()); $logger->setPrint(true); $this->assertTrue($logger->isPrint()); $this->expectOutputString("show tables\n"); $this->connection->executeQuery("show tables"); $logger->setPrint(false); $this->assertFalse($logger->isPrint()); }
/** * make an SQL update * @param array $values associative matrix of new values, the key must be the field name. * For example: array("id"=>"5", "value"="'test3'"). <br> * <b>CAUTION</b>: you have to insert \' delimiters for varchar or text field, but not for numerical fields<br> * Obviously you can use different tables (via chain form: e.g. tableName.id) * @param string $where the where condition to update values, obviously you can use different tables * (via chain form: e.g. tableName.id) * @param string $from you can use this field to specify the from value, if you leave this empty, * default value is used. Obviously you can use complex constructs like JOIN * @param bool|null $quotes you can use this field to specify if insert \` at limits of $from or not. * If you leave this empty,default value is used * @return int the updated rows number * @throws MysqltcsException thrown on mysql error, for example invalid data or permission denied */ public function update(array $values, $where, $from = "", $quotes = null) { $from = $this->fromCheck($from, $quotes); $set = self::updateSet($values); //if an error is occurred mysqltcs throw an exception $this->mysqltcs->executeQuery("UPDATE {$from} SET {$set} WHERE {$where};"); return $this->mysqltcs->getAffectedRows(); }