mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-26 04:14:13 +00:00
93_DbLog: contrib 4.12.3
git-svn-id: https://svn.fhem.de/fhem/trunk@24287 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
49bd0df2b2
commit
eac04fb94d
@ -30,6 +30,7 @@ no if $] >= 5.017011, warnings => 'experimental::smartmatch';
|
||||
|
||||
# Version History intern by DS_Starter:
|
||||
my %DbLog_vNotesIntern = (
|
||||
"4.12.3" => "20.04.2021 change sub DbLog_ConnectNewDBH for SQLITE ",
|
||||
"4.12.2" => "08.04.2021 change standard splitting ",
|
||||
"4.12.1" => "07.04.2021 improve escaping the pipe ",
|
||||
"4.12.0" => "29.03.2021 new attributes SQLiteCacheSize, SQLiteJournalMode ",
|
||||
@ -1778,7 +1779,7 @@ sub DbLog_Push {
|
||||
my $doins = 0; # Hilfsvariable, wenn "1" sollen inserts in Tabelle current erfolgen (updates schlugen fehl)
|
||||
my $dbh;
|
||||
|
||||
my $nh = ($hash->{MODEL} ne 'SQLITE')?1:0;
|
||||
my $nh = ($hash->{MODEL} ne 'SQLITE') ? 1 : 0;
|
||||
# Unterscheidung $dbh um Abbrüche in Plots (SQLite) zu vermeiden und
|
||||
# andererseite kein "MySQL-Server has gone away" Fehler
|
||||
if ($nh) {
|
||||
@ -3322,6 +3323,24 @@ sub DbLog_ConnectNewDBH {
|
||||
if($dbh) {
|
||||
$dbh->{RaiseError} = 0;
|
||||
$dbh->{PrintError} = 1;
|
||||
|
||||
if ($hash->{MODEL} eq "SQLITE") { # Forum: https://forum.fhem.de/index.php/topic,120237.0.html
|
||||
$dbh->do("PRAGMA temp_store=MEMORY");
|
||||
$dbh->do("PRAGMA synchronous=FULL"); # For maximum reliability and for robustness against database corruption,
|
||||
# SQLite should always be run with its default synchronous setting of FULL.
|
||||
# https://sqlite.org/howtocorrupt.html
|
||||
|
||||
if (AttrVal($name, "SQLiteJournalMode", "WAL") eq "off") {
|
||||
$dbh->do("PRAGMA journal_mode=off");
|
||||
}
|
||||
else {
|
||||
$dbh->do("PRAGMA journal_mode=WAL");
|
||||
}
|
||||
|
||||
my $cs = AttrVal($name, "SQLiteCacheSize", "4000");
|
||||
$dbh->do("PRAGMA cache_size=$cs");
|
||||
}
|
||||
|
||||
return $dbh;
|
||||
}
|
||||
else {
|
||||
@ -3496,7 +3515,7 @@ sub DbLog_Get {
|
||||
Log3 $name, 4, "DbLog $name -> ################################################################";
|
||||
Log3($name, 4, "DbLog $name -> main PID: $hash->{PID}, secondary PID: $$");
|
||||
|
||||
my $nh = ($hash->{MODEL} ne 'SQLITE')?1:0;
|
||||
my $nh = ($hash->{MODEL} ne 'SQLITE') ? 1 : 0;
|
||||
if ($nh || $hash->{PID} != $$) { # 17.04.2019 Forum: https://forum.fhem.de/index.php/topic,99719.0.html
|
||||
$dbh = DbLog_ConnectNewDBH($hash);
|
||||
return "Can't connect to database." if(!$dbh);
|
||||
@ -6086,7 +6105,7 @@ return $ret;
|
||||
}
|
||||
|
||||
################################################################
|
||||
# Dropdown-Menü cuurent-Tabelle SVG-Editor
|
||||
# Dropdown-Menü current-Tabelle SVG-Editor
|
||||
################################################################
|
||||
sub DbLog_sampleDataFn {
|
||||
my ($dlName, $dlog, $max, $conf, $wName) = @_;
|
||||
@ -6527,11 +6546,10 @@ sub DbLog_setVersionInfo {
|
||||
$hash->{HELPER}{PACKAGE} = __PACKAGE__;
|
||||
$hash->{HELPER}{VERSION} = $v;
|
||||
|
||||
if($modules{$type}{META}{x_prereqs_src} && !$hash->{HELPER}{MODMETAABSENT}) {
|
||||
# META-Daten sind vorhanden
|
||||
if($modules{$type}{META}{x_prereqs_src} && !$hash->{HELPER}{MODMETAABSENT}) { # META-Daten sind vorhanden
|
||||
$modules{$type}{META}{version} = "v".$v; # Version aus META.json überschreiben, Anzeige mit {Dumper $modules{DbLog}{META}}
|
||||
if($modules{$type}{META}{x_version}) { # {x_version} ( nur gesetzt wenn $Id: 93_DbLog.pm 23888 2021-03-04 19:58:00Z DS_Starter $ im Kopf komplett! vorhanden )
|
||||
$modules{$type}{META}{x_version} =~ s/1.1.1/$v/g;
|
||||
$modules{$type}{META}{x_version} =~ s/1\.1\.1/$v/xsg;
|
||||
}
|
||||
else {
|
||||
$modules{$type}{META}{x_version} = $v;
|
||||
|
Loading…
x
Reference in New Issue
Block a user