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

Fixing #966 #1555

Merged
merged 2 commits into from
Dec 14, 2016
Merged

Fixing #966 #1555

merged 2 commits into from
Dec 14, 2016

Conversation

tminglei
Copy link
Contributor

@tminglei tminglei commented Jul 9, 2016

This patch is trying to fix #966 by including Table.primary(..) defined primary keys when generating upsert sql.

It's not perfect. As the comment said, it remained a derby related issue.

Pls review and give your suggestions.

Thanks!

protected lazy val (pkSyms, softSyms) = syms.toSeq.partition(_.options.contains(ColumnOption.PrimaryKey))
/* NOTE: pk defined by using method `primaryKey` and pk defined with `PrimaryKey` can only have one,
here we let table ddl to help us ensure this. */
private lazy val funcDefinedPKs = table.profileTable.asInstanceOf[Table[_]].primaryKeys
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is asInstanceOf[Table[_]] needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because table.profileTable was declared as Any.

@cvogt
Copy link
Member

cvogt commented Jul 9, 2016

Apart from the comment I like it :). Great work.

@easel
Copy link
Contributor

easel commented Nov 29, 2016

I'm curious on the status of this. I was going to try it out with my codebase, but since it's based on 3.2 and won't trivially backport to 3.1 I'm bailing out of that.

Is the remaining issue the derby issue?

@cvogt cvogt added this to the 3.2.0 milestone Dec 5, 2016
@mallyvai
Copy link

Curious about the state of this as well. We used this patch / fork to get around the insertOrUpdate bug. If it's not an issue anymore would love to not need to special-case this.

@cvogt
Copy link
Member

cvogt commented Dec 13, 2016

I am ok with merging this. @szeiger @tminglei ?

@tminglei
Copy link
Contributor Author

@cvogt I'd like to merge it in.

@cvogt
Copy link
Member

cvogt commented Dec 14, 2016

LGTM. Go ahead, merge :).

@tminglei tminglei merged commit 47d1db0 into slick:master Dec 14, 2016
@tminglei
Copy link
Contributor Author

Merged.

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

Successfully merging this pull request may close these issues.

Scala's Slick with multiple PK insertOrUpdate() throws exception ERROR: syntax error at end of input
4 participants