Skip to content
This repository has been archived by the owner on May 14, 2022. It is now read-only.

Commit

Permalink
Fixed the exception thrown when a table does not exist in showCreate …
Browse files Browse the repository at this point in the history
…function.
  • Loading branch information
Aviram Sterman committed Jan 14, 2014
1 parent 5b27181 commit 444d3fc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function describe(datastore, databaseName, callback) {
*/
function showCreate(datastore, table, callback) {
var parts = table.split('.');
if (parts.length != 2) {
if (parts.length !== 2) {
logger.error('Usage: r.showCreate(\'schemaname.tablename\')');
return;
}
Expand All @@ -105,6 +105,11 @@ function showCreate(datastore, table, callback) {
var diststyle = res[2];
var sortkeys = res[3];

if (columns.length === 0) {
logger.error('Table ' + table + ' does not exist.');
return;
}

var createQuery = 'CREATE TABLE ' + table + ' (' + '\n';
for (var i=0; i<columns.length; i++) {
createQuery += columns[i].col;
Expand Down

0 comments on commit 444d3fc

Please sign in to comment.