Skip to content

Ensure that CHECK's expressions are wrapped in parentheses#667

Merged
fnc12 merged 1 commit into
fnc12:masterfrom
Weyzu:master
Feb 16, 2021
Merged

Ensure that CHECK's expressions are wrapped in parentheses#667
fnc12 merged 1 commit into
fnc12:masterfrom
Weyzu:master

Conversation

@Weyzu
Copy link
Copy Markdown
Contributor

@Weyzu Weyzu commented Feb 13, 2021

An example table creation:

sqlite_orm::make_table(
	"user",
	sqlite_orm::make_column(
		"id",
		&core::entities::User::id,
		sqlite_orm::autoincrement(),
		sqlite_orm::primary_key()
	),
	sqlite_orm::make_column("main", &core::entities::User::is_main),
	sqlite_orm::check(sqlite_orm::in(&core::entities::User::is_main, {0, 1}))
)

Creates a CHECK statement which expression is not wrapped properly in parentheses, i.e.

CREATE TABLE 'user' ( 
	'id' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , 
	'main' INTEGER NOT NULL , 
	CHECK "main" IN (  0,  1 )
)

Proper CHECK syntax in this example would be CHECK ("main" IN ( 0, 1 )).

The following pull request makes a small change to fix this. As I'm not a regular here, the required change may be more sophisticated than what I'm proposing. Nevertheless, the fix should solve the issue for the mentioned case scenario.

@fnc12
Copy link
Copy Markdown
Owner

fnc12 commented Feb 14, 2021

@Weyzu thank you. Let's wait builds and if everything is ok with them I shall merge this PR

@fnc12 fnc12 merged commit 482c6dc into fnc12:master Feb 16, 2021
@fnc12
Copy link
Copy Markdown
Owner

fnc12 commented Feb 16, 2021

@Weyzu merged. Thank you. IDK why not all checks processed but it looks like ok to me.

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.

2 participants