x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

4.6 How to use SQLiteSupport?

Hello, could anyone make a small tutorial how to use SQLiteSupport module with some simple read and write example?

P.S. I'm stuck at "WITH_SQLITE" because it's grayed out and I'm not sure where I have to define it.

Product Version: Not Selected
Tags:
more ▼

asked Dec 06 '14 at 07:11 PM in C++ Programming

avatar image

Rezental
88 5 10 18

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Hi Nicolas, There were a few minor issues with the integration of SQLite support in 4.6 that became apparent after that release was branched. If you are using a Github build of the engine, you can merge in these two changes from the master branch:

https://github.com/EpicGames/UnrealEngine/commit/0aa0b62243a9f90de1b357e10f623b04b85de298 https://github.com/EpicGames/UnrealEngine/commit/170b9329e934b959491112b1f1a9cad8ddc665f1

They remove the need for the WITH_SQLITE defines, amongst other things, including improving the crossplatform support of the library.

With those merged you should be able to simply add SQLiteSupport as a dependency module and then do something like this:

 //create and open the database
     FSQLiteDatabase Database();
     Database.Open("Path\\To\\File", nullptr, nullptr);
     //run query where no results are returned
     Database->Execute(*(FString::Printf(TEXT("Update GameSession set SessionTimeEnd= %s where SessionID = %s"), *(FDateTime::Now().ToString()), *(FApp::GetSessionId().ToString()))));
     
     //run query to fetch results from database
     FSQLiteResultSet* NameResults = NULL;
     if (Database.Execute(*(FString::Printf(TEXT("Select * from Players where SessionID = %s;"), *SessionID)),NameResults))
     {
         for (FSQLiteResultSet::TIterator NameIterator(NameResults); NameIterator; ++NameIterator)
         {
             //do something with the results here
         }
     }

 

more ▼

answered Dec 06 '14 at 07:45 PM

avatar image

twiddle
1.5k 55 36 73

avatar image Rezental Dec 06 '14 at 10:03 PM

Thank you a lot, it did work!

avatar image Hyperloop Dec 09 '14 at 02:28 AM

Where did you find info about SQLite support getting added to the engine? It's not in the patch notes, so I was just curious where I could read about it.

avatar image twiddle Dec 09 '14 at 02:29 AM

On the forum post with additional details, waaay down towards the bottom there's a mention of the SQLite support being added as an optional module.

avatar image Stunt Thumper May 08 '15 at 06:53 PM

Just wanted to mention this here:

SQLite only supports a single writer at a time (meaning the execution of an individual transaction). SQLite locks the entire database when it needs a lock (either read or write) and only one writer can hold a write lock at a time. Due to its speed this actually isn't a problem for low to moderate size applications, but if you have a higher volume of writes (hundreds per second) then it could become a bottleneck.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

We hope this plugin can help you.

HiSQLite3 (SQLite3 For UE4)

more ▼

answered Aug 08 '18 at 01:58 AM

avatar image

YeHaike
0 4 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question