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

MySql: support for unreferenced BIT columns #439

Merged
merged 1 commit into from
Jan 3, 2016

Conversation

javornikolov
Copy link
Contributor

This is to be able to support e.g. updating table which contains BIT column via dbfit Update fixture when the bit column itself is not referenced.

Also it's possibly covering (but not yet tested) referring single BIT columns BIT (1). For longer BIT data types BIT(n > 1) referring such columns is not supported.

As per the MySql driver documentation: the Java type is different for BIT(1) and BIT(n > 1).

TODO:

  • Add acceptance tests
  • Test if the original problem is being solved

The problem has been originally reported on the mailing list. Update like following.

|Update |mytable |
|field1= |field2 |
|value1 |value2 |

results in exception:

java.lang.UnsupportedOperationException: Type BIT is not supported
 at dbfit.environment.MySqlEnvironment.getSqlType(MySqlEnvironment.java:143)
 at dbfit.environment.MySqlEnvironment.readColumnsFromDb(MySqlEnvironment.java:79)
 at dbfit.environment.MySqlEnvironment.getAllColumns(MySqlEnvironment.java:61)
 at dbfit.fixture.Update.initParameters(Update.java:101)
 at dbfit.fixture.Update.doRows(Update.java:86)
 at fit.Fixture.doTable(Fixture.java:156)
 at fitlibrary.traverse.AlienTraverseHandler.doTable(AlienTraverseHandler.java:21)
 at fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretWholeTable(DoTraverseInterpreter.java:104)
 at fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretWholeTable(DoTraverseInterpreter.java:89)
 at fitlibrary.DoFixture.interpretWholeTable(DoFixture.java:73)
 at fitlibrary.suite.InFlowPageRunner.run(InFlowPageRunner.java:27)
 at fitlibrary.DoFixture.interpretTables(DoFixture.java:42)
 at dbfit.DatabaseTest.interpretTables(DatabaseTest.java:26)
 at fit.Fixture.doTables(Fixture.java:81)
 at fit.FitServer.process(FitServer.java:81)
 at fit.FitServer.run(FitServer.java:56)
 at fit.FitServer.main(FitServer.java:41)

The columns in the UPDATE are varchar but there is a bit field in the table.

@MMatten
Copy link
Contributor

MMatten commented Nov 5, 2015

How much more work is it to support BIT(1) in Insert/Update/Clean/Query fixtures?

@javornikolov javornikolov force-pushed the mysql-support-unreferenced-bit-columns branch from 2b05bb2 to 77d857d Compare November 5, 2015 21:41
@javornikolov
Copy link
Contributor Author

How much more work is it to support BIT(1) in Insert/Update/Clean/Query fixtures?

My assumption is that it's already working: but I haven't tested anything yet. If we refer a BIT(1) column - then a question emerges how are the values represented: right now it's mapped to Boolean which would allow true, false as far as I remember. (While one might find 0, 1 notation more appropriate).

@MMatten
Copy link
Contributor

MMatten commented Nov 5, 2015

And, do we really want to have to handle BIT(n>1) differently? May be it!s time to introduce the general binary handler.

@javornikolov
Copy link
Contributor Author

BIT(n) seems to be mapped to byte[] while BIT(1) is Boolean. But indeed - on FitNesse test level it perhaps makes sense to use one the same notation (otherwise it would be confusing for users).

I would vote for splitting this into two:

  • We don't claim any support for referring BIT columns; just allow having them in the table. (This was my initial intention with this PR). This is in order to resolve the issue reported on the mailing list.
  • Later we can add support for using BIT columns (1 or more bits).

@MMatten
Copy link
Contributor

MMatten commented Nov 5, 2015

Sounds good to me too.

A general binary (hex) handler would be really useful and allow us to move on a few of the existing issues too. I think that would be my vote for our next new feature.

@MMatten
Copy link
Contributor

MMatten commented Nov 5, 2015

On a side note, I think Travis supports some DB types (MySQL and perhaps Postgres) so perhaps we could extend the fastbuild or create another build task for the CI.

@javornikolov javornikolov force-pushed the mysql-support-unreferenced-bit-columns branch from 77d857d to a6eaab4 Compare November 6, 2015 18:03
@javornikolov javornikolov force-pushed the mysql-support-unreferenced-bit-columns branch from a6eaab4 to ed28f02 Compare January 2, 2016 20:31
This is to be able to support e.g. updating table which contains BIT
column via dbfit Update or Insert fixture when the BIT column itself is
not referenced
@javornikolov javornikolov force-pushed the mysql-support-unreferenced-bit-columns branch from ed28f02 to f6bcf35 Compare January 3, 2016 09:44
javornikolov added a commit that referenced this pull request Jan 3, 2016
…umns

MySql: support for unreferenced BIT columns
@javornikolov javornikolov merged commit 0722c7c into master Jan 3, 2016
@javornikolov javornikolov deleted the mysql-support-unreferenced-bit-columns branch January 3, 2016 09:50
@javornikolov javornikolov added this to the 4.0.0 milestone Jan 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants