1. Further eDBI Problems

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

new topic     » topic index » view message » categorize

2. Re: Further eDBI Problems

RogerL said...

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?

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

3. Re: Further eDBI Problems

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.

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

4. Re: Further eDBI Problems

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)

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

5. Re: Further eDBI Problems

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

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

6. Re: Further eDBI Problems

RogerL said...

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 ?

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

7. Re: Further eDBI Problems

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

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

8. Re: Further eDBI Problems

Also here is the error output from running the edbi example -

http://euphoria.pastey.net/130910

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

Search



Quick Links

User menu

Not signed in.

Misc Menu