Newbie help with Artful-Mysql

Started by mbartz, April 10, 2014, 08:13:05 PM

Previous topic - Next topic

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:


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

#1
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

#2
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

#3
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:


; 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

#4
Michael,



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



https://gist.github.com/cryptorick/10490156">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

#5
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

#6
Quote from: "mbartz"And the pull from github still breaks as you probably expected.

You mean the gist I dropped?


Quote from: "mbartz"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

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


(module "mysql.lsp")

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


My result was:


>
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

#8
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

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

rickyboy

#10
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

#11
:)



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

#12
Quote from: "mbartz"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

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

rickyboy

#14
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:


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