From 76308b94890ac196c04fefe7f5b1907871e9e3a8 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Tue, 22 Mar 2016 22:53:13 +0000 Subject: [PATCH] fix transaction git-svn-id: file:///root/webif/svn/pkg/webif/trunk@2811 2a923420-c742-0410-a762-8d5b09965624 --- CONTROL/control | 2 +- webif/lib/rsv.class | 24 ++++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/CONTROL/control b/CONTROL/control index 46bb4780..d08cf36e 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 1.2.8-11 +Version: 1.2.8-12 Architecture: mipsel Maintainer: af123@hummypkg.org.uk Depends: tcpfix,webif-channelicons(>=1.1.20),lighttpd(>=1.4.39-1),jim(>=0.76),jim-oo,jim-sqlite3(>=0.76),jim-cgi(>=0.7-1),jim-binary(>=0.76),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.1),hmt(>=2.0.9),ssmtp,cron-daemon(>=1.18.3-2),anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7) diff --git a/webif/lib/rsv.class b/webif/lib/rsv.class index a7a28f2a..f6ff023e 100755 --- a/webif/lib/rsv.class +++ b/webif/lib/rsv.class @@ -329,10 +329,8 @@ rsv method insert {{table pending} {force 0}} { #puts $query #puts $bvals - $rsvdb query "begin transaction;" $rsvdb query "delete from ${table} where ulslot = $ulslot;" $rsvdb query $query {*}$bvals - $rsvdb query "commit transaction;" } proc {rsv list} {{table tbl_reservation} {extra ""}} { @@ -435,8 +433,8 @@ proc {rsv entry} {{table TBL_RESERVATION} crid svc} { return 0 } -proc {rsv fetch} {{table TBL_RESERVATION} ersvtype hsvc nsttime usevtid events} { - set res [$::rsvdb query " +proc {rsv fetch} {table ersvtype hsvc nsttime usevtid {crid ""} {extra ""}} { + set q " select $table.*, channel.TBL_SVC.szSvcName, channel.TBL_SVC.usLcn from $table @@ -444,9 +442,23 @@ proc {rsv fetch} {{table TBL_RESERVATION} ersvtype hsvc nsttime usevtid events} on $table.hSvc = channel.TBL_SVC.hSvc where $table.ersvtype = '%s' and $table.hsvc = '%s' - and $table.nsttime = '%s' and $table.usevtid = '%s' - " $ersvtype $hsvc $nsttime $usevtid] + " + set params "$ersvtype $hsvc $usevtid" + + if {$nsttime > 0} { + append q " and $table.nsttime = '%s' " + lappend params $nsttime + } + if {$crid ne ""} { + append q " and szCRID = '%s' " + lappend params $crid + } + if {$extra ne ""} { + append q " $extra " + } + + set res [$::rsvdb query $q {*}$params] if {[llength $res] > 0} { return [rsv new [lindex $res 0]]