praeclarum / praeclarum/sqlite-net

Using the sqlcipher version, how do you create a new database?

Open
#970 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
4.5k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

Using the sqlcipher version, how do you create a new database?

` Dim strPath As String = Nothing
Dim objOptions As SQLiteConnectionString = Nothing
Dim objConn As SQLiteAsyncConnection = Nothing
Dim objRegistration As Registration = Nothing
Try
strErrMsg = ""
strPIN = "123456"

        strPath = My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData

        ' see if file path exists
        If Not Directory.Exists(strPath) Then
            Directory.CreateDirectory(strPath)
        End If

        strPath = Path.Combine(strPath, "db.db3")

        ' see if file path exists
        If File.Exists(strPath) Then
            objOptions = New SQLiteConnectionString(strPath, SQLiteOpenFlags.ReadWrite, False, strPIN)
        Else
            objOptions = New SQLiteConnectionString(strPath, SQLiteOpenFlags.Create Or SQLiteOpenFlags.FullMutex Or SQLiteOpenFlags.ReadWrite, False, strPIN)
        End If

        objConn =  New SQLiteAsyncConnection(objOptions)

        objRegistration = New Registration()
        With objRegistration
            .Prefix = cboPrefix.SelectedValue
            .FirstName = txtFirstName.Text
            .NickName = txtFirstName.Text
            .MiddleName = txtFirstName.Text
            .LastName = txtFirstName.Text
            .Suffix = cboSuffix.SelectedValue

            .Address1 = txtFirstName.Text
            .Address2 = txtFirstName.Text
            .City = txtFirstName.Text
            .State = cboState.SelectedValue
            .Zip = txtFirstName.Text

            .SSN = txtSSN.Text
            .HomePhone = txtFirstName.Text
            .MobilePhone = txtFirstName.Text
            .Email = txtFirstName.Text
        End With

        With objConn
            .CreateTableAsync(Of Registration)()

            .InsertAsync(objRegistration)
            .CloseAsync()
        End With

    Catch ex As Exception
        strErrMsg = "Error creating database: " + ex.Message
        Return Nothing
    Finally
        If objOptions IsNot Nothing Then
            objOptions = Nothing
        End If
        If objConn IsNot Nothing Then
            objConn = Nothing
        End If
    End Try

`

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file, test, or entry point is identified. Start by reviewing the SQLiteConnectionString, SQLiteOpenFlags, SQLiteAsyncConnection, CreateTableAsync, InsertAsync, and CloseAsync calls shown in the issue; done means providing a verified explanation or documentation for creating a new SQLCipher database.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
database
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.