[REBOL] Re: Mysql-protocol Date issue
From: tim:johnsons-web at: 14-Aug-2003 18:34
* Nenad Rakocevic <[dockimbel--free--fr]> [030814 18:08]:
>
> Hi Tim,
Hello DocKimbel,
> Tim Johnson wrote:
> [...]
> > Here's the problem:
> > My current version (0.9.9) of DocKimbel's mysql-protocol throws
> > an exception if '0000-00-00' is found.
>
> The driver tries to convert it to a date! value, but it's an invalid date for
> REBOL :
>
> >> 0000-00-00
> ** Syntax Error: Invalid date -- 0000-00-00
> ** Near: (line 1) 0000-00-00
>
> > Does anyone know if there is a fix for this, a configuration switch or
> > whatever? I'd like to avoid hacking Nenad's code to get around this.
>
> No need to hack ;-), here's a workaround :
Oh Good!
> - Just after opening the port, add this line :
>
> change-type-handler your-db-port 'date [to string!]
Just what I was looking for!
Thanks!
~tj~
> - Now, for this db port only, all MySQL date types will remain as string! (It's
> then up to you to decide if and how you want to convert these values)
>
> - You can also provide a little more sophisticate handler for 'date :
>
> to-date-except-zero: func [value][
> attempt [value: to date! value]
> value
> ]
>
> change-type-handler your-db-port 'date [to-date-except-zero]
>
> (This one will convert to date! only if possible)
>
> > Also, I note that the URL for the protocol
> > (http://rebol.dhs.org/mysql/) is not reachable at this time.
> > Does anyone if he has relocated?
>
> http://rebol.softinnov.org/mysql/
>
> HTH,
> -DocKimbel
> --
> To unsubscribe from this list, just send an email to
> [rebol-request--rebol--com] with unsubscribe as the subject.
--
Tim Johnson <[tim--johnsons-web--com]>
http://www.alaska-internet-solutions.com
http://www.johnsons-web.com