チェンジセット 94: trunk/install/perl/foltialib.pl
- コミット日時:
- 2010/02/28 22:28:26 (15 年前)
- ファイル:
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
trunk/install/perl/foltialib.pl
r83 r94 4 4 $path = $0; 5 5 $path =~ s/foltialib.pl$//i; 6 if ($p wdne "./"){6 if ($path ne "./"){ 7 7 push( @INC, "$path"); 8 8 } … … 13 13 use DBI; 14 14 use DBD::Pg; 15 16 17 $DBDriv=$main::DBDriv; 18 $DBHost=$main::DBHost; 19 $DBPort=$main::DBPort; 20 $DBName=$main::DBName; 15 use DBD::SQLite; 16 use POSIX qw(strftime); 17 18 $DSN=$main::DSN; 21 19 $DBUser=$main::DBUser; 22 20 $DBPass=""; … … 47 45 sub writelog{ 48 46 my $messages = $_[0]; 49 my $timestump = `date +%Y/%m/%d_%H:%M:%S`;47 my $timestump = strftime("%Y/%m/%d_%H:%M:%S", localtime); 50 48 chomp($timestump); 51 49 if ($debugmode == 1){ … … 146 144 my $stationname = $_[0] ; 147 145 my $stationid ; 148 my $DBQuery = "SELECT count(*) FROM foltia_station WHERE stationname = '$item{ChName}'";149 146 150 147 my $sth; 151 $sth = $dbh->prepare($DBQuery);152 $sth->execute();148 $sth = $dbh->prepare($stmt{'foltialib.getstationid.1'}); 149 $sth->execute($item{'ChName'}); 153 150 my @stationcount; 154 151 @stationcount= $sth->fetchrow_array; … … 156 153 if ($stationcount[0] == 1){ 157 154 #チャンネルID取得 158 $DBQuery = "SELECT stationid,stationname FROM foltia_station WHERE stationname = '$item{ChName}'"; 159 $sth = $dbh->prepare($DBQuery); 160 $sth->execute(); 155 $sth = $dbh->prepare($stmt{'foltialib.getstationid.2'}); 156 $sth->execute($item{'ChName'}); 161 157 @stationinfo= $sth->fetchrow_array; 162 158 #局ID … … 166 162 }elsif($stationcount[0] == 0){ 167 163 #新規登録 168 $DBQuery = "SELECT max(stationid) FROM foltia_station"; 169 $sth = $dbh->prepare($DBQuery); 164 $sth = $dbh->prepare($stmt{'foltialib.getstationid.3'}); 170 165 $sth->execute(); 171 166 @stationinfo= $sth->fetchrow_array; … … 174 169 ##$DBQuery = "insert into foltia_station values ('$stationid' ,'$item{ChName}','0','','','','','','')"; 175 170 #新規局追加時は非受信局をデフォルトに 176 $DBQuery = "insert into foltia_station (stationid , stationname ,stationrecch ) values ('$stationid' ,'$item{ChName}','-10')"; 177 178 $sth = $dbh->prepare($DBQuery); 179 $sth->execute(); 171 $sth = $dbh->prepare($stmt{'foltialib.getstationid.4'}); 172 $sth->execute($stationid, $item{'ChName'}, -10); 180 173 #print "Add station;$DBQuery\n"; 181 &writelog("foltialib Add station;$DBQuery");174 &writelog("foltialib Add station;$stmt{'foltialib.getstationid.4'}"); 182 175 }else{ 183 176 … … 287 280 } 288 281 289 my $DBQuery = "SELECT pid FROM foltia_subtitle WHERE m2pfilename = '$m2pfilename' LIMIT 1 ";290 282 my $sth; 291 $sth = $dbh->prepare($DBQuery);292 $sth->execute();293 #print "$ DBQuery\n";283 $sth = $dbh->prepare($stmt{'foltialib.getpidbympegfilename.1'}); 284 $sth->execute($m2pfilename); 285 #print "$stmt{'foltialib.getpidbympegfilename.1'}\n"; 294 286 my @pidinfo = $sth->fetchrow_array; 295 287 my $pid = $pidinfo[0]; … … 312 304 313 305 if ($updatestatus > 0 ){ 314 my $DBQuery = "UPDATE foltia_subtitle SET filestatus = $updatestatus , lastupdate = now() WHERE pid = $pid ";315 306 my $sth; 316 $sth = $dbh->prepare($DBQuery);317 $sth->execute();307 $sth = $dbh->prepare($stmt{'foltialib.changefilestatus.1'}); 308 $sth->execute($updatestatus, $pid); 318 309 return 1; 319 310 }else{ … … 351 342 } 352 343 353 my $DBQuery = "SELECT filestatus FROM foltia_subtitle WHERE pid = $pid ";354 344 my $sth; 355 $sth = $dbh->prepare($DBQuery);356 $sth->execute();345 $sth = $dbh->prepare($stmt{'foltialib.getfilestatus.1'}); 346 $sth->execute($pid); 357 347 358 348 my @statusinfo = $sth->fetchrow_array;