Skip to content

Commit b55f935

Browse files
authored
Merge pull request #37 from geekcom/developer
Developer
2 parents 0982c42 + c30677c commit b55f935

File tree

3 files changed

+18
-50
lines changed

3 files changed

+18
-50
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ $options = [
209209
'password' => 'DB_PASSWORD',
210210
'host' => 'DB_HOST',
211211
'database' => 'DB_DATABASE',
212-
'schema' => 'DB_SCHEMA',
213212
'port' => '5432'
214213
]
215214
];

docs/pt_BR/LEIA-ME_pt_BR.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ $options = [
205205
'password' => 'DB_PASSWORD',
206206
'host' => 'DB_HOST',
207207
'database' => 'DB_DATABASE',
208-
'schema' => 'DB_SCHEMA',
209208
'port' => '5432'
210209
]
211210
];

src/JasperPHP.php

Lines changed: 18 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -102,54 +102,24 @@ public function process($input_file, $output_file = false, $options = [])
102102
}
103103

104104
if ($options['db_connection']) {
105-
$this->command .= " -t {$options['db_connection']['driver']}";
106-
107-
if (isset($options['db_connection']['username'])) {
108-
$this->command .= " -u {$options['db_connection']['username']}";
109-
}
110-
111-
if (isset($options['db_connection']['password']) && !empty($options['db_connection']['password'])) {
112-
$this->command .= " -p {$options['db_connection']['password']}";
113-
}
114-
115-
if (isset($options['db_connection']['host']) && !empty($options['db_connection']['host'])) {
116-
$this->command .= " -H {$options['db_connection']['host']}";
117-
}
118-
119-
if (isset($options['db_connection']['database']) && !empty($options['db_connection']['database'])) {
120-
$this->command .= " -n {$options['db_connection']['database']}";
121-
}
122-
123-
if (isset($options['db_connection']['port']) && !empty($options['db_connection']['port'])) {
124-
$this->command .= " --db-port {$options['db_connection']['port']}";
125-
}
126-
127-
if (isset($options['db_connection']['jdbc_driver']) && !empty($options['db_connection']['jdbc_driver'])) {
128-
$this->command .= " --db-driver {$options['db_connection']['jdbc_driver']}";
129-
}
130-
131-
if (isset($options['db_connection']['jdbc_url']) && !empty($options['db_connection']['jdbc_url'])) {
132-
$this->command .= " --db-url {$options['db_connection']['jdbc_url']}";
133-
}
134-
135-
if (isset($options['db_connection']['jdbc_dir']) && !empty($options['db_connection']['jdbc_dir'])) {
136-
$this->command .= " --jdbc-dir {$options['db_connection']['jdbc_dir']}";
137-
}
138-
139-
if (isset($options['db_connection']['db_sid']) && !empty($options['db_connection']['db_sid'])) {
140-
$this->command .= " -db-sid {$options['db_connection']['db_sid']}";
141-
}
142-
143-
if (isset($options['db_connection']['xml_xpath'])) {
144-
$this->command .= " --xml-xpath {$options['db_connection']['xml_xpath']}";
145-
}
146-
147-
if (isset($options['db_connection']['data_file'])) {
148-
$this->command .= " --data-file {$options['db_connection']['data_file']}";
149-
}
150-
151-
if (isset($options['db_connection']['json_query'])) {
152-
$this->command .= " --json-query {$options['db_connection']['json_query']}";
105+
$mapDbParams = [
106+
'driver' => '-t',
107+
'username' => '-u',
108+
'password' => '-p',
109+
'host' => '-H',
110+
'database' => '-n',
111+
'port' => '--db-port',
112+
'jdbc_driver' => '--db-driver',
113+
'jdbc_url' => '--db-url',
114+
'jdbc_dir' => '--jdbc-dir',
115+
'db_sid' => '-db-sid',
116+
'xml_xpath' => '--xml-xpath',
117+
'data_file' => '--data-file',
118+
'json_query' => '--json-query'
119+
];
120+
121+
foreach ($options['db_connection'] as $key => $value) {
122+
$this->command .= " {$mapDbParams[$key]} {$value}";
153123
}
154124
}
155125

0 commit comments

Comments
 (0)