RE: Need help with sqlite3.dll
- From: stcheng@xxxxxxxxxxxxxxxxxxxx ("Steven Cheng")
- Date: Tue, 07 Oct 2008 06:14:10 GMT
Hi Norm,
From your description, you're dealing with some VB6 program which maniplatesome SQLite database, correct?
I haven't used SQLite database much, based on my research, here are some
reference about manipulating SQLite database via VB6 code:
http://www.kirupa.com/net/sqllite_vb_pg2.htm
http://www.sqlite.org/cvstrac/wiki?p=SqliteWrappers&1057833364
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: "Norm" <NormF4@xxxxxxxxxxxxxxxxx>
Subject: Need help with sqlite3.dll
Date: Mon, 6 Oct 2008 16:09:02 -0700
Hi,want
I am trying to open and manipulate a sqlite database, containing cookie
information in FireFox browser.
I have an application that I use which removes all the cookies I don't
to save and worked just fine until FireFox changed to a sqlite typethe
database. :-)
I am trying a wrapper which I can get to open the database and list all
items contained in a listview control. But I cannot figure out how todelete
the ones I don't want.String
If anyone knows of a better way to do this please let me know.
Thanks,
Norm
Code:
Option Explicit
'// SQL Lite dll declarations:
Private Declare Sub sqlite3_open Lib "SQLite3VB.dll" (ByVal FileName As
String, ByRef handle As Long)
Private Declare Sub sqlite3_close Lib "SQLite3VB.dll" (ByVal DB_Handle As
Long)
Private Declare Function sqlite3_last_insert_rowid Lib "SQLite3VB.dll"
(ByVal DB_Handle As Long) As Long
Private Declare Function sqlite3_changes Lib "SQLite3VB.dll" (ByVal
DB_Handle As Long) As Long
Private Declare Function sqlite_get_table Lib "SQLite3VB.dll" (ByVal
DB_Handle As Long, ByVal SQLString As String, ByRef ErrStr As String) As
Variant()
Private Declare Function sqlite_libversion Lib "SQLite3VB.dll" () As
' Now returns a BSTRmCurColumn
'// This function returns the number of rows from the last sql statement.
Use this to ensure you have a valid array
Private Declare Function number_of_rows_from_last_call Lib "SQLite3VB.dll"
() As Long
Dim DB As Long
Private Sub Form_Load()
' Display the SQLite3VB version
Caption = "Cookies Listed In FireFox V.3 Profiles File"
StartQueary
End Sub
Private Sub StartQueary()
Dim mRetErr As String ' Will hold an error string if one is
encountered
Dim mResultCnt As Long
Dim mDBFile As String
Dim mQuery As String
Dim i As Long
mQuery = "SELECT * FROM moz_cookies" 'Text2.Text
mDBFile = App.Path & "\" & "cookies.sqlite" 'mDBFile
lvResults.ListItems.Clear
lvResults.ColumnHeaders.Clear
SB1.SimpleText = "Querying database"
mResultCnt = DBQuery(mDBFile, mQuery, mRetErr)
If mRetErr <> "" Then
MsgBox mRetErr, vbCritical, "SQLite Database Error"
End If
SB1.SimpleText = mResultCnt & " Cookies Listed In File!"
For i = 1 To lvResults.ColumnHeaders.Count
If lvResults.ColumnHeaders.Item(i).Text = "host" Or
lvResults.ColumnHeaders.Item(i).Text = "name" _
Or lvResults.ColumnHeaders.Item(i).Text = "expiry" Then
Else
lvResults.ColumnHeaders.Item(i).Width = 0
End If
Next i
DoEvents
Sleep 100
Set lvResults.SelectedItem = lvResults.ListItems.Item(1)
End Sub
Private Function DBQuery(ByVal DBFile As String, ByVal QueryStr As String,
ByRef ErrStr As String) As Long
On Error GoTo ERR_TRAP
Dim i As Long
Dim mVar As Variant ' Will hold our results
Dim mV1 As Variant ' Will be used to get each individual result
Dim mErrStr As String
Dim mStr As String
Dim mRowCnt As Long
Dim mCurColumn As String
Dim LI As ListItem
If QueryStr = "" Or DBFile = "" Then Exit Function
sqlite3_open DBFile, DB
If DB > 0 Then
mVar = sqlite_get_table(DB, QueryStr, mErrStr)
If mErrStr <> "" Then
ErrStr = mErrStr
sqlite3_close DB
Exit Function
Else
mRowCnt = number_of_rows_from_last_call
If mRowCnt > 0 Then
For Each mV1 In mVar
mStr = mV1
If i = 0 Then
mCurColumn = mStr
lvResults.ColumnHeaders.Add , mCurColumn,
Else=
If lvResults.ColumnHeaders.Count = 1 Then
lvResults.ListItems.Add , , mStr
ElseIf lvResults.ColumnHeaders.Count > 1 Then
Set LI = lvResults.ListItems(i)
LI.SubItems(lvResults.ColumnHeaders.Count - 1)
mStr
End If
End If
i = i + 1
If i > mRowCnt Then
i = 0
End If
Next
End If
End If
'sqlite3_close DB
End If
DBQuery = lvResults.ListItems.Count
Exit Function
ERR_TRAP:
ErrStr = Err.Description
End Function
Private Sub Form_Unload(Cancel As Integer)
Dim mDBFile As String
mDBFile = App.Path & "\" & "cookies.sqlite" 'mDBFile
sqlite3_close DB
End Sub
.
- References:
- Need help with sqlite3.dll
- From: Norm
- Need help with sqlite3.dll
- Prev by Date: Re: How to load resorces of a form that is not loaded
- Next by Date: Re: How to load resorces of a form that is not loaded
- Previous by thread: Need help with sqlite3.dll
- Next by thread: Re: Need help with sqlite3.dll
- Index(es):
Relevant Pages
|