Sign in to follow this  
Followers 0
Berkeley

SQLITE syntax problem

4 posts in this topic

#1 ·  Posted (edited)

I having been digging for hours and staring at the help files but I cannot get this to work for anything. I am pretty sure that the syntax on the _SQLITE_SQLITEEXE line is jacked. I am just trying to import a csv file as quick as possible. I( started reading it in line by line but that is way to slow. Then I thought I had it aced with this but cannot seem to get the sqlite syntax right. I am sorry but although I found the help files for autoit really easy to understand I am having a hard time with the autoit sqlite help files

#include <SQLite.au3>
#include <SQLite.dll.au3>
#include <Array.au3>
#include <String.au3>





local $sOut, $aResult, $iRows, $iColumns, $iRval
$hfile = "C:\Documents and Settings\bjd2483\My Documents\AutoIT\RedlinesQC\begend.txt"

_SQLite_Startup()
_SQLite_Open()

If Not _SQLite_Exec(-1, "CREATE TEMP TABLE begend (BEGDOC STRING, ENDDOC STRING);") = $SQLITE_OK Then _
        MsgBox(16, "SQLite Error", _SQLite_ErrMsg())

_SQLite_SQLiteExe(-1,".mode csv" & @CRLF & ".import '" & ($hFile) & "' begend" & @CRLF,$sOut,-1,true)

; Query
$iRval = _SQLite_GetTable(-1, "SELECT * FROM begend;", $aResult, $iRows, $iColumns)
If $iRval = $SQLITE_OK Then

    _ArrayDisplay($aResult, "Query Result")
Else
    MsgBox(16, "SQLite Error: " & $iRval, _SQLite_ErrMsg())
EndIf


_SQLite_Close()
_SQLite_Shutdown()

Thanks,

Berkeley

Edited by Berkeley

Share this post


Link to post
Share on other sites



This might help you a bit. Use _SQLite_Exec()

http://www.sqlite.org/cvstrac/wiki?p=ImportingFiles


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Thanks GEO but still not any closer I can get it to import no problem from the cmd prompt but when I try and do it from autoit I get zilch

If Not _SQLite_Exec(-1, "CREATE TEMP TABLE begend (BEGDOC STRING, ENDDOC STRING);") = $SQLITE_OK Then _
        MsgBox(16, "SQLite Error", _SQLite_ErrMsg())

_SQLite_Exec(-1,".mode csv" & @CRLF & ".import " & ($hFile) & " begend" & @CRLF)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
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
Sign in to follow this  
Followers 0