Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

Commit

Permalink
Merge pull request #93 from doug-martin/master
Browse files Browse the repository at this point in the history
v0.2.15
  • Loading branch information
doug-martin committed Feb 10, 2014
2 parents 53430d8 + 58f9775 commit 72dc0e4
Show file tree
Hide file tree
Showing 23 changed files with 2,662 additions and 2,807 deletions.
5 changes: 5 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#v0.2.15

* Updated patio migrate to use an exit code of `1` if the migration fails. [#92](https://github.com/C2FO/patio/issues/92)
* Fixed the use of hashes in `andGrouped*` methods.

# v0.2.14

* Converted uses of `.then` to `.chain`
Expand Down
2 changes: 2 additions & 0 deletions bin/patio
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ program.command("migrate")
["directory", "uri"].forEach(function (arg) {
if (comb.isUndefined(program[arg])) {
self.missingArgument(arg);
process.exit(1);
}
});

Expand Down Expand Up @@ -61,6 +62,7 @@ program.command("migrate")
var disconnectError = function (err) {
patio.logError(err);
patio.disconnect();
process.exit(1);
};

var start = new Date();
Expand Down
2,257 changes: 1,125 additions & 1,132 deletions docs-md/coverage.html

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions docs/History.html
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,11 @@



<h1>v0.2.15</h1>
<ul>
<li>Updated patio migrate to use an exit code of <code>1</code> if the migration fails. <a href="https://github.com/C2FO/patio/issues/92">#92</a></li>
<li>Fixed the use of hashes in <code>andGrouped*</code> methods.</li>
</ul>
<h1>v0.2.14</h1>
<ul>
<li>Converted uses of <code>.then</code> to <code>.chain</code></li>
Expand Down
2,257 changes: 1,125 additions & 1,132 deletions docs/coverage.html

Large diffs are not rendered by default.

36 changes: 15 additions & 21 deletions docs/patio_Database.html
Original file line number Diff line number Diff line change
Expand Up @@ -6395,7 +6395,6 @@ <h3>
if (!isFunction(this.schemaParseTable)) {
throw new Error(&quot;Schema parsing is not implemented on this database&quot;);
}
var ret = new Promise();
opts = opts || {};
var schemaParts = this.__schemaAndTable(table);
var sch = schemaParts[0], tableName = schemaParts[1];
Expand All @@ -6404,26 +6403,21 @@ <h3>
if (opts.reload) {
delete this.schemas[quotedName];
}
if (this.schemas[quotedName]) {
ret = this.schemas[quotedName];
} else {
var self = this;
ret = this.schemas[quotedName] = this.schemaParseTable(tableName, opts).chain(function (cols) {
if (!cols || cols.length === 0) {
throw new Error(&quot;Error parsing schema, &quot; + table + &quot; no columns returns, table probably doesnt exist&quot;)
} else {
var schema = {};
cols.forEach(function (c) {
var name = c[0];
c = c[1];
c.jsDefault = self.__columnSchemaToJsDefault(c[&quot;default&quot;], c.type);
schema[name] = c;
});
return schema;
}
});
}
return ret.promise();
var self = this;
return this.schemaParseTable(tableName, opts).chain(function (cols) {
if (!cols || cols.length === 0) {
throw new Error(&quot;Error parsing schema, &quot; + table + &quot; no columns returns, table probably doesnt exist&quot;)
} else {
var schema = {};
cols.forEach(function (c) {
var name = c[0];
c = c[1];
c.jsDefault = self.__columnSchemaToJsDefault(c[&quot;default&quot;], c.type);
schema[name] = c;
});
return schema;
}
});

}
</pre>
Expand Down
48 changes: 24 additions & 24 deletions docs/patio_Dataset.html
Original file line number Diff line number Diff line change
Expand Up @@ -3689,7 +3689,7 @@ <h3>
throw new QueryError(&quot;Between requires an array for the value&quot;);
}
}
var ret = pairs.length == 1 ? pairs[0] : BooleanExpression.fromArgs([&quot;AND&quot;].concat(pairs))
var ret = pairs.length === 1 ? pairs[0] : BooleanExpression.fromArgs([&quot;AND&quot;].concat(pairs));
return invert ? BooleanExpression.invert(ret) : ret;

}
Expand Down Expand Up @@ -3760,7 +3760,7 @@ <h3>
pairs.push(new BooleanExpression(op, new Identifier(pair[0]), pair[1]));
});
}
return pairs.length == 1 ? pairs[0] : BooleanExpression.fromArgs([&quot;AND&quot;].concat(pairs));
return pairs.length === 1 ? pairs[0] : BooleanExpression.fromArgs([&quot;AND&quot;].concat(pairs));

}
</pre>
Expand Down Expand Up @@ -4025,7 +4025,7 @@ <h3>
clause = (tOpts.having ? &quot;having&quot; : &quot;where&quot;),
clauseObj = tOpts[clause];
var args = argsToArray(arguments, 2);
args = args.length == 1 ? args[0] : args;
args = args.length === 1 ? args[0] : args;
var opts = {};
if (clauseObj) {
addedByBool = isUndefined(addedByBool) ? &quot;AND&quot; : addedByBool;
Expand Down Expand Up @@ -4253,8 +4253,8 @@ <h3>
if (cond.length &amp;&amp; isFunction(cond[cond.length - 1])) {
cb = cond.pop();
}
cond = cond.length == 1 ? cond[0] : cond
if ((cond == null || cond == undefined || cond === &quot;&quot;) || (isArray(cond) &amp;&amp; cond.length == 0 &amp;&amp; !cb) || (isObject(cond) &amp;&amp; isEmpty(cond) &amp;&amp; !cb)) {
cond = cond.length === 1 ? cond[0] : cond;
if ((cond == null || cond === undefined || cond === &quot;&quot;) || (isArray(cond) &amp;&amp; cond.length === 0 &amp;&amp; !cb) || (isObject(cond) &amp;&amp; isEmpty(cond) &amp;&amp; !cb)) {
return this.mergeOptions();
} else {
cond = this._filterExpr(cond, cb);
Expand Down Expand Up @@ -4309,9 +4309,9 @@ <h3>
function (expr,cb,joinCond){
expr = (isUndefined(expr) || isNull(expr) || (isArray(expr) &amp;&amp; !expr.length)) ? null : expr;
if (expr &amp;&amp; cb) {
return new BooleanExpression(joinCond || &quot;AND&quot;, this._filterExpr(expr, null, joinCond), this._filterExpr(cb, null, joinCond))
return new BooleanExpression(joinCond || &quot;AND&quot;, this._filterExpr(expr, null, joinCond), this._filterExpr(cb, null, joinCond));
} else if (cb) {
expr = cb
expr = cb;
}
if (isInstanceOf(expr, Expression)) {
if (isInstanceOf(expr, NumericExpression, StringExpression)) {
Expand All @@ -4324,7 +4324,7 @@ <h3>
if (isString(first)) {
return new PlaceHolderLiteralString(first, expr.slice(1), true);
} else if (Expression.isConditionSpecifier(expr)) {
return BooleanExpression.fromValuePairs(expr, joinCond)
return BooleanExpression.fromValuePairs(expr, joinCond);
} else {
return BooleanExpression.fromArgs([joinCond || &quot;AND&quot;].concat(expr.map(function (e) {
return this._filterExpr(e, null, joinCond);
Expand Down Expand Up @@ -7875,7 +7875,7 @@ <h3>
cond = this._filterExpr.call(this, cond);
cond = BooleanExpression.invert(cond);
if (clauseObj) {
cond = new BooleanExpression(&quot;AND&quot;, clauseObj, cond)
cond = new BooleanExpression(&quot;AND&quot;, clauseObj, cond);
}
var opts = {};
opts[clause] = cond;
Expand Down Expand Up @@ -8541,16 +8541,16 @@ <h3>
sources.push(new AliasedExpression(new Identifier(i), s[i]));
}
} else if (isString(s)) {
sources.push(this.stringToIdentifier(s))
sources.push(this.stringToIdentifier(s));
} else {
sources.push(s);
}
}, this);
var o = {from: sources.length ? sources : null}
var o = {from: sources.length ? sources : null};
if (tableAliasNum) {
o.numDatasetSources = tableAliasNum;
}
return this.mergeOptions(o)
return this.mergeOptions(o);

}
</pre>
Expand Down Expand Up @@ -8622,7 +8622,7 @@ <h3>
var fs = {};
var nonSqlOptions = this._static.NON_SQL_OPTIONS;
Object.keys(this.__opts).forEach(function (k) {
if (nonSqlOptions.indexOf(k) == -1) {
if (nonSqlOptions.indexOf(k) === -1) {
fs[k] = null;
}
});
Expand Down Expand Up @@ -9244,7 +9244,7 @@ <h3>
function (columns){
columns = argsToArray(arguments);
var self = this;
return this.mergeOptions({group: (array.compact(columns).length == 0 ? null : columns.map(function (c) {
return this.mergeOptions({group: (array.compact(columns).length === 0 ? null : columns.map(function (c) {
return isString(c) ? self.stringToIdentifier(c) : c;
}))});

Expand Down Expand Up @@ -9529,7 +9529,7 @@ <h3>
<pre class="prettyprint linenums lang-js">
function (){
var cond = argsToArray(arguments).map(function (s) {
return isString(s) &amp;&amp; s !== &#x27;&#x27; ? this.stringToIdentifier(s) : s
return isString(s) &amp;&amp; s !== &#x27;&#x27; ? this.stringToIdentifier(s) : s;
}, this);
return this._filter.apply(this, [&quot;having&quot;].concat(cond));

Expand Down Expand Up @@ -10240,7 +10240,7 @@ <h3>
if (!(having || where)) {
throw new QueryError(&quot;No current filter&quot;);
}
var o = {}
var o = {};
if (having) {
o.having = BooleanExpression.invert(having);
}
Expand Down Expand Up @@ -11093,7 +11093,7 @@ <h3>
expr = isUndefined(expr) ? null : expr, options = isUndefined(options) ? {} : options;
var h;
var usingJoin = isArray(expr) &amp;&amp; expr.length &amp;&amp; expr.every(function (x) {
return isString(x) || isInstanceOf(x, Identifier)
return isString(x) || isInstanceOf(x, Identifier);
});
if (usingJoin &amp;&amp; !this.supportsJoinUsing) {
h = {};
Expand Down Expand Up @@ -11128,7 +11128,7 @@ <h3>
} else {
table = isString(table) ? this.stringToIdentifier(table) : table;
var parts = this._splitAlias(table), implicitTableAlias = parts[1];
table = parts[0]
table = parts[0];
tableAlias = tableAlias || implicitTableAlias;
tableName = tableAlias || table;
}
Expand All @@ -11147,7 +11147,7 @@ <h3>
var newExpr = [];
for (var i in expr) {
var val = expr[i];
if (isArray(val) &amp;&amp; val.length == 2) {
if (isArray(val) &amp;&amp; val.length === 2) {
i = val[0], val = val[1];
}
var k = this.qualifiedColumnName(i, tableName), v;
Expand Down Expand Up @@ -11400,7 +11400,7 @@ <h3>
if (this.__opts.sql) {
return this.fromSelf().limit(limit, offset);
}
if (isArray(limit) &amp;&amp; limit.length == 2) {
if (isArray(limit) &amp;&amp; limit.length === 2) {
offset = limit[0];
limit = limit[1] - limit[0] + 1;
}
Expand Down Expand Up @@ -12484,7 +12484,7 @@ <h3>
var clause = (tOpts.having ? &quot;having&quot; : &quot;where&quot;), clauseObj = tOpts[clause];
if (clauseObj) {
var args = argsToArray(arguments);
args = args.length == 1 ? args[0] : args;
args = args.length === 1 ? args[0] : args;
var opts = {};
opts[clause] = new BooleanExpression(&quot;OR&quot;, clauseObj, this._filterExpr(args));
return this.mergeOptions(opts);
Expand Down Expand Up @@ -12565,7 +12565,7 @@ <h3>
return this.or.apply(this, arguments);
} else {
var args = argsToArray(arguments);
args = args.length == 1 ? args[0] : args;
args = args.length === 1 ? args[0] : args;
var opts = {};
opts[clause] = this._filterExpr(args, null, &quot;AND&quot;);
return this.mergeOptions(opts);
Expand Down Expand Up @@ -16078,7 +16078,7 @@ <h3>
throw new QueryError(&quot;This dataset does not support common table expressions&quot;);
}
opts = opts || {};
var wit = (this.__opts[&quot;with&quot;] || []).concat([merge(opts, {recursive: true, name: this.stringToIdentifier(name), dataset: nonRecursive.union(recursive, {all: opts.unionAll != false, fromSelf: false})})]);
var wit = (this.__opts[&quot;with&quot;] || []).concat([merge(opts, {recursive: true, name: this.stringToIdentifier(name), dataset: nonRecursive.union(recursive, {all: opts.unionAll !== false, fromSelf: false})})]);
return this.mergeOptions({&quot;with&quot;: wit});

}
Expand Down Expand Up @@ -16141,7 +16141,7 @@ <h3>
function (sql){
var args = argsToArray(arguments).slice(1);
if (args.length) {
sql = new PlaceHolderLiteralString(sql, args)
sql = new PlaceHolderLiteralString(sql, args);
}
return this.mergeOptions({sql: sql});

Expand Down
Loading

0 comments on commit 72dc0e4

Please sign in to comment.