EUsql

new topic     » topic index » view thread      » older message » newer message

This is a multi-part message in MIME format.

------=_NextPart_000_0009_01C38997.67FEBA80
	charset="iso-8859-1"

Hello,
I am trying EUsql. Here is my creation : of the database, then I have a =
program trying to read the database. I think I have created the database =
and inserted a record. I can't read it=20
-------------------------------------------------------------------------=
--------------
with trace
--without warning
include eusql.e
include database.e
--include get.e
--include print.e
with trace
object ok
trace(1)
global constant
 A_KeyAdd =3D 5+1, -- numeric: 0 =3D GEN, 1 =3D DOS, 2 =3D WIN, 3 =3D =
LNX
 A_LastName =3D 12+1,  -- string
 A_FirstName =3D 13+1,  -- string
 A_Address =3D 14+1,  -- number of K bytes
 A_Street =3D 15+1,  -- string
 A_City =3D 16+1,  -- year: 4 digits
 A_State =3D 17+1,  -- month: 1 to 12     =20
 A_Zip =3D 8+1,  -- day of the month: 1 to 31
 A_Phone =3D 10+1  -- integer - number of pennies

constant sqlarchive =3D "Addsql.edb"
ok =3D create_db( sqlarchive )

ok =3D run_sql( "CREATE TABLE Address " &
     "KeyAdd AS Text, LastName AS Text, ADDRESS AS TEXT, STREET AS =
TEXT," &
     "CITY AS TEXT, STATE AS TEXT, DATE.YEAR AS INTEGER," &
     "DATE.MONTH AS INTEGER, DATE.DAY AS INTEGER, ZIP AS INTEGER," &
     "PHONE AS TEXT" )

if atom(ok) then
 puts(1, get_sql_err( ok ))
 ? 1/0
end if

--ok =3D db_open("Addsql.edb", DB_LOCK_NO )

ok =3D run_sql("insert into Address A_KeyAdd,A_LastName, A_ADDRESS, =
A_STREET," &
   "A_CITY, A_STATE, A_ZIP, A_PHONE")

if atom(ok) then
 puts(1, get_sql_err(ok))
-- ? 1/0
else
 sql =3D ok
end if

eusql_true_typecheck(0)
v =3D create_index( "", ADDRESS", "STATE", "LASTNAME", 0 )

--if wait_key() then end if
-------------------------------------------------------------------------=
-----------------end of creation of db
start read program
--------------------------------------------
include print.e
include eusql.e
with trace
--with type_check
trace(2)
integer fout
fout =3D open( "demo.txt", "w")
EUSQLRESULT ok
ok =3D open_db( "addsql.edb" )
--ok =3D create_index( "", "ADRESS", "LASTNAME", "FIRSTNAME", 0 )
ok =3D run_sql {"SELECT * FROM ADDRESS"}

printf(1,"%d. %s\n\n", {LASTNAME})

close(fout)
----------------------------- end of read =
db-----------------------------------------------
------=_NextPart_000_0009_01C38997.67FEBA80
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1226" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hello,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I am trying EUsql. Here is my creation =
: of the=20
database, then I have a program trying to read the database. I think I =
have=20
created the database and inserted a record. I can't read it =
</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2>----------------------------------------------------------------=
-----------------------</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>with trace<BR>--without =
warning<BR>include=20
eusql.e<BR>include database.e<BR>--include get.e<BR>--include =
print.e<BR>with=20
trace<BR>object ok<BR>trace(1)<BR>global constant<BR>&nbsp;A_KeyAdd =3D =
5+1, --=20
numeric: 0 =3D GEN, 1 =3D DOS, 2 =3D WIN, 3 =3D LNX<BR>&nbsp;A_LastName =
=3D=20
12+1,&nbsp;&nbsp;-- string<BR>&nbsp;A_FirstName =3D 13+1, &nbsp;--=20
string<BR>&nbsp;A_Address =3D 14+1,&nbsp;&nbsp;-- number of K=20
bytes<BR>&nbsp;A_Street =3D 15+1,&nbsp;&nbsp;-- string<BR>&nbsp;A_City =
=3D=20
16+1,&nbsp;&nbsp;-- year: 4 digits<BR>&nbsp;A_State =3D 17+1, &nbsp;-- =
month: 1 to=20
12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;A_Zip =3D 8+1,&nbsp;&nbsp;-- =
day of the=20
month: 1 to 31<BR>&nbsp;A_Phone =3D 10+1&nbsp;&nbsp;-- integer - number =
of=20
pennies</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>constant sqlarchive =3D =
"Addsql.edb"<BR>ok =3D=20
create_db( sqlarchive )</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>ok =3D run_sql( "CREATE TABLE Address " =

&amp;<BR>&nbsp;&nbsp;&nbsp;&nbsp; "KeyAdd AS Text, LastName AS Text, =
ADDRESS AS=20
TEXT, STREET AS TEXT," &amp;<BR>&nbsp;&nbsp;&nbsp;&nbsp; "CITY AS TEXT, =
STATE AS=20
TEXT, DATE.YEAR AS INTEGER," &amp;<BR>&nbsp;&nbsp;&nbsp;&nbsp; =
"DATE.MONTH AS=20
INTEGER, DATE.DAY AS INTEGER, ZIP AS INTEGER," =
&amp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
"PHONE AS TEXT" )</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>if atom(ok) then<BR>&nbsp;puts(1, =
get_sql_err( ok=20
))<BR>&nbsp;? 1/0<BR>end if</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>--ok =3D db_open("Addsql.edb", =
DB_LOCK_NO=20
)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>ok =3D run_sql("insert into Address=20
A_KeyAdd,A_LastName, A_ADDRESS, A_STREET," &amp;<BR>&nbsp;&nbsp; =
"A_CITY,=20
A_STATE, A_ZIP, A_PHONE")</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>if atom(ok) then<BR>&nbsp;puts(1,=20
get_sql_err(ok))<BR>--&nbsp;? 1/0<BR>else<BR>&nbsp;sql =3D ok<BR>end=20
if</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>eusql_true_typecheck(0)<BR>v =3D =
create_index( "",=20
ADDRESS", "STATE", "LASTNAME", 0 )</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>--if wait_key() then end =
if</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2>----------------------------------------------------------------=
--------------------------end=20
of creation of db</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>start read program</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2>--------------------------------------------</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>include print.e<BR>include =
eusql.e<BR>with=20
trace<BR>--with type_check<BR>trace(2)<BR>integer fout<BR>fout =3D open( =

"demo.txt", "w")<BR>EUSQLRESULT ok<BR>ok =3D open_db( "addsql.edb" =
)<BR>--ok =3D=20
create_index( "", "ADRESS", "LASTNAME", "FIRSTNAME", 0 )<BR>ok =3D =
run_sql=20
{"SELECT * FROM ADDRESS"}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>printf(1,"%d. %s\n\n", =
{LASTNAME})</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial =
size=3D2>close(fout)<BR>----------------------------- end of=20
read=20
ML>

------=_NextPart_000_0009_01C38997.67FEBA80--

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu