[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/utils/charm
From: Mirko Boehm <mirko () kde ! org>
Date: 2009-05-07 21:31:02
Message-ID: 1241731862.052101.19052.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 965074 by mirko:
r56653@cutiepie: mirko | 2009-05-06 22:15:24 +0200
- when removing a time sheet, also remove the entry in the time sheets table in a \
single transaction
- add one more error check
_M . (directory)
M +17 -1 trunk/Tools/TimesheetProcessor/Operations.cpp
--- trunk/playground/utils/charm/trunk/Tools/TimesheetProcessor/Operations.cpp \
#965073:965074 @@ -120,7 +120,11 @@
// retrieve index
{
QSqlQuery query( database.database() );
- query.exec( "SELECT id from timesheets WHERE id = last_insert_id()" );
+ if ( ! query.exec( "SELECT id from timesheets WHERE id = \
last_insert_id()" ) ) { + QString msg = QObject::tr( "SQL error \
retrieving index for time sheet %1.").arg(cmd.filename() ); + throw \
TimesheetProcessorException( msg ); + }
+
if ( query.next() ) {
const int idField = query.record().indexOf( "id" );
index = query.value( idField ).toInt();
@@ -156,8 +160,20 @@
Database database;
database.login();
+ SqlRaiiTransactor transaction( database.database() );
database.deleteEventsForReport( cmd.userid(), cmd.index() );
+ {
+ QSqlQuery query( database.database() );
+ query.prepare( "DELETE from timesheets WHERE id = :index" );
+ query.bindValue( QString::fromAscii( ":index" ), cmd.index() );
+ if ( ! query.exec() ) {
+ QString msg = QObject::tr( "Error removing timesheet \
%1.").arg(cmd.index() ); + throw TimesheetProcessorException( msg );
+ }
+ }
+
+ transaction.commit();
cout << "Report " << cmd.index() << " removed" << endl;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic