On 12/06/2009 03:17 PM, tmortagne (SVN) wrote:
> Author: tmortagne
> Date: 2009-12-06 15:17:45 +0100 (Sun, 06 Dec 2009)
> New Revision: 25574
>
> Modified:
>
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/store/DatabaseProduct.java
>
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/store/XWikiHibernateStore.java
> Log:
> XWIKI-4076: Database for a newly created wiki does not support utf8
>
> Modified:
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/store/DatabaseProduct.java
> ===================================================================
> ---
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/store/DatabaseProduct.java
> 2009-12-06 14:04:05 UTC (rev 25573)
> +++
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/store/DatabaseProduct.java
> 2009-12-06 14:17:45 UTC (rev 25574)
> @@ -61,6 +61,11 @@
> public static final DatabaseProduct DB2 = new DatabaseProduct("DB2/");
>
> /**
> + * The product name for MySQL databases.
> + */
> + public static final DatabaseProduct MYSQL = new DatabaseProduct("MySQL");
> +
> + /**
> * Represents an unknown database for which we were not able to find
> the product name.
> */
> public static final DatabaseProduct UNKNOWN = new
> DatabaseProduct("Unknown");
> @@ -127,6 +132,8 @@
> } else if (productNameAsString.startsWith(DB2.getProductName())) {
> // See documentation above on why we check starts with for DB2
> product = DB2;
> + } else if
> (productNameAsString.equalsIgnoreCase(MYSQL.getProductName())) {
> + product = MYSQL;
> } else {
> product = UNKNOWN;
> }
>
> Modified:
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/store/XWikiHibernateStore.java
> ===================================================================
> ---
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/store/XWikiHibernateStore.java
> 2009-12-06 14:04:05 UTC (rev 25573)
> +++
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/store/XWikiHibernateStore.java
> 2009-12-06 14:17:45 UTC (rev 25574)
> @@ -241,6 +241,13 @@
> stmt.execute("CREATE SCHEMA " + schema + " AUTHORIZATION
> DBA");
> } else if (DatabaseProduct.DB2 == databaseProduct) {
> stmt.execute("CREATE SCHEMA " + schema);
> + } else if (DatabaseProduct.MYSQL == databaseProduct) {
> + // TODO: find a proper java lib to convert from java
> encoding to mysql charset name and collation
> + if (context.getWiki().getEncoding().equals("UTF-8")) {
> + stmt.execute("create database " + schema + " CHARACTER
> SET utf8 COLLATE utf8_bin");
utf8_bin also means that mysql becomes case sensitive.
> + } else {
> + stmt.execute("create database " + schema);
> + }
> } else {
> stmt.execute("create database " + schema);
> }
Q: Does this also affect the main database, or just virtual wikis?
--
Sergiu Dumitriu
http://purl.org/net/sergiu/
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs