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

INSERT with NSNull.null inserts a zero into an optional Int field rather than NULL #11

Open
EricShapiro opened this issue May 3, 2018 · 1 comment

Comments

@EricShapiro
Copy link

What did you do?

Issued an INSERT with an NSNull.null value for an INT field.

What happened instead?

A zero value was inserted into the INT field rather than NULL. Note that the field allows for NULL values.

What did you expect?

I expected the field to contain NULL (no value).

OHMySQL Environment

  • OHMySQL version: 2.1.3 (March 2018)
  • Xcode version: 9.2
  • Swift version: (if applicable, if not remove)
  • Platform(s) running OHMySQL: OSX 10.13.3

Demo Project

Don't have a demo project yet. The INSERT code is pretty simple:

NSDictionary<NSString*, id> *d = [NSDictionary dictionaryWithObjectsAndKeys:
"Bob", @"user",
[NSDate date], @"modified",
NSNull.null, @"rec_no",
nil];

OHMySQLQueryRequest *request = [OHMySQLQueryRequestFactory INSERT:@"Log" set:d];

and then passed the request to an OHMySQLQueryContext.

@oleghnidets
Copy link
Owner

Thanks for good report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
OHMySQL 3.0
  
Feature
Development

No branches or pull requests

2 participants