Skip to content
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
Closed

mysql GEOMETRY bug #4953

zhfish opened this issue Dec 1, 2015 · 3 comments
Labels
dialect: mysql For issues and PRs. Things that involve MySQL (and do not involve all dialects). good first issue For issues. An issue that is a good choice for first-time contributors. type: bug

Comments

@zhfish
Copy link

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
Copy link
Author

zhfish commented Dec 3, 2015

@janmeier @mickhansen

@janmeier
Copy link
Member

janmeier commented Dec 3, 2015

Looks good, PR welcome

@janmeier janmeier added type: bug dialect: mysql For issues and PRs. Things that involve MySQL (and do not involve all dialects). good first issue For issues. An issue that is a good choice for first-time contributors. labels Dec 3, 2015
@zhfish
Copy link
Author

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
Labels
dialect: mysql For issues and PRs. Things that involve MySQL (and do not involve all dialects). good first issue For issues. An issue that is a good choice for first-time contributors. type: bug
Projects
None yet
Development

No branches or pull requests

2 participants