2008-09-12 14:30:41 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2009-04-13 09:29:41 -07:00
|
|
|
* vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
|
2012-05-21 04:12:37 -07:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2008-09-12 14:30:41 -07:00
|
|
|
|
2010-06-01 05:38:00 -07:00
|
|
|
#ifndef MOZSTORAGESTATEMENTJSHELPER_H
|
|
|
|
#define MOZSTORAGESTATEMENTJSHELPER_H
|
2008-09-12 14:30:41 -07:00
|
|
|
|
|
|
|
#include "nsIXPCScriptable.h"
|
2015-03-23 17:09:13 -07:00
|
|
|
#include "nsIXPConnect.h"
|
2008-09-12 14:30:41 -07:00
|
|
|
|
2009-05-08 17:29:56 -07:00
|
|
|
class Statement;
|
2008-09-12 14:30:41 -07:00
|
|
|
|
2009-04-08 09:24:25 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace storage {
|
|
|
|
|
|
|
|
class StatementJSHelper : public nsIXPCScriptable
|
2008-09-12 14:30:41 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIXPCSCRIPTABLE
|
|
|
|
|
|
|
|
private:
|
2013-08-17 15:50:18 -07:00
|
|
|
nsresult getRow(Statement *, JSContext *, JSObject *, JS::Value *);
|
|
|
|
nsresult getParams(Statement *, JSContext *, JSObject *, JS::Value *);
|
2008-09-12 14:30:41 -07:00
|
|
|
};
|
|
|
|
|
2015-03-12 09:55:56 -07:00
|
|
|
/**
|
|
|
|
* Wrappers used to clean up the references JS helpers hold to the statement.
|
|
|
|
* For cycle-avoidance reasons they do not hold reference-counted references,
|
|
|
|
* so it is important we do this.
|
|
|
|
*/
|
|
|
|
class StatementJSObjectHolder : public nsIXPConnectJSObjectHolder
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIXPCONNECTJSOBJECTHOLDER
|
|
|
|
|
|
|
|
explicit StatementJSObjectHolder(nsIXPConnectJSObjectHolder* aHolder);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~StatementJSObjectHolder() {};
|
|
|
|
nsCOMPtr<nsIXPConnectJSObjectHolder> mHolder;
|
|
|
|
};
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
class StatementParamsHolder final: public StatementJSObjectHolder {
|
2015-03-12 09:55:56 -07:00
|
|
|
public:
|
|
|
|
explicit StatementParamsHolder(nsIXPConnectJSObjectHolder* aHolder)
|
|
|
|
: StatementJSObjectHolder(aHolder) {
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
virtual ~StatementParamsHolder();
|
|
|
|
};
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
class StatementRowHolder final: public StatementJSObjectHolder {
|
2015-03-12 09:55:56 -07:00
|
|
|
public:
|
|
|
|
explicit StatementRowHolder(nsIXPConnectJSObjectHolder* aHolder)
|
|
|
|
: StatementJSObjectHolder(aHolder) {
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
virtual ~StatementRowHolder();
|
|
|
|
};
|
|
|
|
|
2009-04-08 09:24:25 -07:00
|
|
|
} // namespace storage
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2010-06-01 05:38:00 -07:00
|
|
|
#endif // MOZSTORAGESTATEMENTJSHELPER_H
|