Exemplo n.º 1
0
 /**
  * Executes the SQL with vars
  * @param string $sql
  * @param mixed $vars
  * @example
  * rad_update::execSQL('INSERT INTO @RAD@settings(fldName, fldValue, position, description, rtype, defValue)VALUES("test", "test",100,"description","modules","@value@")', array('value'=>'defValue'));
  * @return rad_update
  */
 public function execSQL($sql, $vars = null)
 {
     if (!empty($vars) and is_array($vars)) {
         foreach ($vars as $key => $value) {
             if (is_scalar($value)) {
                 $sql = str_replace('@' . $key . '@', $value, $sql);
             }
         }
     }
     echo $sql . "\r\n";
     rad_dbpdo::exec($sql);
     if ((int) rad_dbpdo::errorCode()) {
         echo "\r\n" . (int) rad_dbpdo::errorCode();
         print_r(rad_dbpdo::errorInfo());
         echo "\r\n";
     }
     return $this;
 }