Skip to content

fix xcode-10.2 issues #891

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

Merged
merged 5 commits into from
Mar 30, 2019
Merged

fix xcode-10.2 issues #891

merged 5 commits into from
Mar 30, 2019

Conversation

ottosuess
Copy link
Contributor

resolves #888

In Xcode 10.2 beta 4 the macro #function shows a different behaviour. As SQLite.swift relies on #function in different subroutines for the composition of SQLite queries, several bugs linked to invalid SQLite statements seem to be introduced.

I replaced all the #function magic by static strings.

Copy link

@tanzolone tanzolone left a comment

Choose a reason for hiding this comment

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

Good idea getting rid of the #function.
However I would suggest avoiding using multiple duplicated string literals all over the place (as they are harder to refactor and error prone). A form of mapping might be helpful here: e.g.

enum Function: String {
case count
case greaterThan = ">"
...
}

Copy link

@tanzolone tanzolone left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this, looks great! I have a couple of small suggestions.

@@ -24,6 +24,40 @@

import Foundation

private enum Functions: String {

Choose a reason for hiding this comment

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

enum name should be singular e.g. Function

Copy link
Collaborator

Choose a reason for hiding this comment

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

Updated

case trim
case replace
case substr
case LIKE
Copy link

@tanzolone tanzolone Mar 27, 2019

Choose a reason for hiding this comment

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

as a convention case name should be lower case - I'd personally change those (e.g. case like = "LIKE")

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yep. I think the common naming style is better. Updated.

@@ -24,266 +24,297 @@

// TODO: use `@warn_unused_result` by the time operator functions support it

private enum Operators: String {

Choose a reason for hiding this comment

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

Ditto, better singular Operator

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fixed.

@tanzolone
Copy link

This look good - could you kindly have a look at the failing CI checks?

@ypopovych
Copy link
Collaborator

ypopovych commented Mar 28, 2019 via email

@ypopovych
Copy link
Collaborator

@stephencelis What do you think? Can you merge it? The library doesn't work in Xcode 10.2 at all :(

@sznowicki
Copy link

Just wanted to thank you @ypopovych for this work.

Copy link
Owner

@stephencelis stephencelis left a comment

Choose a reason for hiding this comment

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

Thanks! Sorry for the delay. I'll also added you as a contributor if you'd like to help continue unblock these kinds of things in the future.

@stephencelis stephencelis merged commit 861ff28 into stephencelis:master Mar 30, 2019
@eschao
Copy link

eschao commented Mar 31, 2019

@here: After updated codes to latest, I still get unrecognized token: ":" error when count table. Is it really solved? Thanks!

@nickgzzjr
Copy link

@eschao The version in the podspec has not gotten bumped so your CocoaPods is probably caching the pod. You could clear your CocoaPods cache, you could point directly to this git repo, or you could wait until they bump the version. 😄 I had pointed to ottosuess's git repo and all the errors had gone away.

@wddwycc
Copy link

wddwycc commented Apr 1, 2019

@stephencelis could you please make a release for this PR ?

@eschao
Copy link

eschao commented Apr 1, 2019

@nickgzzjr No cocoapods, I use carthage, I deleted all including carthage checkout, carthage build and cache, and then updated again. but the problem is still existing. Any step I missed or made wrong?

@mitesh-iosdev
Copy link

@stephencelis could you please make a release for this PR ?

Please update ASAP if the issue is fixed.

@PatoSalazarNascent
Copy link

@stephencelis Did this update got released in a new version of the pod?? I just updated mine to 0.12.0 but I am still having the issue...

@tuchangwei
Copy link

tuchangwei commented May 16, 2019

@eschao The version in the podspec has not gotten bumped so your CocoaPods is probably caching the pod. You could clear your CocoaPods cache, you could point directly to this git repo, or you could wait until they bump the version. 😄 I had pointed to ottosuess's git repo and all the errors had gone away.

I pointed to ottosuess's git repo, but I still get the error:

created_at > date

use asSQL() function to convert to sql

"created_at" >(_:_:) 0.0

@ypopovych
Copy link
Collaborator

It should work from CocoaPods. 0.12.0

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.

Invalid SQL statements with Xcode 10.2