- or download this
.... For example, the author is either unaware of hash slices
or chooses not to use them in the first code example. While
...
[in the DBI example] with hash slices .... It would be possible
to improve the final example by using placeholders,
as well ....
- or download this
$sql='insert into uregisternew
(country, firstname, lastname, userid, password, address1, cit
+y,
...
$sth2->execute(@data);
$sth2->finish();
- or download this
$sth2->execute(@data);
to
$sth2->execute(@formdata{@formdata_column_ordering});
- or download this
sub make_placeholders {
sprintf "(%s)", join ',', '?' x @_;
...
sprintf "(%s)", join ',', @_;
}
- or download this
$sql = sprintf "insert into %s values %s",
make_columns(@formdata_column_ordering),
make_placeholders(@formdata_column_ordering) ;
- or download this
The key way to determine whether a particular module/library is
matched to the level of a task is to count the number of lines of
``prep code'' you must write before you can do what you want.
- or download this
1 create 2 subroutines
2 use these subroutines to generate sql
3 connect to the database
4 obtain database and statement handles
5 commit the record to database.
- or download this
DBIx::Recordset->Insert({ %connection_hash, %formdata });
- or download this
In most cases the gap between DBI's API and Perl applications
has been bridged by indiscriminately mixing generic
application-level functionality with the specifics of the
current application.
- or download this
$sql= sprintf 'insert into uregisternew
(%s) values (%s)',
join ',', @formdata_ordering,
join ',', '?' x @formdata_ordering;
- or download this
Another maladaptive way that the DBI API has been extended for
application-level databasing is by developing a collection of
generic application-level tools but not publishing them.
- or download this
The final way to misuse DBI in an application is to use it
directly.
- or download this
.... For example, the author is either unaware of hash slices
or chooses not to use them in the first code example.
- or download this
It would be possible to improve the final example by using
placeholders, as well ....