Code Duplication    Length = 44-44 lines in 2 locations

system/libraries/drivers/Database/Pdosqlite.php 1 location

@@ 142-185 (lines=44) @@
139
        return 'LIMIT '.$offset.', '.$limit;
140
    }
141
142
    public function compile_select($database)
143
    {
144
        $sql = ($database['distinct'] == true) ? 'SELECT DISTINCT ' : 'SELECT ';
145
        $sql .= (count($database['select']) > 0) ? implode(', ', $database['select']) : '*';
146
147
        if (count($database['from']) > 0) {
148
            $sql .= "\nFROM ";
149
            $sql .= implode(', ', $database['from']);
150
        }
151
152
        if (count($database['join']) > 0) {
153
            foreach ($database['join'] as $join) {
154
                $sql .= "\n".$join['type'].'JOIN '.implode(', ', $join['tables']).' ON '.$join['conditions'];
155
            }
156
        }
157
158
        if (count($database['where']) > 0) {
159
            $sql .= "\nWHERE ";
160
        }
161
162
        $sql .= implode("\n", $database['where']);
163
164
        if (count($database['groupby']) > 0) {
165
            $sql .= "\nGROUP BY ";
166
            $sql .= implode(', ', $database['groupby']);
167
        }
168
169
        if (count($database['having']) > 0) {
170
            $sql .= "\nHAVING ";
171
            $sql .= implode("\n", $database['having']);
172
        }
173
174
        if (count($database['orderby']) > 0) {
175
            $sql .= "\nORDER BY ";
176
            $sql .= implode(', ', $database['orderby']);
177
        }
178
179
        if (is_numeric($database['limit'])) {
180
            $sql .= "\n";
181
            $sql .= $this->limit($database['limit'], $database['offset']);
182
        }
183
184
        return $sql;
185
    }
186
187
    public function escape_str($str)
188
    {

system/libraries/drivers/Database/Pgsql.php 1 location

@@ 170-213 (lines=44) @@
167
        return 'LIMIT '.$limit.' OFFSET '.$offset;
168
    }
169
170
    public function compile_select($database)
171
    {
172
        $sql = ($database['distinct'] == true) ? 'SELECT DISTINCT ' : 'SELECT ';
173
        $sql .= (count($database['select']) > 0) ? implode(', ', $database['select']) : '*';
174
175
        if (count($database['from']) > 0) {
176
            $sql .= "\nFROM ";
177
            $sql .= implode(', ', $database['from']);
178
        }
179
180
        if (count($database['join']) > 0) {
181
            foreach ($database['join'] as $join) {
182
                $sql .= "\n".$join['type'].'JOIN '.implode(', ', $join['tables']).' ON '.$join['conditions'];
183
            }
184
        }
185
186
        if (count($database['where']) > 0) {
187
            $sql .= "\nWHERE ";
188
        }
189
190
        $sql .= implode("\n", $database['where']);
191
192
        if (count($database['groupby']) > 0) {
193
            $sql .= "\nGROUP BY ";
194
            $sql .= implode(', ', $database['groupby']);
195
        }
196
197
        if (count($database['having']) > 0) {
198
            $sql .= "\nHAVING ";
199
            $sql .= implode("\n", $database['having']);
200
        }
201
202
        if (count($database['orderby']) > 0) {
203
            $sql .= "\nORDER BY ";
204
            $sql .= implode(', ', $database['orderby']);
205
        }
206
207
        if (is_numeric($database['limit'])) {
208
            $sql .= "\n";
209
            $sql .= $this->limit($database['limit'], $database['offset']);
210
        }
211
212
        return $sql;
213
    }
214
215
    public function escape_str($str)
216
    {