summaryrefslogtreecommitdiffstats
path: root/application/models/mmultipaste.php
diff options
context:
space:
mode:
authorRafael Bodill <rafi@sortex.co.il>2014-09-19 17:47:08 +0200
committerRafael Bodill <rafi@sortex.co.il>2014-09-19 17:47:08 +0200
commit7c100145ce197c86e1c849124daaa39ac6b240f5 (patch)
tree89cd87cff350b805d4f608b2c9813f50c22531a0 /application/models/mmultipaste.php
parent0b62a117ca8d34331406a07dc52aa937ff76ace1 (diff)
parentd98ba32e9717a5e325d439e785c967f8cc44d095 (diff)
Merge branch 'pgsql_controllers'
* pgsql_controllers: Fix user/register mistaken query handling WIP: Cascading delete where_in for in array queries a proper count usage Fix timestamp adjusting for a list of arrays Correct unsupported open/close where query statements File controller uses query builder, except 2 queries Integrating query builder in models User controller queries built dynamically Query builder in user login and controller
Diffstat (limited to 'application/models/mmultipaste.php')
-rw-r--r--application/models/mmultipaste.php19
1 files changed, 13 insertions, 6 deletions
diff --git a/application/models/mmultipaste.php b/application/models/mmultipaste.php
index 723132a50..9b1a7b16e 100644
--- a/application/models/mmultipaste.php
+++ b/application/models/mmultipaste.php
@@ -90,12 +90,19 @@ class Mmultipaste extends CI_Model {
public function delete_id($id)
{
- $this->db->query('
- DELETE m, mfm
- FROM multipaste m
- LEFT JOIN multipaste_file_map mfm ON mfm.multipaste_id = m.multipaste_id
- WHERE m.url_id = ?
- ', array($id));
+ if (strpos($this->db->dbdriver, 'postgre') === FALSE) {
+ $this->db->query('
+ DELETE m, mfm
+ FROM multipaste m
+ LEFT JOIN multipaste_file_map mfm ON mfm.multipaste_id = m.multipaste_id
+ WHERE m.url_id = ?
+ ', array($id));
+ } else {
+ // TODO.rafi: Deletes multipaste + multipaste_file_map
+ // but not files. Is it supposed to?
+ $this->db->where('url_id', $id)
+ ->delete('multipaste');
+ }
if ($this->id_exists($id)) {
return false;