<commit_before>/*
 * Copyright 2013 <NAME>
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef GUARD_sqlite_dbconn_hpp_8577399267152603
#define GUARD_sqlite_dbconn_hpp_8577399267152603

// Hide from Doxygen
/// @cond

/** @file
 *
 * @brief Header file pertaining to SQLiteDBConn class.
 */

#include "../sqloxx_exceptions.hpp"
#include "sql_statement_impl.hpp"
#include <jewel/checked_arithmetic.hpp>
#include "sqlite3.h"  // Compiling directly into build
#include <boost/filesystem/path.hpp>
#include <limits>
#include <string>
#include <vector>

namespace sqloxx
{
namespace detail
{

/**
 * @class SQLiteDBConn
 *
 * This class is designed to be used only by other classes within
 * the Sqloxx module, and should not be accessed by external client
 * code.
 *
 * This class is intended to encapsulate calls to the C API
 * provided by SQLite, in relation to managing a database connection
 * represented by a sqlite3* struct.
 *
 * SQLiteDBConn is in designed to be contained
 * within an instance of DatabaseConnection; and it is DatabaseConnection
 * that provides the higher-level interface with clients outside of
 * Sqloxx, as well as a range of convenience functions that are not
 * provided by this lower-level class.
 *
 * @todo MEDIUM PRIORITY Supply public member functions to close
 * any database connections and to shut down SQLite3. Current this is done
 * in the destructor, but destructors should not throw, so the destructor
 * calls std::terminate() if close or shut-down fails.
 */
class SQLiteDBConn
{
	friend class SQLStatementImpl;

public:

	/**
	 * Initializes SQLite3 and creates a database connection
	 * initially set to null.
	 *
	 * @throws SQLiteInitializationError if initialization fails
	 * for any reason.
	 */
	SQLiteDBConn();<commit_msg>Added a TODO re. SQLiteDBConn, re. managing SQLite initialization and shutdown functions better.<commit_after>/*
 * Copyright 2013 <NAME>
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef GUARD_sqlite_dbconn_hpp_8577399267152603
#define GUARD_sqlite_dbconn_hpp_8577399267152603

// Hide from Doxygen
/// @cond

/** @file
 *
 * @brief Header file pertaining to SQLiteDBConn class.
 */

#include "../sqloxx_exceptions.hpp"
#include "sql_statement_impl.hpp"
#include <jewel/checked_arithmetic.hpp>
#include "sqlite3.h"  // Compiling directly into build
#include <boost/filesystem/path.hpp>
#include <limits>
#include <string>
#include <vector>

namespace sqloxx
{
namespace detail
{

/**
 * @class SQLiteDBConn
 *
 * This class is designed to be used only by other classes within
 * the Sqloxx module, and should not be accessed by external client
 * code.
 *
 * This class is intended to encapsulate calls to the C API
 * provided by SQLite, in relation to managing a database connection
 * represented by a sqlite3* struct.
 *
 * SQLiteDBConn is in designed to be contained
 * within an instance of DatabaseConnection; and it is DatabaseConnection
 * that provides the higher-level interface with clients outside of
 * Sqloxx, as well as a range of convenience functions that are not
 * provided by this lower-level class.
 *
 * @todo MEDIUM PRIORITY Supply public member functions to close
 * any database connections and to shut down SQLite3. Current this is done
 * in the destructor, but destructors should not throw, so the destructor
 * calls std::terminate() if close or shut-down fails.
 *
 * @todo HIGH PRIORITY sqlite3_initialize() and sqlite3_shutdown()
 * functions should probably be managed such that they are called automatically
 * only by the first SQLiteDBConn to be created globally, and the last
 * SQLiteDBConn to be destructed globally, respectively.
 */
class SQLiteDBConn
{
	friend class SQLStatementImpl;

public:

	/**
	 * Initializes SQLite3 and creates a database connection
	 * initially set to null.
	 *
	 * @throws SQLiteInitializationError if initialization fails
	 * for any reason.
	 */
	SQLiteDBConn();
{'fraction_non_alphanumeric': 0.07124117053481333, 'fraction_numerical': 0.018163471241170535, 'mean_word_length': 4.1625, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6697057', 'n_tokens_mistral': 1433, 'n_tokens_neox': 1336, 'n_words': 608}