Корпоративный сайт Главного федерального инспектора по УР

Дипломная работа - Компьютеры, программирование

Другие дипломы по предмету Компьютеры, программирование

rn ;}}function constructColumns() {if (sizeof ($this->dataArray[columns])>0) {return (.implode (,,$this->dataArray[columns]).);} else {return ;}}function constructValues() {if (sizeof ($this->dataArray[values])>0) {$ar=array(); foreach ($this->dataArray [merge_insert] as $key => $value) {$ar[]=$value;}; return VALUES (.implode(,,$ar).);} else {return ;}}function constructJoin() {

$ar = array();($i=0;$idataArray [joinArray] [$i] [method]) {using:

$ar[] = $this->dataArray [joinArray] [$i] [type]. .$this->dataArray [joinArray] [$i] [table]. USING (.implode (,,$this->dataArray [joinArray] [$i] [ar]).);;

}

}; return .implode(,$ar);

}

// - CHECKER DATA-function check() {

$ar = array();$ar_table = array();

$arTable = array_merge ($this->dataArray[table],$this->dataArray [EXT_table]);($i=0;$i<sizeof($arTable);$i++) {$ar_table[$i] = explode (,$arTable[$i]);$ar_table[$i] = $ar_table[$i] [0];}($i=0;$i<sizeof ($ar_table);$i++) {$ar[] = table_name = .$ar_table[$i]. ;}

$query = select column_name, column_default, data_type, is_nullable, table_name FROM information_schema.columns where table_schema = public and (.implode ( OR,$ar).);

$query = $_ENV[db]->send_query($query);($i=0;$i<sizeof ($ar_table);$i++) {

$flag = true;($j=0;$j;}

}(sizeof($query)>0) {

$this->checkErrorHandler ($this->dataArray [where]);$this->checkErrorHandler ($this->dataArray [set]);

$this->restore_value (where,$query);$this->restore_value (set,$query);

$this->isset_select_columns($query);$this->isset_insert_value($query);

} else {

$this->ERROR=true;$this->ERROR_STR.= [check]:колонки в таблице .implode(,,$arTable). не найдены;

}

}function isset_insert_value ($meta_info) {($i=0;$idataArray[values] [$i]!=) {

$this->dataArray [merge_insert] [$this->dataArray[columns] [$i]] = $this->dataArray[values] [$i];

}

};

$this->checkErrorHandler ($this->dataArray [merge_insert]);

$this->restore_value (merge_insert,$meta_info);

}function isset_select_columns ($meta_info) {($i=0;$idataArray[select]);$i++) {

$column_name = explode (.,$this->dataArray[select] [$i]);(sizeof ($column_name)>1) {$column_name = $column_name[1];} else {$column_name = $column_name[0];}($j=0;$j<sizeof ($meta_info);$j++) {

$flag = false;($column_name==$meta_info[$j] [column_name]) {$flag=true; break;} elseif ($column_name== *) {$flag=true; break;}

}(!$flag) {$this->ERROR=true;$this->ERROR_STR.= [isset_select_columns]:колонка .$this->dataArray[select] [$i]. не найдена.;}

}

}function checkErrorHandler($array) {(sizeof ($this->dataArray[errorHandler])>0) {($array as $key => $value) {($i=0;$i;} break;

}

}

}

}

}function restore_value ($key_data,$meta_info) {($this->dataArray [$key_data] as $key => $value) {

$flag = false;$column_name = explode(.,$key);(sizeof ($column_name)>1) {$column_name = $column_name[1];} else {$column_name = $column_name[0];}($i=0;$i<sizeof ($meta_info);$i++) {($column_name==$meta_info[$i] [column_name]) {

$flag = true;($this->is_type (int,$meta_info[$i] [data_type])) {($value==) {($meta_info[$i] [column_default]==) {($meta_info[$i] [is_nullable]== NO) {$this->ERROR.=true;$this->ERROR_STR= [restoreValue]:колонка .$key. должна иметь значение типа.$meta_info[$i] [data_type]. не нулевое. ;

} else {$this->dataArray [$key_data] [$key] = null;}

} else {$this->dataArray [$key_data] [$key] = $meta_info[$i] [column_default];}

} else {(is_numeric($value)) {$this->dataArray [$key_data] [$key] = $value;}{$this->ERROR=true;$this->ERROR_STR.= [restoreValue]:значение колонки .$key. не может быть равно .$value. так как тип данных.$meta_info[$i] [data_type].. ;}

}

} elseif ($this->is_type (char,$meta_info[$i] [data_type]) || $this->is_type (text,$meta_info[$i] [data_type])) {($value==) {($meta_info[$i] [column_default]==) {($meta_info[$i] [is_nullable]== NO) {$this->ERROR.=true;$this->ERROR_STR= [restoreValue]:колонка .$key. должна иметь значение типа.$meta_info[$i] [data_type]. не нулевое. ;

} else {$this->dataArray [$key_data] [$key] = null;}

} else {$this->dataArray [$key_data] [$key] = $meta_info[$i] [column_default];}

} else {(is_string($value)) {$this->dataArray [$key_data] [$key] = .$this->string_encode($value). ;}{$this->ERROR=true;$this->ERROR_STR.= [restoreValue]:значение колонки .$key. не может быть равно .$value. так как тип данных.$meta_info[$i] [data_type].. ;}

}

} elseif ($this->is_type (date,$meta_info[$i] [data_type]) || $this->is_type (times,$meta_info[$i] [data_type])) {($value==) {($meta_info[$i] [column_default]==) {($meta_info[$i] [is_nullable]== NO) {$this->ERROR.=true;$this->ERROR_STR= [restoreValue]:колонка .$key. должна иметь значение типа.$meta_info[$i] [data_type]. не нулевое. ;

} else {$this->dataArray [$key_data] [$key] = null;}

} else {$this->dataArray [$key_data] [$key] = $meta_info[$i] [column_default];}

} else {(@date (Y-m-d, strtotime($value))==$value) {

$this->dataArray [$key_data] [$key] = .$this->string_encode($value). ;

} else {

$this->ERROR=true;$this->ERROR_STR.= [restoreValue]:значение колонки .$key. не может быть равно .$value. так как тип данных.$meta_info[$i] [data_type]. (Y-m-d). ;

}

}

}

}

}; if(!$flag) {$this->ERROR=true;$this->ERROR_STR.= [restoreValue]:колонка .$key. не найдена.;}

}

}function is_type ($type,$str) {if (sizeof (explode ($type,$str))>1) {return true;} else {return false;}}function string_encode($str) {$str = htmlspecialchars ($str, ENT_QUOTES); return $str;}

// - RETURN ANSWER-function getQuery() {

$this->check();

$this->checker = true;

$answer = ;($this->direction) {SELECT:

$answer = $this->direction.$this->constructDistinct().implode (,,$this->dataArray [select]). FROM.implode (,,$this->dataArray [table]).$this->constructJoin().$this->constructWhere().$this->constructAscOrderBy().$this->constructDescOrderBy();;UPDATE:

direction.implode(,,$this->dataArray[table]).$this->constructSet().$this->constructWhere().$this->constructAscOrderBy().$this->constructDescOrderBy();;INSERTINTO:">$answer = $this->direction.implode (,,$this->dataArray [table]).$this->constructSet().$this->constructWhere().$this->constructAscOrderBy().$this->constructDescOrderBy();;INSERT INTO:

direction.implode(,,$this->dataArray[%