Re: [sqlite] TCL loadable extensions

2008-07-10 Thread Lauri Ojansivu
If you mean making extensions with C, look at the wiki.tcl.tk :
http://wiki.tcl.tk/_search?_charset_=UTF-8S=extension

If you mean additional commands or fuctions for SQLite with Tcl, look
at TkSQLite:
http://reddog.s35.xrea.com/wiki/TkSQLite.html

- Lauri

2008/7/10 Alexey Pechnikov [EMAIL PROTECTED]:
 Hello!

 How can I make tcl lodable extensions? It's possibly on pythone and how about
 other languages?

 Best regards, Alexey.
 ___
 sqlite-users mailing list
 sqlite-users@sqlite.org
 http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Accessing SQLite from Javascript in Firefox

2008-06-10 Thread Lauri Ojansivu
2008/6/10 Ujval Mysore [EMAIL PROTECTED]:
 Hi,

 Has anyone tried accessing SQLite from Javascript in Firefox?

 I found an Sqlite helper library for Mozilla at 
 http://codesnippets.joyent.com/posts/show/1030

Hi,
do you mean like in Google Gears?
http://gears.google.com

- Lauri
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] REGEX

2008-06-08 Thread Lauri Ojansivu
2008/6/8 Alyssa Papalopa [EMAIL PROTECTED]:
 Has anybody developed a function to support REGEX?

TkSQLite has regex:
http://reddog.s35.xrea.com/wiki/TkSQLite.html

- Lauri
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Insert / Update images using MS VBScript

