diff --git a/composer.json b/composer.json index 966a5eba..3f9da997 100644 --- a/composer.json +++ b/composer.json @@ -1,12 +1,12 @@ { - "name": "marquine/php-etl", + "name": "claonilton/php-etl", "description": "Extract, Transform and Load data using PHP.", "keywords": ["etl", "extract", "transform", "load", "extraction", "transformation", "seed", "data", "laravel"], "license": "MIT", "authors": [ { - "name": "Leonardo Marquine", - "email": "leonardomarquine@gmail.com" + "name": "Claonilton Jr", + "email": "claonilton@vscorp.com.br" } ], "require": { diff --git a/src/Database/ConnectionFactory.php b/src/Database/ConnectionFactory.php index 0f85f3d8..8a4f82cc 100644 --- a/src/Database/ConnectionFactory.php +++ b/src/Database/ConnectionFactory.php @@ -38,6 +38,8 @@ protected function getConnector($driver) return new Connectors\PostgresConnector; case 'sqlsrv': return new Connectors\SqlServerConnector; + case 'firebird': + return new Connectors\FirebirdConnector; } throw new InvalidArgumentException("Unsupported driver: $driver"); diff --git a/src/Database/Connectors/FirebirdConnector.php b/src/Database/Connectors/FirebirdConnector.php new file mode 100644 index 00000000..032a4d92 --- /dev/null +++ b/src/Database/Connectors/FirebirdConnector.php @@ -0,0 +1,55 @@ +getDsn($config); + + $connection = $this->createConnection($dsn, $config); + + + return $connection; + + + } + + /** + * Get the DSN string. + * + * @param array $config + * @return string + */ + public function getDsn($config) + { + extract($config, EXTR_SKIP); + + $dsn = []; + + if (isset($host) && ! isset($unix_socket)) { + $dsn['host'] = $host; + } + + if (isset($port) && ! isset($unix_socket)) { + $dsn['port'] = $port; + } + if (isset($charset) && ! isset($unix_socket)) { + $dsn['charset'] = $charset; + } + if (isset($port) && isset($database) && isset($host) && ! isset($unix_socket)) { + $dsn['dbname'] = "$host/$port:$database"; + } + + return urldecode('firebird:' . http_build_query($dsn, '', ';')); + + + } +} diff --git a/src/Transformers/Base64Decode.php b/src/Transformers/Base64Decode.php new file mode 100644 index 00000000..3b706ecd --- /dev/null +++ b/src/Transformers/Base64Decode.php @@ -0,0 +1,38 @@ +transform($this->columns, function ($column) { + return base64_decode($column); + }); + } +} + diff --git a/src/Transformers/Base64Encode.php b/src/Transformers/Base64Encode.php new file mode 100644 index 00000000..670b4cdc --- /dev/null +++ b/src/Transformers/Base64Encode.php @@ -0,0 +1,40 @@ +transform($this->columns, function ($column) { + return base64_encode($column); + }); + return($row); + + } +} + diff --git a/src/bindings.php b/src/bindings.php index 6da40dd1..c3141bc6 100644 --- a/src/bindings.php +++ b/src/bindings.php @@ -28,6 +28,8 @@ $container->bind('replace_transformer', Marquine\Etl\Transformers\Replace::class); $container->bind('trim_transformer', Marquine\Etl\Transformers\Trim::class); $container->bind('unique_rows_transformer', Marquine\Etl\Transformers\UniqueRows::class); +$container->bind('base64_encode_transformer', Marquine\Etl\Transformers\Base64Encode::class); +$container->bind('base64_decode_transformer', Marquine\Etl\Transformers\Base64Decode::class); // Loaders $container->bind('insert_loader', Marquine\Etl\Loaders\Insert::class);