blob: cf5156a31d5ddd138cb6ecfc53b75be0f08d1681 [file] [log] [blame]
Alexander Afanasyeva199f972013-01-02 19:37:26 -08001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2012-2013 University of California, Los Angeles
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19 * Zhenkai Zhu <zhenkai@cs.ucla.edu>
20 */
21
22#include "action-log.h"
23
24using namespace boost;
25using namespace std;
26
27ActionLog::ActionLog (const std::string &path, const std::string &localName)
28 : SyncLog (path)
29 , m_localName (localName)
30{
31}
32
33// local add action. remote action is extracted from content object
34void
35ActionLog::AddActionUpdate (const std::string &filename,
36 const Hash &hash,
37 const std::string &atime, const std::string &mtime, const std::string &ctime,
38 int mode)
39{
40 int res = sqlite3_exec (m_db, "BEGIN TRANSACTION;", 0,0,0);
41
42 // sqlite3_stmt *stmt;
43 // res += sqlite3_prepare_v2 (m_db, "SELECT version,device_id,seq_no FROM ActionLog WHERE filename=? ORDER BY version DESC,device_id DESC LIMIT 1", -1, &stmt, 0);
44
45 // if (res != SQLITE_OK)
46 // {
47 // BOOST_THROW_EXCEPTION (Error::Db ()
48 // << errmsg_info_str ("Some error with AddActionUpdate"));
49 // }
50
51 // sqlite3_bind_text (stmt, 1, filename.c_str (), -1);
52 // if (sqlite3_step (stmt) == SQLITE_ROW)
53 // {
54 // // with parent
55 // sqlite3_int64 version = sqlite3_value_int64 (stmt, 0) + 1;
56 // sqlite3_int64 device_id = sqlite3_value_int64 (stmt, 1);
57 // sqlite3_int64 seq_no = sqlite3_value_int64 (stmt, 0);
58
59
60 // }
61 // else
62 // {
63 // // without parent
64
65 // }
66
67 res += sqlite3_exec (m_db, "END TRANSACTION;", 0,0,0);
68}
69
70void
71ActionLog::AddActionMove (const std::string &oldFile, const std::string &newFile)
72{
73}
74
75void
76ActionLog::AddActionDelete (const std::string &filename)
77{
78}