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

Fixed MySQL database backend/Region_Storage.sql files for new installations, converts db automatically for old installations #197

Closed
wants to merge 1 commit into from

Conversation

Nach0z
Copy link

@Nach0z Nach0z commented Mar 12, 2012

Fixed the MySQL backend to actually store the correct flags in the mysql db.
Most important for anything that wasn't a State flag or a String flag, i.e. feed-max-health, or price, etc etc etc.
Automatically detects if the mySQL region_flags table is in the correct format; if not,it tries to parse as many flags as it can and update the table to the new format.. If it is, it adds any flags as a byte array from an object output stream, i.e. no more issues with the "Couldn't parse flag" etc etc for non-State or -String flags.

Next up: a WorldGuard command to convert the old table format to the new table format. /wg fixtables, etc etc.
Should pull in old flags, parse the data correctly, and add it to the new table format.

@@ -65,7 +65,7 @@ CREATE TABLE IF NOT EXISTS `region_flag` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`region_id` VARCHAR(128) NOT NULL ,
`flag` VARCHAR(64) NOT NULL ,
`value` VARCHAR(256) NOT NULL ,
Copy link
Author

Choose a reason for hiding this comment

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

This just changes the MySQL table format from a VARCHAR to a BLOB which is basically a byte array as far as Java is concerned.

Fixed region_storage.sql and mysql backend for new installations; old installations being prepped for conversion to new MySQL format.

fixed formatting and tabs

More work on formatting/indentations

more work on indentations and general formatting. I will get this code pulled one way or another...

More formatting/indentation work. THIS. WILL. GET. PULLED.

Updated "InvalidStreamHeader" exception code, correctly parses doubles from the database now

Trying to squash commits.

Added an auto-converter for MySQL installations. Attempts to recover flags that may have been irrecoverable on worldguard reload. Recovers ALL previously functional flags. Allows MySQL to contain ALL region flags correctly.

Fixed some formatting.
@@ -112,6 +120,59 @@ public MySQLDatabase(ConfigurationManager config, String world, Logger logger) t
}
}

private void convertTables() {
Copy link
Author

Choose a reason for hiding this comment

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

This method is an automatic converter for the MySQL tables. There is no reason whatsoever that previous MySQL installations should be allowed to remain on the old format. It doesn't store many flags on a server reload. This update code will automatically recover more flags than the current worldguard setup will even allow to be parsed on server reload, such as Double and Integer flags.
It can't recover ALL the flags, but it does NOT drop any flags that work under the current mysql setup, and it DOES recover more flags than would be present on a reload.
It leaves the old region_flag table in legacy_flag as a backup.
This is run AUTOMATICALLY if the code detects that the current region_flag table is NOT the new region_flag format.

@narthollis
Copy link
Contributor

This looks like a good addition to me. I really overlooked flags when I wrote the original code (I made a very poor assumption that they were all being serialized correctly)

@zml2008
Copy link
Collaborator

zml2008 commented Mar 28, 2012

This should be updated for any fixes it has that are still relevant after @narthollis 's changes

@Nach0z
Copy link
Author

Nach0z commented Mar 28, 2012

it'll be updated. have narthollis's updates gone through yet?

@narthollis
Copy link
Contributor

Yes, about 2 minutes ago :)

@Nach0z
Copy link
Author

Nach0z commented Mar 28, 2012

coo'. I'll get cracking then. Gotta j0b to focus on as of last friday so it may take a day or two to get stuff fully re-haxx'd

@zml2008
Copy link
Collaborator

zml2008 commented Sep 16, 2012

Doesn't look like this has been updated for 6 months, closing.

@zml2008 zml2008 closed this Sep 16, 2012
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.

None yet

3 participants