loopbackio / loopback-connector-oracle

Connect Loopback to Oracle
http://loopback.io/doc/en/lb3/Oracle-connector.html
Other
28 stars 30 forks source link

owner is ignored in discoverSchema #153

Closed vanceeasleaf closed 5 years ago

vanceeasleaf commented 6 years ago

in oracle.js

  Oracle.prototype.getArgs = function (table, options, cb) {
    if ('string' !== typeof table || !table) {
      throw new Error(g.f('{{table}} is a required string argument: %s', table));
    }
    options = options || {};
    if (!cb && 'function' === typeof options) {
      cb = options;
      options = {};
    }
    if (typeof options !== 'object') {
      throw new Error(g.f('{{options}} must be an {{object}}: %s', options));
    }
    return {
      owner: options.owner || options.schema,
      table: table,
      options: options,
      cb: cb,
    };
  };
Oracle.prototype.getDefaultSchema = function () {
    return '';
  };

in its super class

 SQLConnector.prototype.discoverModelProperties = function (table, options, cb) {
  var self = this;
  var args = self.getArgs(table, options, cb);
  var schema = args.schema;
  table = args.table;
  options = args.options;
  if (!schema) {
    schema = self.getDefaultSchema();
  }
  self.setDefaultOptions(options);
  cb = args.cb;
  var sql = self.buildQueryColumns(schema, table);
  var callback = function (err, results) {
    if (err) {
      cb(err, results);
    } else {
      results.map(function (r) {
        r.type = self.buildPropertyType(r, options);
        self.setNullableProperty(r);
      });
      cb(err, results);
    }
  };
  this.execute(sql, callback);
};

args.schema is undefined

so buildQueryColumns gets its first arg undefined

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.