Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you use parameterised queries the query and the data are supplied to the database separately. This has several effects...</p> <ul> <li><p>It allows the RDBMS to see that the query is identical to previous instances of that query. <em>(If you embed the data as static values in the query string, the RDBMS will not see that the query is the same and only the data has changed.)</em> This allows execution plan re-use and other beneficial characteristic of the RDBMS.</p></li> <li><p>It simplifies the data validation. This is relevant to injection attacks. No matter what values are substituted into the parameter, the data is always just data. It will never be treated as part of the query.</p></li> </ul> <p>This latter point, however, also means that you <strong><em>can't</em></strong> do this...</p> <pre><code>INSERT INTO @tableName(@fieldName) VALUES (@dataValue) </code></pre> <p>Each parameter is treated as a data item. It isn't a loosely bound script, the value in <code>@tableName</code> won't be substituted into the script. The query <strong><em>must</em></strong> be hard-coded with the table and field names. Only true data items can be passed as parameters.</p> <p>This often feels like a limitation to users of java script, etc. It is, however, the mecahnism that prtects you from SQL Injection attacks. It's a good thing :)</p> <p><br/></p> <p>This means that to allow user defined Data Definition Lanaguage <em>(Such as a CREATE TABLE)</em> you need to concatenate the different parts of the string together yourself. And virtually no matter what you do to protect yourself from a SQL Injection Attack here, some-one will find a way through.</p> <p>As soon as you allow a user to specify table names, field names, etc, you become immediately open to attack. The <strong><em>only</em></strong> safe way is to have a white-list of allowable strings.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload