Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
sqlitebrowser/src/sqlitedb.h at master · robohh/sqlitebrowser · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
See all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
robohh
sqlitebrowser
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
sqlitebrowser
/
src
/
sqlitedb.h
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
138 lines (111 loc) · 5.18 KB
master
Breadcrumbs
sqlitebrowser
/
src
/
sqlitedb.h
Copy path
Top
File metadata and controls
Code
Blame
138 lines (111 loc) · 5.18 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#
ifndef
SQLITEDB_H
#
define
SQLITEDB_H
#
include
"
sqlitetypes.h
"
#
include
<
QStringList
>
#
include
<
QMultiMap
>
#
include
<
QByteArray
>
struct
sqlite3
;
class
CipherDialog
;
enum
{
kLogMsg_User
,
kLogMsg_App
};
typedef
QMultiMap<QString, sqlb::ObjectPtr> objectMap;
class
DBBrowserDB
:
public
QObject
{
Q_OBJECT
public:
explicit
DBBrowserDB
() : _db(
0
), isEncrypted(
false
), isReadOnly(
false
), dontCheckForStructureUpdates(
false
) {}
virtual
~DBBrowserDB
(){}
bool
open
(
const
QString& db,
bool
readOnly =
false
);
bool
attach
(
const
QString& filename, QString attach_as =
"
"
);
bool
create
(
const
QString & db);
bool
close
();
bool
setSavepoint
(
const
QString& pointname =
"
RESTOREPOINT
"
);
bool
releaseSavepoint
(
const
QString& pointname =
"
RESTOREPOINT
"
);
bool
revertToSavepoint
(
const
QString& pointname =
"
RESTOREPOINT
"
);
bool
releaseAllSavepoints
();
bool
revertAll
();
bool
dump
(
const
QString & filename,
const
QStringList &tablesToDump,
bool
insertColNames,
bool
insertNew,
bool
exportSchema,
bool
exportData);
bool
executeSQL
(QString statement,
bool
dirtyDB =
true
,
bool
logsql =
true
);
bool
executeMultiSQL
(
const
QString& statement,
bool
dirty =
true
,
bool
log =
false
);
const
QString&
lastError
()
const
{
return
lastErrorMessage; }
/*
*
* @brief getRow Executes a sqlite statement to get the rowdata(columns)
* for the given rowid.
* @param sTableName Table to query.
* @param rowid The rowid to fetch.
* @param rowdata A list of QByteArray containing the row data.
* @return true if statement execution was ok, else false.
*/
bool
getRow
(
const
QString&
sTableName
,
const
QString& rowid, QList<QByteArray>& rowdata);
/*
*
* @brief max Queries the table t for the max value of field.
* @param t Table to query
* @param field Field to get the max value
* @return the max value of the field or 0 on error
*/
QString
max
(
const
sqlb::Table& t, sqlb::FieldPtr field)
const
;
void
updateSchema
();
QString
addRecord
(
const
QString&
sTableName
);
/*
*
* @brief Creates an empty insert statement.
* @param pk_value This optional parameter can be used to manually set a specific value for the primary key column
* @return An sqlite conform INSERT INTO statement with empty values. (NULL,'',0)
*/
QString
emptyInsertStmt
(
const
sqlb::Table& t,
const
QString& pk_value = QString())
const
;
bool
deleteRecords
(
const
QString& table,
const
QStringList& rowids);
bool
updateRecord
(
const
QString& table,
const
QString& column,
const
QString& rowid,
const
QByteArray& value,
bool
itsBlob);
bool
createTable
(
const
QString& name,
const
sqlb::FieldVector& structure);
bool
renameTable
(
const
QString& from_table,
const
QString& to_table);
bool
addColumn
(
const
QString& table,
const
sqlb::FieldPtr& field);
/*
*
* @brief renameColumn Can be used to rename, modify or drop an existing column of a given table
* @param table_name Specifies the name of the table to edit
* @param table Specifies the table to edit. The table constraints are used from this but not the columns
* @param name Name of the column to edit
* @param to The new field definition with changed name, type or the like. If Null-Pointer is given the column is dropped.
* @param move Set this to a value != 0 to move the new column to a different position
* @return true if renaming was successful, false if not. In the latter case also lastErrorMessage is set
*/
bool
renameColumn
(
const
QString& tablename,
const
sqlb::Table& table,
const
QString& name, sqlb::FieldPtr to,
int
move =
0
);
objectMap
getBrowsableObjects
()
const
;
const
sqlb::ObjectPtr
getObjectByName
(
const
QString& name)
const
;
bool
isOpen
()
const
;
bool
encrypted
()
const
{
return
isEncrypted; }
bool
readOnly
()
const
{
return
isReadOnly; }
bool
getDirty
()
const
;
QString
currentFile
()
const
{
return
curDBFilename; }
void
logSQL
(QString statement,
int
msgtype);
QString
getPragma
(
const
QString& pragma);
bool
setPragma
(
const
QString& pragma,
const
QString& value);
bool
setPragma
(
const
QString& pragma,
const
QString& value, QString& originalvalue);
bool
setPragma
(
const
QString& pragma,
int
value,
int
& originalvalue);
bool
loadExtension
(
const
QString& filename);
QVector<QPair<QString, QString>>
queryColumnInformation
(
const
QString& object_name);
QString
generateSavepointName
(
const
QString& identifier = QString())
const
;
sqlite3 * _db;
objectMap objMap;
signals:
void
sqlExecuted
(QString sql,
int
msgtype);
void
dbChanged
(
bool
dirty);
void
structureUpdated
();
private:
QString curDBFilename;
QString lastErrorMessage;
QStringList savepointList;
bool
isEncrypted;
bool
isReadOnly;
bool
tryEncryptionSettings
(
const
QString& filename,
bool
* encrypted, CipherDialog*& cipherSettings);
bool
dontCheckForStructureUpdates;
class
NoStructureUpdateChecks
{
public:
NoStructureUpdateChecks
(DBBrowserDB& db) : m_db(db) { m_db.
dontCheckForStructureUpdates
=
true
; }
~NoStructureUpdateChecks
() { m_db.
dontCheckForStructureUpdates
=
false
; }
private:
DBBrowserDB& m_db;
};
};
#
endif
You can’t perform that action at this time.