1. db_dump error

I tried the following code to do a dump of my database but got an error. =
=0D
 =0D
procedure onClick_MenuPrint(integer self, integer even, sequence parms)=0D
err =3D db_open("Eye-Comp",DB_LOCK_NO)=0D
fn =3D open("diag.dmp","w")=0D
db_dump(fn,0)=0D
db_close()=0D
end procedure =0D
setHandler({ MenuPrint, ToolPrint}, w32HClick, routine_id(=20
onClick_MenuPrint" ))=0D
 =0D
 =0D
ex.err=0D
=3D=3D=3D=3D=0D
work.exw:504 in procedure onClick_MenuPrint() =0D
type_check failure, fn is 4 =0D
self =3D 25=0D
even =3D 4=0D
parms =3D {}=0D
=2E.. called from E:\Euphoria\EyeComp\win32lib.ew:7146 in function
invokeHandler() =0D
id =3D 25=0D
event =3D 4=0D
params =3D {}=0D
lRoutines =3D {=0D
{76'L'}=0D
}=0D
lCallType =3D 1=0D
i =3D 1=0D
j =3D 1=0D
It looks to me like I did it just like the documentation said to, but I m=
ust
have done something wrong.=0D
=20

new topic     » topic index » view message » categorize

2. Re: db_dump error

check the rest of your code, since you got a type check error, my guess is
that fn is defined as a sequence and not an integer, atom or object, or some
other home-made type in which 4 is not a proper value.

~Greg

PS. You really should get in the habit of checking the return values you get
from functions such as db_open() and open()

Here is some cleaned up code:

procedure onClick_MenuPrint(integer self, integer even, sequence parms)
atom ret

    if db_open("Eye-Comp",DB_LOCK_NO) != DB_OK then
        ret = message_box("Could not find Eye-Comp.edb", "Database Error",
MB_OK)
        return    -- quit this procedure now
    end if

    fn = open("diag.dmp","w")
    if fn = -1 then
        ret = message_box("Could not open diag.dmp", "File Access Error",
MB_OK)
        return
    end if

    db_dump(fn,0)

    close(fn)
    db_close()

end procedure
setHandler({ MenuPrint, ToolPrint}, w32HClick, routine_id(
"onClick_MenuPrint" ))

new topic     » goto parent     » topic index » view message » categorize

3. Re: db_dump error

=0D
 =0D
-------Original Message-------=0D
 =0D
From: EUforum at topica.com=0D
Subject: Re: db_dump error=0D
 =0D
 =0D
 =0D
check the rest of your code, since you got a type check error, my guess i=
s=0D
that fn is defined as a sequence and not an integer, atom or object, or s=
ome=0D
other home-made type in which 4 is not a proper value.=0D
 =0D
~Greg=0D
 =0D
PS. You really should get in the habit of checking the return values you =
get=0D
from functions such as db_open() and open()=0D
 *examples sniped*=0D
 =0D
That was it.  I had fn defined as a sequence.=0D
 =0D
I'll take your suggestion about error trapping to heart also.  I have
extensive error trapping the programs I've developed in the language I ha=
ve
been using, but I have been more interested in getting the basic
input/output/disk i/o stuff done first.=0D
Thanks for your help=0D
 =0D
 =0D
TOPICA - Start your own e-mail discussion group. FREE!=0D
 =0D
 =0D
 =0D
 =0D
 =0D
=2E=20

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu