sqldata/sqlmysqlapi.cpp
// Initialize the bulk copy from one database into another
Initialize the bulk copy from one database into another
Initialize the bulk copy from one database into another
int SqlMysqlApi::InitBulkTransfer(const char *table, size_t col_count, size_t , SqlCol * , SqlCol ** )
{
	TRACE("MySQL/C InitBulkTransfer() Entered");
	_ldi_cols = NULL;
	_ldi_cols_count = col_count;
	_load_command = "LOAD DATA LOCAL INFILE 'sqldata.in_memory' IGNORE INTO TABLE "; 
	_load_command += table;
	TRACE(_load_command.c_str());
	TRACE_DMP_INIT(table);
	_ldi_rc = 0;
	_ldi_terminated = 0;
	_ldi_current_row = 0;
	_ldi_current_col = 0;
	_ldi_current_col_len = 0;
	_ldi_write_newline = false;
	_ldi_lob_data = NULL;
	_ldi_lob_size = 0;
	_ldi_bytes = 0;
	_ldi_bytes_all = 0;
#if defined(WIN32) || defined(WIN64)
	ResetEvent(_wait_event);
	ResetEvent(_completed_event);
	_beginthreadex(NULL, 0, StartLoadDataInfileS, this, 0, NULL);
	WaitForSingleObject(_completed_event, INFINITE);
#else
	Os::ResetEvent(&_wait_event);
	Os::ResetEvent(&_completed_event);
	pthread_t thread;
	pthread_create(&thread, NULL, StartLoadDataInfileS, this);
	Os::WaitForEvent(&_completed_event);
#endif
	TRACE("MySQL/C InitBulkTransfer() Left");
	return _ldi_rc;
}
int SqlMysqlApi :: InitBulkTransfer ( const char * table , size_t col_count , size_t , SqlCol * , SqlCol * * ) { TRACE ( " " ) ; _ldi_cols = NULL ; _ldi_cols_count = col_count ; _load_command = " " ; _load_command += table ; TRACE ( _load_command . c_str ( ) ) ; TRACE_DMP_INIT ( table ) ; _ldi_rc = 0 ; _ldi_terminated = 0 ; _ldi_current_row = 0 ; _ldi_current_col = 0 ; _ldi_current_col_len = 0 ; _ldi_write_newline = false ; _ldi_lob_data = NULL ; _ldi_lob_size = 0 ; _ldi_bytes = 0 ; _ldi_bytes_all = 0 ; #if defined ( WIN32 ) || defined ( WIN64 ) ResetEvent ( _wait_event ) ; ResetEvent ( _completed_event ) ; _beginthreadex ( NULL , 0 , StartLoadDataInfileS , this , 0 , NULL ) ; WaitForSingleObject ( _completed_event , INFINITE ) ; #else Os :: ResetEvent ( & _wait_event ) ; Os :: ResetEvent ( & _completed_event ) ; pthread_t thread ; pthread_create ( & thread , NULL , StartLoadDataInfileS , this ) ; Os :: WaitForEvent ( & _completed_event ) ; #endif TRACE ( " " ) ; return _ldi_rc ; }
Initialize the bulk copy from one database into another
Initialize the bulk copy from one database into another
/*allocated_array_rows*/ /*s_cols*/ /*t_cols*/ // Column metadata and data passed directly to TransferRows // Counters must be reset to clear data for the previous table // Run blocking LOAD DATA INFILE command in a separate thread // Wait until the thread started // Return code typically 0 as init function waits for LDI thread to start only, but in case cases init can catch LDI errors