Thread DBD::SQLite - Datentypen (9 answers)
Opened by Kuerbis at 2025-09-25 07:36

rosti
 2025-09-29 18:03
#197282 #197282
User since
2011-03-19
3712 Artikel
BenutzerIn
[Homepage]
user image
Hier noch eine universal insert-Methode aus meinem Framework:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
sub insert{
    my $self = shift;
    my $dbh  = ref $_[0] ? shift : $self->dbh('myweb');
    my $tabn = shift; 
    my %hunt = @_;
    my @fields = keys %hunt;
    $dbh->do(qq(
        INSERT INTO @{[$dbh->quote_identifier($tabn)]} (@{[join ',', map{$dbh->quote_identifier($_)}@fields]}) 
        VALUES( @{[join ',', map{$dbh->quote($_)}@hunt{@fields}]} )
    ));
    
    my @row = $dbh->selectrow_array("SELECT LAST_INSERT_ID()");
    return $row[0];
}
http://rolfrost.de/wallpaper.html

WallPaper -- jeden Monat neu. Mit nur 2 Klicks den Aktuellen Monat auf dem Desktop.

View full thread DBD::SQLite - Datentypen