Başar Erdivanlı | 25 Jun 00:23 2015
Picon

update-records updates all rows

I use clozure cl version 1.10 on linux arm.
As far as I read on the documentation, I coded the following function to update a boolean value in a table:

(defun function-name (id)
  (clsql:update-records 'table-name
                        :av-pairs '((column_name "f"))
                        :where (eq 'id id)))

But the function above updates the value of column_name of all rows to 'f'. I tried it with other equality predictors. Only '=' complained that id is not a number. I also tried it with other columns, which contain smallints or strings and equality predictors like string=. The result is always the same: the whole column becomes 'f'.

The mail list contains many posts where I see codes like this:
...
  (with-custom-database () 
    (let ((a (get-object 3)))
      (setf (student-name a) "Joe Stud")
      (update-records-from-instance a)))...

Whereas I can't find any example of clsql:update-records.
What may be the reason?
_______________________________________________
CLSQL mailing list
CLSQL <at> b9.com
http://lists.b9.com/cgi-bin/mailman/listinfo/clsql
jhyiugjhvbjh234 | 7 Jun 15:16 2015
Picon

PostgreSQL and backslash escaping

		Hello.
	Currently CLSQL escapes backslashes in string literals for
PostgreSQL by doubling the character.
	Unfortunately, new versions of PostgreSQL don't need this 
anymore. I think the change has occured between 9.0 and 9.1 releases.

Before the change:
select length ('\\'); 
-> 1
select length ('\');
-> waits for the closing '

After the change:
select length('\\');
-> 2
select length('\');
-> 1

So the code generated by CLSQL leads to the backslashes in the string
being doubled with the new PostgreSQL databases.

What is the most reasonable way to handle this?

_______________________________________________
CLSQL mailing list
CLSQL <at> b9.com
http://lists.b9.com/cgi-bin/mailman/listinfo/clsql
Mariano Montone | 10 Mar 18:52 2015
Picon

Bug: NO-NEXT-METHOD error on read-sql-value (SBCL)

Hi.

When trying to use latest version from SBCL, read-sql-value signals a
NO-NEXT-METHOD error for the :around read-sql-value definition. It
should work, as I understand the code, and maybe this is a bug in SBCL,
but I'm posting FYI. Dosn't work on latest SBCL or older versions.

This is the conflicting code:

596 (defmethod read-sql-value :around
597     (val type database db-type
598      ;; never eval while reading values, always read base 10
599      &aux *read-eval* (*read-base* #10r10))
600   (declare (ignore db-type))
601   (cond
602     ;; null value or type
603     ((or (equalp "nil" val) (eql 'null val)) nil)
604    
605     ;; no specified type or already the right type
606     ((or (null type)
607          (ignore-errors (typep val type)))
608      val)
609
610     ;; actually convert
611     (t
612      (let ((res (handler-bind
613                     ;; all errors should be converted to
sql-value-conversion-error
614                     ((error (lambda (c)
615                               (when *debugger-hook*
616                                 (invoke-debugger c))
617                               (unless (typep c
'sql-value-conversion-error)
618                                 (error-converting-value val type
database)))))
619                   (call-next-method))))
620        ;; if we didnt get the right type after converting, we should
probably
621        ;; error right away
622        (maybe-error-converting-value
623         res val type database)))))
624
625 (defmethod read-sql-value (val type database db-type)
626   ;; errors, nulls and preconverted types are already handled in around
627   (typecase type
628     (symbol
629      (case type
630        ((string varchar) val)
631        (char (string (schar val 0)))
632        ((or keyword symbol)
633         (read-from-string val))
634        ((smallint mediumint bigint integer universal-time)
635         (parse-integer val))
636        ((double-float float)
637         ;; ensure that whatever we got is coerced to a float of the
correct
638         ;; type (eg: 1=>1.0d0)
639         (float
640          (etypecase val
641            (string (let ((*read-default-float-format*
642                            (ecase type
643                              (float 'single-float)
644                              (double-float 'double-float))))
645                      (read-from-string val)))
646            ;; maybe wrong type of float
647            (float val))
648          (if (eql type 'double-float) 1.0d0 1.0s0)))
649        (number (read-from-string val))
650        ((boolean generalized-boolean)
651         (if (member val '(nil t))
652             val
653             (etypecase val
654               (string
655                (when (member val '("1" "t" "true" "y") :test
#'string-equal)
656                  t))
657               (number (not (zerop val))))))
658        ((wall-time duration) (parse-timestring val))
659        (date (parse-datestring val))
660        (t (call-next-method))))
661     (t (typecase val
662          (string (read-from-string val))
663          (t (error-converting-value val type database))))))

Mariano
DJ | 7 Mar 04:58 2015

problem resolving foreign function (I think)

OK - I'm in over my head here. I did search the archives for help on this, but I am not that sure what I am looking for.

I can connect to a mysql database, but when I do any query with (clsql:query...) I get:

Can't resolve foreign symbol "clsql_mysql_field_flags"

So, here is the setup. I am running:

Linux Mint 17 64-bit
Clozure CL Version 1.10-r16196 64-bit

I do NOT have the debian clsql packages installed. When I had them installed, doing (ql:quickload :clsql-mysql) caused a compile error. Some of the uffi stuff did not compile. I do not have the specifics of that right now because I uninstalled the clsql packages on the assumption that I could use the shared libraries within the quicklisp distribution, and so would not need to install the debian packages. (Let me know if that's wrong.)

Anyway, I did a "make" in the db-mysql directory of the the quicklisp distro of clsql. This made a 64-bit version of clsql_mysql64.so but crapped out on the 32-bit version. I don't know how to set up 32-bit development on my Linux MInt box, but I am not sure that's the real problem anyway.

I jthen did "readelf -Ws clsql_mysql64.so" and saw that the library exports "clsql_mysql_field_flags".

I did:

(clsql:push-library-path #p "/home/jakep/quicklisp/dists/quicklisp/software/clsql-20150302-git/db-mysql/")

As I understand it this should make the shared library available to clsql, which I would have thought would allow resolution of clsql_mysql_field_flags.

At one point I also pushed  the path to the uffi stuff also: "/home/jakep/quicklisp/dists/quicklisp/software/clsql-20150302-git/uffi/" but this made no difference.

I have had no trouble running clsql on two of my OS X machines, but cannot get it going on Linux Mint.

Any help will be deeply appreciated.

Best,

- DJ -


_______________________________________________
CLSQL mailing list
CLSQL@...
http://lists.b9.com/cgi-bin/mailman/listinfo/clsql
Russ Tyndall | 25 Feb 15:28 2015
Picon

Re: CLSQL Release

Thanks as always Zach, and apologies. 

That back end worked last I checked it (~6mo), but apparently that was too long ago.

Everything compiles and all the tests pass for me again, once I resolved the type error.
I thought it a little odd that the "warning" stopped compilation, but it seems SBCL does that more frequently as releases progress.

The fix has been pushed to git.b9.org and http://github.com/Unwashedmeme/clsql

Cheers,
Russ Tyndall
Developer
Acceleration.net


On 02/24/2015 07:08 PM, Zach Beane wrote:
Unfortunately, there seems to be a bug - http://report.quicklisp.org/2015-02-24/failure-report/clsql.html#clsql-mysql has the log.

; caught WARNING: ; Constant NIL conflicts with its asserted type (SB-ALIEN:ALIEN (* T)). ; See also: ; The SBCL Manual, Node "Handling of Types"

On Tue, Feb 24, 2015 at 2:06 PM, Russ Tyndall <russ <at> acceleration.net> wrote:
Spurred on by a message from the SBCL-devel list, I think its time for
a clsql release.

> It is actually a clsql problem, its reinitialize-instance around methods
> for standard-db-class do not return the passed instance to them.
> I made SBCL ignore that again, but things should be prepared that
> SBCL won't be so lenient in the future, maybe with type and equality
> assertions for all standard GFs.
>
> --
> With best regards, Stas.

I made the `reinitialize-instance :around`, return the passed in
instance.

Also in this release are some encoding bug fixes for sqlite backends
(thanks Zach Beane). Fixes for procedures and multiple result sets in
the mysql backend (thanks Ilya Khaprov). There was also a fixed load
bug for mysql on recent Ubuntu's (hopefully not causing problems
elsewhere).

I believe this will be release 6.6.0, but as always I leave that to
Kevin's discretion. Nathan Bird will push this all to b9.org in a bit.

Cheers,
Russ Tyndall
Developer
Acceleration.net

_______________________________________________
CLSQL mailing list
CLSQL <at> b9.com
http://lists.b9.com/cgi-bin/mailman/listinfo/clsql


_______________________________________________
CLSQL mailing list
CLSQL@...
http://lists.b9.com/cgi-bin/mailman/listinfo/clsql
Russ Tyndall | 24 Feb 20:06 2015
Picon

CLSQL Release

Spurred on by a message from the SBCL-devel list, I think its time for
a clsql release.

> It is actually a clsql problem, its reinitialize-instance around methods
> for standard-db-class do not return the passed instance to them.
> I made SBCL ignore that again, but things should be prepared that
> SBCL won't be so lenient in the future, maybe with type and equality
> assertions for all standard GFs.
>
> --
> With best regards, Stas.

I made the `reinitialize-instance :around`, return the passed in
instance.

Also in this release are some encoding bug fixes for sqlite backends
(thanks Zach Beane). Fixes for procedures and multiple result sets in
the mysql backend (thanks Ilya Khaprov). There was also a fixed load
bug for mysql on recent Ubuntu's (hopefully not causing problems
elsewhere).

I believe this will be release 6.6.0, but as always I leave that to
Kevin's discretion. Nathan Bird will push this all to b9.org in a bit.

Cheers,
Russ Tyndall
Developer
Acceleration.net
Mark Meyer | 5 Feb 12:40 2015
Picon

Maria DB Problems

Hi,
I've got a problem using MariaDB with CLSQL. Using the MariaDB Client libs CLSQL does not compile because mysql-client-info.lisp does check for a specific Version of the MySQL libs. The *mysql-client-info* is retrieved from mysql-get-client-info and the result should be something like 5.0.0-mysql but it is in fact 10.0.0-MariaDB. I did a quick fix to work around this (checking if the first letter of the string is 1), but would like a more permanent fix. Any ideas on how a good fix should look?

Regards, Mark
_______________________________________________
CLSQL mailing list
CLSQL@...
http://lists.b9.com/cgi-bin/mailman/listinfo/clsql
Christopher Laux | 20 Dec 12:38 2014
Picon

clsql-mysql problem with join

Hi,

the second point of your post helped thanks, I had to modify 2 Makefiles.

I have another problem with clsql: when querying an object (user) with a one-to-many join

(jobs :reader user-jobs :db-kind :join :db-info (:join-class job
   :home-key id
   :foreign-key user-id
   :set t))

the slot sometimes returns all 4 job objects sometimes only 2 randomly. What could this be?

Chris


On Sat, Dec 20, 2014 at 8:04 AM, Jussi Lahdenniemi <jlahd <at> iki.fi> wrote:
Hello,

> using the most recent quicklisp version of clsql on sbcl 1.2.0 on ubuntu
> 14.04 with the corresponding mysql and libmysqlclient-dev definitely
> installed I receive this error upon loading clsql-mysql:
>
> OPERATION-ERROR while invoking #<COMPILE-OP > on
> #<CLSQL-MYSQL-SOURCE-FILE "clsql-mysql" "db-mysql" "clsql_mysql">

About a month ago I listed in my answer at Stackoverflow
(http://stackoverflow.com/questions/27123292/installing-clsql-sqlite3-using-sbcl-quicklisp)
the three issues I have faced when installing clsql on different
systems. Maybe one of these covers your situation as well?

--
Jussi Lahdenniemi
_______________________________________________
CLSQL mailing list
CLSQL-0lovp2JerKU@public.gmane.org
http://lists.b9.com/cgi-bin/mailman/listinfo/clsql

_______________________________________________
CLSQL mailing list
CLSQL@...
http://lists.b9.com/cgi-bin/mailman/listinfo/clsql
Christopher Laux | 19 Dec 20:45 2014
Picon

clsql-mysql load error

Hi all,

using the most recent quicklisp version of clsql on sbcl 1.2.0 on ubuntu 14.04 with the corresponding mysql and libmysqlclient-dev definitely installed I receive this error upon loading clsql-mysql:

OPERATION-ERROR while invoking #<COMPILE-OP > on #<CLSQL-MYSQL-SOURCE-FILE "clsql-mysql" "db-mysql" "clsql_mysql">

Unfortunately it doesn't say much more...

What can I do?

Cheers,
Chris

_______________________________________________
CLSQL mailing list
CLSQL@...
http://lists.b9.com/cgi-bin/mailman/listinfo/clsql
Zach Beane | 25 Nov 20:33 2014

clsql-sqlite does not build on sbcl - argument error

I get this when trying to build clsql-sqlite:

  ; file: /home/quicklisp/quicklisp-controller/dist/build-cache/clsql/369f4bee8ea4573e08e35f09583a1ea0c1b03c08/clsql-20141124-git/db-sqlite/sqlite-sql.lisp
  ; in: DEFUN CANONICALIZE-RESULT-TYPES
  ;     (SQLITE:SQLITE-AREF CLSQL-SQLITE::COL-NAMES CLSQL-SQLITE::J)
  ; 
  ; caught WARNING:
  ;   The function was called with two arguments, but wants exactly three.

More of a log is here:

  http://report.quicklisp.org/2014-11-25/failure-report/clsql.html#clsql-sqlite

Zach
Russ Tyndall | 10 Jun 19:32 2014
Picon

Makefile Change for db-mysql backend

Hello,

Something apparently changed in the output of `dpkg-buildflags --get 
LDFLAGS` that caused this makefile to output invalid command line 
arguments to `ld`.  I made a change that I think is backwards compatible 
and should result

Gmane