New topic: Database Best Practices
<http://forums.realsoftware.com/viewtopic.php?t=39786> Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message mbeaucourt Post subject: Database Best PracticesPosted: Mon Jul 11, 2011 6:28 am Joined: Fri Sep 30, 2005 11:44 am Posts: 63 Location: Antwerp, Belgium Hi all, I've been working with REALbasic for years and I'm using MySQL a lot in my applications. Now, in the past, I've used SQLExecute for updates and inserts, creating my own queries and stuff, having to check input (for SQL injection etc...). But i recently discovered (read: really started to like) the DatabaseRecord class and the ability to Edit records with rs.Edit/rs.Update (I guess I must have been living under a rock that I didn't discover those earlier ). Now I'm wondering 1. what is the best way to insert records with MySQL? - write my own insert query and use SQLExecute - or create a DatabaseRecord and use App.db.InsertRecord? 2. What is the best way to update records with MySQL? - write my own update query and use SQLExecute - Or use rs.Edit and rs.Update? Are 'DatabaseRecord', rs.Edit and rs.Update sufficiently 'SQL Injection-safe' or do I need to do more checks before using those. Any suggestions about best practices here would be really appreciated. Best Regards, Michael Top timhare Post subject: Re: Database Best PracticesPosted: Mon Jul 11, 2011 10:48 am Joined: Fri Jan 06, 2006 3:21 pm Posts: 9982 Location: Portland, OR USA DatabaseRecord and RecordSet.Edit are no more injection-safe than building your own sql statements. I use SQLExecute exclusively because it gives me better control. However, you might look into the new PreparedStatement methods. They are safer. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 2 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]
