Jump to content

squlite thunderbird reading writing


faustf
 Share

Recommended Posts

hi guy i wanna creat a app for read whitout thunderbird the message stored in thunderbird

i find in

C:\Users\(your user )\AppData\Roaming\Thunderbird\Profiles\(your default profile)

the file

global-messages-db.sqlite

i read this file for look a structure whit

sql database browser

i see the table (for me interest) is

messagesText_content

i wrote this script (only for understund how connect and read somthing)

#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.8.1
Author:      myName
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
#include <sqlite.au3>
#include <SQLite.dll.au3>
Local $sSQliteDll
Local $hQuery, $aRow, $sMsg
$sSQliteDll = _SQLite_Startup()
If @error Then
    MsgBox(16, "SQLite Error", "SQLite3.dll Can't be Loaded!")
    Exit -1
EndIf

$FN="C:\Users\stefano\Desktop\New folder (4)\global-messages-db.sqlite"
$Handle=_SQLite_Open($FN=":File:"); This is what is shown in the examples, however, it does not work. (I replaced "Memory" with "File")
;MsgBox(0,"",$Handle)
_SQLite_Query(-1, "SELECT docid FROM messagesText_content ORDER BY 1;", $hQuery)
While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK
$sMsg &= $aRow[0]
WEnd
MsgBox(0, "SQLite", "Get Data using a Query : " & $sMsg)
_SQLite_Shutdown()

but give me always in console this error

! SQLite.au3 Error

--> Function: _SQLite_Query

--> Query: SELECT docid FROM messagesText_content ORDER BY 1;

--> Error: no such table: messagesText_content

why ??

Link to comment
Share on other sites

Try this way:

#include 
#include 
#include 

_SQLite_Startup()
If @error Then
MsgBox(16, "SQLite Error", "SQLite3.dll Can't be Loaded!")
Exit -1
EndIf

Local $FN = "C:UsersstefanoDesktopNew folder (4)global-messages-db.sqlite"
Local $Handle = _SQLite_Open($FN); open the correct file!
If Not @error Then
Local $aRows, $iNbRows, $iNbCols
_SQLite_GetTable2d($Handle, "SELECT docid FROM messagesText_content;", $aRows, $iNbRows, $iNbCols) ; "order by 1" makes no sense
If Not @error Then
_ArrayDisplay($aRow)
EndIf
_SQLite_Close($Handle)
EndIf
_SQLite_Shutdown()

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

faustf,

When you actually put in some code to detect the error like this

#include <sqlite.au3>
#include <array.au3>

_SQLite_Startup()
If @error Then
    MsgBox(16, "SQLite Error", "SQLite3.dll Can't be Loaded!")
    Exit -1
EndIf

Local $FN = "C:UsersstefanoDesktopNew folder (4)global-messages-db.sqlite"
Local $Handle = _SQLite_Open($FN); open the correct file!
If Not @error Then
    Local $aRows, $iNbRows, $iNbCols
    _SQLite_GetTable2d($Handle, "SELECT docid FROM messagesText_content;", $aRows, $iNbRows, $iNbCols) ; "order by 1" makes no sense
    If Not @error Then
        _ArrayDisplay($aRows)
    Else
        ConsoleWrite('Error reading table ' & @error & @LF)
    EndIf
    _SQLite_Close($Handle)
else
    ConsoleWrite('error opening DB ' & @error & @LF)
EndIf
_SQLite_Shutdown()

You will see that the DB open is failing.

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...