Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
05343bdf
Commit
05343bdf
authored
9 years ago
by
Steven Murray
Browse files
Options
Downloads
Patches
Plain Diff
Forgot to add the new helper class catalogue::Sqlite
parent
72d4c81f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
catalogue/Sqlite.cpp
+89
-0
89 additions, 0 deletions
catalogue/Sqlite.cpp
catalogue/Sqlite.hpp
+44
-0
44 additions, 0 deletions
catalogue/Sqlite.hpp
with
133 additions
and
0 deletions
catalogue/Sqlite.cpp
0 → 100644
+
89
−
0
View file @
05343bdf
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
"catalogue/Sqlite.hpp"
#include
<sstream>
//------------------------------------------------------------------------------
// rcToStr
//------------------------------------------------------------------------------
std
::
string
cta
::
catalogue
::
Sqlite
::
rcToStr
(
const
int
rc
)
{
switch
(
rc
)
{
case
SQLITE_ABORT
:
return
"Abort requested"
;
case
SQLITE_AUTH
:
return
"Authorization denied"
;
case
SQLITE_BUSY
:
return
"Failed to take locks"
;
case
SQLITE_CANTOPEN
:
return
"Cannot open database file"
;
case
SQLITE_CONSTRAINT
:
return
"Constraint violation"
;
case
SQLITE_CORRUPT
:
return
"Database file corrupted"
;
case
SQLITE_DONE
:
return
"Statement finished executing successfully"
;
case
SQLITE_EMPTY
:
return
"Database file empty"
;
case
SQLITE_FORMAT
:
return
"Database format error"
;
case
SQLITE_FULL
:
return
"Database full"
;
case
SQLITE_INTERNAL
:
return
"Internal SQLite library error"
;
case
SQLITE_INTERRUPT
:
return
"Interrupted"
;
case
SQLITE_IOERR
:
return
"I/O error"
;
case
SQLITE_LOCKED
:
return
"A table is locked"
;
case
SQLITE_MISMATCH
:
return
"Datatype mismatch"
;
case
SQLITE_MISUSE
:
return
"Misuse"
;
case
SQLITE_NOLFS
:
return
"OS does not provide large file support"
;
case
SQLITE_NOMEM
:
return
"Memory allocation error"
;
case
SQLITE_NOTADB
:
return
"Not a database file"
;
case
SQLITE_OK
:
return
"Operation successful"
;
case
SQLITE_PERM
:
return
"Permnission denied"
;
case
SQLITE_RANGE
:
return
"Invalid bind parameter index"
;
case
SQLITE_READONLY
:
return
"Failed to write to read-only database"
;
case
SQLITE_ROW
:
return
"A new row of data is ready for reading"
;
case
SQLITE_SCHEMA
:
return
"Database schema changed"
;
case
SQLITE_TOOBIG
:
return
"TEXT or BLOCK too big"
;
case
SQLITE_ERROR
:
return
"Generic error"
;
default:
{
std
::
ostringstream
oss
;
oss
<<
"Unknown SQLite return code "
<<
rc
;
return
oss
.
str
();
}
}
}
This diff is collapsed.
Click to expand it.
catalogue/Sqlite.hpp
0 → 100644
+
44
−
0
View file @
05343bdf
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include
<sqlite3.h>
#include
<string>
namespace
cta
{
namespace
catalogue
{
/**
* A helper class for working with SQLite.
*/
class
Sqlite
{
public:
/**
* Returns the string representation of the specified SQLite return code.
*
* @param rc The SQLite return code.
* @return The string representation of the SQLite return code.
*/
static
std
::
string
rcToStr
(
const
int
rc
);
};
// class SqlLiteStmt
}
// namespace catalogue
}
// namespace cta
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment