Big Chemical Encyclopedia

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

Articles Figures Tables About

Bind Values in SQL Statements

When a client program selects data from an RDBMS table using SQL, there are several methods that can be used. The following Perl code illustrates some of these methods. [Pg.142]

In this code snippet, the SQL statement is prepared and executed and each row is fetched into an array and then printed. It is also possible to fetch all rows at one time, for example, using the following code snippet. [Pg.143]

After the SQL statement is executed, an array reference is returned using fetchall arraryref. The individual rows from this array are then printed. Some care needs to be taken when using fetchall arrayref when a large number of rows are returned. In that case, not all rows may be returned and the function will need to be called again until all rows are returned. The documentation for the DBI perl module discusses this more fully.1 [Pg.143]

In this final example, the use of bind variables is illustrated. [Pg.143]

The bind columns function requires as many perl variables as there are columns in the select statement. The names used here are indicative of the columns selected, making the code more understandable. The use of bind columns is also very efficient. [Pg.143]


See other pages where Bind Values in SQL Statements is mentioned: [Pg.142]   


SEARCH



In value

SQL

SQLs

© 2024 chempedia.info