1. eDBI problem simplified
- Posted by RogerL Jan 03, 2010
- 1274 views
Hi All, As I have had no further response to the problem in my previous post I have tried to clarify the whole issue by running a simplified copy of the original eDBI example program and seeing what output I got. The script and output is at :-
pastey.net link is: http://euphoria.pastey.net/130962
essentially the problem is that while the database and table are created correctly and the records inserted OK (I can see them in an sqlite management tool that I have), when I try to read the records and display I only seem to display atoms (numbers) and not sequences (strings). The read and display routines are unchanged from the original example script (and the data types are exactly the same) included with eDBI - so once again I am wondering if I have an old copy and things have changed or ??? Any help/pointers/suggestions much appreciated ....
Roger
2. Re: eDBI problem simplified
- Posted by ChrisB (moderator) Jan 04, 2010
- 1152 views
Hi
Thats actually quite strange, because in sqlite3 all data fields are strings, I know edbi does some conversion, but for some reason its not recognising the strings as strings.
Try
while 1 do object o = edbi:next(dbr) if atom(o) then exit end if printf(1, "Desc=%s, Dues=%d length=%d\n", { o[1], o[2], length(o[1])}) end while edbi:closeq(dbr) data = edbi:query_rows("SELECT * FROM MembershipTypes") for i = 1 to length(data) do object o = data[i] printf(1, "Desc=%s, Dues=%d length=%d\n", { o[1], o[2], length(o[1])}) end for
Looks like empty strings are being returned, the above will confirm it, if so there's an edbi problem.
3. Re: eDBI problem simplified
- Posted by RogerL Jan 04, 2010
- 1180 views
Hi, Tried your suggestion with the following error :- C:\Users\Roger\Documents\Euphoria4Scripts>eui example.ex
example.ex:28 length of an atom is not defined
> See ex.err
In ex.err it shows the value of object o to be {0, 140} ie the string is being returned as an atom of value zero!
Roger
4. Re: eDBI problem simplified
- Posted by RogerL Jan 04, 2010
- 1150 views
Further - in ex.err it shows that the value of data is correct! ie
example.ex: data = { { {70'F',117'u',108'l',108'l',32' ',77'M',101'e',109'm',98'b', 101'e',114'r'}, 140 }, { {67'C',111'o',117'u',110'n',116't',114'r',121'y',32' ',77'M', 101'e',109'm',98'b',101'e',114'r'}, 70'F' }, { {83'S',101'e',99'c',114'r',101'e',116't',97'a',114'r',121'y'}, 10 } }
5. Re: eDBI problem simplified
- Posted by RogerL Jan 04, 2010
- 1178 views
Sorry, ignore the last post - data still holds the values from when the table was initially loaded as the error has occurred before data was read back in from the table!
6. Re: eDBI problem simplified
- Posted by ChrisB (moderator) Jan 04, 2010
- 1238 views
Hi
I'm afraid I can't help you any more with eDBI - there may be a simple thing you are doing wrong, or it may be that that the interface has a problem - I have had a look through the code, and what's basically happening is your program is calling the euphoria eDBI include, which is then calling a C library which then calls sqlite - and this is written by someone who programs for a living, so it starts to become hideously complicated for mortals to read (or me at least)!
However, if you want a quick and reliable way to read sqlite databases, then use eusqlite (originally by Ray Smith, maiantained (sort of) by me, and write your own conversion routine to one of the many other database wrappers available. I'm sure that eDBI is going to be great, but it has a level of complexity that at this stage I (personally) just don't need, and also will cater to the 'lowest common denominator' set of functions for all the databases.
eusqlite is here http://eusqlite.wikispaces.com/
Cheers
Chris
7. Re: eDBI problem simplified
- Posted by RogerL Jan 04, 2010
- 1145 views
Thanks for the help, but I think I'll backtrack now - I previously was using Euphoria 3.1, win32lib and EDS with great results and virtually no problems. Thought I'd try Euphoria4, wxEuphoria and eDBI to be right up to date. My feeling now is that either eDBI is not mature enough for production use (I do wonder how the web-site manages) or that there is just insufficient qualified available support as no-one has had a solution for what seems to me to be a 'gross' problem. As I am going back to EDS it seems that there is no point sticking with Euphoria4 as basic and essential tools like wxedb don't work with Euphoria4 yet. The one bright thing from the exercise - I think I will change from win32lib to wxEuphoria - easy enough to use and cross platform just for the cost of a dll! So - back to 3.1 and EDS for me. Thanks to those who tried to assist. Roger
8. Re: eDBI problem simplified
- Posted by mattlewis (admin) Jan 07, 2010
- 1212 views
As I am going back to EDS it seems that there is no point sticking with Euphoria4 as basic and essential tools like wxedb don't work with Euphoria4 yet.
I took a quick look at this today. There were a couple of changes required. Basically, I'd updated it previously to work with an earlier v4, but the std library had changed slightly, and some new reserved words happened. I updated these spots in the several libraries used by wxedb to work with the current head of the trunk. The easiest way right now (I'm not going to package it up ATM) is to just get them from their various svn repositories. There are several, and I think that these are all of them:
https://wxedb.svn.sourceforge.net/svntrunk/wxedb/trunk https://ooeu.svn.sourceforge.net/svntrunk/ooeu/trunk https://eudbc.svn.sourceforge.net/svntrunk/eudbc/trunk https://eusql.svn.sourceforge.net/svntrunk/eusql/trunk https://euslibs.svn.sourceforge.net/svntrunk/euslibs/trunk https://matheval.svn.sourceforge.net/svntrunk/matheval/trunk
These are in addition, of course, to the latest bleeding edge version of wxEuphoria. I recommend checking them out to their respective directories, and then adding those directories to your eu.cfg file.
I haven't done extensive testing, but I was able to run it and open a database and inspect some data.
Matt
9. Re: eDBI problem simplified
- Posted by RogerL Jan 07, 2010
- 1149 views
Thanks Matt, in the meantime I have re-setup my old 3.1 environment and got stuck into modifying my test programs from Win32lib to wxEuphoria. I think I'll wait to upgrade to v4 when wxEDB etc is all packaged up nicely for it as I'm more interested in getting my CRUD functions to work than worrying about keeping all my development environment up to date with svn plus the obvious risks of 'bleeding edge' software. I'm still learning Euphoria and I need to know if a problem is mine or Euphoria's - in the case of 3.1 its almost certainly going to be me! Thanks anyway - I'll keep my eyes open for future releases. Roger