![]() XOJO PRO PRIORITY SUPPORT CODEThis way I can break on the code and not the conditional, and in some cases this saves many hundreds of calls and having to step through the code.Īs always, remember that what you do today can save your sanity or break it tomorrow! This is why, as I go through the Xojo IDE code base, I usually remove one-liners and turn them into multi-line if … end if statements. ![]() This allows you to put the break point on the code and not on the conditional. If it is code that gets run a lot, this can be a big deal. You can’t put a break point on the code that runs when the condition is true. And though sometimes this may not matter, when it does, like when you want to step into the method or code that is run, you have to turn the one-liner into a multi-line If…End If statement. He manages and is the developer behind the GuancheMOS plug-in for Xojo Developers, Markdown Parser for Xojo, HTMLColorizer for Xojo and the Snippery app, among others.Ī lot of times you’d think that single lines of code, aka “one-liners”, like if j >= 145 condition then dosomething() Javier Rodriguez has been the Xojo Spanish Evangelist since 2008, he’s also a Developer, Consultant and Trainer who has be using Xojo since 1998. XOJO PRO PRIORITY SUPPORT PASSWORDIn addition, you need to provide the String to the password used originally to encrypt the data on the source database. This example assumes that this has been done using the AES 256 option, stronger than the one using a length of 128 bits and the only option available before Xojo 2018r1.įinally, in the last sentence db.SQLExecute you’ll have to change the table name you want to copy from the source database to the new RAM based one ( product_table in the example). to the newly created table on the RAM SQLite databaseĭb.SQLExecute("create table RAMDB.product_table as select * from main.product_table")Īs you can see, the second line of code expects a valid FolderItem instance pointing to the SQLite database on disk. Copying all the contents from the source table We create a in-memory database, 'attaching' it with the disk based SQLite databaseĭb.SQLExecute("attach database ':memory:' as 'RAMDB'") Re.Reason = "Error trying to connect to the database"ĭb.SQLExecute("PRAGMA LOCKING_MODE = Exclusive") // Improves the read access to the database However, and focusing on the tip itself, this is the snippet of code you can use: Dim db as SQLiteDatabase = New SQLiteDatabaseĭb.DatabaseFile = // FolderItem to the SQLite database file on diskĭb.EncryptionKey = "aes256:" + // same password that the one used to encrypt the data You can further modify this technique so you can work with your databases in a mixed way that is, where we want to simultaneously execute a query involving both an encrypted database table and an in-memory table database.īut for this example code we are only focused on opening an encrypted SQLite database (based on disk) as a new SQLite class instance, and using next a SQL sentence to create a new in-memory database (named RAMDB in the example), creating the same table on the RAM database next and then copying the data from the source table during the process.įrom that time on, you will be able to use the new table on RAM at light speed!Īnother SQL command you might find of interest, and that you can use in all your SQLite databases where you expect to get a gain in the read speed, is to use the exclusive mode, using for that PRAGMA LOCKING_MODE = Exclusive. How can we improve this? One technique is the creation of a new in-memory based SQLite database, where we will be able to copy the table (or tables) we are interested in getting the maximum speed possible with. But the truth is that encrypting the data in these databases can introduce a penalty in our queries, both from read and writing/updating data to them. ![]() It’s very usual to use encrypted SQLite databases in our Xojo projects where we expect to get the maximum read speed from them. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |