catfan / Medoo

The lightweight PHP database framework to accelerate the development.
https://medoo.in
MIT License
4.84k stars 1.15k forks source link

[where between <> or ><] type is text ,the result is error in sqlite and mysql #829

Closed withu2018 closed 5 years ago

withu2018 commented 5 years ago

Describe the bug A clear and concise description of what the bug is.

Information

use [where between <> or ><], type is text(Numbers exist in text columns) ,the result is error in sqlite and mysql

catfan commented 5 years ago

Sorry, I'm not really sure I can understand what's your mean.

Would you like to provide more details?

<> and >< should only be available for number and datetime.

https://medoo.in/api/where

withu2018 commented 5 years ago

thank you. but,Can you add conversion function?

$database->select("account", "user_name", [
    "[int]age[<>]" => [200, 500]
]);

SQL: select user_name from account where CAST(age as int) between 200 and 500

catfan commented 5 years ago

There is no need to do that. If the column data are all number, you should set it as Integer, not text.