WSF
RevisionSqlStmt.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2003-2015 The Boeing Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12#ifndef REVISIONSQLSTMT_HPP
13#define REVISIONSQLSTMT_HPP
14
15#include <string>
16
17#include <QByteArray>
18
19#include "ViExport.hpp"
20struct sqlite3;
21struct sqlite3_stmt;
22
23namespace wizard
24{
25// Wrapper around an sqlite statement
27{
28public:
30 RevisionSqlStmt(sqlite3* aDb, const std::string& aSql);
31 virtual ~RevisionSqlStmt();
32
33 bool Prepare(sqlite3* aDb, const std::string& aSql);
34 void Finalize();
35
36 bool Bind(int idx, int aInt);
37 bool Bind(int idx, const std::string& aString);
38 bool Bind(int idx, const char* aString);
39 bool Bind(int idx, double aValue);
40 bool Bind(int idx, const QByteArray& aBlob);
41 bool BindBlobStatic(int idx, const char* aBlob, int aBlobSize);
42 bool BindZipped(int idx, const QByteArray& aBlob);
43 bool Bind64(int idx, long long aInt64);
44 bool BindNull(int idx);
45
46 bool Reset();
47 bool Step();
48 bool StepRow();
49 bool Execute();
50 bool ExecuteStepRow();
51
52 std::string GetParameterName(int idx);
54
55 const char* ColCString(int col);
56 std::string ColText(int col);
57 int ColInt(int col);
58 long long ColInt64(int col);
59 QByteArray ColBlob(int col);
60 QByteArray ColBlobUnzipped(int col);
61
62 static int Exec(sqlite3* aSqlDb, const char* aSql);
63 static int ExecOk(sqlite3* aSqlDb, const char* aSql);
64
65private:
66 bool CheckSuccess(bool success);
67 bool CheckOk(int resultCode);
68 bool CheckStep(int resultCode);
69
70 sqlite3* mDb;
71 sqlite3_stmt* mSqlStmt;
72};
73} // namespace wizard
74
75#endif // REVISIONSQLSTMT_HPP
#define VI_EXPORT
Definition ViExport.hpp:38
bool success
Definition WsfScriptPlatformClass.cpp:3270
static int ExecOk(sqlite3 *aSqlDb, const char *aSql)
Definition RevisionSqlStmt.cpp:184
bool Execute()
Definition RevisionSqlStmt.cpp:117
bool ExecuteStepRow()
Definition RevisionSqlStmt.cpp:122
RevisionSqlStmt()
Definition RevisionSqlStmt.cpp:21
bool Bind64(int idx, long long aInt64)
Definition RevisionSqlStmt.cpp:90
QByteArray ColBlobUnzipped(int col)
Definition RevisionSqlStmt.cpp:166
bool Prepare(sqlite3 *aDb, const std::string &aSql)
Definition RevisionSqlStmt.cpp:37
bool BindNull(int idx)
Definition RevisionSqlStmt.cpp:95
int GetParameterCount()
Definition RevisionSqlStmt.cpp:132
bool BindBlobStatic(int idx, const char *aBlob, int aBlobSize)
Definition RevisionSqlStmt.cpp:79
bool Step()
Definition RevisionSqlStmt.cpp:105
bool StepRow()
Definition RevisionSqlStmt.cpp:110
bool BindZipped(int idx, const QByteArray &aBlob)
Definition RevisionSqlStmt.cpp:84
const char * ColCString(int col)
Definition RevisionSqlStmt.cpp:137
QByteArray ColBlob(int col)
Definition RevisionSqlStmt.cpp:158
static int Exec(sqlite3 *aSqlDb, const char *aSql)
Definition RevisionSqlStmt.cpp:175
std::string ColText(int col)
Definition RevisionSqlStmt.cpp:142
long long ColInt64(int col)
Definition RevisionSqlStmt.cpp:153
int ColInt(int col)
Definition RevisionSqlStmt.cpp:148
bool Reset()
Definition RevisionSqlStmt.cpp:100
void Finalize()
Definition RevisionSqlStmt.cpp:44
bool Bind(int idx, int aInt)
Definition RevisionSqlStmt.cpp:53
std::string GetParameterName(int idx)
Definition RevisionSqlStmt.cpp:127
Definition Runner.hpp:22
Copyrights Multiple, All Rights Reserved