<commit_before>#ifndef __NANOSQL
#define __NANOSQL

#include <sqlite3.h>
#include <string>
typedef struct
{
	char **arr;
	int row, col;
} Res;

typedef int CallbackFunc (void *notUsed, int argc, char **argv, char **colName);

class Sql
{
	public:
		Sql(const std::string& filename);
		~Sql();
		Res raw_result; // by get_table(query)
		std::string lasterr;
		bool is_tran() const;
		int exec(const std::string& query, CallbackFunc cb=NULL);
		int get_table(const std::string& query);
		inline char* result(long row, long col);
		inline char* colName(long col);
		int begin_tran();
		int end_tran();

	private:
		sqlite3* db_;
		bool tran_;
};


inline char* Sql::result(long row, long col)
{
	return (raw_result.arr[ row*raw_result.col + col -1 ]);
}

inline char* Sql::colName(long col)
{
	return raw_result.arr[col-1];
}
#endif<commit_msg>Add "const" to result() & colName()<commit_after>#ifndef __NANOSQL
#define __NANOSQL

#include <sqlite3.h>
#include <string>
typedef struct
{
	char **arr;
	int row, col;
} Res;

typedef int CallbackFunc (void *notUsed, int argc, char **argv, char **colName);

class Sql
{
	public:
		Sql(const std::string& filename);
		~Sql();
		Res raw_result; // by get_table(query)
		std::string lasterr;
		bool is_tran() const;
		int exec(const std::string& query, CallbackFunc cb=NULL);
		int get_table(const std::string& query);
		inline char* result(long row, long col) const;
		inline char* colName(long col) const;
		int begin_tran();
		int end_tran();

	private:
		sqlite3* db_;
		bool tran_;
};


inline char* Sql::result(long row, long col) const
{
	return (raw_result.arr[ row*raw_result.col + col -1 ]);
}

inline char* Sql::colName(long col) const
{
	return raw_result.arr[col-1];
}
#endif
{'fraction_non_alphanumeric': 0.14293981481481483, 'fraction_numerical': 0.004629629629629629, 'mean_word_length': 4.6875, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1911878', 'n_tokens_mistral': 685, 'n_tokens_neox': 640, 'n_words': 187}