Results 1 to 38 of 38

Thread: RC6 - New encrypt option for Sqlite DB: SqlCipher

Threaded View

  1. #4
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    6,203

    Re: RC6 - New encrypt option for Sqlite DB: SqlCipher

    Quote Originally Posted by ThiagoPSanches View Post
    Now it worked!

    I tested it with the SqlCipher version 3 and 4.

    Here are some notes, in case anyone needs...


    Code:
    Dim sCn As New cConnection
    Dim sRs As New cRecordset
    
    '*** Define 'CodecType' before 'OpenDB'
    sCn.CodecType = CODEC_TYPE_SQLCIPHER
    
    '*** Inform the Path and DB File to open
    '*** Do not enter the 'EncrKey' parameter here
    sCn.OpenDB "C:\Users\Th\Desktop\Cipher3.db"
    
    '*** Indicate that the file is a 'SqlCipher 3' (if the file is 'SqlCipher 4', it is also necessary to indicate here: legacy=4)
    sCn.Execute "PRAGMA legacy=3;"
    
    '*** Inform 'EncrKey' here, that way and after setting the 'legacy' parameter
    sCn.Execute "PRAGMA key=123;"
    Nice!

    Here are some more PRAGMAs which set useful non-default settings that I'm successfully using with sqlite

    Code:
        Set slcn = New cConnection
        slcn.OpenDB m_sDbFile
        slcn.Execute "PRAGMA auto_vacuum=incremental"
        slcn.Execute "PRAGMA journal_mode=WAL"
        slcn.Execute "PRAGMA temp_store=MEMORY"
        slcn.Execute "PRAGMA cache_spill=OFF"
        slcn.Execute "PRAGMA synchronous=FULL"
        slcn.BusyTimeOutSeconds = 5
    The synchronous=FULL minimizes db corruption (and slowing down transaction commits) while journal_mode=WAL makes sqlite super efficient even for single reader/single writer scenario.

    cheers,
    </wqw>

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width