2008-05-31 Thread Lauri Ojansivu
2008/5/31 MoDementia [EMAIL PROTECTED]:
 I have spent most of the day searching for examples in VBscript to add /
 update an image into a database without luck.

 If anyone has a snippet of code they could share I would be most grateful.

 I have either an image as an object in the script and or a physical file
 location i.e. C:\image.jpg

 None of the examples I looked at even came close to helping me understand
 what I need to do :(

Hi,
in following VB code image file (or any other binary file) is read
from disk to string, uuencoded, and can then be inserted into
database.

Another option is try to figure out dhSQLite http://www.thecommon.net/2.html  .

- Lauri



Sub test_image_read_write()

Dim path As String, filename As String

Dim t1 As String, t2 As String

Dim sql As String



path = C:\

filename = image.jpg



t1 = loadfilename(path  filename)



' Do something here with t1, like insert into database...

' If insert statements don't like it, you can uuencode it

t1 = uuencodetext(t1)



' If uuencoded text has ' in it, replace it with '' for sqlite insert

t1 = Replace(t1, ', '')



' Now make sql string...

sql = INSERT INTO pics(filename, image) VALUES ('  _

  filename  ', '  t1  ');

MsgBox sql

' And execute it.

' And after reading it from database uudecode.

t1 = uudecodetext(t1)



savefilename t1, path  test-  filename

t2 = loadfilename(path  test-  filename)

If t1 = t2 Then

t1 = 

t2 = 

Kill path  test-  filename

MsgBox Success!

Exit Sub

Else

t1 = 

t2 = 

Kill path  test-  filename

MsgBox Error: image modified when saved and loaded again!

Exit Sub

End If

End Sub



Function loadfilename(filename As String) As String

If Not FileExists(filename) Then

loadfilename = File does not exist!

Exit Function

End If



Dim t As Variant

loadfilename = 



Dim iFreeFile As Integer

Dim bytCount As Byte

Dim data() As Byte



iFreeFile = FreeFile



Open filename For Binary As iFreeFile

ReDim data(LOF(iFreeFile)) 'redim the array to take the whole file

Get #iFreeFile, , data 'read the entire file into the byte array

loadfilename = ByteArrayToString(data)

Close iFreeFile



End Function



Sub savefilename(text As String, filename As String)

Close

If FileExists(filename) Then Kill filename



Dim iFreeFile As Integer

Dim bytCount As Byte

Dim data() As Byte



iFreeFile = FreeFile



Open filename For Binary As iFreeFile

data = StrConv(text, vbFromUnicode)

Put #iFreeFile, , data 'read the entire file into the byte array

Close iFreeFile



End Sub



Function uudecodetext(text As String) As String

' 1) Take away uudecode start

text = Replace(text, begin 644 data.dat  vbLf, )



' 2) Take away uudecode end

text = Replace(text, vbLf  end  vbLf, )



' 3) Do uudecode

text = UUDecode(text)



' 4) Return result

uudecodetext = text

End Function



Function uuencodetext(text As String)

' 1) UUEncode text

text = UUEncode(text)



' 2) Add UUEncode beginning and end

text = begin 644 data.dat  vbLf  text  vbLf  end  vbLf



' 3) Return result

uuencodetext = text

End Function





Public Function ByteArrayToString(bytArray() As Byte) As String

Dim sAns As String

Dim iPos As String



sAns = StrConv(bytArray, vbUnicode)

iPos = InStr(sAns, Chr(0))

If iPos  0 Then sAns = Left(sAns, iPos - 1)



ByteArrayToString = sAns



End Function



Function FileExists(ByVal FileName As String) As Boolean

On Error GoTo ErrorHandler

' get the attributes and ensure that it isn't a directory

FileExists = (GetAttr(FileName) And vbDirectory) = 0

ErrorHandler:

' if an error occurs, this function returns False

End Function



Public Function UUEncode(sString As String) As String



Dim bTrans(63) As Byte, lPowers8(255) As Long, lPowers16(255) As
Long, bOut() As Byte, bIn() As Byte

Dim lChar As Long, lTrip As Long, iPad As Integer, lLen As Long,
lTemp As Long, lPos As Long



For lTemp = 1 To 63 'Fill the translation table.

bTrans(lTemp) = lTemp + 32

Next lTemp



bTrans(0) = 96  'Replace spaces with 'graves'



For lTemp = 0 To 255'Fill the 2^8 and 2^16
lookup tables.

lPowers8(lTemp) = lTemp * cl2Exp8

lPowers16(lTemp) = lTemp * cl2Exp16

Next lTemp



iPad = Len(sString) Mod 3   'See if the length is divisible by 3

If iPad Then'If not, figure out the
odd bytes and resize the input.

iPad = 3 - iPad

sString = sString  String(iPad, Chr(0))

End If



bIn = StrConv(sString, vbFromUnicode)   'Load the input string.


Re: [sqlite] Insert / Update images using MS VBScript

2008-05-31 Thread Lauri Ojansivu
2008/6/1 MoDementia [EMAIL PROTECTED]:
 Thanks for the reply.
 However I am restricted to VBscript rather than visual basic.

 I will try to convert the syntax but I'm not confident that all the
 functions will be available in VBscript.

If you run into any problems, reply to this sqlite-users list so we'll
figure out the solution.

- Lauri
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite DB on a CD

2008-04-23 Thread Lauri Ojansivu
2008/4/22  [EMAIL PROTECTED]:
 Hi,
  I like to distribute my application on a CD.
  This application has a sqlite database which will be part of the
  distribution.
  I do not like anybody reading/accesing the database directly, so I put
  the database file inside a zip file which is password protected.
  My application is written in VB, and I have hard coded the password
  inside the VB program.
  When the application loads, it opens the password protected zip file,
  and extracts the sqlite file within it.
  Now, I do not want to write this db file to any temporary location on
  the hard disk. Is it possible to load the entire sqlite file in memory
  and the application read data from it?

Another option is to buy Molebox that encrypts vb exe, sqlite database
and other files to single packed exe where reading sqlite database
from encrypted exe works like it was in same directory without any
encryption, and database is not extracted to disk in any phase.

- Lauri
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Available extensions for sqlite

2008-04-16 Thread Lauri Ojansivu
Well, there is new features sitting on cvstrack of Sqlite, from there
I'd like to have first
Ticket 2939: instr, locate, position, charindex etc:
http://www.sqlite.org/cvstrac/tktview?tn=2939,35

There author of the ticket Brodies says:
If this is accepted then I will write the documentation and test
cases for it too. Just contact me. As few suggestions appear to be
accepted, I won't bother until then.

At freenode #tcl channel I pointed one user that needed instr to
tksqlite that has
instr and other features included. I haven't checked if they are added
with tcl or c.
http://reddog.s35.xrea.com/wiki/TkSQLite.html

So it would be nice if someone collected all nice patches and made binary
feature-added versions available. If there already is such one then please
post the url.

All active sqlite tickets are at:
http://www.sqlite.org/cvstrac/rptview?rn=35

It would be nice too if there was sqlite with tcl bindings (.dll/.so)
compiled for
different architectures (win32/64 linux-x86/64 openbsd solaris etc) so
that it would
be possible to make tcl starkit supporting all those.
Examles of such starkits can be found in sdarchive:
http://tcl.tk/starkits/

- Lauri

2008/4/16, Marco Bambini [EMAIL PROTECTED]:
 Is there a repository that collects a list of available extensions for
  sqlite?

  Until now I found just an extension:
  http://www.gaia-gis.it/spatialite/

  Thanks.
  ---
  Marco Bambini
  http://www.sqlabs.net
  http://www.sqlabs.net/blog/
  http://www.sqlabs.net/realsqlserver/



  ___
  sqlite-users mailing list
  sqlite-users@sqlite.org
  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] MAIL PROBLEM??? Fwd: 这是一封自 动回复邮件

2008-04-15 Thread Lauri Ojansivu
Maybe you could check your mailing list settings, if you have any
autoresponse settings there. Only the subject of that message came to
the list, and according to Google Translate it's chinese and says:
This is an auto-response e-mail

I haven't got that kind of autoresponse e-mail when I joined to
mailing list, used default  settings and have sent message to mailing
list.

- Lauri

2008/4/15, Ken [EMAIL PROTECTED]:
 Every time I send a message to the sqlite list I get this goofy email sent 
 back to me.. Is this a problem with the List or something on my end?

  Thanks,
  Ken


  Note: forwarded message attached.
 ___
  sqlite-users mailing list
  sqlite-users@sqlite.org
  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] sqlite.kit (tcl starkit) for multiple platforms?

2008-04-13 Thread Lauri Ojansivu
Hi,
is there called sqlite.kit (tcl starkit) for multiple platforms
somewhere? There is link at sdarchive:
http://tcl.tk/starkits/
- but when I click it, it says it's not found.
I tried search for it with google but didn't find yet.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users