Skip to content
Permalink
Browse files

Merge pull request #28 from shadowhand/fix/insert-qualified

Fix inserts with qualified table name
  • Loading branch information...
shadowhand committed Jul 28, 2017
2 parents bd1ee5e + 94aa9de commit 31b14511cbcdb32f0773f3a12401861508721dac
Showing with 20 additions and 1 deletion.
  1. +6 −0 CHANGELOG.md
  2. +1 −1 src/InsertQuery.php
  3. +13 −0 tests/InsertQueryTest.php
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [2.0.1]

### Fixed

- Qualified tables are now supported by `InsertQuery`

## [2.0.0]

### Changed
@@ -78,7 +78,7 @@ public function sql(Identifier $identifier = null): string
return \sprintf(
'INSERT INTO %s (%s) VALUES %s',
$identifier->escape($this->table),
$identifier->escapeQualified($this->table),
\implode(', ', $identifier->all($this->columns)),
$this->stringifyIterator($this->insertLines())
);
@@ -117,6 +117,19 @@ public function testInsertMultiple()
);
}
public function testInsertQualified()
{
$table = 'public.users';
$map = [
'username' => 'jsmith',
];
$insert = InsertQuery::make($table, $map);
$identifier = Common\Identifier::make();
$this->assertContains('"public"."users"', $insert->sql($identifier));
}
public function testInsertCountMismatch()
{
$insert = InsertQuery::make('tokens')->columns('token');

0 comments on commit 31b1451

Please sign in to comment.
You can’t perform that action at this time.