Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Tue Jul 17, 2018 4:30 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: RealSQLDatabase SQLExecute Error - Solved
PostPosted: Mon Dec 10, 2012 5:33 am 
Offline

Joined: Mon Aug 29, 2011 12:21 pm
Posts: 4
Greetings,

I`m working on an project based that uses RealSQLDatabase

I`m taking the SQL String From a remote location by parsing an XML file and doing and db.SQLExecute procedure.

Same string if I put it directly in the code works perfectly, if I put it trough the parsed function after all the trim and sqlify I get an error 1 and on the error message it says Error Near "

I`m already going crazy with this for one week, can somebody help me please .

On the XML o have
<sqlval>'CREATE TABLE updsqlt(id integer PRIMARY KEY NOT NULL, SoftVers string, UpdImportance string, Description text, SQLVal text, Database string, UpdateStat integer, UpdateDate timestamp, UpdatedOn timestamp)'</sqlval>


Then I do the parsing and I get

'CREATE TABLE updsqlt(id integer PRIMARY KEY NOT NULL, SoftVers string, UpdImportance string, Description text, SQLVal text, Database string, UpdateStat integer, UpdateDate timestamp, UpdatedOn timestamp)'


Finally I have

Dim test as string

test = EscapeSQLData(valSql)

Then I do the EscapeSQLData function and I get

"CREATE TABLE updsqlt(id integer PRIMARY KEY NOT NULL, SoftVers string, UpdImportance string, Description text, SQLVal text, Database string, UpdateStat integer, UpdateDate timestamp, UpdatedOn timestamp)"


And the Code :

I do an db connect before in app.open and db decrypt so the connection is ok.

db.SQLExecute("BEGIN TRANSACTION")

db.SQLExecute(test)

if App.db.Error then
MsgBox App.db.ErrorMessage
MsgBox "db Error Code : " + Str(App.db.ErrorCode)
else
App.db.Commit()
end if


In the end if I put the same code in the place of test it works perfectly, if I use all the procedures to get the string, and to run it I get that nasty error with near """: syntax error.

Thanks in advance .

I`m using RealStudio 2012 Release 1.2 on MacBookPro Retina 15" with Mountain Lion 10.8.2 and the app is for mac only.

Best Regards,

Aurelian


Solved,

It seems that the App does not like the quotes in the string, if i remove them from the xml and i put them separate it works perfectly.

an
test = "'" + test + "'"
is enough before the
test = EscapeSQLData(valSql)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group