Created
April 4, 2017 15:16
-
-
Save MCAR43/683977b7e789f9a5aa65d3d60b1d1f5f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void Query::getQuery(){ | |
| std::istringstream iss(raw_query); | |
| string selectLine, fromLine, whereLine, tempString, trashString; | |
| int newlineCounter = 0; | |
| int embeddedCounter = 0; | |
| string next; | |
| do{ | |
| if(newlineCounter == 0){ | |
| std::getline(iss,selectLine, '\n'); | |
| std::istringstream selectStream(selectLine); | |
| std::getline(selectStream, next, ' '); | |
| selectStatement.arguments.push_back(next); | |
| while(selectStream >> next){ | |
| selectStatement.arguments.push_back(next); | |
| } | |
| } | |
| else if(newlineCounter == 1){ | |
| std::getline(iss,fromLine, '\n'); | |
| std::istringstream fromStream(fromLine); | |
| std::getline(fromStream, next, ' '); | |
| fromStatement.arguments.push_back(next); | |
| while(fromStream >> next){ | |
| fromStatement.arguments.push_back(next); | |
| } | |
| } | |
| else if(newlineCounter == 2){ | |
| std::getline(iss,whereLine, '\n'); | |
| std::istringstream whereStream(whereLine); | |
| std::getline(whereStream, next, ' '); | |
| whereStatement.arguments.push_back(next); | |
| while(whereStream >> next){ | |
| whereStatement.arguments.push_back(next); | |
| } | |
| } | |
| newlineCounter++; | |
| } while(!endOfQuery(next, ';')); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment