Big Chemical Encyclopedia

Chemical substances, components, reactions, process design ...

Articles Figures Tables About

Placeholders in SQL Statements

Consider the following example using Perl to insert data into a table. [Pg.141]

The get data function is not detailed here, but would return three values, perhaps from user input, a file of data, or an instrument. The detail to notice in this example is that the call to dbh- prepare is made once for every set of data values. The DBI prepare function is relatively inefficient. There is a more efficient way to insert multiple rows. The following code uses placeholders in the SQL statement. [Pg.141]

In this example, the prepare function is executed only once. The SQL statement passed to the prepare function contains placeholders to represent values that will be made available once the statement is actually executed. The placeholder is simply a question mark. The arguments to the execute function provide three new values during each execution of the loop. This runs faster than the previous example. [Pg.141]

The technique of using placeholders in prepared SQL statements is common in java as well. The following code snippets show examples in java. [Pg.142]

PreparedStatement st = con.prepareStatement( Insert Into test assay (id,ic50,ed50) Values ( , , ) ) while ( true )  [Pg.142]


See other pages where Placeholders in SQL Statements is mentioned: [Pg.141]   


SEARCH



SQL

SQLs

© 2024 chempedia.info