transport: pass correct channel
[abstract.git] / storage / base / aaIncomeDelete.cpp
blob71518f701d18063ddee1cbccdaad50fd3cde64bc
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent tw=79 ft=cpp: */
3 /*
4 * Copyright (C) 2008 Sergey Yanovich <ynvich@gmail.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public
17 * License along with this program; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
22 #include "xpcom-config.h"
24 #include "nsCOMPtr.h"
25 #include "nsComponentManagerUtils.h"
26 #include "nsXPCOMCID.h"
27 #include "nsIMutableArray.h"
28 #include "nsISupportsPrimitives.h"
30 /* Unfrozen API */
32 /* Project includes */
33 #include "aaIBalance.h"
35 #include "aaIncomeDelete.h"
37 static const char *sql = "DELETE FROM income\
38 WHERE start=replace(round(julianday(?,'unixepoch')),'.0','')";
40 aaIncomeDelete::aaIncomeDelete()
42 mSql = sql;
45 NS_IMPL_ISUPPORTS_INHERITED0(aaIncomeDelete,
46 aaSaveRequest)
48 /* aaISqlRequest */
49 NS_IMETHODIMP
50 aaIncomeDelete::SetFilter(nsISupports * aFilter)
52 nsresult rv;
53 mIncome = do_QueryInterface(aFilter, &rv);
54 NS_ENSURE_SUCCESS(rv, rv);
56 return NS_OK;
59 NS_IMETHODIMP
60 aaIncomeDelete::GetParams(nsIArray * * aParams)
62 NS_ENSURE_TRUE(mIncome, NS_ERROR_NOT_INITIALIZED);
63 nsresult rv;
65 nsCOMPtr<nsIMutableArray> result
66 = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
67 NS_ENSURE_SUCCESS(rv, rv);
69 nsCOMPtr<nsISupportsPRInt64> valInt64;
71 valInt64 = do_CreateInstance(NS_SUPPORTS_PRINT64_CONTRACTID, &rv);
72 NS_ENSURE_SUCCESS(rv, rv);
73 rv = valInt64->SetData(mIncome->PickStart() / 1000000);
74 NS_ENSURE_SUCCESS(rv, rv);
75 rv = result->InsertElementAt(valInt64, 0, PR_FALSE);
76 NS_ENSURE_SUCCESS(rv, rv);
78 *aParams = result;
79 result.forget();
81 return NS_OK;