started to adjust system to pg environment
This commit is contained in:
parent
bdd5043fa3
commit
1bc891b7c8
@ -2,7 +2,7 @@
|
||||
namespace SYSTEM\SQL;
|
||||
class SYS_API_TREE extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function pqsql(){return
|
||||
public static function pgsql(){return
|
||||
'SELECT * FROM '.\SYSTEM\SQL\system_api::NAME_PG
|
||||
.' WHERE "'.\SYSTEM\SQL\system_api::FIELD_GROUP.'" = $1'
|
||||
.' ORDER BY "'.\SYSTEM\SQL\system_api::FIELD_ID.'"';
|
||||
|
||||
@ -57,5 +57,11 @@ class ConnectionPG extends ConnectionAbstr {
|
||||
|
||||
return new ResultPostgres($result,$this);
|
||||
}
|
||||
|
||||
public function trans(){
|
||||
return $this->connection->trans();}
|
||||
|
||||
public function commit(){
|
||||
return $this->connection->commit();}
|
||||
|
||||
}
|
||||
@ -8,7 +8,7 @@ abstract class Result {
|
||||
|
||||
public abstract function affectedRows();
|
||||
|
||||
public abstract function next($object = false, $result_type = MYSQL_BOTH);
|
||||
public abstract function next($object = false);
|
||||
|
||||
public abstract function seek($row_number);
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ class ResultPostgres extends \SYSTEM\DB\Result{
|
||||
public function affectedRows(){
|
||||
return pg_affected_rows($this->res);}
|
||||
|
||||
public function next($object = false, $result_type = MYSQL_BOTH){
|
||||
public function next($object = false){
|
||||
if($object){
|
||||
$this->current = pg_fetch_object($this->res);
|
||||
} else {
|
||||
|
||||
@ -9,7 +9,6 @@ class error_handler_dbwriter extends \SYSTEM\LOG\error_handler {
|
||||
try{
|
||||
if(\property_exists(get_class($E), 'logged') && $E->logged){
|
||||
return false;} //alrdy logged(this prevents proper thrown value for every system exception)
|
||||
|
||||
\SYSTEM\SQL\SYS_LOG_INSERT::Q1( /*array( get_class($E), $E->getMessage(), $E->getCode(), $E->getFile(), $E->getLine(), $E->getTraceAsString(),
|
||||
getenv('REMOTE_ADDR'),round(microtime(true) - \SYSTEM\time::getStartTime(),5),
|
||||
$_SERVER["SERVER_NAME"],$_SERVER["SERVER_PORT"],$_SERVER['REQUEST_URI'], serialize($_POST),
|
||||
@ -17,11 +16,11 @@ class error_handler_dbwriter extends \SYSTEM\LOG\error_handler {
|
||||
array_key_exists('HTTP_USER_AGENT',$_SERVER) ? $_SERVER['HTTP_USER_AGENT'] : null,
|
||||
($user = \SYSTEM\SECURITY\Security::getUser()) ? $user->id : null, $thrown ? 1 : 0),*/
|
||||
array( get_class($E), $E->getMessage(), $E->getCode(), $E->getFile(), $E->getLine(), $E->getTraceAsString(),
|
||||
getenv('REMOTE_ADDR'),round(microtime(true) - \SYSTEM\time::getStartTime(),5),date('Y-m-d H:i:s', microtime(true)),
|
||||
getenv('REMOTE_ADDR'),round(microtime(true) - \SYSTEM\time::getStartTime(),5),
|
||||
$_SERVER["SERVER_NAME"],$_SERVER["SERVER_PORT"],$_SERVER['REQUEST_URI'], serialize($_POST),
|
||||
array_key_exists('HTTP_REFERER', $_SERVER) ? $_SERVER['HTTP_REFERER'] : null,
|
||||
array_key_exists('HTTP_USER_AGENT',$_SERVER) ? $_SERVER['HTTP_USER_AGENT'] : null,
|
||||
($user = \SYSTEM\SECURITY\Security::getUser()) ? $user->id : null,$thrown));
|
||||
($user = \SYSTEM\SECURITY\Security::getUser()) ? $user->id : null,$thrown ? 1 : 0));
|
||||
if(\property_exists(get_class($E), 'logged')){
|
||||
$E->logged = true;} //we just did log
|
||||
} catch (\Exception $E){return false;} //Error -> Ignore
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
namespace SYSTEM\SQL;
|
||||
class SYS_LOG_INSERT extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function pqsql(){return
|
||||
public static function pgsql(){return
|
||||
'INSERT INTO '.\SYSTEM\SQL\system_log::NAME_PG.
|
||||
'("'.\SYSTEM\SQL\system_log::FIELD_CLASS.'","'.\SYSTEM\SQL\system_log::FIELD_MESSAGE.'","'.
|
||||
\SYSTEM\SQL\system_log::FIELD_CODE.'","'.\SYSTEM\SQL\system_log::FIELD_FILE.'","'.
|
||||
@ -25,6 +25,6 @@ class SYS_LOG_INSERT extends \SYSTEM\DB\QP {
|
||||
\SYSTEM\SQL\system_log::FIELD_POST.','.\SYSTEM\SQL\system_log::FIELD_HTTP_REFERER.','.
|
||||
\SYSTEM\SQL\system_log::FIELD_HTTP_USER_AGENT.','.\SYSTEM\SQL\system_log::FIELD_USER.','.
|
||||
\SYSTEM\SQL\system_log::FIELD_THROWN.')'.
|
||||
'VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);';
|
||||
'VALUES(?, ?, ?, ?, ?, ?, ?, ?, NOW(), ?, ?, ?, ?, ?, ?, ?, ?);';
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,11 @@
|
||||
namespace SYSTEM\SQL;
|
||||
class SYS_TEXT_GET_TAG extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function pgsql(){return
|
||||
'SELECT system.text.id,text FROM system.text
|
||||
LEFT JOIN system.text_tag ON system.text.id = system.text_tag.id
|
||||
WHERE tag = $1 and lang = $2;';
|
||||
}
|
||||
public static function mysql(){return
|
||||
'SELECT system_text.id,text FROM system_text
|
||||
LEFT JOIN system_text_tag ON system_text.id = system_text_tag.id
|
||||
|
||||
@ -2,6 +2,20 @@
|
||||
namespace SYSTEM\SQL;
|
||||
class SYS_SAIMOD_TODO_EXCEPTION_INSERT extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function pgsql(){return
|
||||
'INSERT INTO '.\SYSTEM\SQL\system_todo::NAME_PG.
|
||||
'('.\SYSTEM\SQL\system_todo::FIELD_CLASS.','.\SYSTEM\SQL\system_todo::FIELD_MESSAGE.','.
|
||||
\SYSTEM\SQL\system_todo::FIELD_CODE.','.\SYSTEM\SQL\system_todo::FIELD_FILE.','.
|
||||
\SYSTEM\SQL\system_todo::FIELD_LINE.','.\SYSTEM\SQL\system_todo::FIELD_TRACE.','.
|
||||
\SYSTEM\SQL\system_todo::FIELD_IP.','.\SYSTEM\SQL\system_todo::FIELD_QUERYTIME.','.
|
||||
\SYSTEM\SQL\system_todo::FIELD_TIME.','.\SYSTEM\SQL\system_todo::FIELD_SERVER_NAME.','.
|
||||
\SYSTEM\SQL\system_todo::FIELD_SERVER_PORT.','.\SYSTEM\SQL\system_todo::FIELD_REQUEST_URI.','.
|
||||
\SYSTEM\SQL\system_todo::FIELD_POST.','.\SYSTEM\SQL\system_todo::FIELD_HTTP_REFERER.','.
|
||||
\SYSTEM\SQL\system_todo::FIELD_HTTP_USER_AGENT.',"'.\SYSTEM\SQL\system_todo::FIELD_USER.'",'.
|
||||
\SYSTEM\SQL\system_todo::FIELD_THROWN.','.\SYSTEM\SQL\system_todo::FIELD_MESSAGE_HASH.','.
|
||||
\SYSTEM\SQL\system_todo::FIELD_TYPE.')'.
|
||||
'VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, digest($18, \'sha1\'),$19)';
|
||||
}
|
||||
public static function mysql(){return
|
||||
'INSERT INTO '.\SYSTEM\SQL\system_todo::NAME_MYS.
|
||||
'('.\SYSTEM\SQL\system_todo::FIELD_CLASS.','.\SYSTEM\SQL\system_todo::FIELD_MESSAGE.','.
|
||||
|
||||
1
sql/qt/pg/schema/extension_pgcrypto.sql
Normal file
1
sql/qt/pg/schema/extension_pgcrypto.sql
Normal file
@ -0,0 +1 @@
|
||||
create extension pgcrypto;
|
||||
10
sql/qt/pg/schema/system_text.sql
Normal file
10
sql/qt/pg/schema/system_text.sql
Normal file
@ -0,0 +1,10 @@
|
||||
CREATE TABLE system.text (
|
||||
id character varying(35) NOT NULL,
|
||||
lang character varying(4) NOT NULL,
|
||||
text text NOT NULL,
|
||||
author serial NOT NULL,
|
||||
author_edit serial NOT NULL,
|
||||
time_create timestamp with time zone NOT NULL DEFAULT now(),
|
||||
time_edit timestamp with time zone DEFAULT NULL,
|
||||
CONSTRAINT system_text_pk_id_lang PRIMARY KEY (id,lang)
|
||||
);
|
||||
5
sql/qt/pg/schema/system_text_tag.sql
Normal file
5
sql/qt/pg/schema/system_text_tag.sql
Normal file
@ -0,0 +1,5 @@
|
||||
CREATE TABLE system.text_tag (
|
||||
id character varying(35) NOT NULL,
|
||||
tag character varying(35) NOT NULL,
|
||||
CONSTRAINT system_text_tag_pk_id_tag PRIMARY KEY (id,tag)
|
||||
)
|
||||
Loading…
x
Reference in New Issue
Block a user