Re: n00b EO questions :-)
Re: n00b EO questions :-)
- Subject: Re: n00b EO questions :-)
- From: Chuck Hill <email@hidden>
- Date: Thu, 22 May 2008 20:04:39 -0700
On May 22, 2008, at 7:50 PM, Rams wrote:
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?
Create a unique constraint in the database. WO 5.4 has support for
indexes in the Model (props to Pierre for that!), but I have not had a
chance to take them for a spin.
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...
I can't think of how to do SQL Injection attacks.
Finally, third question... I'm using MySQL. I will ensure InnoDB is
used by default as mentioned here:
http://homepage.mac.com/kelleherk/iblog/C711669388/E20070719095201/index.html
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 ;-)
I don't use it and don't know.
Chuck
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden