- SDWORD cb;
- int i_dbDataType;
- int i=0;
- char s_temp[1024+1];
- long l_temp;
- double f_temp;
- int AnzError=0;
- TIMESTAMP_STRUCT t_temp;
- wxString Temp0;
- //-----------------------------
- if (!db_BrowserDB->GetNext())
- {
- return FALSE;
- Temp0.Printf(_("\n-E-> BrowserDB::OnGetNext - ODBC-Error with GetNext \n-E-> "));
- Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
- wxLogMessage(Temp0);
- wxMessageBox(Temp0);
- }
- else
- {
- for (i=0;i<Cols;i++)
- {
- strcpy((cl_BrowserDB+i)->tableName,"-E->");
- i_dbDataType = (cl_BrowserDB->pColFor+i)->i_dbDataType;
- if (i_dbDataType == 0) // Filter unsupported dbDataTypes
- {
- if (((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_VARCHAR) || ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_LONGVARCHAR))
- i_dbDataType = DB_DATA_TYPE_VARCHAR;
- if ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_C_DATE)
- i_dbDataType = DB_DATA_TYPE_DATE;
- if ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_C_BIT)
- i_dbDataType = DB_DATA_TYPE_INTEGER;
- if ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_NUMERIC)
- i_dbDataType = DB_DATA_TYPE_VARCHAR;
- if ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_REAL)
- i_dbDataType = DB_DATA_TYPE_FLOAT;
- }
- if ((i_dbDataType == DB_DATA_TYPE_INTEGER) && ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_C_DOUBLE))
- { // DBASE Numeric
- i_dbDataType = DB_DATA_TYPE_FLOAT;
- }
- switch(i_dbDataType)
- {
- case DB_DATA_TYPE_VARCHAR:
- strcpy(s_temp,"");
- if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_dbDataType,&s_temp,sizeof(s_temp), &cb))
- {
- Temp0.Printf(_("\n-E-> BrowserDB::OnGetNext - ODBC-Error with GetNext of >%s<.\n-E-> "),(cl_BrowserDB+i)->tableName);
- Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
- wxLogMessage(Temp0);
- }
- Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,s_temp);
- strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
- break;
- case DB_DATA_TYPE_INTEGER:
- l_temp = 0;
- if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_sqlDataType,&l_temp,sizeof(l_temp), &cb))
- {
- Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
- Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
- }
- else
- {
- Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,l_temp);
- strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
- }
- break;
- case DB_DATA_TYPE_FLOAT:
- f_temp = 0;
- if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_sqlDataType,&f_temp,sizeof(f_temp), &cb))
- {
- Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
- Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
- wxMessageBox(Temp0);
- }
- else
- {
- Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,f_temp);
- strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
- }
- break;
- case DB_DATA_TYPE_DATE:
- t_temp.day = t_temp.month = t_temp.year = t_temp.hour = t_temp.minute = t_temp.second = t_temp.fraction = 0;
- if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_sqlDataType,&t_temp,sizeof(t_temp), &cb))
- {
- Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
- Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
- }
- else
- {
- // i_Nation = 0 = timestamp , 1=EU, 2=UK, 3=International, 4=US
- if (((cl_BrowserDB->pColFor+i)->i_Nation == 0) || // TS YYYY-MM-DD
- ((cl_BrowserDB->pColFor+i)->i_Nation == 3)) // IT YYYY-MM-DD
- {
- Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,t_temp.year,t_temp.month,t_temp.day,
- t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction);
- strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
- }
- if (((cl_BrowserDB->pColFor+i)->i_Nation == 1) || // EU DD.MM.YYYY
- ((cl_BrowserDB->pColFor+i)->i_Nation == 2)) // UK DD/MM/YYYY
- {
- Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,t_temp.day,t_temp.month,t_temp.year,
- t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction);
- strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
- }
- if ((cl_BrowserDB->pColFor+i)->i_Nation == 3) // US MM/DD/YYYY
- {
- Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,t_temp.month,t_temp.day,t_temp.year,
- t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction);
- strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
- }
- }
- break;
- default:
- AnzError++;
- if (AnzError <= 100)
- {
- Temp0 = (cl_BrowserDB+i)->colName;
- wxLogMessage(_("-E-> BrowserDB::OnGetNext - DB_DATA_TYPE_?? (%d) in Col(%s)"),(cl_BrowserDB->pColFor+i)->i_dbDataType,Temp0.c_str());
- }
- else
- return TRUE;
- Temp0.Printf(_("-E-> unknown Format(%d) - sql(%d)"),(cl_BrowserDB->pColFor+i)->i_dbDataType,(cl_BrowserDB->pColFor+i)->i_sqlDataType);
- strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
- break;
- };
- }
- }
- // wxLogMessage("-E-> BrowserDB::OnGetNext - End");
- return TRUE;
+ SDWORD cb;
+ int i_dbDataType;
+ int i=0;
+ wxChar s_temp[1024+1];
+ long l_temp;
+ double f_temp;
+ int AnzError=0;
+ TIMESTAMP_STRUCT t_temp;
+ wxString Temp0;
+ //-----------------------------
+ if (!db_BrowserDB->GetNext())
+ {
+#ifdef __WXDEBUG__
+ Temp0.Printf(_("\n-E-> BrowserDB::OnGetNext - ODBC-Error with GetNext \n-E-> "));
+ Temp0 += GetExtendedDBErrorMsg(__TFILE__,__LINE__);
+ wxLogMessage(Temp0);
+ wxMessageBox(Temp0);
+#endif
+ return FALSE;
+ }
+ else
+ {
+ for (i=0;i<Cols;i++)
+ {
+ wxStrcpy((cl_BrowserDB+i)->tableName,_T("-E->"));
+ i_dbDataType = (cl_BrowserDB+i)->pColFor->i_dbDataType;
+ if (i_dbDataType == 0) // Filter unsupported dbDataTypes
+ {
+ if (((cl_BrowserDB+i)->pColFor->i_sqlDataType == SQL_VARCHAR) ||
+ ((cl_BrowserDB+i)->pColFor->i_sqlDataType == SQL_LONGVARCHAR))
+ i_dbDataType = DB_DATA_TYPE_VARCHAR;
+ if ((cl_BrowserDB+i)->pColFor->i_sqlDataType == SQL_C_DATE)
+ i_dbDataType = DB_DATA_TYPE_DATE;
+ if ((cl_BrowserDB+i)->pColFor->i_sqlDataType == SQL_C_BIT)
+ i_dbDataType = DB_DATA_TYPE_INTEGER;
+ if ((cl_BrowserDB+i)->pColFor->i_sqlDataType == SQL_NUMERIC)
+ i_dbDataType = DB_DATA_TYPE_VARCHAR;
+ if ((cl_BrowserDB+i)->pColFor->i_sqlDataType == SQL_REAL)
+ i_dbDataType = DB_DATA_TYPE_FLOAT;
+ }
+ if ((i_dbDataType == DB_DATA_TYPE_INTEGER) &&
+ ((cl_BrowserDB+i)->pColFor->i_sqlDataType == SQL_C_DOUBLE))
+ { // DBASE Numeric
+ i_dbDataType = DB_DATA_TYPE_FLOAT;
+ }
+ switch(i_dbDataType)
+ {
+ case DB_DATA_TYPE_VARCHAR:
+ wxStrcpy(s_temp,_T(""));
+ if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB+i)->pColFor->i_dbDataType,&s_temp,sizeof(s_temp), &cb))
+ {
+ Temp0.Printf(_("\n-E-> BrowserDB::OnGetNext - ODBC-Error with GetNext of >%s<.\n-E-> "),(cl_BrowserDB+i)->tableName);
+ Temp0 += GetExtendedDBErrorMsg(__TFILE__,__LINE__);
+ wxLogMessage(Temp0);
+ }
+ Temp0.Printf((cl_BrowserDB+i)->pColFor->s_Field,s_temp);
+ wxStrcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
+ break;
+ case DB_DATA_TYPE_INTEGER:
+ l_temp = 0;
+ if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB+i)->pColFor->i_sqlDataType,&l_temp,sizeof(l_temp), &cb))
+ {
+ Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
+ Temp0 += GetExtendedDBErrorMsg(__TFILE__,__LINE__);
+ }
+ else
+ {
+ Temp0.Printf((cl_BrowserDB+i)->pColFor->s_Field,l_temp);
+ wxStrcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
+ }
+ break;
+ case DB_DATA_TYPE_FLOAT:
+ f_temp = 0;
+ if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB+i)->pColFor->i_sqlDataType,&f_temp,sizeof(f_temp), &cb))
+ {
+ Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
+ Temp0 += GetExtendedDBErrorMsg(__TFILE__,__LINE__);
+ wxMessageBox(Temp0);
+ }
+ else
+ {
+ Temp0.Printf((cl_BrowserDB+i)->pColFor->s_Field,f_temp);
+ wxStrcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
+ }
+ break;
+ case DB_DATA_TYPE_DATE:
+ t_temp.day = t_temp.month = t_temp.year = t_temp.hour = t_temp.minute = t_temp.second = t_temp.fraction = 0;
+ if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB+i)->pColFor->i_sqlDataType,&t_temp,sizeof(t_temp), &cb))
+ {
+ Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
+ Temp0 += GetExtendedDBErrorMsg(__TFILE__,__LINE__);
+ }
+ else
+ {
+ // i_Nation = 0 = timestamp , 1=EU, 2=UK, 3=International, 4=US
+ if (((cl_BrowserDB+i)->pColFor->i_Nation == 0) || // TS YYYY-MM-DD
+ ((cl_BrowserDB+i)->pColFor->i_Nation == 3)) // IT YYYY-MM-DD
+ {
+ Temp0.Printf((cl_BrowserDB+i)->pColFor->s_Field,t_temp.year,t_temp.month,t_temp.day,
+ t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction);
+ wxStrcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
+ }
+ if (((cl_BrowserDB+i)->pColFor->i_Nation == 1) || // EU DD.MM.YYYY
+ ((cl_BrowserDB+i)->pColFor->i_Nation == 2)) // UK DD/MM/YYYY
+ {
+ Temp0.Printf((cl_BrowserDB+i)->pColFor->s_Field,t_temp.day,t_temp.month,t_temp.year,
+ t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction);
+ wxStrcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
+ }
+ if ((cl_BrowserDB+i)->pColFor->i_Nation == 3) // US MM/DD/YYYY
+ {
+ Temp0.Printf((cl_BrowserDB+i)->pColFor->s_Field,t_temp.month,t_temp.day,t_temp.year,
+ t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction);
+ wxStrcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
+ }
+ }
+ break;
+ default:
+ AnzError++;
+ if (AnzError <= 100)
+ {
+ Temp0 = (cl_BrowserDB+i)->colName;
+ wxLogMessage(_("-E-> BrowserDB::OnGetNext - DB_DATA_TYPE_?? (%d) in Col(%s)"),(cl_BrowserDB+i)->pColFor->i_dbDataType,Temp0.c_str());
+ }
+ else
+ return TRUE;
+ Temp0.Printf(_("-E-> unknown Format(%d) - sql(%d)"),(cl_BrowserDB+i)->pColFor->i_dbDataType,(cl_BrowserDB+i)->pColFor->i_sqlDataType);
+ wxStrcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
+ break;
+ }; // switch
+ } // for
+ } // else
+
+ return TRUE;