mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-23 14:07:20 +00:00
3de3932503
Remove the CDClientDatabase::ExecuteQueryWithArgs() function and replace it with CDClientDatabase::CreatePreppedStmt(). This prevents a developer from accidently using %s, or incorrectly passing std::string, and causing a silent error.
50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
#pragma once
|
|
|
|
// C++
|
|
#include <string>
|
|
|
|
// SQLite
|
|
#include "CppSQLite3.h"
|
|
|
|
/*
|
|
* Optimization settings
|
|
*/
|
|
|
|
#include <sstream>
|
|
#include <iostream>
|
|
|
|
// Enable this to cache all entries in each table for fast access, comes with more memory cost
|
|
//#define CDCLIENT_CACHE_ALL
|
|
|
|
// Enable this to skip some unused columns in some tables
|
|
#define UNUSED(v)
|
|
|
|
/*!
|
|
\file CDClientDatabase.hpp
|
|
\brief An interface between the CDClient.sqlite file and the server
|
|
*/
|
|
|
|
//! The CDClient Database namespace
|
|
namespace CDClientDatabase {
|
|
|
|
//! Opens a connection with the CDClient
|
|
/*!
|
|
\param filename The filename
|
|
*/
|
|
void Connect(const std::string& filename);
|
|
|
|
//! Queries the CDClient
|
|
/*!
|
|
\param query The query
|
|
\return The results of the query
|
|
*/
|
|
CppSQLite3Query ExecuteQuery(const std::string& query);
|
|
|
|
//! Queries the CDClient and parses arguments
|
|
/*!
|
|
\param query The query with formatted arguments
|
|
\return prepared SQLite Statement
|
|
*/
|
|
CppSQLite3Statement CreatePreppedStmt(const std::string& query);
|
|
};
|