diff --git a/js/globals.js b/js/globals.js
index 29f62c5..46c7699 100644
--- a/js/globals.js
+++ b/js/globals.js
@@ -53,6 +53,10 @@ var SQL = {
unsubscribe: function(message, subscriber) {
var index = this._subscribers[message].indexOf(subscriber);
if (index > -1) { this._subscribers[message].splice(index, 1); }
+ },
+
+ escape: function(str) {
+ return str.replace(/&/g, "&").replace(/>/g, ">").replace(/"+d+"";
+ xml += ""+SQL.escape(d)+"";
}
for (var i=0;i/g, ">").replace(/"+escaped+"\n";
+ xml += ""+SQL.escape(this.data.comment)+"\n";
}
xml += "\n";
diff --git a/js/table.js b/js/table.js
index b72ce11..099881d 100644
--- a/js/table.js
+++ b/js/table.js
@@ -133,7 +133,7 @@ SQL.Table.prototype.addKey = function(name) {
return k;
}
-SQL.Table.prototype.removeKey = function(i) {
+SQL.Table.prototype.removeKey = function(k) {
var idx = this.keys.indexOf(k);
if (idx == -1) { return; }
k.destroy();
@@ -245,8 +245,7 @@ SQL.Table.prototype.toXML = function() {
}
var c = this.getComment();
if (c) {
- c = c.replace(/&/g, "&").replace(/>/g, ">").replace(/"+c+"\n";
+ xml += ""+SQL.escape(c)+"\n";
}
xml += "\n";
return xml;
@@ -294,19 +293,6 @@ SQL.Table.prototype.findNamedRow = function(n) { /* return row with a given name
return false;
}
-SQL.Table.prototype.addKey = function(type, name) {
- var i = new SQL.Key(this, type, name);
- this.keys.push(i);
- return i;
-}
-
-SQL.Table.prototype.removeKey = function(i) {
- var idx = this.keys.indexOf(i);
- if (idx == -1) { return; }
- i.destroy();
- this.keys.splice(idx,1);
-}
-
SQL.Table.prototype.setComment = function(c) {
this.data.comment = c;
this.dom.title.title = this.data.comment;