The code atm:
UFUNCTION(BlueprintCallable, Category = "SQLite")
static void UpdateTileID_Row(
int32 TileQ,
int32 TileR,
int32 TileS,
TOptional<float> VecX,
TOptional<float> VecY,
TOptional<float> VecZ,
AActor* Store,
TOptional<int32> Row,
TOptional<int32> Col
);
void USQLiteDB::UpdateTileID_Row
(
int32 TileQ,
int32 TileR,
int32 TileS,
TOptional<float> VecX,
TOptional<float> VecY,
TOptional<float> VecZ,
AActor* Store,
TOptional<int32> Row,
TOptional<int32> Col
)
{
// Open the database
sqlite3* db;
FString dbPath = FPaths::ProjectContentDir().Append("Database/Current.btf");
int rc = sqlite3_open(TCHAR_TO_UTF8(*dbPath), &db);
if (rc != SQLITE_OK)
{
// Handle error
return;
}
// Construct the SET clause
FString setClause;
if (VecX.IsSet())
setClause.Append(FString::Printf(TEXT("VecX = %f,"), VecX.GetValue()));
if (VecY.IsSet())
setClause.Append(FString::Printf(TEXT("VecY = %f,"), VecY.GetValue()));
if (VecZ.IsSet())
setClause.Append(FString::Printf(TEXT("VecZ = %f,"), VecZ.GetValue()));
if (Store != nullptr)
setClause.Append(FString::Printf(TEXT("Store = '%s',"), *Store->GetName()));
if (Row.IsSet())
setClause.Append(FString::Printf(TEXT("Row = %d,"), Row.GetValue()));
if (Col.IsSet())
setClause.Append(FString::Printf(TEXT("Col = %d,"), Col.GetValue()));
setClause.RemoveFromEnd(",");
// Prepare the UPDATE statement
FString sql = FString::Printf(TEXT("UPDATE TileIdentity SET %s WHERE TileQ = %d AND TileR = %d AND TileS = %d"), *setClause, TileQ, TileR, TileS);
sqlite3_stmt* stmt;
rc = sqlite3_prepare_v2(db, TCHAR_TO_UTF8(*sql), -1, &stmt, nullptr);
if (rc != SQLITE_OK)
{
// Handle error
sqlite3_close(db);
return;
}
// Execute the UPDATE statement
rc = sqlite3_step(stmt);
if (rc != SQLITE_DONE)
{
// Handle error
sqlite3_finalize(stmt);
sqlite3_close(db);
return;
}
// Finalize the statement and close the database
sqlite3_finalize(stmt);
sqlite3_close(db);
}
Gives the following compile error in the editor: Error: Unable to find ‘class’, ‘delegate’, ‘enum’, or ‘struct’ with name ‘TOptional’ for each line where the TOptional is declared…
I did some searching of the internets and added:
#include "Optional.h"
to my header. File unknown, so even further searches had me adding to my build.cs:
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; //existing
PublicIncludePaths.Add("Runtime/Core/Public"); //new-line
PublicDependencyModuleNames.AddRange(new string[] //existing
{ //etc
I’m now at an absolute loss… any ideas?