[Groonga-commit] groonga/gcs [master] Calculate table names correctly

Back to archive index

null+****@clear***** null+****@clear*****
2012年 8月 3日 (金) 14:34:38 JST


SHIMODA Hiroshi	2012-08-03 14:34:38 +0900 (Fri, 03 Aug 2012)

  New Revision: 701f07f1f2e30c7d16875000b0172b2f2bf50504
  https://github.com/groonga/gcs/commit/701f07f1f2e30c7d16875000b0172b2f2bf50504

  Log:
    Calculate table names correctly

  Modified files:
    lib/database/domain.js
    lib/database/index-field.js

  Modified: lib/database/domain.js (+10 -8)
===================================================================
--- lib/database/domain.js    2012-08-03 14:32:05 +0900 (4706c08)
+++ lib/database/domain.js    2012-08-03 14:34:38 +0900 (e87d434)
@@ -145,18 +145,19 @@ Domain.prototype = {
     return string;
   },
 
+  get referenceTableBaseName() {
+    if (!this._referenceTableBaseName)
+      this._referenceTableBaseName = REFERENCE_TABLE_PREFIX + '_' +
+                             this.toTableNamePart(this.name);
+    return this._referenceTableBaseName;
+  },
+
   get termsTableName() {
-    if (!this._termsTableName)
-      this._termsTableName = REFERENCE_TABLE_PREFIX + '_' +
-                             this.toTableNamePart(this.name) + '_BigramTerms';
-    return this._termsTableName;
+    return this.referenceTableBaseName + '_BigramTerms';
   },
 
   get synonymTableName() {
-    if (!this._synonymTableName)
-      this._synonymTableName = REFERENCE_TABLE_PREFIX + '_' +
-                               this.toTableNamePart(this.name) + '_synonyms';
-    return this._synonymTableName;
+    return this.referenceTableBaseName + '_synonyms';
   },
 
   getIndexField: function(field) {
@@ -185,6 +186,7 @@ Domain.prototype = {
     this._id = value;
     // clear caches
     delete this._tableName;
+    delete this._referenceTableBaseName;
     delete this._termsTableName;
     delete this._synonymTableName;
     return value;

  Modified: lib/database/index-field.js (+2 -2)
===================================================================
--- lib/database/index-field.js    2012-08-03 14:32:05 +0900 (4845532)
+++ lib/database/index-field.js    2012-08-03 14:34:38 +0900 (bb8d8cd)
@@ -62,12 +62,12 @@ IndexField.prototype = {
   },
   get indexColumnName() {
     if (!this._indexColumnName)
-      this._indexColumnName = this.domain.tableName + '_' + this.columnName;
+      this._indexColumnName = this.domain.referenceTableBaseName + '_' + this.columnName;
     return this._indexColumnName;
   },
   get referenceTableName() {
     if (!this._referenceTableName)
-      this._referenceTableName = this.domain.tableName + '_' + this.columnName;
+      this._referenceTableName = this.domain.referenceTableBaseName + '_' + this.columnName;
     return this._referenceTableName;
   },
   get referenceTableKeyType() {
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
下載 



Groonga-commit メーリングリストの案内
Back to archive index