From f235b0502683c6b7f213dd564196725de9cbcdbe Mon Sep 17 00:00:00 2001 From: hummypkg Date: Wed, 14 Sep 2011 16:58:11 +0000 Subject: [PATCH] fix insert bugs git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@396 2a923420-c742-0410-a762-8d5b09965624 --- CONTROL/control | 2 +- var/mongoose/cgi-bin/backup/restore.jim | 10 +++++++--- var/mongoose/lib/rsv.class | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CONTROL/control b/CONTROL/control index b876760..1dbd51a 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 0.7.0 +Version: 0.7.0-1 Architecture: mipsel Maintainer: af123@hummypkg.org.uk Depends: mongoose(>=3.0-2),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.4),jim-oo,jim-pack,service-control,busybox(>=1.18.3-1),lsof,epg(>=1.0.3),hmt(>=1.0.6),ssmtp diff --git a/var/mongoose/cgi-bin/backup/restore.jim b/var/mongoose/cgi-bin/backup/restore.jim index 3a362e5..67c845c 100755 --- a/var/mongoose/cgi-bin/backup/restore.jim +++ b/var/mongoose/cgi-bin/backup/restore.jim @@ -29,11 +29,11 @@ if {![file exists $ffile]} { } if {[catch { set fd [open $ffile r] } msg]} { - puts "Error opening backup file. - $msg" + puts "Error opening $file - $msg" exit } -puts "Restoring scheduled events..." +puts "Restoring scheduled events from $file..." $rsvdb query {begin transaction;} $rsvdb query {delete from TBL_RESERVATION;} @@ -76,7 +76,11 @@ foreach line $data { } } - if {!$bad} { $rsv insert } + if {!$bad} { + if {[catch {$rsv insert pending 1} msg]} { + puts " Error inserting event, $msg" + } + } } $rsvdb query {commit transaction;} diff --git a/var/mongoose/lib/rsv.class b/var/mongoose/lib/rsv.class index 4fe85d7..3fea91a 100755 --- a/var/mongoose/lib/rsv.class +++ b/var/mongoose/lib/rsv.class @@ -137,11 +137,11 @@ rsv method fix_hsvc {} { return $hsvc } -rsv method insert {{table pending}} { +rsv method insert {{table pending} {force 0}} { global rsvdb # Duplicate check - all tables - if {$szCRID ne "" && $action == 0} { + if {!$force && $szCRID ne "" && $action == 0} { foreach tab {pending TBL_RESERVATION} { set rec [$rsvdb query " select ulslot from $tab @@ -302,7 +302,7 @@ proc {rsv commit} {} { foreach rec [rsv list pending] { if {[$rec get action] == 0} { $rec clear_ulslot - $rec insert TBL_RESERVATION + $rec insert TBL_RESERVATION 1 } } $::rsvdb query {delete from pending}