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

getTable throws UnexpectedNullValueException #245

Closed
lauris opened this issue May 6, 2014 · 6 comments
Closed

getTable throws UnexpectedNullValueException #245

lauris opened this issue May 6, 2014 · 6 comments
Assignees
Labels
Milestone

Comments

@lauris
Copy link

lauris commented May 6, 2014

Today I encountered a bug when using getTable method.

Let's assume the following table structure in MySQL:

CREATE TABLE `test_table` (
  `some_setting` tinyint(1) NOT NULL DEFAULT '1'
)

And then try to access table like this (e.g., to get meta data and column list):
db.getTable("test_table").get

First you will get ResultSetExtractorException exception:

Failed to retrieve value because **null**. If you're using SQLInterpolation, you may mistake u.id for u.resultName.id.

As you can see the reason of exception is null, which is a bit strange. If you access the real exception e.e that caused this, you actually get scalikejdbc.UnexpectedNullValueException.

After looking through TypeBinder.scala, it made some sense, but I am still confused.

What could be possible fix or workaround for this? I think that ``some_setting tinyint(1) NOT NULL DEFAULT '1' is a legit column and actually quite common.

I think that this bug is related to the change described in #172.

Thanks!

@seratch
Copy link
Member

seratch commented May 6, 2014

Which version are you using? I guess you're using 1.7.4 or lower version. If so, would you try the latest version (version 1.7.7)? We fixed a similar issue in version 1.7.5. b0f02d9

@seratch seratch added the core label May 6, 2014
@seratch seratch self-assigned this May 6, 2014
@lauris
Copy link
Author

lauris commented May 6, 2014

I was using 1.7.5 and just upgraded to 1.7.7, but the issue still remains.

"org.scalikejdbc" %% "scalikejdbc" % "1.7.7",
"org.scalikejdbc" %% "scalikejdbc-interpolation" % "1.7.7"

@lauris
Copy link
Author

lauris commented May 6, 2014

Tried with 2.0.0-RC3 too, same result.

@seratch
Copy link
Member

seratch commented May 6, 2014

Thanks. I just fixed this issue on both of 1.x and develop branch.

ScalikeJDBC 2.0.0 will be out within days and we'll release 1.7.8 too at the same time.

@seratch seratch added this to the version 2.0.0 milestone May 6, 2014
@lauris
Copy link
Author

lauris commented May 6, 2014

Thanks! Is it possible to use this fix right away by referencing the commit in build.sbt?

@seratch
Copy link
Member

seratch commented May 6, 2014

Is it possible to use this fix right away by referencing the commit in build.sbt?

I've never done. Maybe git clone & sbt publishLocal is better.

I just published the latest version as 1.7.8-SNAPSHOT (Sonatype snapshots repository). Try it out.

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

No branches or pull requests

2 participants