New topic: 

RealSQLDatabase SQLExecute Error   - Solved

<http://forums.realsoftware.com/viewtopic.php?t=46186>

         Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic          Author  
Message        AurelianRQ          Post subject: RealSQLDatabase SQLExecute 
Error - SolvedPosted: Mon Dec 10, 2012 5:33 am                         
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             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to