Changeset 18 for trunk/tmdmcreator/src/tmdmprocessor.cpp
- Timestamp:
- 02/22/13 13:30:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tmdmcreator/src/tmdmprocessor.cpp
r17 r18 61 61 62 62 63 bool TmDmProcessorSimple::ProcessBlock(int blockstart ) {64 wx String mySQLCols = wxEmptyString;65 wxString mySQLTxt = wxEmptyString;63 bool TmDmProcessorSimple::ProcessBlock(int blockstart, const wxString & tablename) { 64 wxArrayString mySQLCols; 65 TmDmCopier myCopier(m_FileDst); 66 66 67 67 wxFileInputStream input(m_FileSrc.GetFullPath()); … … 69 69 long myLineIndex = 0; 70 70 while(input.IsOk() && !input.Eof() ){ 71 wxString myRow = text.ReadLine(); 71 72 if (myLineIndex <= blockstart) { 72 73 myLineIndex++; … … 74 75 } 75 76 76 wxString myRow = text.ReadLine(); 77 if (myLineIndex == blockstart+1) { 78 mySQLCols = wxStringTokenize(myRow, _T("\t"), wxTOKEN_RET_EMPTY); 79 myLineIndex++; 80 continue; 81 } 77 82 78 // HERE !!! 83 wxArrayString myValues = wxStringTokenize(myRow, _T("\t"), wxTOKEN_RET_EMPTY_ALL); 84 bool bEmpty = true; 85 for (unsigned int i = 0; i< myValues.GetCount(); i++) { 86 if (myValues[i] != wxEmptyString) { 87 bEmpty = false; 88 break; 89 } 90 } 91 if (bEmpty == true) { 92 // ok empty line found 93 return true; 94 } 79 95 80 81 96 // write insert sentence 97 wxString myInsert = wxString::Format(_T("INSERT INTO `%s` ("), tablename); 98 for (unsigned int i = 0; i< mySQLCols.GetCount(); i++) { 99 myInsert.Append(wxString::Format(_T("%s,"), mySQLCols.Item(i))); 100 } 101 myInsert.RemoveLast(); 102 myInsert.Append(_T(") VALUES (")); 103 for (unsigned int i = 0; i< mySQLCols.GetCount(); i++) { 104 myInsert.Append(wxString::Format(_T("\"%s\","), myValues.Item(i))); 105 } 106 myInsert.RemoveLast(); 107 myInsert.Append(_T(");\n")); 108 myCopier.CopyFrom(myInsert); 82 109 myLineIndex++; 83 110 } 84 return wxNOT_FOUND;85 86 87 88 89 111 return false; 90 112 } … … 104 126 } 105 127 106 bool TmDmProcessorAttributs::ProcessBlock(int blockstart ) {128 bool TmDmProcessorAttributs::ProcessBlock(int blockstart, const wxString & tablename) { 107 129 return false; 108 130 }
Note: See TracChangeset
for help on using the changeset viewer.