Skip to content

Commit 3418a4b

Browse files
authored
Merge pull request #44 from keboola/zajca-fix-exasol-upper
fix Exasol datatype when lowercase
2 parents 0d38717 + 04a7aa2 commit 3418a4b

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/Definition/Exasol.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public function __construct($type, $options = [])
184184
public function getSQLDefinition()
185185
{
186186
$type = $this->getType();
187-
$definition = $type;
187+
$definition = strtoupper($type);
188188
if (!in_array($definition, self::TYPES_WITHOUT_LENGTH)) {
189189
$length = $this->getLength() ?: $this->getDefaultLength();
190190
// length is set, use it
@@ -230,7 +230,7 @@ private function buildComplexLength($type, $lengthString)
230230
private function getDefaultLength()
231231
{
232232
$out = null;
233-
switch ($this->type) {
233+
switch (strtoupper($this->type)) {
234234
case self::TYPE_DECIMAL:
235235
case self::TYPE_DEC:
236236
case self::TYPE_NUMBER:

tests/ExasolDatatypeTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ public function expectedSqlDefinitions()
138138
'NCHAR' => ['NCHAR', [], 'NCHAR (2000)'],
139139

140140
'VARCHAR' => ['VARCHAR', [], 'VARCHAR (2000000)'],
141+
'VARCHAR lowercase' => ['varchar', [], 'VARCHAR (2000000)'],
141142
'CHAR VARYING' => ['CHAR VARYING', [], 'CHAR VARYING (2000000)'],
142143
'CHARACTER LARGE OBJECT' => ['CHARACTER LARGE OBJECT', [], 'CHARACTER LARGE OBJECT (2000000)'],
143144
'CHARACTER VARYING' => ['CHARACTER VARYING', [], 'CHARACTER VARYING (2000000)'],

0 commit comments

Comments
 (0)