Hi Sjoerd,

Thank you for getting back to me.

My colleague tested what you suggested and got the same error so it is still failing. He is certain he is passing the correct value as he is able to execute the same query in raw format, so he believed it has to do with the way params are implemented. I'm no expert but he said it looks like an error from C language.

Please advise.

Thank you.

Regards,

 

Kevork Vartanian



From: users-list <users-list-bounces+kev=innotta.com.au@monetdb.org> on behalf of users-list-request@monetdb.org <users-list-request@monetdb.org>
Sent: Friday, 4 December 2020 10:00 PM
To: users-list@monetdb.org <users-list@monetdb.org>
Subject: users-list Digest, Vol 100, Issue 2
 
Send users-list mailing list submissions to
        users-list@monetdb.org

To subscribe or unsubscribe via the World Wide Web, visit
        https://www.monetdb.org/mailman/listinfo/users-list
or, via email, send a message with subject or body 'help' to
        users-list-request@monetdb.org

You can reach the person managing the list at
        users-list-owner@monetdb.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of users-list digest..."


Today's Topics:

   1. MonetDB-PHP Error on parameterized query with timestamp
      (Kevork  Vartanian)
   2. Re: MonetDB-PHP Error on parameterized query with timestamp
      (Sjoerd Mullender)


----------------------------------------------------------------------

Message: 1
Date: Fri, 4 Dec 2020 00:11:59 +0000
From: "Kevork  Vartanian" <kev@innotta.com.au>
To: "users-list@monetdb.org" <users-list@monetdb.org>
Subject: MonetDB-PHP Error on parameterized query with timestamp
Message-ID:
        <SYBP282MB0346DC1924EC1C610E29428B81F10@SYBP282MB0346.AUSP282.PROD.OUTLOOK.COM>
       
Content-Type: text/plain; charset="iso-8859-1"

Hi,

The below is from my colleague who is not a member on this list, so I'm sending on his behalf.

I'm using MonetDB with MonetDB-PHP library.


I have followed the documentation from: https://github.com/MonetDB/MonetDB-PHP


Everything is working fine, but if I set parameter for timestamp type column I get the following error:

Error from MonetDB: 42000!Wrong type for argument 1 of function call: char, expected timestamp

For example, this is working:

$result = $connection->Query('
    select
        *
    from
        "cats"
    where
        "name" = ?
        and "weight_kg" > ?
    limit
        10', [ "D'artagnan", 5.3 ]);

but this will not work:

$result = $connection->Query('
    select
        *
    from
        "cats"
    where
        "name" = ?
        and "weight_kg" > ?
        and "birthdate" < ? // timestamp data type
    limit
        10
', [ "D'artagnan", 5.3, "2020-02-28 12:37:16" ]);


The error occurs for any column that is of timestamp type and only when passing value as parameter.


What am I doing wrong?

Thank you.


Regards,

Kevork Vartanian

This email correspondence may contain privileged information and it is intended to be transmitted to the addressee abovementioned. If you are not the intended recipient of this email correspondence, you must not distribute, copy, forward or rely upon its contents. We ask that you notify the sender of this error and immediately delete this email correspondence.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.monetdb.org/pipermail/users-list/attachments/20201204/fdddb99f/attachment-0001.htm>

------------------------------

Message: 2
Date: Fri, 4 Dec 2020 09:28:42 +0100
From: Sjoerd Mullender <sjoerd@monetdb.org>
To: users-list@monetdb.org
Subject: Re: MonetDB-PHP Error on parameterized query with timestamp
Message-ID: <21399d1c-6e66-5387-90bb-9266bec2f57c@monetdb.org>
Content-Type: text/plain; charset=windows-1252; format=flowed

I haven't tried this using the PHP driver, but does it work to use
[ "D'artagnan", 5.3, "timestamp '2020-02-28 12:37:16'" ]
as the argument?

On 04/12/2020 01.11, Kevork Vartanian wrote:
> Hi,
>
>
> The below is from my colleague who is not a member on this list, so I'm
> sending on his behalf.
>
>
> I'm using MonetDB with MonetDB-PHP library.
>
>
> I have followed the documentation
> from:https://github.com/MonetDB/MonetDB-PHP
> <https://github.com/MonetDB/MonetDB-PHP>
>
>
> Everything is working fine, but if I set parameter for timestamp type
> column I get the following error:
>
>     Error from MonetDB: 42000!Wrong type for argument 1 of function
>     call: char, expected timestamp
>
> For example, this is working:
>
> |$result = $connection->Query('select* from"cats"where"name"= ?
> and"weight_kg"> ? limit 10', [ "D'artagnan", 5.3 ]);|
>
> but this will not work:
>
> |$result = $connection->Query(' select * from "cats"where"name"= ? and
> "weight_kg"> ? and "birthdate"< ? // timestamp datatypelimit 10', [
> "D'artagnan", 5.3, "2020-02-28 12:37:16"]); |
>
> The error occurs for any column that is of timestamp type and only when
> passing value as parameter.
>
>
> What am I doing wrong?
>
>
> Thank you.
>
> Regards,
>
> Kevork Vartanian
>
> This email correspondence may contain privileged information and it is
> intended to be transmitted to the addressee abovementioned. If you are
> not the intended recipient of this email correspondence, you must not
> distribute, copy, forward or rely upon its contents. We ask that you
> notify the sender of this error and immediately delete this email
> correspondence.
>
> _______________________________________________
> users-list mailing list
> users-list@monetdb.org
> https://www.monetdb.org/mailman/listinfo/users-list
>

--
Sjoerd Mullender


------------------------------

Subject: Digest Footer

_______________________________________________
users-list mailing list
users-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/users-list


------------------------------

End of users-list Digest, Vol 100, Issue 2
******************************************
This email correspondence may contain privileged information and it is intended to be transmitted to the addressee abovementioned. If you are not the intended recipient of this email correspondence, you must not distribute, copy, forward or rely upon its contents. We ask that you notify the sender of this error and immediately delete this email correspondence.