2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-04 05:16:45 +00:00

93_DbRep: contrib 8.47.0

git-svn-id: https://svn.fhem.de/fhem/trunk@25480 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2022-01-17 16:37:49 +00:00
parent 10b20a9ba1
commit 3bedfa5f76

View File

@ -7001,7 +7001,7 @@ sub DbRep_sqlCmdDone {
ReadingsBulkUpdateValue ($hash, "sqlCmd", $cmd);
ReadingsBulkUpdateValue ($hash, "sqlResultNumRows", $nrows);
DbRep_addSQLcmdCache ($name, $cmd); # Drop-Down Liste bisherige sqlCmd-Befehle füllen und in Key-File sichern
DbRep_addSQLcmdCache ($name); # Drop-Down Liste bisherige sqlCmd-Befehle füllen und in Key-File sichern
if ($srf eq "sline") {
$rowstring =~ s/§/]|[/g;
@ -11455,12 +11455,9 @@ return;
####################################################################################################
sub DbRep_addSQLcmdCache {
my $name = shift;
my $cmd = shift;
my $hash = $defs{$name};
$cmd = _DbRep_convertSQL ($cmd);
my $hlc = AttrVal($name, "sqlCmdHistoryLength", 0); # Anzahl der Einträge in Drop-Down Liste
my $tmpsql = delete $data{DbRep}{$name}{sqlcache}{temp}; # SQL incl. Formatierung aus Zwischenspeicher
@ -11500,7 +11497,7 @@ sub DbRep_listSQLcmdCache {
$cache .= $key." => ".$data{DbRep}{$name}{sqlcache}{cmd}{$key}."\n";
if ($write) {
$cstr .= $key."|=>|"._DbRep_convertSQL ($data{DbRep}{$name}{sqlcache}{cmd}{$key}).",";
$cstr .= $key."|=>|"._DbRep_convertSQL ($data{DbRep}{$name}{sqlcache}{cmd}{$key}, 1).",";
}
else {
$cstr .= _DbRep_convertSQL ($data{DbRep}{$name}{sqlcache}{cmd}{$key}).",";
@ -11547,9 +11544,16 @@ return;
####################################################################################################
# SQL Statement konvertieren
# $write - setzen für Schreiben Cache File
####################################################################################################
sub _DbRep_convertSQL {
my $cmd = shift;
my $cmd = shift;
my $write = shift // 0;
if($write) {
$cmd =~ s/\n/*/g;
$cmd =~ s/\s/ /g;
}
$cmd =~ s/\s+/ /g;
$cmd =~ s/,/,/g; # Forum: https://forum.fhem.de/index.php/topic,103908.0.html
@ -11564,6 +11568,7 @@ return $cmd;
sub _DbRep_deconvertSQL {
my $cmd = shift;
$cmd =~ s/*/\n/g;
$cmd =~ s/ / /g;
$cmd =~ s/,/,/g; # Forum: https://forum.fhem.de/index.php/topic,103908.0.html