| … | |
… | |
| 113 | my @realFieldnames = $self->{record}->FIELDS(); |
113 | my @realFieldnames = $self->{record}->FIELDS(); |
| 114 | my @fieldvalues = map { $Record->$_() } @realFieldnames; |
114 | my @fieldvalues = map { $Record->$_() } @realFieldnames; |
| 115 | |
115 | |
| 116 | my $stmt = "INSERT INTO $table ($fieldnames) VALUES ($marks)"; |
116 | my $stmt = "INSERT INTO $table ($fieldnames) VALUES ($marks)"; |
| 117 | $self->debug("SQL-add: $stmt\n"); |
117 | $self->debug("SQL-add: $stmt\n"); |
|
|
118 | #no warnings; |
|
|
119 | #$self->debug("SQL-add: fieldvalues=@fieldvalues\n"); |
|
|
120 | #use warnings; |
| 118 | |
121 | |
| 119 | $self->{driver}->connect("rw"); |
122 | $self->{driver}->connect("rw"); |
| 120 | my $sth = $self->{driver}->handle()->prepare($stmt); |
123 | my $sth = $self->{driver}->handle()->prepare($stmt); |
| 121 | my $result = $sth->execute(@fieldvalues); |
124 | my $result = $sth->execute(@fieldvalues); |
| 122 | $self->{driver}->disconnect(); |
125 | $self->{driver}->disconnect(); |
| … | |
… | |
| 179 | my $stmt = "UPDATE $table SET"; |
182 | my $stmt = "UPDATE $table SET"; |
| 180 | while (@fieldnames) { |
183 | while (@fieldnames) { |
| 181 | $stmt .= " " . (shift @fieldnames) . "=?"; |
184 | $stmt .= " " . (shift @fieldnames) . "=?"; |
| 182 | $stmt .= "," if @fieldnames; |
185 | $stmt .= "," if @fieldnames; |
| 183 | } |
186 | } |
|
|
187 | $stmt .= " "; |
|
|
188 | $stmt .= $self->makeWhereClause(map { $Record->$_() } @realKeynames); |
| 184 | $self->debug("SQL-put: $stmt\n"); |
189 | $self->debug("SQL-put: $stmt\n"); |
| 185 | |
190 | |
| 186 | $self->{driver}->connect("rw"); |
191 | $self->{driver}->connect("rw"); |
| 187 | my $sth = $self->{driver}->handle()->prepare($stmt); |
192 | my $sth = $self->{driver}->handle()->prepare($stmt); |
| 188 | my $result = $sth->execute(@fieldvalues); |
193 | my $result = $sth->execute(@fieldvalues); |