2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-26 10:34:52 +00:00

93_DbRep: version 4.12.2, PK evaluation changed

git-svn-id: https://svn.fhem.de/fhem/trunk@14010 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2017-04-17 07:38:36 +00:00
parent 29357e6eac
commit 1f52e62465
2 changed files with 13 additions and 8 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it. # Do not insert empty lines here, update check depends on it.
- change: 93_DbRep: version 4.12.2, PK evaluation changed
- bugfix: 71_PHILIPS_AUDIO: Player readings fix. - bugfix: 71_PHILIPS_AUDIO: Player readings fix.
- feature: 71_PHILIPS_AUDIO: Module rewritten for better usability. - feature: 71_PHILIPS_AUDIO: Module rewritten for better usability.
New commands. See documentation. New commands. See documentation.

View File

@ -40,6 +40,7 @@
########################################################################################################### ###########################################################################################################
# Versions History: # Versions History:
# #
# 4.12.2 17.04.2017 DbRep_checkUsePK changed
# 4.12.1 07.04.2017 get tableinfo changed for MySQL # 4.12.1 07.04.2017 get tableinfo changed for MySQL
# 4.12.0 31.03.2017 support of primary key for insert functions # 4.12.0 31.03.2017 support of primary key for insert functions
# 4.11.4 29.03.2017 bugfix timestamp in minValue, maxValue if VALUE contains more than one # 4.11.4 29.03.2017 bugfix timestamp in minValue, maxValue if VALUE contains more than one
@ -182,7 +183,7 @@ use Blocking;
use Time::Local; use Time::Local;
# no if $] >= 5.017011, warnings => 'experimental'; # no if $] >= 5.017011, warnings => 'experimental';
my $DbRepVersion = "4.12.1"; my $DbRepVersion = "4.12.2";
my %dbrep_col = ("DEVICE" => 64, my %dbrep_col = ("DEVICE" => 64,
"TYPE" => 64, "TYPE" => 64,
@ -3848,20 +3849,23 @@ sub DbRep_checkUsePK ($$){
my ($hash,$dbh) = @_; my ($hash,$dbh) = @_;
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my $dbconn = $hash->{dbloghash}{dbconn}; my $dbconn = $hash->{dbloghash}{dbconn};
my @usepkh = 0; my $upkh = 0;
my @usepkc = 0; my $upkc = 0;
my (@pkh,@pkc);
my $db = (split("=",(split(";",$dbconn))[0]))[1]; my $db = (split("=",(split(";",$dbconn))[0]))[1];
eval {@usepkh = $dbh->primary_key( undef, undef, 'history' );}; eval {@pkh = $dbh->primary_key( undef, undef, 'history' );};
eval {@usepkc = $dbh->primary_key( undef, undef, 'current' );}; eval {@pkc = $dbh->primary_key( undef, undef, 'current' );};
my $pkh = @usepkh?join(",",@usepkh):"none"; my $pkh = (!@pkh || @pkh eq "")?"none":join(",",@pkh);
my $pkc = @usepkc?join(",",@usepkc):"none"; my $pkc = (!@pkc || @pkc eq "")?"none":join(",",@pkc);
$pkh =~ tr/"//d; $pkh =~ tr/"//d;
$pkc =~ tr/"//d; $pkc =~ tr/"//d;
$upkh = 1 if(@pkh && @pkh ne "none");
$upkc = 1 if(@pkc && @pkc ne "none");
Log3 $hash->{NAME}, 5, "DbLog $name -> Primary Key used in $db.history: $pkh"; Log3 $hash->{NAME}, 5, "DbLog $name -> Primary Key used in $db.history: $pkh";
Log3 $hash->{NAME}, 5, "DbLog $name -> Primary Key used in $db.current: $pkc"; Log3 $hash->{NAME}, 5, "DbLog $name -> Primary Key used in $db.current: $pkc";
return (scalar(@usepkh),scalar(@usepkc),$pkh,$pkc); return ($upkh,$upkc,$pkh,$pkc);
} }
#################################################################################################### ####################################################################################################