<commit_before>#include "DatabaseProxy.h"

# define DEBUG cout << "[" << __FILE__ << ":" << __LINE__ << "] " <<
# define ERROR cerr << "[" << __FILE__ << ":" << __LINE__ << "] " <<


using namespace std;


string DatabaseProxy::convertIntToStr( int number )
{
   stringstream ss;//create a stringstream
   ss << number;//add number to the stream
   return ss.str();//return a string with the contents of the stream
}

vector< vector<string> > DatabaseProxy::sqlGet ( string sqlcommand )
{
    Config config;
    vector< vector<string> >  list_2d;
    unsigned int     col_count;
    
    string conn_para = config.get( "DB-DRIVER" );
    tntdb::Connection conn;
    tntdb::Result result;
    
    conn = tntdb::connect(conn_para);
    DEBUG "SQLCODE: " << sqlcommand << endl;
    result = conn.select( sqlcommand );
    DEBUG "result.size()=" << result.size() << endl;
    for (tntdb::Result::const_iterator it = result.begin();
        it != result.end(); ++it
    ) {
        vector<string>  list_1d;
        tntdb::Row row = *it;
        for ( col_count = 0; col_count != row.size(); col_count++ ) {       
            DEBUG "col_count: " << col_count << endl;
            std::string value;
            row[col_count].get(value); 
            DEBUG "value=" << value << endl;
            string copy_value = value;
            DEBUG "copy_value=" << copy_value << endl;
            list_1d.push_back( copy_value );
        }
        DEBUG "list_1d[0]=" << list_1d[0] << endl;
        list_2d.push_back( list_1d );
    }
    conn.close();
    for ( unsigned int i = 0; i != list_2d.size(); i++ ) {    
        DEBUG "list_2d[i]: " << list_2d[i][0] << endl;
    }
    return list_2d;
}    

string DatabaseProxy::sqlGetSingle ( string sqlcommand )
{<commit_msg>remove debug info.<commit_after>#include "DatabaseProxy.h"

# define DEBUG cout << "[" << __FILE__ << ":" << __LINE__ << "] " <<
# define ERROR cerr << "[" << __FILE__ << ":" << __LINE__ << "] " <<


using namespace std;


string DatabaseProxy::convertIntToStr( int number )
{
   stringstream ss;//create a stringstream
   ss << number;//add number to the stream
   return ss.str();//return a string with the contents of the stream
}

vector< vector<string> > DatabaseProxy::sqlGet ( string sqlcommand )
{
    Config config;
    vector< vector<string> >  list_2d;
    unsigned int     col_count;
    
    string conn_para = config.get( "DB-DRIVER" );
    tntdb::Connection conn;
    tntdb::Result result;
    
    conn = tntdb::connect(conn_para);
    DEBUG "SQLCODE: " << sqlcommand << endl;
    result = conn.select( sqlcommand );
    for (tntdb::Result::const_iterator it = result.begin();
        it != result.end(); ++it
    ) {
        vector<string>  list_1d;
        tntdb::Row row = *it;
        for ( col_count = 0; col_count != row.size(); col_count++ ) {  
            std::string value;
            row[col_count].get(value); 
            string copy_value = value;
            list_1d.push_back( copy_value );
        }
        list_2d.push_back( list_1d );
    }
    conn.close();
    return list_2d;
}    

string DatabaseProxy::sqlGetSingle ( string sqlcommand )
{
{'fraction_non_alphanumeric': 0.14853689567430026, 'fraction_numerical': 0.007315521628498728, 'mean_word_length': 2.606651376146789, 'pattern_counts': {'":': 4, '<': 97, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1333196', 'n_tokens_mistral': 1024, 'n_tokens_neox': 1014, 'n_words': 242}