No announcement yet.

UDK - DLLBind: Embedded database (SQLite,MySQL) v3.1.0.2

  • Filter
  • Time
  • Show
Clear All
new posts

    Awesome, I think I'll use this for savegames


      @research: I will have a look into this evening, but it looks like the editor doesn't unload the dll properly, thanks for the hint.


        This looks really good. Do you know if it's safe against SQL injection attacks? Or will it all depend on the queries written by the developer?



          the DLL itself do not perform any functions like htmlescape or something like that.

          with the parameterized statements you can perform own checks on every input value before binding it.

          In a multiplayer game, all sql action should be done on server side anyway.


            I guess parameters will take care of most possible problems It's true to say that most sql actions are performed server-side, but what if for example a player search feature was included and the player entered malicious sql in the search string.

            More a curiosity than anything ,great work though!


              in my meaning, this should be handled by the server, to check the players input before performing the SQL command...just passing the values without having a look on first...i dont like this ^^


                My understanding of SQLite might be what's confusing me, but is having an in-memory DB necessary? All I'm trying to do right now is open up an existing db, accounts.s3db (already contains usernames and passwords), add a new entry into the existing table by script, and then overwrite/update the existing accounts.s3db with the new data.

                I tried using your DBMgr and FileMgr along with some exec functions I quickly coded into my PlayerController to try and see if I could achieve this but ran into some problems, particularly with saving.. Basically what I did was set my default ContentDatabase to accounts.s3db, made an exec function DB_CreateNewAccount(string username, string password) that successfully inserted new acc info into the in-memory db. I verified this by running another exec function that ran a select * query and fed all the results to `Log, the newly created account info was there.. but I couldn't figure out how to save the new database as accounts.s3db, in effect overwriting the existing one.. I tried creating a new exec function that used the saveDatabase("accounts.s3db") function; but this didn't work, nor did using the full filepath "C:\UDK....\Content\Data\accounts.s3db".


                  due to the fact you cannot access the unrealscript varibables from the C++ side, you have to give the whole path to the file you wanna save...
                  local string lSavePath;
                  lSavePath = mUserCodeRelPathUDKGame $ mDataRootPath $ "\\" $ "accounts.s3db"; // or using a string passed into a function
                  and your right, you could also work directly in opened files instead of in-memory databases, maybe this is an addtion for one of the next versions, but i don't like this approach in this meaning.
                  One of my intentions when i create this DLL was: I want to realize savegames.

                  And for me a Savegame is a game state, so i just save my gameplay database to hard disc, and finished...all changes during gameplay are in-memory and lost if not saved. And writing operations into memory are faster than onto disc, even if SQlite are very handy and there might be any problems commonly used.

                  PS: Check your Bin\Win32\UserCode folder for your saved database (this is the working folder of the DLL). There your saved database should be.


                    Originally posted by BlackHornet80 View Post
                    @research: I will have a look into this evening, but it looks like the editor doesn't unload the dll properly, thanks for the hint.
                    The Editor never unloads the dll once it has been loaded. You can verify this by deleting the dll file after the editor has started up. The dll related functions will still work.

                    So maybe you could add a check in C++ to verify if the driver has been initialized or not before, before actually initializing it?


                      just updated the sources to version including the fix for this, compiled dll will follow



                        Thanks a lot, its working now

                        Had to remove the following line in CUDKSQLDriverSQLite::execute() to compile:
                        case SQLITE_NULL:


                          using the zip or SVN? zip maybe some files not uptodate...will check it

                          Edit....i'm sry for this mistake
                          Done, zip updated


                            I was using the zip file, although the code in your svn also has the same line in it
                            Edit: Thanks a lot, its working fine now


                              Wanted to update to my earlier question.. it's all working now! Thanks. My problem was looking to the database.ini's paths for the new accounts rather than the usercode folder, that P.S. you included at the end of your response was a big help =)




                                I have working simple save system now,
                                and thanks to you i can have items, quests , monsters, NPC databases.
                                Everything seems a lot easier now.

                                When I release my game, you will get credited and I will name `item set/ area/ boss` after you.

                                Many thanks!