Правка определения типа в подстановке SQL строки

This commit is contained in:
2020-10-22 10:53:23 +06:00
parent ffffd7f926
commit 4056b369b9
2 changed files with 18 additions and 11 deletions

View File

@ -1,4 +1,4 @@
//Шаблон класса для авторизации пользователя (под проекты переделывается)
class DBMSUser class DBMSUser
{ {
constructor(){ constructor(){

View File

@ -67,14 +67,20 @@
if($v=='1') $v='true'; else if($v=='1') $v='true'; else
if($v=='0') $v='false'; if($v=='0') $v='false';
}else }else
if($t=='string' || $t=='text' || $t=='dateTime' || $t=='time' || $t=='date' || $t=='file'){ if($t=='string' || $t=='text' || $t=='dateTime' || $t=='time' || $t=='date' || $t=='file') {
if($v==''){ if ($v == '') {
$v='NULL'; $v = 'NULL';
}else{ } else {
if(strpos($db_connection, 'pgsql')!==false) if (strpos($db_connection, 'pgsql') !== false)
$v=str_replace("'","''",$v); //так как в SQL строку вставляется $v = str_replace("'", "''", $v); //так как в SQL строку вставляется
else else
$v=str_replace('\'','\\\'',$v); //так как в SQL строку вставляется $v = str_replace('\'', '\\\'', $v); //так как в SQL строку вставляется
$v = '\'' . $v . '\'';
}
}if($t=="NULL" || $t==null){
if ($v == '') {
$v = 'NULL';
} else {
$v='\''.$v.'\''; $v='\''.$v.'\'';
} }
}else{ }else{
@ -619,6 +625,7 @@
$nextnode = $nextnode->nextSibling; $nextnode = $nextnode->nextSibling;
} }
} }
$vType=gettype($_SESSION['USER_ID']);
$sql_query=str_replace('${_user_id}',getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID']),$sql_query); $sql_query=str_replace('${_user_id}',getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID']),$sql_query);
if($objListR!=null && $objListR->getAttribute('order')!='' && $objListR->getAttribute('order')!=null && $objListR->getAttribute('order')!='null') if($objListR!=null && $objListR->getAttribute('order')!='' && $objListR->getAttribute('order')!=null && $objListR->getAttribute('order')!='null')
{ {