[seam-commits] Seam SVN: r10396 - in trunk/examples/wiki: src/main/org/jboss/seam/wiki/util and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Apr 14 10:42:50 EDT 2009


Author: christian.bauer at jboss.com
Date: 2009-04-14 10:42:50 -0400 (Tue, 14 Apr 2009)
New Revision: 10396

Modified:
   trunk/examples/wiki/README.txt
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiMySQL5HibernateDialect.java
Log:
JBSEAM-4086, migrate sfwk.org production database to UTF, enable by default

Modified: trunk/examples/wiki/README.txt
===================================================================
--- trunk/examples/wiki/README.txt	2009-04-14 14:38:48 UTC (rev 10395)
+++ trunk/examples/wiki/README.txt	2009-04-14 14:42:50 UTC (rev 10396)
@@ -85,37 +85,15 @@
 INSTALLATION WITH UNICODE SUPPORT ON MYSQL
 ==========================================================================================
 
-If you want to use any non-latin characters, create the MySQL database you want to use (or
-drop and recreate the default 'test' database) with the following options:
+The database tables in wiki-ddl.sql are automatically created with UTF8 support.
 
-      CREATE DATABASE test CHARACTER SET utf8 COLLATE utf8_general_ci;
-
-Your database should at least have the 'character_set_database' variable set to 'utf8':
-
-  mysql> show variables like '%character%';
-  +--------------------------+------------------------------------------------------------+
-  | Variable_name            | Value                                                      |
-  +--------------------------+------------------------------------------------------------+
-  | character_set_client     | latin1                                                     |
-  | character_set_connection | latin1                                                     |
-  | character_set_database   | utf8                                                       |
-  | character_set_filesystem | binary                                                     |
-  | character_set_results    | latin1                                                     |
-  | character_set_server     | latin1                                                     |
-  | character_set_system     | utf8                                                       |
-  | character_sets_dir       | /usr/local/mysql-5.0.45-osx10.4-i686/share/mysql/charsets/ |
-  +--------------------------+------------------------------------------------------------+
-
-If you keep the default latin1 encoding, exceptions will be thrown by the application as
-soon as you try to store any non-latin character.
-
 Note that due to URL rewriting rules, stored wiki items (documents, uploaded files) MUST have
 at least three latin1 characters in their name! The application will prompt you with a validation
 error message when you forget that limitation and enter only non-latin1 characters in a form.
 
-The wiki search engine passes search terms as request parameters in the URI. If you require
-unicode support for search terms, you need to set an option in Tomcat to enable the correct
-decoding of URL-encoded request parameter values to UTF-8. To do that, edit
+Furthermore, the wiki search engine passes search terms as request parameters in the URI and allows bookmarking
+of search terms. If you  require unicode support for search terms, you need to set an option in Tomcat to
+enable the correct decoding of URL-encoded request parameter values to UTF-8. To do that, edit
 
   ${JBOSS_HOME}/server/(default)/deploy/jboss-web.deployer/server.xml
 
@@ -125,4 +103,3 @@
 
 to the <connector> declaration.
 
-

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiMySQL5HibernateDialect.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiMySQL5HibernateDialect.java	2009-04-14 14:38:48 UTC (rev 10395)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiMySQL5HibernateDialect.java	2009-04-14 14:42:50 UTC (rev 10396)
@@ -17,15 +17,25 @@
  */
 public class WikiMySQL5HibernateDialect extends MySQL5InnoDBDialect {
 
-	protected void registerVarcharTypes() {
-		registerColumnType( Types.VARCHAR, "longtext" );
-		registerColumnType( Types.VARCHAR, 16777215, "mediumtext" );
+    @Override
+    protected void registerVarcharTypes() {
 
+        // TODO: The MySQL default makes it difficult to migrate the data because mysqldump is braindead...
+        // registerColumnType(Types.BIT, "tinyint(1)");
+
         // It's pretty safe to assume that anything with more than 1024 characters (minus length byte) should probably be
         // a TEXT, not a VARCHAR which would have the "maximum row size" limit of 65KB.
         // I mean, where is the limit? If you have 20 of these VARCHAR fields on a table, and your character set is
         // UTF8, you are over the limit. Less than 20 or so should be OK. Just another fine example of how MySQL
         // protects its users from seeing its ugly internal implementation details.
-        registerColumnType( Types.VARCHAR, 1023, "varchar($l)" );
-	}
+        registerColumnType(Types.VARCHAR, "longtext");
+        registerColumnType(Types.VARCHAR, 16777215, "mediumtext");
+        registerColumnType(Types.VARCHAR, 1023, "varchar($l)");
+    }
+
+    // Create all tables as default UTF8!
+    @Override
+    public String getTableTypeString() {
+        return " ENGINE=InnoDB DEFAULT CHARSET=utf8";
+    }
 }




More information about the seam-commits mailing list