Results 1 to 10 of 10

Thread: Validations in an Application

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Validations in an Application

    I have a question about validations in applications.
    See, when we create apps, we always do input validation, thus there wont be any invalid data in our DBs. (assuming the validation is 100% accurate)

    And then we use these data for manipulation. For an example , we create an app to collect student marks to compute their grades.

    Since our input data is validated 100% , do we have to validate them in the computaion part again?

    This is the question I have. Do we need to take extra burden to validate them again when we do computations on the already validated data?


    And not to forget eventhough the app validates these data, we can change them in the DB itself (Admins?)
    So do we need to validate them again or make them validated in the DB? (if triggers are supported it d be easy I guess.)


    Hope you got my question clearly.

    Thanks In Advance
    IIF(Post.Rate > 0 , , )

  2. #2
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Validations in an Application

    I normally do validation on save of data. Then again when I go to use that data anywhere else. Just in case some one changed it in the DB using SQL commands.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Validations in an Application

    Quote Originally Posted by GaryMazzone
    Just in case some one changed it in the DB using SQL commands.
    This I m worried. We have so much data in our system which we validate in input (ie SaveData)
    ANd again when using them , we validte SOME of them.
    But do we have to do that everywhere for all the data we use?
    If so whats the point in validating in the input ?
    Its a real headache sometimes.
    IIF(Post.Rate > 0 , , )

  4. #4
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Validations in an Application

    I definatly agree with you on the headache part. But (espcially here) some places allow personnel access to the data directly and I want the results I display to be correct. So validate once and then once more and once more.....
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Validations in an Application

    I wonder if there is another way to do this.
    And if we have trigers, we could chek em in inserts and updates right?
    (Unfortunately DB version we have dont support trigers, but my question is general to any DD)
    IIF(Post.Rate > 0 , , )

  6. #6
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Validations in an Application

    You can use a trigger to test on update. If the value is not proper then the trigger can put the old value back in place. Just think you would have to check every column on each table. Lots of triggers. Then again I guess it would be a before after (before) insert also. Some could just try and add the data by hand from SQL statements.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Validations in an Application

    Yes, you are right.
    Trigger would be a mess If I try that. and I cant as for the moment we dont have any.

    So the final answer would be Validate ALWAYS to make sure its ok.
    And i guess its better to use custom validate functions right?
    We use it for basic types
    like currancy
    number
    email
    date

    but we should use some application specific validation functions also ?
    like Customer Ids' ?


    EDIT: big typo
    IIF(Post.Rate > 0 , , )

  8. #8
    Hyperactive Member Davadvice's Avatar
    Join Date
    Apr 2007
    Location
    Glasgow (Scotland)
    Posts
    440

    Re: Validations in an Application

    belts and braces,

    If you inherate a system then you also are unsure if the validation is 100%. however as stated in a systems like access then a user can just link to the db via word excel or open the file Direclty and alter the DB. i always validate the data at both ends. this also reduces the errors you could encounter on future computations.

    Dav

  9. #9
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Validations in an Application

    If customer ID's are application generated I would at least look at them. Are they carried down as an FK to another table?
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  10. #10

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Validations in an Application

    Quote Originally Posted by GaryMazzone
    If customer ID's are application generated I would at least look at them. Are they carried down as an FK to another table?
    Yes, they become FKs in many tables, almost every table. th CUSTOMERID is the heart of relations of bussinesslogic.
    Ther are many Ids like this. EG : GL ACcount IDs, ProductIDs, etc ...
    Ssome have specific formats. eg : GL Accounts
    But this FORMAT is not complusory. Its there only for the purpose of identification and sometimes to easily identify records.
    Eg: 01-02-003 -> BranchID-AccountType-SubAccountID

    But all these FORMATS are not complusory. So do we need to validate the format?
    I mean if its a FK, we can validate from the intergrity constraint , right? Should we bother to check them again?
    IIF(Post.Rate > 0 , , )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width