mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-22 02:10:32 +00:00
93_DbLog: minor fixes for PostgreSQL
git-svn-id: https://svn.fhem.de/fhem/trunk@26923 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
7cafc44211
commit
ea8c5e9286
@ -38,6 +38,8 @@ no if $] >= 5.017011, warnings => 'experimental::smartmatch';
|
|||||||
|
|
||||||
# Version History intern by DS_Starter:
|
# Version History intern by DS_Starter:
|
||||||
my %DbLog_vNotesIntern = (
|
my %DbLog_vNotesIntern = (
|
||||||
|
"5.5.9" => "28.12.2022 optimize \$hash->{HELPER}{TH}, \$hash->{HELPER}{TC}, mode in Define ".
|
||||||
|
"Forum: https://forum.fhem.de/index.php/topic,130588.msg1254073.html#msg1254073 ",
|
||||||
"5.5.8" => "27.12.2022 two-line output of long state messages, define LONGRUN_PID threshold ",
|
"5.5.8" => "27.12.2022 two-line output of long state messages, define LONGRUN_PID threshold ",
|
||||||
"5.5.7" => "20.12.2022 cutted _DbLog_SBP_onRun_Log into _DbLog_SBP_onRun_LogArray and _DbLog_SBP_onRun_LogBulk ".
|
"5.5.7" => "20.12.2022 cutted _DbLog_SBP_onRun_Log into _DbLog_SBP_onRun_LogArray and _DbLog_SBP_onRun_LogBulk ".
|
||||||
"__DbLog_SBP_onRun_LogCurrent, __DbLog_SBP_fieldArrays, some bugfixes, add drivers to configCheck, edit comref ",
|
"__DbLog_SBP_onRun_LogCurrent, __DbLog_SBP_fieldArrays, some bugfixes, add drivers to configCheck, edit comref ",
|
||||||
@ -410,12 +412,9 @@ sub DbLog_Define {
|
|||||||
return "Bad regexp: $@" if($@);
|
return "Bad regexp: $@" if($@);
|
||||||
|
|
||||||
$hash->{REGEXP} = $regexp;
|
$hash->{REGEXP} = $regexp;
|
||||||
#$hash->{MODE} = AttrVal($name, 'asyncMode', undef) ? 'asynchronous' : 'synchronous'; # Mode setzen Forum:#76213
|
$hash->{MODE} = AttrVal ($name, 'asyncMode', 0) ? 'asynchronous' : 'synchronous'; # Mode setzen Forum:#76213
|
||||||
$hash->{MODE} = 'synchronous';
|
|
||||||
$hash->{HELPER}{OLDSTATE} = 'initialized';
|
$hash->{HELPER}{OLDSTATE} = 'initialized';
|
||||||
$hash->{HELPER}{MODMETAABSENT} = 1 if($modMetaAbsent); # Modul Meta.pm nicht vorhanden
|
$hash->{HELPER}{MODMETAABSENT} = 1 if($modMetaAbsent); # Modul Meta.pm nicht vorhanden
|
||||||
$hash->{HELPER}{TH} = 'history'; # Tabelle history (wird ggf. durch Datenbankschema ergänzt)
|
|
||||||
$hash->{HELPER}{TC} = 'current'; # Tabelle current (wird ggf. durch Datenbankschema ergänzt)
|
|
||||||
|
|
||||||
DbLog_setVersionInfo ($hash); # Versionsinformationen setzen
|
DbLog_setVersionInfo ($hash); # Versionsinformationen setzen
|
||||||
notifyRegexpChanged ($hash, $regexp); # nur Events dieser Devices an NotifyFn weiterleiten, NOTIFYDEV wird gesetzt wenn möglich
|
notifyRegexpChanged ($hash, $regexp); # nur Events dieser Devices an NotifyFn weiterleiten, NOTIFYDEV wird gesetzt wenn möglich
|
||||||
@ -433,7 +432,7 @@ sub DbLog_Define {
|
|||||||
InternalTimer(gettimeofday()+2, 'DbLog_setinternalcols', $hash, 0); # set used COLUMNS
|
InternalTimer(gettimeofday()+2, 'DbLog_setinternalcols', $hash, 0); # set used COLUMNS
|
||||||
|
|
||||||
DbLog_setReadingstate ($hash, 'waiting for connection');
|
DbLog_setReadingstate ($hash, 'waiting for connection');
|
||||||
DbLog_SBP_CheckAndInit ($hash, 1); # SubProcess starten - direkt nach Define !! um wenig Speicher zu allokieren
|
DbLog_SBP_CheckAndInit ($hash, 1); # SubProcess starten - direkt nach Define !! um wenig Speicher zu allokieren
|
||||||
_DbLog_initOnStart ($hash); # von init_done abhängige Prozesse initialisieren
|
_DbLog_initOnStart ($hash); # von init_done abhängige Prozesse initialisieren
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -468,6 +467,8 @@ sub _DbLog_initOnStart {
|
|||||||
readingsDelete ($hash, $r);
|
readingsDelete ($hash, $r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DbLog_setSchemeTable ($hash);
|
||||||
|
|
||||||
DbLog_SBP_CheckAndInit ($hash);
|
DbLog_SBP_CheckAndInit ($hash);
|
||||||
|
|
||||||
my $rst = DbLog_SBP_sendConnectionData ($hash); # Verbindungsdaten an SubProzess senden
|
my $rst = DbLog_SBP_sendConnectionData ($hash); # Verbindungsdaten an SubProzess senden
|
||||||
@ -516,7 +517,6 @@ return;
|
|||||||
sub DbLog_DelayedShutdown {
|
sub DbLog_DelayedShutdown {
|
||||||
my $hash = shift;
|
my $hash = shift;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my $async = AttrVal($name, 'asyncMode', 0);
|
|
||||||
|
|
||||||
$hash->{HELPER}{SHUTDOWNSEQ} = 1;
|
$hash->{HELPER}{SHUTDOWNSEQ} = 1;
|
||||||
|
|
||||||
@ -686,7 +686,7 @@ sub DbLog_Attr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($aName eq "disable") {
|
if ($aName eq "disable") {
|
||||||
my $async = AttrVal($name, "asyncMode", 0);
|
my $async = AttrVal($name, 'asyncMode', 0);
|
||||||
|
|
||||||
if($cmd eq "set") {
|
if($cmd eq "set") {
|
||||||
$do = $aVal ? 1 : 0;
|
$do = $aVal ? 1 : 0;
|
||||||
@ -711,12 +711,10 @@ sub DbLog_Attr {
|
|||||||
$do = 0 if($cmd eq "del");
|
$do = 0 if($cmd eq "del");
|
||||||
|
|
||||||
if ($do == 1) {
|
if ($do == 1) {
|
||||||
$hash->{HELPER}{TH} = $aVal.'.history';
|
DbLog_setSchemeTable ($hash, $aVal);
|
||||||
$hash->{HELPER}{TC} = $aVal.'.current';
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$hash->{HELPER}{TH} = 'history';
|
DbLog_setSchemeTable ($hash, '');
|
||||||
$hash->{HELPER}{TC} = 'current';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($init_done == 1) {
|
if ($init_done == 1) {
|
||||||
@ -2119,7 +2117,7 @@ sub DbLog_execMemCacheAsync {
|
|||||||
my $hash = shift;
|
my $hash = shift;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
my $async = AttrVal($name, "asyncMode", 0);
|
my $async = AttrVal($name, 'asyncMode', 0);
|
||||||
|
|
||||||
|
|
||||||
RemoveInternalTimer($hash, 'DbLog_execMemCacheAsync');
|
RemoveInternalTimer($hash, 'DbLog_execMemCacheAsync');
|
||||||
@ -7031,6 +7029,25 @@ sub DbLog_jsonError {
|
|||||||
return $json;
|
return $json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# Tabellenname incl. Schema erstellen
|
||||||
|
################################################################
|
||||||
|
sub DbLog_setSchemeTable {
|
||||||
|
my $hash = shift;
|
||||||
|
my $scheme = shift // AttrVal($hash->{NAME}, 'dbSchema', '');
|
||||||
|
|
||||||
|
if ($scheme) {
|
||||||
|
$hash->{HELPER}{TH} = $scheme.'.history';
|
||||||
|
$hash->{HELPER}{TC} = $scheme.'.current';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$hash->{HELPER}{TH} = 'history';
|
||||||
|
$hash->{HELPER}{TC} = 'current';
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# Check Zeitformat
|
# Check Zeitformat
|
||||||
# Zeitformat: YYYY-MM-DD HH:MI:SS
|
# Zeitformat: YYYY-MM-DD HH:MI:SS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user