2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

configDB.pm: add index on fhemconfig if sqlite used

git-svn-id: https://svn.fhem.de/fhem/trunk@13788 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2017-03-24 16:13:32 +00:00
parent ab1ff60fbd
commit 5c659e1d1c

View File

@ -120,6 +120,8 @@
# 2016-07-04 - fixed improve config file read
# 2016-07-07 - bugfix select configuration
#
# 2017-03-24 - added use index on fhemconfig (only sqlite)
#
##############################################################################
=cut
@ -261,6 +263,11 @@ sub cfgDB_Init() {
# create TABLE fhemconfig if nonexistent
$fhem_dbh->do("CREATE TABLE IF NOT EXISTS fhemconfig(COMMAND VARCHAR(32), DEVICE VARCHAR(64), P1 VARCHAR(50), P2 TEXT, VERSION INT, VERSIONUUID CHAR(50))");
# create INDEX on fhemconfig if nonexistent (only if SQLITE)
$fhem_dbh->do("CREATE INDEX IF NOT EXISTS config_idx on 'fhemconfig' (versionuuid,version)")
if($cfgDB_dbtype eq "SQLITE");
# check TABLE fhemconfig already populated
my $count = $fhem_dbh->selectrow_array('SELECT count(*) FROM fhemconfig');
if($count < 1) {