null+****@clear*****
null+****@clear*****
2012年 8月 3日 (金) 14:51:51 JST
SHIMODA Hiroshi 2012-08-03 14:51:51 +0900 (Fri, 03 Aug 2012) New Revision: b1782616df510035e60e2eb34859fba699d31420 https://github.com/groonga/gcs/commit/b1782616df510035e60e2eb34859fba699d31420 Log: Move toTableNamePart to the class Domain itself and define new class method toDonamName Modified files: lib/database/domain.js Modified: lib/database/domain.js (+11 -7) =================================================================== --- lib/database/domain.js 2012-08-03 14:48:51 +0900 (2b3196a) +++ lib/database/domain.js 2012-08-03 14:51:51 +0900 (669092f) @@ -106,7 +106,7 @@ Domain.prototype = { }, getIdFromDatabase: function() { if (this.context) { - var tableName = this.toTableNamePart(this.name); + var tableName = Domain.toTableNamePart(this.name); var tables = this.context.tableListSync(); var tableIdMatcher = new RegExp('^' + DOMAIN_TABLE_PREFIX + '_' + tableName + '_([^_]+)$'); var id; @@ -137,18 +137,15 @@ Domain.prototype = { if (!this._tableName) { assertValidDomainName(this.name); this._tableName = DOMAIN_TABLE_PREFIX + '_' + - this.toTableNamePart(this.name) + '_' + this.id; + Domain.toTableNamePart(this.name) + '_' + this.id; } return this._tableName; }, - toTableNamePart: function(string) { - return string; - }, get referenceTableBaseName() { if (!this._referenceTableBaseName) this._referenceTableBaseName = REFERENCE_TABLE_PREFIX + '_' + - this.toTableNamePart(this.name) + '_' + this.id; + Domain.toTableNamePart(this.name) + '_' + this.id; return this._referenceTableBaseName; }, @@ -321,6 +318,13 @@ Domain.getNameAndIdFromPath = function(path) { return { name: '', id: '' }; }; +Domain.toTableNamePart = function(domainName) { + return domainName; +}; +Domain.toDonamName = function(tableNamePart) { + return tableNamePart; +}; + Domain.getAll = function(context) { var tables = context.tableListSync(); var tableMatcher = new RegExp('^' + DOMAIN_TABLE_PREFIX + '_([^_]+)_([^_]+)$'); @@ -328,7 +332,7 @@ Domain.getAll = function(context) { tables.forEach(function(table) { var match = table.name.match(tableMatcher); if (match) { - var name = match[1]; // XXX this must be "unescape"d in the future. + var name = Domain.toDonamName(match[1]); domains.push(new Domain(name, context)); } }); -------------- next part -------------- HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...Download