Newer
Older

Jan Reher
committed
// Basic
#include <fstream>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
// Boost
#include <boost/program_options.hpp>
// Custom
#include "ProdDbAccess.h"
#include "BulkDbAccess.h"

Jan Reher
committed
#include "toolbox.cpp"
using namespace std;
namespace po = boost::program_options;
static string fileName = "serials.dat";
int main(int argc, char* argv[]) {
if ( argc < 2 ) {
cerr << "ERROR: Missing parameters! Please provide the name of a text file containing the serials needed." << endl;
exit(1);
}
if ( argc > 2 ) {
cerr << "ERROR: Too many parameters! Please only provide the name of a text file containing the serials needed." << endl;
exit(1);
}
fileName = string(argv[1]);
vector<string> apdSerials = loadSerialsFromFileName(fileName);
AbsDbAccess* _dba = suitedDbAccess(apdSerials.size());

Jan Reher
committed
for (size_t i = 0 ; i < apdSerials.size() ; i++ ) {
if (apdSerials[i].size() == 9) apdSerials[i] = "0" + apdSerials[i];
cout << "S/N: " << apdSerials[i] << " New: " << _dba->getBatchNew( uint( stoul( apdSerials[i] ) ) ) << " Old: " << _dba->getBatchIrr( uint( stoul( apdSerials[i] ) ) ) << endl;
}
return 0;
}