catfan / Medoo

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

'String' in Data Type Declaration does not work #1085

Closed webgoto closed 1 year ago

webgoto commented 1 year ago

Thanks for the great library.

Information

Describe the Problem A clear and concise description of what the problem is.

$db->select('folder', ['id[String]','name','articleOrder[JSON]']); Even if you run this, the ID will be returned as a number.

Looking at the source code https://github.com/catfan/Medoo/blob/master/src/Medoo.php#L1464

                        case 'String':
                            $stack[$columnKey] = $item;
                            break;

Shouldn't we add (string) like this? $stack[$columnKey] = (string) $item;

catfan commented 1 year ago

Thanks for the feedback.

Would you submit a pull request for this?

webgoto commented 1 year ago

Sorry. Due to my lack of skill, I don't know how to use git.

catfan commented 1 year ago

@webgoto OK, I will fix it.

carliblaz commented 1 year ago

I'm not sure that this was OK, db field bigint(20) has now string value not int.