Recent

Author Topic: Simple SQLite3 Demo with Encryption and PRAGMA - Updated  (Read 19716 times)

jdlinke

  • Jr. Member
  • **
  • Posts: 62
  • Just old me
Re: Simple SQLite3 Demo with Encryption and PRAGMA - Updated
« Reply #15 on: July 12, 2014, 06:19:44 pm »
Thanks so much for the help and comments BigChimp and Mike!


1. I wonder whether you need the .Net framework if you use System.Data.SQLite? Obviously yes if you use .Net to program but I would hope that the MSVC++ runtimes would be enough to use the dll?? Haven't tested this of course.

That's a really good question. Maybe I misread the info from the SQLite website, but I'll take another look and get back to you. It would be beneficial if that's the case, because the program I'm currently developing is a few megabytes, and that .net framework is HUGE. It'll be frustrating if I have to include it into my installation exe.


2. Hmmm, I would expect that user_version would be used to track metadata changes, not application_id. I do understand both would work so more of a comment really...

I agree 100%, but it looks like it was one of those situations where changes were made later on and things became unclear. This page has some info about how these terms came to be.


(with Mike's fix)
SQLite3Connection1.ExecuteDirect('PRAGMA rekey = ' + QuotedStr(txtNew.Text) + ';');

Thanks for pointing this out. Much more readable.


2. btnAddToDBClick: Why are you closing the sqlite connection? To free the default transaction and allow 3rd party programs to access the db? I've removed it...
4. SQLTransaction1.Commit; makes the transaction.active property false so specifying that is redundant; removed it.

I'm still pretty new, and it seems I'm always doing redundant stuff like that...


5. Add to db button a call to update grid automatically so user sees what happened
6. Cleaned up sql3connection.password handling a bit
7. Added some showmessages to show succesful completion

Thanks again. I really appreciate the input and guidance you've provided with this.
Lazarus 1.2.4 32-bit version on Windows 8.1 64-bit, Windows 7 64-bit, and Windows XP 32-bit

Currently developing TimberLog and the VirtualDBScroll Component Package

renabor

  • Jr. Member
  • **
  • Posts: 67
Re: Simple SQLite3 Demo with Encryption and PRAGMA - Updated
« Reply #16 on: May 15, 2016, 10:25:57 am »
Hello @jdlinke!
I will suggest you to enclose properly this code, just for avoiding trouble to linux users:

  {$IFDEF Windows}
  SQLiteLibraryName := 'sqlite3.dll';
  {$ENDIF}

Thank you!
FPC 3.0.5 | Lazarus 1.8 | Ubuntu Gnome 17.10 64bit

xaver13

  • Full Member
  • ***
  • Posts: 106
Re: Simple SQLite3 Demo with Encryption and PRAGMA - Updated
« Reply #17 on: November 23, 2018, 06:10:36 pm »
Hello @jdlinke!
I will suggest you to enclose properly this code, just for avoiding trouble to linux users:

  {$IFDEF Windows}
  SQLiteLibraryName := 'sqlite3.dll';
  {$ENDIF}


Hello, I tried it on Ubuntu 18.10 . I installed (sudo apt remove libwxsqlite3-3.0-0) libwxsqlite and added
  {$IFDEF LINUX}
    SQLiteLibraryName :='libwxsqlite3-3.0.so.0.0.0';
  {$ENDIF}

No password and encryption was set.  libwxsqlite3-3.0.so.0.0.0    is on Ubuntu 18.10 from XII/2016 and I do not know how to install newer version.
If anybody can help, thank you very much.

« Last Edit: November 24, 2018, 10:19:58 am by xaver13 »
--
Jiri Cvrk

 

TinyPortal © 2005-2018