Page 1 of 1 1
Topic Options
#70444 - 2002-10-01 05:30 AM KixDB - possible?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I made a baseline db-connector for pure text but it has some adjustments to be made in the syntax for real usage...
anyway, as a testbench or something, it could work.
code:
;need to have utleast 1 filehandle free on open and close
;var namespace $_DB_ may not be used elsewhere in the script
;NO ERROR-CHECKS YET!

function DB($handle, $action, $arg1,optional $arg2)
dim $,$temp,$nul
select
case $action="new"
$=execute("global $$_DB_$handle[0]")
$arg1=join($arg1,chr(13))
$=execute("$$_DB_$handle[0]=$arg1")
case $action="open"
$=execute("global $$_DB_$handle[0]")
$=10
while open($,$arg1) and $ $=$-1 loop
$temp=readline($)
$nul=execute("$$_DB_$handle[0]=$temp")
$temp=readline($)
while not @error
$nul=execute("redim preserve $$_DB_$handle[ubound($$_DB_$handle)+1]")
$nul=execute("$$_DB_$handle[ubound($$_DB_$handle)]=$temp")
$temp=readline($)
loop
$nul=close($)
case $action="close"
if exist($arg1) del $arg1 endif
$=10
while open($,$arg1,5) and $ $=$-1 loop
$nul=execute("for $$temp=0 to ubound($$_DB_$handle) $$nul=writeline($$,$$_DB_$handle[$$temp]) next")
$nul=close($)
$=execute("redim $$_DB_$handle")
case $action="add"
$arg1=join($arg1,chr(13))
$nul=execute("redim preserve $$_DB_$handle[ubound($$_DB_$handle)+1]")
$nul=execute("$$_DB_$handle[ubound($$_DB_$handle)]=$arg1")
case $action="del"
$arg1=join($arg1,chr(13))
$nul=execute("for $$temp=0 to ubound($$_DB_$handle)
if $$_DB_$handle[$$temp]=$arg1
$$_DB_$handle[$$temp]=$$_DB_$handle[ubound($$_DB_$handle)]
$$temp=ubound($$_DB_$handle)
redim preserve $$_DB_$handle[ubound($$_DB_$handle)-1]
endif
next")
case $action="mod"
$arg1=join($arg1,chr(13))
$nul=execute("for $$temp=0 to ubound($$_DB_$handle)
if $$_DB_$handle[$$temp]=$arg1
$$_DB_$handle[$$temp]=$arg2
$$temp=ubound($$_DB_$handle)
endif
next")
endselect
endfunction

_________________________
!

download KiXnet

Top
#70445 - 2002-10-01 03:11 PM Re: KixDB - possible?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
There is a ODBC driver for text files. You might want to give that one a try.
_________________________
There are two types of vessels, submarines and targets.

Top
#70446 - 2002-10-01 04:43 PM Re: KixDB - possible?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
jens, yep. you are right.

I just had to have something to do during the little hours as the board was silent (americanos seem to be more active during night than during evening).
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.036 seconds in which 0.019 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org