Skip to content

Some issues with Oracle DB #105

Open
@buchatsky

Description

@buchatsky
  1. sqltree.js: To accept CHAR(1) Oracle "boolean"
    toObject: function (row, result) {
    ...
    if (column.modelColumn.type === type.BOOLEAN && (val !== null)) {
    //val = !!val;
    val = [true, 1].indexOf(val) != -1 || (val.length > 0 && ['T', 't', 'Y', 'y', '1'].indexOf(val[0]) != -1);
    (probably, setter requires changes too, Delphi uses 'F' / 'T' in SetAsBoolean()
  2. driver.js: Oracle does not permit quoted columns in ORDER BY
    getSqlFromSqlTree: function(sqlTree) {
    ...
    //var orderByClause = this.escapeColumnName(orderBy.column.alias) + ' ';
    var orderByClause = orderBy.column.alias + ' ';
  3. model.js: to accept one-to-many relationship in both directions:
    Model.hasMany = function (associatedModel, opts) {
    ...
    if (opts.through) {
    ...
    } else if (opts.createHasOne) {
    var associatedOpts = {};
    associatedOpts.name = opts.hasOneName;
    associatedOpts.foreignKey = opts.foreignKey;
    associatedOpts = this.normalizeHasOneOptions(this, associatedOpts);
    associatedModel.hasOne(this, associatedOpts);
    }
    ...
    Model.hasOne = function (associatedModel, opts) {
    ...
    var foreignKeyPropertyName = inflection.camelize(opts.foreignKey, true);
    if (!this.columns[foreignKeyPropertyName] || !this.columns[foreignKeyPropertyName].foreignKey) {
    this.addColumn(foreignKeyPropertyName, { type: "int", foreignKey: true });
    }
    if (opts.createHasMany) {
        var associatedOpts = {};
        associatedOpts.name = opts.hasManyName;
        associatedOpts.foreignKey = opts.foreignKey;
        associatedOpts = this.normalizeHasManyOptions(this, associatedOpts);
        associatedModel.hasMany(this, associatedOpts);
    }

Good luck!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions