Пример #1
0
 public function createDB()
 {
     if (!$this->db->tableExists('migration')) {
         $sql = "\r\n\t\t\tCREATE TABLE `migration`\r\n\t\t\t(\r\n\t\t\t\t`id` INT PRIMARY KEY NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t`name` VARCHAR(255) NOT NULL,\r\n\t\t\t\t`date` DATETIME NOT NULL,\r\n\t\t\t\t`isUp` INT NOT NULL\r\n\t\t\t);\r\n\t\t";
         $this->db->query($sql);
     }
 }
Пример #2
0
 /**
  * @param bmMySQLLink $db
  * @param $queryString
  * @param null $key
  * @param null $value
  *
  * @return array
  */
 public static function queryToArray($db, $queryString, $key = null, $value = null)
 {
     $dbResult = $db->select($queryString);
     $arr = array();
     while ($res = $dbResult->nextHash()) {
         if ($value === null) {
             if ($key === null) {
                 $arr[] = $res;
             } else {
                 $arr[$res[$key]] = $res;
             }
         } else {
             if ($key === null) {
                 $arr[] = $res[$value];
             } else {
                 $arr[$res[$key]] = $res[$value];
             }
         }
     }
     return $arr;
 }
 public function getObjectIdBySynonym($objectName, $synonym)
 {
     $sql = "SELECT `" . $objectName . "Id` AS `identifier` FROM `" . $objectName . "_synonym` WHERE `synonym` = '" . $this->dataLink->formatInput($synonym, BM_VT_STRING) . "';";
     $result = $this->dataLink->getValue($sql);
     return $result != null ? $result : 0;
 }
Пример #4
0
 public function execute($sql)
 {
     $this->db->query($sql);
     $this->log->add($sql);
 }