Thursday, 15 July 2010

mysql - SQL Query into a STRING$ -



mysql - SQL Query into a STRING$ -

i have mysql query (about 20 lines long). want know if there online or other can create string code. example...

select `tblapplied`.* , `tbljobs`.* , concat(salutation," ",firstname," ",lastname) , `tblusers`.`id` , `tblcountry`.`countryname` , `tblquestions`.`question` , `tblquestions_1`.`question`

becomes

mysql = "select" mysql += "`tblapplied`.*" mysql += ", `tbljobs`.*" mysql += ", concat(salutation," ",firstname," ",lastname)"

and on, picture.. inquire because maintain on having embed sql code , able quick convert string$

many thanks

i time text editor allows me search , replace end of line characters new characters.

my editor of selection notetab pro, sure there many others.

in text editor, line end represented ^p, re-create raw sql new document , replace

^p

with

"^p mysql += "

this add together double quote @ end of each line , mysql += " @ origin of next line.

this has saved me tons of time on years , simple use.

one other comment: if code, using stringbuilder instead of string concatenation since concatenation generate lot of unnecessary string objects clean up.

there powerful tool in our arsenal utilize automatically generating sql (such add together or insert stored procedures) , code (such dto classes) existing database tables or views: codesmith.

this tool allows write code can format output whatever need be. have little ramp time , wouldn't applicable if writing sql in runtime tool test prior moving code, aware of other tasks.

mysql vb.net string

No comments:

Post a Comment