[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using Raw with IN #1079

Closed
ggedde opened this issue Apr 8, 2023 · 1 comment
Closed

Error when using Raw with IN #1079

ggedde opened this issue Apr 8, 2023 · 1 comment
Labels

Comments

@ggedde
Copy link
ggedde commented Apr 8, 2023

Medoo: 2.1.8
PHP: 8.1
Database: MySql
System: Mac and Linux

Describe the Problem
I am looking for a way to use Raw with the IN statement when using arrays. However when I do so I am get an Error:
"PHP Fatal Error: Uncaught Error: Object of class Medoo\Raw could not be converted to string Medoo.php:556"

Detail Code
Here is an example of my code

$data = $database->select('user', [
    'id',
    'name',
], [
    'id' => [
        Medoo::raw("uuid_to_bin('d9fca370-319b-4529-a15c-0d27d9053ef1')"),
        Medoo::raw("uuid_to_bin('9b629b8c-c1a2-4b7d-aa4b-3d6fa85ca85a')"),
    ]
]);

Expected output
I would expect it to work the same way as using Raw for a single value.
As this works.

$data = $database->select('user', [
    'id',
    'name',
], [
    'id' => Medoo::raw("uuid_to_bin('d9fca370-319b-4529-a15c-0d27d9053ef1')")
]);

Or is there another way to do what I am trying to do.
Thanks

ggedde added a commit to ggedde/Medoo that referenced this issue Apr 8, 2023
This is working for me, but I am not too familiar with the map system so please review this thoroughly.
This resolves issue catfan#1079
@receiver1
Copy link
receiver1 commented Sep 9, 2023

This is really a much needed change. Because now you have to completely replace WHERE with Medoo::raw to do this.

@catfan catfan added the bug label Jan 22, 2024
@catfan catfan closed this as completed Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants