B2_Chapter 7_B.pdf - SOLVING THE PROBLEM VALIDATING INPUT...

  • No School
  • AA 1
  • 16

This preview shows page 1 - 7 out of 16 pages.

SOLVING THE PROBLEM: VALIDATING INPUT Regular expressions Works for string data types They are a kind of programming language used to find complex patterns in strings They are very powerful and very complex Person’s name: Matches names with apostrophies Also matches: 1
Image of page 1

Subscribe to view the full document.

SOLVING THE PROBLEM: ESCAPING INPUT To store single quotes in a database you can do so by escaping them into pairs of single quotes 2
Image of page 2
SOLVING THE PROBLEM: ESCAPING INPUT There are other characters that needs to be escaped too (ex. %27) 3
Image of page 3

Subscribe to view the full document.

SOLVING THE PROBLEM: ESCAPING INPUT The preferred way to escape input is to avoid ad-hoc SQL altogether Use parameterized queries No explicit escaping Didn’t need to specify quotes around the ? DBMS knows the data type 4
Image of page 4
SOLVING THE PROBLEM: ESCAPING INPUT Parameterized query ≠ string replacement Parameterized queries can’t work to specify a table or column name 5
Image of page 5

Subscribe to view the full document.

SOLVING THE PROBLEM: ESCAPING INPUT
Image of page 6
Image of page 7
  • Fall '19

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes