Thread SQL Insert Statement: keine doppelten Eintraege zulassen (10 answers)
Opened by paidopoieo at 2006-03-31 05:58

paidopoieo
 2006-04-01 05:05
#34181 #34181
User since
2005-12-02
96 Artikel
BenutzerIn
[default_avatar]
hi ptk,
ich hab kein do() und execute(), ich verwende das modul Net::MySQL
hab das jetzt folgendermassen gemacht:

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
$mysql->query(qq{SELECT * FROM protein WHERE accession_code = '$accession_code'});

print $mysql->has_selected_record(), "\n";

if ($mysql->has_selected_record() == 1) {

$id = $mysql->query (qq{INSERT INTO protein (accession_code, name_of_protein, length_of_protein)

VALUES('$accession_code', '$name_of_protein', '$length_of_protein')});

print "return value insert protein: ", $id, "\n";


$id_pep = $mysql->query(qq{INSERT INTO peptide (startpos_in_proteinseq, endpos_in_proteinseq, peptide_seq, expect_val, length_of_peptideseq)

VALUES ('$startpos_in_proteinseq', '$endpos_in_proteinseq', '$peptide_seq', '$expect_val', '$length_of_peptideseq')});

print "return value insert peptide: ", $id_pep, "\n";



print "Affected row:", $mysql->get_affected_rows_length, "\n";
#
print $mysql->get_error_message if $mysql->is_error, "\n";

print "\n";


} else {

print "don't do anything, ENTRY !!!!!!!! is already in the database \n";


}

View full thread SQL Insert Statement: keine doppelten Eintraege zulassen