Hi Everyone,
Please pardon me if I am asking extremely stupid questions, but I'm starting to do some work with my database and I have a few questions about EnterpriseObjects and database things in general...
The first question is about creating unique data... I have a user object and I need unique usernames for obvious reasons. Now, I know it is unlikely, but let's say that two visitors attempt to create a user at the same time and they happen to pick the same username.
EOQualifier qualifier = User.SCREEN_NAME.eq(username);
if(User.fetchUser(ec, qualifier) == null) {
User.createUser(ec, email, password, username);
ec.saveChanges();
}
If these fired at the same time, is it possible that two users with the same username could be created? If so, does anyone have any pointers to prevent duplicate data?
The second question regards security/sql injection. Is there any sort of user input I should be on the lookout for in my validateUsername method? Like username "admin'--" or some such? I assume that as long as I stick to EOQualifiers and don't touch the SQL myself that all the input will be properly escaped...
Finally, third question... I'm using MySQL. I will ensure InnoDB is used by default as mentioned here:
Is there anything else I need to do in order to produce ACID transactions with WO? It doesn't hurt to be buzzword compliant you know ;-)
Thanks everybody! I really appreciate the help everyone here provides.