Subversion Repositories DevTools

Rev

Rev 2265 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2265 Rev 2267
Line 62... Line 62...
62
        m_batchPrefix(batchPrefix),
62
        m_batchPrefix(batchPrefix),
63
        m_batchSize(0),
63
        m_batchSize(0),
64
        m_batchSuffix(batchSuffix),
64
        m_batchSuffix(batchSuffix),
65
        m_folder(folder),
65
        m_folder(folder),
66
        m_stream(0),
66
        m_stream(0),
67
        m_manifest(0)
67
        m_manifest(0),
-
 
68
        m_filename("")
68
  //## end TransactionStream::TransactionStream%4207228700FB.hasinit
69
  //## end TransactionStream::TransactionStream%4207228700FB.hasinit
69
  //## begin TransactionStream::TransactionStream%4207228700FB.initialization preserve=yes
70
  //## begin TransactionStream::TransactionStream%4207228700FB.initialization preserve=yes
70
  //## end TransactionStream::TransactionStream%4207228700FB.initialization
71
  //## end TransactionStream::TransactionStream%4207228700FB.initialization
71
{
72
{
72
  //## begin TransactionStream::TransactionStream%4207228700FB.body preserve=yes
73
  //## begin TransactionStream::TransactionStream%4207228700FB.body preserve=yes
Line 215... Line 216...
215
{
216
{
216
  //## begin TransactionStream::close%420819C203E4.body preserve=yes
217
  //## begin TransactionStream::close%420819C203E4.body preserve=yes
217
 
218
 
218
	if ( m_stream )
219
	if ( m_stream )
219
	{
220
	{
220
		m_stream->close();
221
      m_stream->close();
221
 
-
 
222
		delete m_stream;
222
		delete m_stream;
223
		m_stream = 0;
223
		m_stream = 0;
-
 
224
		
-
 
225
		AnsiString tmpathname, targetpathname;
-
 
226
      tmpathname = "../data/tmp/" + AnsiString( m_filename.c_str());
-
 
227
      targetpathname = AnsiString( m_folder.c_str()) + "\\" + AnsiString( m_filename.c_str());
-
 
228
      if (FileExists(tmpathname))
-
 
229
      {
-
 
230
         if (!RenameFile(tmpathname, targetpathname))
-
 
231
         {
-
 
232
            MessageDlg(	"cannot rename temporary UD file " + tmpathname
-
 
233
                        + " to " + targetpathname,
-
 
234
								mtConfirmation,TMsgDlgButtons() << mbOK, 0 ) ;
-
 
235
	      }
-
 
236
      }
-
 
237
      else
-
 
238
      {
-
 
239
         MessageDlg(	"cannot rename " + tmpathname + " as it does not exist",
-
 
240
							mtConfirmation,TMsgDlgButtons() << mbOK, 0 ) ;
-
 
241
	   }    
-
 
242
 
224
	}
243
	}
225
 
244
 
226
  //## end TransactionStream::close%420819C203E4.body
245
  //## end TransactionStream::close%420819C203E4.body
227
}
246
}
228
 
247
 
Line 251... Line 270...
251
 
270
 
252
//## Operation: newBatch%420722B50215
271
//## Operation: newBatch%420722B50215
253
const bool TransactionStream::newBatch (const unsigned &size, const std::string &name)
272
const bool TransactionStream::newBatch (const unsigned &size, const std::string &name)
254
{
273
{
255
  //## begin TransactionStream::newBatch%420722B50215.body preserve=yes
274
  //## begin TransactionStream::newBatch%420722B50215.body preserve=yes
-
 
275
	/**
-
 
276
	 *	Do we have a batch in progress
-
 
277
	 */
-
 
278
	if ( m_batchCount++ > 0 )
-
 
279
		{
-
 
280
			close();
-
 
281
			++m_batchNumber;
-
 
282
		}
256
 
283
 
257
	m_batchSize		= size;
284
	m_batchSize		= size;
258
	m_batchCount	= 0;
285
	m_batchCount	= 0;
259
	m_batchName		= name;
286
	m_batchName		= name;
260
	
287
	
Line 269... Line 296...
269
  //## begin TransactionStream::open%420819AE03C4.body preserve=yes
296
  //## begin TransactionStream::open%420819AE03C4.body preserve=yes
270
 
297
 
271
	close();	// Close the stream should it be open.
298
	close();	// Close the stream should it be open.
272
 
299
 
273
	std::string filename;
300
	std::string filename;
-
 
301
   AnsiString tmpathname;
274
	buildFileName( filename, m_folder, m_batchPrefix, m_batchSuffix, m_batchName, m_batchNumber );
302
	buildFileName( filename, "", m_batchPrefix, m_batchSuffix, m_batchName, m_batchNumber );
-
 
303
	
-
 
304
	m_filename = filename; //save for later
-
 
305
   tmpathname = "../data/tmp/" + AnsiString( filename.c_str());
-
 
306
 
275
 
307
 
276
	m_stream = new std::ofstream(
308
	m_stream = new std::ofstream(
277
		filename.c_str(),
309
		tmpathname.c_str(),
278
		std::ios_base::binary | std::ios_base::out );
310
		std::ios_base::binary | std::ios_base::out );
279
	if ( m_stream->is_open() )
311
	if ( m_stream->is_open() )
280
	{
312
	{
281
		if ( m_manifest )
313
		if ( m_manifest )
282
		{
314
		{