Skip to content

Commit

Permalink
fix: merge optionally and enclosedBy
Browse files Browse the repository at this point in the history
  • Loading branch information
yajra committed May 29, 2024
1 parent 3ece4e8 commit b3081a4
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
6 changes: 1 addition & 5 deletions src/ControlFileBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,8 @@ public function inserts(): string
$inserts .= "FIELDS TERMINATED BY '{$table->terminatedBy}' ";
}

if ($table->optionally) {
$inserts .= 'OPTIONALLY ';
}

if ($table->enclosedBy) {
$inserts .= "ENCLOSED BY '{$table->enclosedBy}'".PHP_EOL;
$inserts .= "OPTIONALLY ENCLOSED BY '{$table->enclosedBy}'".PHP_EOL;
}

if ($table->trailing) {
Expand Down
3 changes: 1 addition & 2 deletions src/SQLLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,10 @@ public function into(
string $table,
array $columns,
?string $terminatedBy = ',',
bool $optionally = true,
?string $enclosedBy = '"',
?string $trailing = null
): static {
$this->tables[] = new TableDefinition($table, $columns, $terminatedBy, $optionally, $enclosedBy, $trailing);
$this->tables[] = new TableDefinition($table, $columns, $terminatedBy, $enclosedBy, $trailing);

return $this;
}
Expand Down
1 change: 0 additions & 1 deletion src/TableDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public function __construct(
public string $table,
public array $columns,
public ?string $terminatedBy = null,
public ?bool $optionally = null,
public ?string $enclosedBy = null,
public ?string $trailing = null
) {
Expand Down

0 comments on commit b3081a4

Please sign in to comment.