sqldata/sqldata.cpp
// Run the data transfer or validation
Run the data transfer or validation
Run the data transfer or validation
int SqlData::Run()
{
	if(_tables == NULL && _queries == NULL)
		return 1;
	_tables_in_progress.clear();
	_meta_in_progress.clear();
	_s_total_rows = 0;
	_t_total_rows = 0;
	_s_total_bytes = 0;
	_t_total_bytes = 0;
#if defined(WIN32) || defined(_WIN64)
	_completed_event = CreateEvent(NULL, FALSE, FALSE, NULL); 
#else
	Os::CreateEvent(&_completed_event);
#endif
	size_t start = GetTickCount();
	StartLocalWorkers();
#if defined(WIN32) || defined(_WIN64)
	WaitForSingleObject(_completed_event, INFINITE);
#else
	Os::WaitForEvent(&_completed_event);
#endif
	if(_callback)
	{
		SqlDataReply reply;
		reply._cmd = (short)_command;
		reply._cmd_subtype = SQLDATA_CMD_ALL_COMPLETE;
		reply._s_int1 = _s_total_rows;
		reply._t_int1 = _t_total_rows;
		reply._s_bigint1 = _s_total_bytes;
		reply._t_bigint1 = _t_total_bytes;
		reply._time_spent = GetTickCount() - start;
		reply._int1 = (int)reply._time_spent;
		_callback(_callback_object, &reply);
	}
	return 0;
}
int SqlData :: Run ( ) { if ( _tables == NULL && _queries == NULL ) return 1 ; _tables_in_progress . clear ( ) ; _meta_in_progress . clear ( ) ; _s_total_rows = 0 ; _t_total_rows = 0 ; _s_total_bytes = 0 ; _t_total_bytes = 0 ; #if defined ( WIN32 ) || defined ( _WIN64 ) _completed_event = CreateEvent ( NULL , FALSE , FALSE , NULL ) ; #else Os :: CreateEvent ( & _completed_event ) ; #endif size_t start = GetTickCount ( ) ; StartLocalWorkers ( ) ; #if defined ( WIN32 ) || defined ( _WIN64 ) WaitForSingleObject ( _completed_event , INFINITE ) ; #else Os :: WaitForEvent ( & _completed_event ) ; #endif if ( _callback ) { SqlDataReply reply ; reply . _cmd = ( short ) _command ; reply . _cmd_subtype = SQLDATA_CMD_ALL_COMPLETE ; reply . _s_int1 = _s_total_rows ; reply . _t_int1 = _t_total_rows ; reply . _s_bigint1 = _s_total_bytes ; reply . _t_bigint1 = _t_total_bytes ; reply . _time_spent = GetTickCount ( ) - start ; reply . _int1 = ( int ) reply . _time_spent ; _callback ( _callback_object , & reply ) ; } return 0 ; }
Run the data transfer or validation
Run the data transfer or validation
// Create an event to wait for completion of all tasks // Start local in-process workers // Wait until all tasks are completed // Notify on operation completion