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

Returning null fields #1039

Open
lamuzzachiodi opened this issue Mar 11, 2022 · 3 comments
Open

Returning null fields #1039

lamuzzachiodi opened this issue Mar 11, 2022 · 3 comments

Comments

@lamuzzachiodi
Copy link

When i recover nullable fields (i'm working in mysql, btw) in a form for update, i get the string "null".
May be there are a context where this way is useful, but it seem no practical in general (at least when you are updating data and you want recover and also save this data as is).
I guess that recovering as an empty string could be a better way. So, i suggest add the option to get null fields as empty strings.

@tunakode
Copy link

Same here... using PHP 7.3

datatype: text
allow null
default value: null

I'm confused when try to validating null value:

// after init medoo
$result = $database->get("mytable", "myfield_thats_null", ["id" => 1]);

some times result was NULL but sometimes will becomes "null" (string)

@tunakode
Copy link

Same here... using PHP 7.3

datatype: text allow null default value: null

I'm confused when try to validating null value:

// after init medoo
$result = $database->get("mytable", "myfield_thats_null", ["id" => 1]);

some times result was NULL but sometimes will becomes "null" (string)

Forget my reply above, I found null string comes from 3rd party json result that not proper set null:

"value": "null"  instead "value":null

@WeslleyRAraujo
Copy link

WeslleyRAraujo commented Feb 13, 2024

I believe it doesn't make sense bacause the Medoo is PDO based, its a default behaviour of PDO.

if you use Oracle you can pass this attibutes in your options of Medoo connection:

	PDO::ATTR_ORACLE_NULLS => PDO::NULL_TO_STRING

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants