Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Source/CISQLite3/CISQLite3.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ public CISQLite3(ReadOnlyTargetRules Target) : base(Target)
PublicIncludePaths.AddRange(new string[] { Path.Combine(ModuleDirectory, "Public") });
PrivateIncludePaths.AddRange(new string[] { Path.Combine(ModuleDirectory, "Private") });

PrivatePCHHeaderFile = "Private/CISQLite3PrivatePCH.h";

PublicDependencyModuleNames.AddRange(
PrivatePCHHeaderFile = "Private/CISQLite3PrivatePCH.h";
PublicDependencyModuleNames.AddRange(
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this indentation happened, this change seems to be whitespace only?

new string[] {
"Engine",
"Core",
Expand Down
1 change: 1 addition & 0 deletions Source/CISQLite3/Private/CISQLite3.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) 2016 conflict.industries MIT License (MIT)

#include "CISQLite3.h"
#include "CISQLite3PrivatePCH.h"

DEFINE_LOG_CATEGORY(LogDatabase)
Expand Down
6 changes: 3 additions & 3 deletions Source/CISQLite3/Private/SQLiteBlueprintFunctionLibrary.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "CISQLite3PrivatePCH.h"
#include "Engine.h"
#include "CString.h"

#include "SQLiteBlueprintFunctionLibrary.h"
#include "CISQLite3PrivatePCH.h"
#include "Engine.h"
#include "Misc/CString.h"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the PCH needs the BlueprintFunctionLibrary or why is this? 🤔

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea, I'm a complete noob in UE4 and C++ 😆
I don't quite remember why, but this fixed some issues I had..

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, found it. CString.h was moved to Misc/CString.h , and the order of imports was important, so they moved.




Expand Down
12 changes: 6 additions & 6 deletions Source/CISQLite3/Private/SQLiteDatabase.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "CISQLite3PrivatePCH.h"
#include "SQLiteDatabase.h"
#include "CISQLite3PrivatePCH.h"

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

Expand All @@ -17,7 +17,7 @@ USQLiteDatabase::USQLiteDatabase(const FObjectInitializer& ObjectInitializer)

bool USQLiteDatabase::CreateDatabase(const FString& Filename, bool RelativeToProjectContentDirectory)
{
const FString actualFilename = RelativeToProjectContentDirectory ? FPaths::ProjectContentDir() + Filename : Filename;
const FString actualFilename = RelativeToProjectContentDirectory ? FPaths::ConvertRelativePathToFull(FPaths::ProjectContentDir()) + Filename : Filename;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember fighting path issues on Android, but I don't think this should be a problem.
Anyone test this on Android coincidentally? 🤔

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't tested on anything else but Windows, sorry. I'm not sure why I did this either, but IIRC a relative path didn't work correctly.

I'm sorry for the incredibly low quality of the MR - I just managed to make it work on my machine and decided to share ;p

Thanks for your time!

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, sharing is always valuable, maybe someone using this on Android will pick it up and verify 👍


sqlite3* db;
int res = sqlite3_open(TCHAR_TO_ANSI(*actualFilename), &db);
Expand Down Expand Up @@ -273,12 +273,12 @@ bool USQLiteDatabase::GetDataIntoObjectBP(const FSQLiteDatabaseReference& DataSo

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

TMap<FString, UProperty*> USQLiteDatabase::CollectProperties(UObject* SourceObject)
TMap<FString, FProperty*> USQLiteDatabase::CollectProperties(UObject* SourceObject)
{

UClass* SourceObjectClass = SourceObject->GetClass();
TMap<FString, UProperty*> Props;
for (TFieldIterator<UProperty> PropIt(SourceObjectClass, EFieldIteratorFlags::SuperClassFlags::IncludeSuper);
TMap<FString, FProperty*> Props;
for (TFieldIterator<FProperty> PropIt(SourceObjectClass, EFieldIteratorFlags::SuperClassFlags::IncludeSuper);
PropIt; ++PropIt)
{
Props.Add(*PropIt->GetNameCPP(), *PropIt);
Expand Down Expand Up @@ -797,7 +797,7 @@ void USQLiteDatabase::AssignResultsToObjectProperties(const SQLiteResultValue& R
{
if (propertyMap.Contains(field.Name))
{
UProperty* targetProperty = propertyMap[field.Name];
FProperty* targetProperty = propertyMap[field.Name];

if (field.Type == SQLiteResultValueTypes::Integer)
{
Expand Down
2 changes: 1 addition & 1 deletion Source/CISQLite3/Public/CISQLite3.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#pragma once

#include "ModuleManager.h"
#include "Modules/ModuleManager.h"

class FCISQLite3 : public IModuleInterface
{
Expand Down
2 changes: 1 addition & 1 deletion Source/CISQLite3/Public/SQLiteDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class CISQLITE3_API USQLiteDatabase : public UObject
/** Tries to open a database. */
static bool CanOpenDatabase(const FString& DatabaseFilename);
/** Collects all properties from an UObject and maps them by the property name. */
static TMap<FString, UProperty*> CollectProperties(UObject* SourceObject);
static TMap<FString, FProperty*> CollectProperties(UObject* SourceObject);
/** Constructs an SQL query from the blueprint fed data. */
static FString ConstructQuery(TArray<FString> Tables, TArray<FString> Fields, FSQLiteQueryFinalizedQuery QueryObject, int32 MaxResults = -1, int32 ResultOffset = 0);
/** Assigns a result row's fields' values to an UObject, ie. assigns them to the properties that have the same name. */
Expand Down