#ifndef SQLStatement_h
#define SQLStatement_h
#if ENABLE(DATABASE)
#include "PlatformString.h"
#include "SQLCallbackWrapper.h"
#include "SQLResultSet.h"
#include "SQLValue.h"
#include <wtf/Forward.h>
#include <wtf/Vector.h>
namespace WebCore {
class Database;
class SQLError;
class SQLStatementCallback;
class SQLStatementErrorCallback;
class SQLTransaction;
class SQLStatement : public ThreadSafeRefCounted<SQLStatement> {
public:
static PassRefPtr<SQLStatement> create(Database*, const String&, const Vector<SQLValue>&, PassRefPtr<SQLStatementCallback>, PassRefPtr<SQLStatementErrorCallback>, int permissions);
bool execute(Database*);
bool lastExecutionFailedDueToQuota() const;
bool hasStatementCallback() const { return m_statementCallbackWrapper.hasCallback(); }
bool hasStatementErrorCallback() const { return m_statementErrorCallbackWrapper.hasCallback(); }
void setDatabaseDeletedError();
void setVersionMismatchedError();
bool performCallback(SQLTransaction*);
SQLError* sqlError() const { return m_error.get(); }
private:
SQLStatement(Database*, const String& statement, const Vector<SQLValue>& arguments, PassRefPtr<SQLStatementCallback>, PassRefPtr<SQLStatementErrorCallback>, int permissions);
void setFailureDueToQuota();
void clearFailureDueToQuota();
String m_statement;
Vector<SQLValue> m_arguments;
SQLCallbackWrapper<SQLStatementCallback> m_statementCallbackWrapper;
SQLCallbackWrapper<SQLStatementErrorCallback> m_statementErrorCallbackWrapper;
RefPtr<SQLError> m_error;
RefPtr<SQLResultSet> m_resultSet;
int m_permissions;
};
}
#endif // ENABLE(DATABASE)
#endif // SQLStatement_h