Index: trunk/install/php/listreserve.php =================================================================== --- trunk/install/php/listreserve.php (リビジョン 90) +++ trunk/install/php/listreserve.php (リビジョン 94) @@ -62,32 +62,20 @@ $query = " SELECT -foltia_program .tid, -stationname, -foltia_program .title, -foltia_subtitle.countno, -foltia_subtitle.subtitle, -foltia_subtitle.startdatetime , -foltia_subtitle.lengthmin , -foltia_tvrecord.bitrate , -foltia_subtitle.startoffset , -foltia_subtitle.pid , -foltia_subtitle.epgaddedby , + foltia_program.tid, stationname, foltia_program.title, + foltia_subtitle.countno, foltia_subtitle.subtitle, + foltia_subtitle.startdatetime as x, foltia_subtitle.lengthmin, + foltia_tvrecord.bitrate, foltia_subtitle.startoffset, + foltia_subtitle.pid, foltia_subtitle.epgaddedby, foltia_tvrecord.digital FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid -AND foltia_subtitle.enddatetime >= '$now' +AND foltia_subtitle.enddatetime >= ? UNION SELECT -foltia_program .tid, -stationname, -foltia_program .title, -foltia_subtitle.countno, -foltia_subtitle.subtitle, -foltia_subtitle.startdatetime , -foltia_subtitle.lengthmin , -foltia_tvrecord.bitrate , -foltia_subtitle.startoffset , -foltia_subtitle.pid , -foltia_subtitle.epgaddedby , + foltia_program.tid, stationname, foltia_program.title, + foltia_subtitle.countno, foltia_subtitle.subtitle, + foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, + foltia_tvrecord.bitrate, foltia_subtitle.startoffset, + foltia_subtitle.pid, foltia_subtitle.epgaddedby, foltia_tvrecord.digital FROM foltia_tvrecord @@ -96,10 +84,9 @@ LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) WHERE foltia_tvrecord.stationid = 0 AND -foltia_subtitle.enddatetime >= '$now' ORDER BY \"startdatetime\" ASC + foltia_subtitle.enddatetime >= ? ORDER BY x ASC "; - $rs = m_query($con, $query, "DBクエリに失敗しました"); - $maxrows = pg_num_rows($rs); - +// $rs = m_query($con, $query, "DBクエリに失敗しました"); + $rs = sql_query($con, $query, "DBクエリに失敗しました",array($now,$now)); //チューナー数 @@ -122,11 +109,10 @@ fetch(); + if (! $rowdata) { print "番組データがありません
\n"; }else{ - - /* フィールド数 */ - $maxcols = pg_num_fields($rs); + $maxcols = $rs->columnCount(); ?> @@ -149,8 +135,7 @@ \n"); - /* pg_fetch_row で一行取り出す */ - $rowdata = pg_fetch_row($rs, $row); + $pid = htmlspecialchars($rowdata[9]); @@ -168,32 +153,20 @@ $query = " SELECT -foltia_program .tid, -stationname, -foltia_program .title, -foltia_subtitle.countno, -foltia_subtitle.subtitle, -foltia_subtitle.startdatetime , -foltia_subtitle.lengthmin , -foltia_tvrecord.bitrate , -foltia_subtitle.startoffset , -foltia_subtitle.pid , -foltia_tvrecord.digital + foltia_program.tid, stationname, foltia_program.title, + foltia_subtitle.countno, foltia_subtitle.subtitle, + foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, + foltia_tvrecord.bitrate, foltia_subtitle.startoffset, + foltia_subtitle.pid, foltia_tvrecord.digital FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid -AND foltia_subtitle.enddatetime > '$rowdata[5]' -AND foltia_subtitle.startdatetime < '$endtime' +AND foltia_subtitle.enddatetime > ? +AND foltia_subtitle.startdatetime < ? UNION SELECT -foltia_program .tid, -stationname, -foltia_program .title, -foltia_subtitle.countno, -foltia_subtitle.subtitle, -foltia_subtitle.startdatetime , -foltia_subtitle.lengthmin , -foltia_tvrecord.bitrate , -foltia_subtitle.startoffset , -foltia_subtitle.pid , -foltia_tvrecord.digital + foltia_program.tid, stationname, foltia_program.title, + foltia_subtitle.countno, foltia_subtitle.subtitle, + foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, + foltia_tvrecord.bitrate, foltia_subtitle.startoffset, + foltia_subtitle.pid, foltia_tvrecord.digital FROM foltia_tvrecord LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) @@ -201,10 +174,12 @@ LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) WHERE foltia_tvrecord.stationid = 0 AND -foltia_subtitle.enddatetime > '$rowdata[5]' -AND foltia_subtitle.startdatetime < '$endtime' - "; +foltia_subtitle.enddatetime > ? +AND foltia_subtitle.startdatetime < ? +"; $rclass = ""; - $overlap = m_query($con, $query, "DBクエリに失敗しました"); - $overlapmaxrows = pg_num_rows($overlap); +// $overlap = m_query($con, $query, "DBクエリに失敗しました"); + $overlap = sql_query($con, $query, "DBクエリに失敗しました",array($rowdata[5],$endtime,$rowdata[5],$endtime)); + $owrowall = $overlap->fetchAll(); + $overlapmaxrows = count($owrowall); if ($overlapmaxrows > ($recunits) ){ @@ -212,5 +187,5 @@ for ($rrow = 0; $rrow < $overlapmaxrows ; $rrow++) { - $owrowdata = pg_fetch_array($overlap, $rrow); + $owrowdata = $owrowall[$rrow]; $owtimeline[ $owrowdata['startdatetime'] ] = $owtimeline[ $owrowdata['startdatetime'] ] +1; @@ -237,33 +212,21 @@ $query = " SELECT -foltia_program .tid, -stationname, -foltia_program .title, -foltia_subtitle.countno, -foltia_subtitle.subtitle, -foltia_subtitle.startdatetime , -foltia_subtitle.lengthmin , -foltia_tvrecord.bitrate , -foltia_subtitle.startoffset , -foltia_subtitle.pid , -foltia_tvrecord.digital + foltia_program.tid, stationname, foltia_program.title, + foltia_subtitle.countno, foltia_subtitle.subtitle, + foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, + foltia_tvrecord.bitrate, foltia_subtitle.startoffset, + foltia_subtitle.pid, foltia_tvrecord.digital FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid -AND foltia_subtitle.enddatetime > '$rowdata[5]' -AND foltia_subtitle.startdatetime < '$endtime' +AND foltia_subtitle.enddatetime > ? +AND foltia_subtitle.startdatetime < ? AND (foltia_station.stationrecch = '0' OR foltia_station.stationrecch = '-1' ) UNION SELECT -foltia_program .tid, -stationname, -foltia_program .title, -foltia_subtitle.countno, -foltia_subtitle.subtitle, -foltia_subtitle.startdatetime , -foltia_subtitle.lengthmin , -foltia_tvrecord.bitrate , -foltia_subtitle.startoffset , -foltia_subtitle.pid , -foltia_tvrecord.digital + foltia_program.tid, stationname, foltia_program.title, + foltia_subtitle.countno, foltia_subtitle.subtitle, + foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, + foltia_tvrecord.bitrate, foltia_subtitle.startoffset, + foltia_subtitle.pid, foltia_tvrecord.digital FROM foltia_tvrecord LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) @@ -271,11 +234,12 @@ LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) WHERE foltia_tvrecord.stationid = 0 AND -foltia_subtitle.enddatetime > '$rowdata[5]' -AND foltia_subtitle.startdatetime < '$endtime' +foltia_subtitle.enddatetime > ? +AND foltia_subtitle.startdatetime < ? AND (foltia_station.stationrecch = '0' OR foltia_station.stationrecch = '-1' ) - "; - $eoverlap = m_query($con, $query, "DBクエリに失敗しました"); - $eoverlapmaxrows = pg_num_rows($eoverlap); +// $eoverlap = m_query($con, $query, "DBクエリに失敗しました"); + $eoverlap = sql_query($con, $query, "DBクエリに失敗しました",array($rowdata[5], $endtime,$rowdata[5], $endtime)); + $eowrowall = $eoverlap->fetchAll(); + $eoverlapmaxrows = count($eowrowall); if ($eoverlapmaxrows > ($externalinputs) ){ @@ -283,5 +247,5 @@ for ($erow = 0; $erow < $eoverlapmaxrows ; $erow++) { - $eowrowdata = pg_fetch_array($eoverlap, $erow); + $eowrowdata = $eowrowall[$erow]; $eowtimeline[ $eowrowdata['startdatetime'] ] = $eowtimeline[ $eowrowdata['startdatetime'] ] +1; @@ -359,5 +323,5 @@ echo("
\n"); echo("\n"); - } + } while ($rowdata = $rs->fetch()); ?> @@ -374,14 +338,9 @@ fetch(); +if (! $rowdata) { //なければなにもしない }else{ - $maxcols = pg_num_fields($rs); + $maxcols = $rs->columnCount(); ?> @@ -417,8 +376,5 @@ "); }//if tid 0 - }//for + } while ($rowdata = $rs->fetch()); }//else ?>