Welcome Guest, Not a member yet? Register   Sign In
Best Practice for Database Concurrency?
#1

[eluser]cyang[/eluser]
Hey everyone. Just getting started with CodeIgniter, and gotta say I'm having a blast. The term that comes to mind is "controlled chaos", as I can still do whatever I want but have some semblance of order ;-)

Anyways, probably a basic question, but is there some best practice for database-related concurrency? Specifically, I'm implementing an user auth system (actually just using Redux Auth) and want to add a uniqueness check on usernames and emails. Since (hopefully) there might be many registrations at once, I'd imagine a simple database scan followed by insert is a definite race condition. I've thought about using the database class transactions (e.g. $this->db->trans_start()) and also adding a uniqueness constraint directly in the database, but I feel like these will make my app platform dependent (e.g. what if, using MySQL, I want to convert my users table to MyISAM for speed, which I believe doesn't support transactions). Also, I'd then have to rely on catching a database error/exception, and I'd rather validate first, rather than try-and-correct (also not 100% sure how PHP/CI does error handling; I remember it's php4, so no exceptions, right?).

So to sum it up, is there some best-practice for this kind of stuff? Thanks, any help would be greatly appreciated!


Messages In This Thread
Best Practice for Database Concurrency? - by El Forum - 07-30-2008, 06:06 PM
Best Practice for Database Concurrency? - by El Forum - 07-30-2008, 06:50 PM
Best Practice for Database Concurrency? - by El Forum - 07-31-2008, 12:49 AM
Best Practice for Database Concurrency? - by El Forum - 07-31-2008, 01:48 AM
Best Practice for Database Concurrency? - by El Forum - 07-31-2008, 03:05 PM
Best Practice for Database Concurrency? - by El Forum - 07-31-2008, 09:32 PM
Best Practice for Database Concurrency? - by El Forum - 09-11-2009, 05:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB