Permalink
Browse files

Fix removed cache_id column usage, SQL queries formatting

  • Loading branch information...
1 parent d9921e4 commit b3ef217f6605c6e0dedd322eac255eb0c6995a56 Aleksander Machniak committed Sep 18, 2012
Showing with 16 additions and 16 deletions.
  1. +16 −16 plugins/database_attachments/database_attachments.php
View
32 plugins/database_attachments/database_attachments.php
@@ -46,9 +46,9 @@ function upload($args)
$data = base64_encode($data);
$status = $rcmail->db->query(
- "INSERT INTO ".get_table_name('cache')."
- (created, user_id, cache_key, data)
- VALUES (".$rcmail->db->now().", ?, ?, ?)",
+ "INSERT INTO ".get_table_name('cache')
+ ." (created, user_id, cache_key, data)"
+ ." VALUES (".$rcmail->db->now().", ?, ?, ?)",
$_SESSION['user_id'],
$key,
$data);
@@ -82,9 +82,9 @@ function save($args)
$data = base64_encode($args['data']);
$status = $rcmail->db->query(
- "INSERT INTO ".get_table_name('cache')."
- (created, user_id, cache_key, data)
- VALUES (".$rcmail->db->now().", ?, ?, ?)",
+ "INSERT INTO ".get_table_name('cache')
+ ." (created, user_id, cache_key, data)"
+ ." VALUES (".$rcmail->db->now().", ?, ?, ?)",
$_SESSION['user_id'],
$key,
$data);
@@ -106,9 +106,9 @@ function remove($args)
$args['status'] = false;
$rcmail = rcmail::get_instance();
$status = $rcmail->db->query(
- "DELETE FROM ".get_table_name('cache')."
- WHERE user_id=?
- AND cache_key=?",
+ "DELETE FROM ".get_table_name('cache')
+ ." WHERE user_id = ?"
+ ." AND cache_key = ?",
$_SESSION['user_id'],
$args['id']);
@@ -138,10 +138,10 @@ function get($args)
$rcmail = rcmail::get_instance();
$sql_result = $rcmail->db->query(
- "SELECT cache_id, data
- FROM ".get_table_name('cache')."
- WHERE user_id=?
- AND cache_key=?",
+ "SELECT data"
+ ." FROM ".get_table_name('cache')
+ ." WHERE user_id=?"
+ ." AND cache_key=?",
$_SESSION['user_id'],
$args['id']);
@@ -161,9 +161,9 @@ function cleanup($args)
$prefix = $this->cache_prefix . $args['group'];
$rcmail = rcmail::get_instance();
$rcmail->db->query(
- "DELETE FROM ".get_table_name('cache')."
- WHERE user_id=?
- AND cache_key like '{$prefix}%'",
+ "DELETE FROM ".get_table_name('cache')
+ ." WHERE user_id = ?"
+ ." AND cache_key LIKE '{$prefix}%'",
$_SESSION['user_id']);
}
}

0 comments on commit b3ef217

Please sign in to comment.