Skip to content

MySQL FIELD function #12

@dvandersluis

Description

@dvandersluis

I created an extension for handling MySQL's FIELD function, would that be valuable as a PR? As far as I can tell, there's no parallel functions in the other RDBMSes (although it could maybe be faked with a CASE statement?), so I'm not sure if there's a way to handle non-universally supported functions, or a desire for them in this gem.

ids = [1, 2, 3, 4, 5]
Post.order(Post[:id].field(ids)).to_sql
=> "SELECT `posts`.* FROM `posts` ORDER BY FIELD(`posts`.`id`, 1, 2, 3, 4, 5)"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions