| |

VerySource

 Forgot password?
 Register
Search
View: 638|Reply: 3

Please help parse the SQL string!

[Copy link]

4

Threads

4

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 Invalid IP Address

Post time: 2020-1-11 09:20:01
| Show all posts |Read mode
CString strSql = "updata t_table set aa = bb";

Please heroes help, parse it out
CString a;
CString b;
CString c;
CString d;
CString e;
CString f;
Shown as:
a = "updata";
b = "t_table";
c = "set";
d = "aa";
e = "=";
f = "bb";
Reply

Use magic Report

0

Threads

57

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 China

Post time: 2020-1-14 19:09:01
| Show all posts
CStringT :: Tokenize
// typedef CStringT <TCHAR, StrTraitATL <TCHAR>> CAtlString;
CAtlString str ("% First Second # Third");
CAtlString resToken;
int curPos = 0;

resToken = str.Tokenize ("% #", curPos);
while (resToken! = "")
{
   printf ("Resulting token:% s\n", resToken);
   resToken = str.Tokenize ("% #", curPos);
};
-----------------------------
Resulting Token: First
Resulting Token: Second
Resulting Token: Third
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 United States

Post time: 2020-1-14 20:27:02
| Show all posts
CString strSql = "updata t_table set aa = bb";
CString a;
CString b;
CString c;
CString d;
CString e;
CString f;
int i = strSql.Find ("");
a = strSql.Left (i-1);
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-15 14:45:01
| Show all posts
CString strSql = "updata t_table set aa = bb";
CString a;
CString b;
CString c;
CString d;
CString e;
CString f;
int i = strSql.Find ("", 0);-where the next parameter starts to find
a = strSql.Left (i-1);
j = strSql.Find ("", i);
b = strSql.Mid (i, j);

Probably so. . .
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list