Newbie help with Artful-Mysql

Q&A's, tips, howto's
Locked
mbartz
Posts: 9
Joined: Mon Apr 29, 2013 1:02 pm

Newbie help with Artful-Mysql

Post by mbartz »

I am very new to newLisp (so be gentle!)

I was trying to run the "Artful" version of the Mysql module and am running into the following error:

Code: Select all

Michaels-MacBook-Pro:~ michaelbartz$ newlisp
newLISP v.10.6.0 64-bit on OSX IPv4/6 UTF-8 libffi, options: newlisp -h

> (module "mysql.lsp")
MAIN
> (setf db (Mysql))
(Mysql 4336914432)
> (:connect db "localhost" "RetransDjango" "pwd" "retransdjango")

ERR: list expected in function : : "localhost"
called from user defined function Mysql:connect
The MySQL version is 5.5 and the standard module works fine. I am running the most recent version of newLisp (10.6) and running Mavericks.

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Re: Newbie help with Artful-Mysql

Post by cormullion »

Some suggestions - I don't actually know the answer...:)

If you're using the latest version from Github, that appears to be written for an earlier newLISP version - 10.0.1... It's possible that the change in FOOP (in version 10.2?) has made the code non-functional.

I'm not sure whether these code modules have been updated recently. Looking at the various dates, I expect not. Also, I think Jeff and Kanen have moved on to other things. So someone needs to fix and maintain them.

mbartz
Posts: 9
Joined: Mon Apr 29, 2013 1:02 pm

Re: Newbie help with Artful-Mysql

Post by mbartz »

I did open a ticket in github, but I was a little worried about the inactivity. Being new to Lisp in general I was not able to diagnose the problem quickly.

Thanks for the clues. Maybe I'll fork the repo and try to dig in, but swimming in the dark right now with Lisp :).

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Re: Newbie help with Artful-Mysql

Post by cormullion »

Perhaps someone with mySQL installed can help - I tried to run mysql.lsp on my Mac but mysql isn't installed by default. I stick to sqlite :).

newLISP itself changes quite often - - but there are many libraries out there which don't manage to keep up with the changes....

On another thread, Lutz offers this advice for moving from old FOOP to new FOOP - this may not be relevant, but here it is:

Code: Select all

; old FOOP code original
(define (method obj p1 p2)
   …
   (… (obj 1) …)
)

; old FOOP code prepared for upgrade
(define (method self p1 p2)
   …
   (… (self 1) …)
)

; new FOOP code after taking out self from the parameter list
(define (method p1 p2)
   …
   (… (self 1) …)
)

rickyboy
Posts: 607
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

Re: Newbie help with Artful-Mysql

Post by rickyboy »

Michael,

Can you try this code I just posted (I can't really test it now)?

https://gist.github.com/cryptorick/10490156

Please let me know if it works.

P.S. EDIT: In other words, I believe that cormullion is correct. FOOP's definition of method interfaces changed and you have to use the intrinsic self.
(λx. x x) (λx. x x)

mbartz
Posts: 9
Joined: Mon Apr 29, 2013 1:02 pm

Re: Newbie help with Artful-Mysql

Post by mbartz »

Started some preliminary testing. And the pull from github still breaks as you probably expected. I am reading the FOOP conversion discussions and will tinker, but you will probably fix it before I will.

rickyboy
Posts: 607
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

Re: Newbie help with Artful-Mysql

Post by rickyboy »

mbartz wrote:And the pull from github still breaks as you probably expected.
You mean the gist I dropped?
mbartz wrote:I am reading the FOOP conversion discussions and will tinker, but you will probably fix it before I will.
Not likely. I probably won't get to it until sometime this weekend. Sorry.
(λx. x x) (λx. x x)

mbartz
Posts: 9
Joined: Mon Apr 29, 2013 1:02 pm

Re: Newbie help with Artful-Mysql

Post by mbartz »

I dropped your version into my modules directory and ran the following script:

Code: Select all

(module "mysql.lsp")

(setf db (Mysql))
(:connect db "localhost" "RetransDjango" "retrans1" "retransdjango")
(:query db "select * from mg_enterprise")
(:close-db)
My result was:

Code: Select all

> 
MAIN
(Mysql 4303375872)

ERR: list expected in function : : self@100000DF8
called from user defined function Mysql:connect
> 
I can wait for your weekend work :).

rickyboy
Posts: 607
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

Re: Newbie help with Artful-Mysql

Post by rickyboy »

Gist is now updated (as of a few minutes ago). This one should basically work, although I did not test all the functions. Please try it though and let us know. (I got help from cormullion, btw.) Thanks!
(λx. x x) (λx. x x)

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Re: Newbie help with Artful-Mysql

Post by cormullion »

Ah, so it was the self-ish additions that were wrong... Good job, mate! (I assume, I can't run the code...)

rickyboy
Posts: 607
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

Re: Newbie help with Artful-Mysql

Post by rickyboy »

Yeah, it was. You called it from the beginning.

BTW, I'm enjoying reading your commit messages of the changes you submitted to github's linguist repo. Ah, Ruby code. :) The way they put that together is so damned opaque. So, do your efforts here entail that we can finally have newLISP highlighting on github? I hope the answer is yes.
(λx. x x) (λx. x x)

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Re: Newbie help with Artful-Mysql

Post by cormullion »

:)

The plan was to get the newLISP syntax into the linguist code, but even with help I can't get my pull request past the "Travis build" phase. I have no idea what Github are doing (busy watching hula-hooping work colleagues?) but they couldn't have made it more difficult .... I think we'll just have to make do with labelling ourselves as Common Lisp users for now... I can cope with the shame. :)

rickyboy
Posts: 607
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

Re: Newbie help with Artful-Mysql

Post by rickyboy »

mbartz wrote:I can wait for your weekend work :).
Michael, I had a fix this morning, but in the afternoon, I had to make more changes, this time to make it work on a 64-bit platform. Check the latest revisions of the gist to see what I changed. I was testing on a 64-bit platform (Ubuntu 12.04) where the fetch-row method wasn't working (earlier today); it's working now though.

Please give it a whirl. Since you are working on a 64-bit too, but on a Mac, I'd be curious if it works for you too. I'm not happy with the original code that tests the library (it finds) for 64-bit-ness. However, I just added another test to it that I hope works for you on the Mac.

Let me know! Cheers, Rick.
(λx. x x) (λx. x x)

mbartz
Posts: 9
Joined: Mon Apr 29, 2013 1:02 pm

Re: Newbie help with Artful-Mysql

Post by mbartz »

I am putting it through its paces. So far so good. I am testing basic reads. I'll try some inserts later.

rickyboy
Posts: 607
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

Re: Newbie help with Artful-Mysql

Post by rickyboy »

Excellent! I'll do some more testing (later) also. After that, I'd like to push that code upstream. I'm sure Kanen and Co. would appreciate it.

Hopefully you see this:

Code: Select all

> (load "mysql.lsp") ; or (module "mysql.lsp") if you already installed it.
MAIN
> _MYSQL:is-64-bit
true
(λx. x x) (λx. x x)

Locked