mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
93_DbLog: contrib 4.12.0
git-svn-id: https://svn.fhem.de/fhem/trunk@24117 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
8fa3ef17f2
commit
069bbfbeff
@ -456,6 +456,11 @@ sub DbLog_Attr {
|
|||||||
|
|
||||||
if ($aName eq "shutdownWait") {
|
if ($aName eq "shutdownWait") {
|
||||||
return "DbLog $name - The attribute $aName is deprecated and has been removed !";
|
return "DbLog $name - The attribute $aName is deprecated and has been removed !";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($aName eq "SQLiteCacheSize" || $aName eq "SQLiteJournalMode") {
|
||||||
|
InternalTimer(gettimeofday()+1.0, "DbLog_attrForSQLite", $hash, 0);
|
||||||
|
InternalTimer(gettimeofday()+1.5, "DbLog_attrForSQLite", $hash, 0); # muß zweimal ausgeführt werden - Grund unbekannt :-(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -564,6 +569,29 @@ sub DbLog_Attr {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# reopen DB beim Setzen bestimmter Attribute
|
||||||
|
################################################################
|
||||||
|
sub DbLog_attrForSQLite {
|
||||||
|
my $hash = shift;
|
||||||
|
|
||||||
|
return if($hash->{MODEL} ne "SQLITE");
|
||||||
|
|
||||||
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
|
my $dbh = $hash->{DBHP};
|
||||||
|
if ($dbh) {
|
||||||
|
my $history = $hash->{HELPER}{TH};
|
||||||
|
if(!$dbh->{AutoCommit}) {
|
||||||
|
eval {$dbh->commit()} or Log3($name, 2, "DbLog $name -> Error commit $history - $@");
|
||||||
|
}
|
||||||
|
$dbh->disconnect();
|
||||||
|
}
|
||||||
|
DbLog_ConnectPush ($hash,1);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
sub DbLog_Set {
|
sub DbLog_Set {
|
||||||
my ($hash, @a) = @_;
|
my ($hash, @a) = @_;
|
||||||
@ -3242,12 +3270,16 @@ sub DbLog_ConnectPush {
|
|||||||
|
|
||||||
if (AttrVal($name, "SQLiteJournalMode", "WAL") eq "off") {
|
if (AttrVal($name, "SQLiteJournalMode", "WAL") eq "off") {
|
||||||
$dbhp->do("PRAGMA journal_mode=off");
|
$dbhp->do("PRAGMA journal_mode=off");
|
||||||
|
$hash->{SQLITEWALMODE} = "off";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$dbhp->do("PRAGMA journal_mode=WAL");
|
$dbhp->do("PRAGMA journal_mode=WAL");
|
||||||
|
$hash->{SQLITEWALMODE} = "on";
|
||||||
}
|
}
|
||||||
|
|
||||||
$dbhp->do("PRAGMA cache_size=". AttrVal($name, "SQLiteCacheSize", "4000"));
|
my $cs = AttrVal($name, "SQLiteCacheSize", "4000");
|
||||||
|
$dbhp->do("PRAGMA cache_size=$cs");
|
||||||
|
$hash->{SQLITECACHESIZE} = $cs;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -7678,8 +7710,7 @@ attr SMA_Energymeter DbLogValueFn
|
|||||||
Since WAL about doubles the spaces requirements on disk it might not be the best fit for embedded devices
|
Since WAL about doubles the spaces requirements on disk it might not be the best fit for embedded devices
|
||||||
using a RAM backed disk. <b>off</b> will turn the journaling off. In case of corruption, the database probably
|
using a RAM backed disk. <b>off</b> will turn the journaling off. In case of corruption, the database probably
|
||||||
won't be possible to repair and has to be recreated! <br>
|
won't be possible to repair and has to be recreated! <br>
|
||||||
(default: WAL) <br><br>
|
(default: WAL)
|
||||||
<b>Note:</b> FHEM must be restarted to take this attribute affected !
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -9144,8 +9175,7 @@ attr SMA_Energymeter DbLogValueFn
|
|||||||
|
|
||||||
Standardmäßig werden ca. 4MB RAM für Caching verwendet (page_size=1024bytes, cache_size=4000).<br>
|
Standardmäßig werden ca. 4MB RAM für Caching verwendet (page_size=1024bytes, cache_size=4000).<br>
|
||||||
Bei Embedded Devices mit wenig RAM genügen auch 1000 Pages - zu Lasten der Performance. <br>
|
Bei Embedded Devices mit wenig RAM genügen auch 1000 Pages - zu Lasten der Performance. <br>
|
||||||
(default: 4000)<br><br>
|
(default: 4000)
|
||||||
<b>Note:</b> FHEM muß nach der Attributänderung restarted werden !
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -9165,8 +9195,7 @@ attr SMA_Energymeter DbLogValueFn
|
|||||||
Festplattenplatz (z.B. eine RAM Disk in Embedded Devices) kann das Journal deaktiviert werden (<b>off</b>).
|
Festplattenplatz (z.B. eine RAM Disk in Embedded Devices) kann das Journal deaktiviert werden (<b>off</b>).
|
||||||
Im Falle eines Datenfehlers kann die Datenbank aber wahrscheinlich nicht repariert werden, und muss neu erstellt
|
Im Falle eines Datenfehlers kann die Datenbank aber wahrscheinlich nicht repariert werden, und muss neu erstellt
|
||||||
werden! <br>
|
werden! <br>
|
||||||
(default: WAL) <br><br>
|
(default: WAL)
|
||||||
<b>Note:</b> FHEM muß nach der Attributänderung restarted werden !
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
Loading…
Reference in New Issue
Block a user