cstorage/sdata.h

73 lines
1.8 KiB
C++

/*
* dtata.h
* Copyright (C) 2023 Leonardo de Araújo Lima <leonardo@asl-sl.com.br>
*
* dstorage 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.
*
* dstorage 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/>.
*/
#ifndef _DTATA_H_
#define _DTATA_H_
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#include <iostream>
#include <vector>
#include <string>
#include "sqlite3.h"
using namespace std;
class sdata
{
public:
// variables, data members.
int nitens = 0;
int debug = 1;
int nreg =0;
char *zErrMsg = 0;
const char* data = "Callback function called";
vector<string> iname;
vector<string> idata;
// methods.
sdata(); // default constructor.
~sdata(); // default destructor.
int citens();
int show();
void set_db(const char *name);
void set_tb(const char *name);
void set_dpath(const char *path);
int dbinfo();
int add_data(const char *n, const char *d);
int tsize();
int nsize();
int vsize();
void dbtest();
int cDBase();
bool addreg();
int cnreg();
int objid = 1;
bool load();
static int callback(void *unused, int count, char **data, char **columns);
protected:
const char *dpath = " ";
const char *dbn = " ";
const char *tbn = " ";
private:
sqlite3* db;
int dsize = 0;
};
#endif // _DTATA_H_