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

Fix crashes caused by CREATE INDEX SQL commands upon DB update by add… #515

Merged
merged 1 commit into from
Nov 29, 2017

Conversation

lemonboston
Copy link
Contributor

…ing IF NOT EXISTS clause. #382


Steps to reproduce the crash:

  • clean install from master with TaskDatabaseHelper#DATABASE_VERSION = 15
    (may also need allowBackup=false in manifest)
  • add tasks
  • install update with version TaskDatabaseHelper#DATABASE_VERSION = 16

Doing the same with this branch should not result in a crash.

}
buffer.append("INDEX ");
buffer.append("INDEX IF NOT EXISTS");
Copy link
Owner

Choose a reason for hiding this comment

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

How can this work? This doesn't leave a space between "EXISTS" and the table name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, the commited version missed the space, the 'IF NOT EXIST ' append was in a separate line when I tested.
This is why the build failed as well. Fixed now.

buffer.append("INDEX ");
buffer.append(table).append("_").append(fields[0]).append("_idx ON ");
buffer.append("INDEX IF NOT EXISTS ");
buffer.append(table).append("_").append(fields[0]).append("_idx ON ");
Copy link
Owner

Choose a reason for hiding this comment

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

why the indentation now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've squashed-rebased now to fix this, please check again.

But finally it turned out what these look like identation changes are: the file has tabs instead of spaces and the IDE keeps them even though the code style uses spaces.

There is this settings:
screenshot from 2017-11-29 14-39-18

And this notification:
screenshot from 2017-11-29 14-41-20
(So in my commit those 2 lines were reformatted for some reason.)

I guess we could fix this in a separate ticket. Turn off that settings and re-format alll project files, to remove the tabs.

Copy link
Owner

@dmfs dmfs left a comment

Choose a reason for hiding this comment

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

Looks good now.

@dmfs dmfs merged commit 34ea288 into master Nov 29, 2017
@dmfs dmfs deleted the bugs/382-db-update branch November 29, 2017 18:45
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