cstorage/ok_files/new.main.cpp

76 lines
2.3 KiB
C++

/*
* new.main.cpp
* Copyright (C) 2023 Leonardo de Araújo Lima <leonardo@deb-horus.local>
*
* 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/>.
*/
/*
# Copyright 2022 Leonardo de Araújo Lima
#
# 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 <iostream>
#include "sdata.h"
int main(int argc, char* argv[])
{
sdata monka;
monka.debug = 1;
monka.set_dpath("/home/leonardo/databases/");
monka.set_db("/home/leonardo/databases/sData.db");
monka.set_tb("info");
monka.dbinfo();
monka.dbtest();
monka.debug = 0;
if (argv[1] > " ")
{
monka.objid = atoi(argv[1]);
}
else
{
cout << "é necessário informar o id do registro!"<< endl;
return 0;
}
cout << "\nloading..." << endl;
cout << "registtro número : " << monka.objid << endl;
bool t = monka.load();
cout << t << endl;
cout << "\ndata loaded..." << endl;
monka.show();
cout << "data sizes..." << endl;
monka.debug=1;
size_t vs = monka.tsize();
vs = monka.nsize();
vs+= monka.vsize();
cout << "\n size of data : " << vs << " bytes." << endl;
return 0;
}