Skip to content

Commit

Permalink
Added debug logging for delete/insert/update queries
Browse files Browse the repository at this point in the history
  • Loading branch information
aimeos committed Sep 19, 2022
1 parent d0d26e7 commit ab1cb01
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Schema/DB.php
Expand Up @@ -110,6 +110,7 @@ public function delete( string $table, array $conditions = [] ) : self
$map[$this->qi( $column )] = $value;
}

$this->up->info( ' => DELETE {"' . $table . '"} WHERE ' . json_encode( $conditions ), 'vvv' );
$this->conn->delete( $this->qi( $table ), empty( $map ) ? ['1' => 1] : $map );
return $this;
}
Expand Down Expand Up @@ -422,6 +423,7 @@ public function insert( string $table, array $data ) : self
$map[$this->qi( $column )] = $value;
}

$this->up->info( ' => INSERT {"' . $table . '"} VALUES ' . json_encode( $data ), 'vvv' );
$this->conn->insert( $this->qi( $table ), $map );
return $this;
}
Expand Down Expand Up @@ -752,6 +754,7 @@ public function update( string $table, array $data, array $conditions = [] ) : s
$values[$this->qi( $column )] = $value;
}

$this->up->info( ' => UPDATE {"' . $table . '"} SET ' . json_encode( $data ) . ' WHERE ' . json_encode( $conditions ), 'vvv' );
$this->conn->update( $this->qi( $table ), $map, empty( $values ) ? ['1' => 1] : $values );
return $this;
}
Expand Down

0 comments on commit ab1cb01

Please sign in to comment.