1. Further eDBI Problems
- Posted by RogerL Jan 02, 2010
- 1324 views
Hi, I am having further problems - I can read nummeric values OK from my old sqlite database, but strings are being returned empty. Just to check i thought I'd try running the example.ex program that comes with eDBI - it fell over with the following message :-
c:\euphoria-40b2\include\std\datetime.e:788 in function format() type_check failure, d is {49,57,55,56,45,48,49,45,48,51}
... called from C:\Users\Roger\Documents\Euphoria4Scripts\example.ex:31
> See ex.err
Press Enter...
I assume either I have my environment set up incorrectly, or I have an old version of eDBI - can anyone please point me in the right direction. Thanks, Roger
2. Re: Further eDBI Problems
- Posted by jimcbrown (admin) Jan 02, 2010
- 1325 views
Hi, I am having further problems - I can read nummeric values OK from my old sqlite database, but strings are being returned empty. Just to check i thought I'd try running the example.ex program that comes with eDBI - it fell over with the following message :-
c:\euphoria-40b2\include\std\datetime.e:788 in function format() type_check failure, d is {49,57,55,56,45,48,49,45,48,51}
... called from C:\Users\Roger\Documents\Euphoria4Scripts\example.ex:31
> See ex.err
Press Enter...
I assume either I have my environment set up incorrectly, or I have an old version of eDBI - can anyone please point me in the right direction. Thanks, Roger
You are using the wrong format. You need to include std/text.e as text and then change the format call to text:format()
Or does eDBI have its own format() function?
3. Re: Further eDBI Problems
- Posted by RogerL Jan 02, 2010
- 1294 views
Thanks for the quick reply - here is what I tried from your suggestion - but I am obviously doing it wrong as I got further errors :-
edbi:dbr_handle dbr = edbi:query("select * from MembershipTypes") object o o = edbi:next(dbr) while sequence(o) do if linecount >= 40 then linecount = 0 puts(fileHandle,"</TABLE></DIV>\n") puts(fileHandle,"<DIV><TABLE><CAPTION><H2>Membership Types</H2></CAPTION>\n") puts(fileHandle,"<TR><TH ALIGN=LEFT>Type</TH><TH ALIGN=RIGHT>Dues</TH></TR>\n") end if printf(fileHandle,"<TR><TD WIDTH=200>%-15s</TD><TD>$%6.2f\n</TD></TR>", {text:format(o[1]),o[2]}) linecount = linecount + 1 o = edbi:next(dbr) end while edbi:closeq(dbr)
previously I just had {o[1], o[2]} at the end of the printf line.
4. Re: Further eDBI Problems
- Posted by RogerL Jan 02, 2010
- 1334 views
sorry the code I posted lost its formatting - I'll try again :-
Loop through data and print each line edbi:dbr_handle dbr = edbi:query("select * from MembershipTypes") object o o = edbi:next(dbr) while sequence(o) do if linecount >= 40 then linecount = 0 puts(fileHandle,"</TABLE></DIV>\n") puts(fileHandle,"<DIV><TABLE><CAPTION><H2>Membership Types</H2></CAPTION>\n") puts(fileHandle,"<TR><TH ALIGN=LEFT>Type</TH><TH ALIGN=RIGHT>Dues</TH></TR>\n") end if printf(fileHandle,"<TR><TD WIDTH=200>%-15s</TD><TD>$%6.2f\n</TD></TR>", {text:format(o[1]),o[2]}) linecount = linecount + 1 o = edbi:next(dbr) end while edbi:closeq(dbr)
5. Re: Further eDBI Problems
- Posted by RogerL Jan 02, 2010
- 1295 views
sorry code looks fine in preview mode - but not once its posted! The important line is :-
printf(fileHandle,"<TR><TD WIDTH=200>%-15s</TD><TD>$%6.2f\n</TD></TR>", {text:format(o[1]),o[2]})
After the suggestion I just added in the text:format and an include line at the top of the script - but that didn't help at all (got further errors).
Roger
6. Re: Further eDBI Problems
- Posted by jimcbrown (admin) Jan 02, 2010
- 1372 views
sorry code looks fine in preview mode - but not once its posted! The important line is :-
printf(fileHandle,"<TR><TD WIDTH=200>%-15s</TD><TD>$%6.2f\n</TD></TR>", {text:format(o[1]),o[2]})
After the suggestion I just added in the text:format and an include line at the top of the script - but that didn't help at all (got further errors).
Roger
Can you copy your ex.err to http://euphoria.pastey.net ?
7. Re: Further eDBI Problems
- Posted by RogerL Jan 02, 2010
- 1314 views
Link is
http://euphoria.pastey.net/130909
I just put my code in as I don't actually get an error - just a blank field in the output. Could it be because of my data type in sqlite - it is VARCHAR2(30)
Thanks Roger
8. Re: Further eDBI Problems
- Posted by RogerL Jan 02, 2010
- 1401 views
Also here is the error output from running the edbi example -