Leser: 2
|< 1 2 >| | 15 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/perl -w
use DBI;
my $dbh = DBI->connect("DBI:mysql:TEST;host=localhost","joe","");
my $EIN = <stdin>;
my $sth = $dbh->prepare("insert into Test (Name) values ($EIN);
$sth->execute;
nach der Eingabe von Umlauten kann ich mit MySQL-Query diese in der Tabelle korrekt lesen.
das gleiche auch beim Auslesen und anzeigen in der shell.
#!/usr/bin/perl -w
use DBI;
my $dbh = DBI->connect("DBI:mysql:TEST;host=localhost","joe","");
my $sth1 = $dbh->prepare("select * from Test");
$sth1->execute;
my $ref1 = $sth1->fetchrow_hashref())
print "Überschrift -- $ref1->{\"Name\"}\n";
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl -w
use Tk;
use DBI;
my $dbh = DBI->connect("DBI:mysql:TEST;host=localhost","joe","");
my $Main=MainWindow->new();
$Main->minsize( qw(250 250));
$Main->maxsize( qw(250 250));
$Main->title("Eintest");
$Main->configure(-background=> 'blue' );
my $top=$Main->Frame(-background=> 'blue',)->pack(-side=>'top',-fill=>'both' );
$CELL = $top->Entry(-width=>10, -background=>'white', -textvariable =>\$EIN)->pack(-side=>'left' );
$CELL->bind("<Return>",&Schreiben);
sub Schreiben
{
my $sth2 = $dbh->prepare("insert into Test
(Name)
values($EIN);
$sth->execute;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/perl -w
use Tk;
use DBI;
my $dbh = DBI->connect("DBI:mysql:TEST;host=localhost","joe","");
my $Main=MainWindow->new();
$Main->minsize( qw(250 250));
$Main->maxsize( qw(250 250));
$Main->title("Austest");
$Main->configure(-background=> 'blue' );
my $top=$Main->Frame(-background=> 'blue',)->pack(-side=>'top',-fill=>'both' );
$CELLE = $top->Label(-width =>10, -background =>'white', -text =>'Überschrift')->pack(-side=>'left' );
$CELLE1 = $top->Label(-width =>10,-background =>'white', -textvariable => \$AUS)->pack(-side=>'left' );
$sth3 = $dbh->prepare("select * from Test);
$sth3->execute;
my $ref3 = $sth3->fetchrow_hashref();
$AUS = $ref3->{"Name"};
use utf8;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
foreach my $datensatz_id (sort keys(%{$hash_ref})) {
if (defined($id_kontrolle->{$datensatz_id})){
foreach $zeilen_bezeichnung (keys(%{$hash_ref->{$datensatz_id}})) {
$sql .= "," if $sql;
$sql .= "$zeilen_bezeichnung"." = ?";
$values = Encode::encode ("ISO-8859-1", $hash_ref->{$datensatz_id}->{$zeilen_bezeichnung});
push (@array, "$values");
}
push (@array, $datensatz_id);
$sql = "UPDATE $tabellen_name SET $sql WHERE id = ?";
$dbh->do ($sql, undef, @array);
undef $sql;
undef @array;
}
|< 1 2 >| | 15 Einträge, 2 Seiten |