New topic: Escape textual data function problem
<http://forums.realsoftware.com/viewtopic.php?t=46057> Page 1 of 1 [ 5 posts ] Previous topic | Next topic Author Message jamesbackus Post subject: Escape textual data function problemPosted: Tue Nov 27, 2012 2:04 pm Joined: Tue Nov 27, 2012 1:04 pm Posts: 2 I followed Mike Bailey's post of Sep 15, 2006 regarding Escape Textual data building a SQL statement as I had an apostrophy that would stop the search. The code works well in curing the apostraphy problem but now I can only Update once before having to leave the window and then come back it to do another Update. On another window with the same code except for the EscapeQuote SQL statement I can Update multiple times without any problem. The reworked SQL statement is: rs = App.InvestorsDB.SQLSelect("SELECT * FROM Sectors WHERE Topic = '" + EscapeQuotes ( sectorsTopic) + "'") The function I am using is: return replaceAll ( data, "'", "''" ) The working SQL statement is: rs = App.InvestorsDB.SQLSelect("SELECT * FROM Regions WHERE Topic = '" + regionsTopic + "'") Would anyone be able to explain why the first SQL statement only allows one Update and then stops while the second permits multiple Updates? Top timhare Post subject: Re: Escape textual data function problemPosted: Tue Nov 27, 2012 2:28 pm Joined: Fri Jan 06, 2006 3:21 pm Posts: 11841 Location: Portland, OR USA From what you posted, there is no reason it shouldn't work. You'll need to snoop around a little more and get more info about what's going wrong. The debugger should provide a lot of good info for you. To help see what's up, create your sql statement in a string variable. Also, check App.InvestorsDB.ErrorMessage after the SQLSelect call. Top ktekinay Post subject: Re: Escape textual data function problemPosted: Tue Nov 27, 2012 2:55 pm Joined: Mon Feb 05, 2007 5:21 pm Posts: 262 Location: New York, NY Also look into Prepared Statements as that is the preferred way for doing this. _________________ Kem Tekinay MacTechnologies Consulting http://www.mactechnologies.com/ Need to develop, test, and refine regular expressions? Try RegExRX. Top jamesbackus Post subject: Re: Escape textual data function problemPosted: Tue Nov 27, 2012 4:24 pm Joined: Tue Nov 27, 2012 1:04 pm Posts: 2 There is no error message; I press on the push button, it moves as expected and that is all that occurs. Without the EscapeQuotes the push button moves and an update occurs and I can make another change and the Update will work instead of "lock-up". I appreciate your giving this your time. Top timhare Post subject: Re: Escape textual data function problemPosted: Tue Nov 27, 2012 6:08 pm Joined: Fri Jan 06, 2006 3:21 pm Posts: 11841 Location: Portland, OR USA Well, that's a little more info at least. So you say your code locks up? Do you have to force quit the app? Again, have you stepped through this code in the debugger? Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 5 posts ] -- 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]
