[thelist] Web Forms to Access DB?

rudy r937 at interlog.com
Tue Jan 8 09:24:15 CST 2002

>The thing to be aware of is that getting the database design right
>in the first place can have a major impact on the effectiveness
>and speed of your site.
>(passes ball to the expert)

yes, that's right

getting the database design right is a good thing

for example, just today norman beresford posted some code for checking to
see whether a user logging in has entered the correct username/password --

> The way we'll check to see if it's an empty recordset is by looking to
> see if the current record is both the begining and end of the recordset.

in the remote chance that the username/password somehow got into the
database twice, the query to retrieve the username/password would return
two rows and the script would, incorrectly, bounce the user back to the
login page

what this means is that the page to add a new username/password has to have
logic to detect duplicate entries

this logic can be in the script or handled by a database unique constraint

if by script, the logic would be

    run a query to see if the username/password already exists
    if it does, issue an error
    otherwise, proceed with insert of username/password

if by database constraint, the logic would be

   insert username/password
   if database constraint violated, issue error

let's say that the incidence of somebody trying to add the same
username/password occurs one out of every hundred attempts

if you are using script logic, you will issue 199 database calls

if you let the database constraint handle it, you will only ever issue 100

not a big deal, admittedly, but there you go


More information about the thelist mailing list