- or download this
my $sth = $dbh -> prepare("insert into table1 (col1, col2, col2) value
+s (?, ?, ?)");
- or download this
# do we need an insert or an update?
my $row_checker = $dbh -> prepare("select count(col1) from table1 wher
+e col1 = ? and col2 = ? and
...
my $inserter = $dbh -> prepare("insert into table1 (col1, col2, col2)
+values (?, ?, ?)");my $upda
ter = $dbh -> parepare("update table1 set col1 = ?, col2 = ?, col3 = ?
+ where col1 = ? and col2 =
? and col3 = ?");
- or download this
my $row_checker = "select count(col1) from table1 where col1 = ? and c
+ol2 = ? and col3 = ?";
$row_checker = $dbh -> prepare($row_checker);
...
update table1 set col1 = ?, col2 = ?, col3 = ?
where col1 = ? and col2 = ? and col3 = ?
});
- or download this
my $rowRef = $dbh -> selectrow_arrayref("select col1 from table1 where
+ col1 = col2 and col2 != '$
someval'");
...
my $tuple = shift @{ $rowRef };
#or ...
my $tuple = @{ $rowRef }[0];
- or download this
my ($tuple) = map { @{ $_ } } $dbh -> selectall_arrayref("select col1
+from table1 where col1 = co
l2 and col2 != '$someval'");
- or download this
if ($tuple) { # succeeded...
- or download this
my $next_col1 = "select distinct(col1) from table1";
$next_col1 = $dbh -> prepare($next_col1);
...
my @col1s = map { @{ $_ } } @{ $next_col1 -> fetchall_arrayref() };
foreach my $col1 (@col1s) { ...