SQL error - Incorrect datetime value

Arran Cudbard-Bell a.cudbardb at freeradius.org
Wed Jul 8 15:58:20 CEST 2015


> On Jul 8, 2015, at 9:15 AM, Renato Sousa <rensousa at gmail.com> wrote:
> 
> Hello Alan,
> 
> I checked the file
> /usr/local/etc/raddb/mods-config/sql/main/mysql/queries.conf and contains
> FROM_UNIXTIME () functions.
> The file keeps the default installation settings.
> 
> 
> start {
>                        #
>                        #  Insert a new record into the sessions table
>                        #
>                        query = "\
>                                INSERT INTO ${....acct_table1} \
>                                        (${...column_list}) \
>                                VALUES \
>                                        ('%{Acct-Session-Id}', \
>                                        '%{Acct-Unique-Session-Id}', \
>                                        '%{SQL-User-Name}', \
>                                        '%{Realm}', \
>                                        '%{NAS-IP-Address}', \
>                                        '%{NAS-Port}', \
>                                        '%{NAS-Port-Type}', \
> 
> *FROM_UNIXTIME*(%{integer:Event-Timestamp}),
> \
>                                       *
> FROM_UNIXTIME*(%{integer:Event-Timestamp}),
> \
>                                        NULL, \
>                                        '0', \
>                                        '%{Acct-Authentic}', \
>                                        '%{Connect-Info}', \
>                                        '', \
>                                        '0', \
>                                        '0', \
>                                        '%{Called-Station-Id}', \
>                                        '%{Calling-Station-Id}', \
>                                        '', \
>                                        '%{Service-Type}', \
>                                        '%{Framed-Protocol}', \
>                                        '%{Framed-IP-Address}')"
> 
> Why freeradius does not perform the function in the query?

Because it's easier to use the server side functions to convert the unix timestamps into native date types, instead of writing code to format the timestamps for specific database flavours.

-Arran

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20150708/f5218e2e/attachment.sig>


More information about the Freeradius-Users mailing list