New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql GEOMETRY bug #4953

Closed
zhfish opened this Issue Dec 1, 2015 · 3 comments

Comments

2 participants
@zhfish

zhfish commented Dec 1, 2015

https://github.com/sequelize/sequelize/blob/master/lib/dialects/mysql/data-types.js#L64

value.buffer() maybe is null

node_modules/mysql/lib/protocol/Parser.js:82
        throw err;
        ^

TypeError: Cannot read property 'slice' of null
    at Object.GEOMETRY.parse.GEOMETRY.parse [as GEOMETRY] 
users:
    ID: {
      type: 'CHAR(36)',
      allowNull: false,
      defaultValue: '',
      primaryKey: true
    },
    groupID: {
      type: type: 'CHAR(36)',
      allowNull: false
    },

groups:
    ID: {
      type: 'CHAR(36)',
      allowNull: false,
      defaultValue: '',
      primaryKey: true
    },
    location: {
      type: DataTypes.GEOMETRY,
      allowNull: false
    }

db.users.belongsTo(db.groups,{foreignKey:'groupID',targetKey:'ID'});

query

 let userInfo = yield db.users.findAll({
    include: [db.groups]
  });

I temporarily fix it

    value = value.buffer();
    if (value == null) {
      return null;
    }

    value = value.slice(4);
@zhfish

This comment has been minimized.

zhfish commented Dec 3, 2015

@janmeier

This comment has been minimized.

Member

janmeier commented Dec 3, 2015

Looks good, PR welcome

@zhfish

This comment has been minimized.

zhfish commented Dec 3, 2015

@janmeier
i don't know how to write the test case ...
so you can fix it just
thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment