<commit_before>#include "SQLite3UE4PluginPrivatePCH.h"
#include "../Classes/SQLiteDatabase.h"

#define LOGSQLITE(verbosity, text) UE_LOG(LogDatabase, verbosity, TEXT("SQLite: %s"), text)

TMap<FString, FString> USQLiteDatabase::Databases;

//--------------------------------------------------------------------------------------------------------------

USQLiteDatabase::USQLiteDatabase(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
}

//--------------------------------------------------------------------------------------------------------------

bool USQLiteDatabase::RegisterDatabase(FString Name, FString Filename, bool RelativeToGameContentDirectory)
{
	FString actualFilename = Filename;

	if (RelativeToGameContentDirectory)
	{
		actualFilename = FPaths::GameDir() + Filename;
	}

	if (IsDatabaseRegistered(Name))
	{
		FString message = "Database '" + actualFilename + "' is already registered, skipping.";
		LOGSQLITE(Warning, *message);
		return true;
	}

	if (!IsValidDatabase(actualFilename, true))
	{
		FString message = "Unable to add database '" + actualFilename + "', it is not valid (problems opening it)!";
		LOGSQLITE(Error, *message);
		return false;
	}

	Databases.Add(Name, actualFilename);

	FString successMessage = "Registered SQLite database '" + actualFilename + "' successfully.";
	LOGSQLITE(Verbose, *successMessage);
	return true;

}

//--------------------------------------------------------------------------------------------------------------

bool USQLiteDatabase::GetDataIntoObject(const FString& DatabaseName, const FString& Query, UObject* ObjectToPopulate)
{
	//////////////////////////////////////////////////////////////////////////<commit_msg>Your not getting the Game Content Dir but the game root<commit_after>#include "SQLite3UE4PluginPrivatePCH.h"
#include "../Classes/SQLiteDatabase.h"

#define LOGSQLITE(verbosity, text) UE_LOG(LogDatabase, verbosity, TEXT("SQLite: %s"), text)

TMap<FString, FString> USQLiteDatabase::Databases;

//--------------------------------------------------------------------------------------------------------------

USQLiteDatabase::USQLiteDatabase(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
}

//--------------------------------------------------------------------------------------------------------------

bool USQLiteDatabase::RegisterDatabase(FString Name, FString Filename, bool RelativeToGameContentDirectory)
{
	FString actualFilename = Filename;

	if (RelativeToGameContentDirectory)
	{
		actualFilename = FPaths::GameContentDir() + Filename;
	}

	if (IsDatabaseRegistered(Name))
	{
		FString message = "Database '" + actualFilename + "' is already registered, skipping.";
		LOGSQLITE(Warning, *message);
		return true;
	}

	if (!IsValidDatabase(actualFilename, true))
	{
		FString message = "Unable to add database '" + actualFilename + "', it is not valid (problems opening it)!";
		LOGSQLITE(Error, *message);
		return false;
	}

	Databases.Add(Name, actualFilename);

	FString successMessage = "Registered SQLite database '" + actualFilename + "' successfully.";
	LOGSQLITE(Verbose, *successMessage);
	return true;

}

//--------------------------------------------------------------------------------------------------------------

bool USQLiteDatabase::GetDataIntoObject(const FString& DatabaseName, const FString& Query, UObject* ObjectToPopulate)
{
	//////////////////////////////////////////////////////////////////////////
{'fraction_non_alphanumeric': 0.32232117207698935, 'fraction_numerical': 0.0011490950876185005, 'mean_word_length': 1.9383966244725739, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2771874', 'n_tokens_mistral': 874, 'n_tokens_neox': 851, 'n_words': 192}