{"action":"created","comment":{"url":"https://api.github.com/repos/sequelize/sequelize/pulls/comments/238055065","pull_request_review_id":180514975,"id":238055065,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzODA1NTA2NQ==","diff_hunk":"@@ -0,0 +1,358 @@\n+'use strict';\n+\n+const Utils = require('../../utils');\n+const logger = require('../../utils/logger');\n+const debug = logger.getLogger().debugContext('sql:mariadb');\n+const AbstractQuery = require('../abstract/query');\n+const uuidv4 = require('uuid/v4');\n+const sequelizeErrors = require('../../errors');\n+const _ = require('lodash');\n+const DataTypes = require('../../data-types');\n+\n+const ER_DUP_ENTRY = 1062;\n+const ER_ROW_IS_REFERENCED = 1451;\n+const ER_NO_REFERENCED_ROW = 1452;\n+\n+class Query extends AbstractQuery {\n+  constructor(connection, sequelize, options) {\n+    super();\n+    this.connection = connection;\n+    this.instance = options.instance;\n+    this.model = options.model;\n+    this.sequelize = sequelize;\n+    this.uuid = uuidv4();\n+    this.options = Object.assign({\n+      logging: console.log,\n+      plain: false,\n+      raw: false,\n+      showWarnings: false\n+    }, options || {});\n+\n+    this.checkLoggingOption();\n+  }\n+\n+  static formatBindParameters(sql, values, dialect) {\n+    const bindParam = [];\n+    const replacementFunc = (match, key, val) => {\n+      if (val[key] !== undefined) {\n+        bindParam.push(val[key]);\n+        return '?';\n+      }\n+      return undefined;\n+    };\n+    sql = AbstractQuery.formatBindParameters(sql, values, dialect,\n+      replacementFunc)[0];\n+    return [sql, bindParam.length > 0 ? bindParam : undefined];\n+  }\n+\n+  run(sql, parameters) {\n+    this.sql = sql;\n+\n+    //do we need benchmark for this query execution\n+    const benchmark = this.sequelize.options.benchmark\n+      || this.options.benchmark;\n+    const showWarnings = this.sequelize.options.showWarnings\n+      || this.options.showWarnings;\n+\n+    let queryBegin;\n+    if (benchmark) {\n+      queryBegin = Date.now();\n+    } else {\n+      this.sequelize.log(\n+        `Executing (${this.connection.uuid || 'default'}): ${this.sql}`,\n+        this.options);\n+    }\n+\n+    debug(`executing(${this.connection.uuid || 'default'}) : ${this.sql}`);\n+\n+    if (parameters) {\n+      debug('parameters(%j)', parameters);\n+    }\n+    return new Utils.Promise((resolve, reject) => {\n+      this.connection.query(this.sql, parameters)\n+        .then(results => {\n+          debug(\n+            `executed(${this.connection.uuid || 'default'}) : ${this.sql}`);\n+\n+          if (benchmark) {\n+            this.sequelize.log(\n+              `Executed (${this.connection.uuid || 'default'}): ${this.sql}`,\n+              Date.now() - queryBegin, this.options);\n+          }\n+\n+          // Log warnings if we've got them.\n+          if (showWarnings && results && results.warningStatus > 0) {\n+            resolve(this.logWarnings(results));\n+            return;\n+          }\n+          resolve(results);\n+        })\n+        .catch(err => {\n+          debug(","path":"lib/dialects/mariadb/query.js","position":91,"original_position":91,"commit_id":"7fe7cd101c27c4b7e4108f96409120094f43b356","original_commit_id":"7f3e7428c53e1af7fa812808706230431fdc8170","user":{"login":"sushantdhiman","id":9989487,"node_id":"MDQ6VXNlcjk5ODk0ODc=","avatar_url":"https://avatars1.githubusercontent.com/u/9989487?v=4","gravatar_id":"","url":"https://api.github.com/users/sushantdhiman","html_url":"https://github.com/sushantdhiman","followers_url":"https://api.github.com/users/sushantdhiman/followers","following_url":"https://api.github.com/users/sushantdhiman/following{/other_user}","gists_url":"https://api.github.com/users/sushantdhiman/gists{/gist_id}","starred_url":"https://api.github.com/users/sushantdhiman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sushantdhiman/subscriptions","organizations_url":"https://api.github.com/users/sushantdhiman/orgs","repos_url":"https://api.github.com/users/sushantdhiman/repos","events_url":"https://api.github.com/users/sushantdhiman/events{/privacy}","received_events_url":"https://api.github.com/users/sushantdhiman/received_events","type":"User","site_admin":false},"body":"No keep this format","created_at":"2018-12-01T07:04:00Z","updated_at":"2018-12-01T07:04:00Z","html_url":"https://github.com/sequelize/sequelize/pull/10192#discussion_r238055065","pull_request_url":"https://api.github.com/repos/sequelize/sequelize/pulls/10192","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/comments/238055065"},"html":{"href":"https://github.com/sequelize/sequelize/pull/10192#discussion_r238055065"},"pull_request":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/10192"}},"in_reply_to_id":237555978},"pull_request":{"url":"https://api.github.com/repos/sequelize/sequelize/pulls/10192","id":233040492,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMzMDQwNDky","html_url":"https://github.com/sequelize/sequelize/pull/10192","diff_url":"https://github.com/sequelize/sequelize/pull/10192.diff","patch_url":"https://github.com/sequelize/sequelize/pull/10192.patch","issue_url":"https://api.github.com/repos/sequelize/sequelize/issues/10192","number":10192,"state":"open","locked":false,"title":"feat(mariadb): implementation for MariaDB","user":{"login":"rusher","id":618074,"node_id":"MDQ6VXNlcjYxODA3NA==","avatar_url":"https://avatars2.githubusercontent.com/u/618074?v=4","gravatar_id":"","url":"https://api.github.com/users/rusher","html_url":"https://github.com/rusher","followers_url":"https://api.github.com/users/rusher/followers","following_url":"https://api.github.com/users/rusher/following{/other_user}","gists_url":"https://api.github.com/users/rusher/gists{/gist_id}","starred_url":"https://api.github.com/users/rusher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rusher/subscriptions","organizations_url":"https://api.github.com/users/rusher/orgs","repos_url":"https://api.github.com/users/rusher/repos","events_url":"https://api.github.com/users/rusher/events{/privacy}","received_events_url":"https://api.github.com/users/rusher/received_events","type":"User","site_admin":false},"body":"### Pull Request check-list\r\n\r\n_Please make sure to review and check all of these items:_\r\n\r\n- [x] Does `npm run test` or `npm run test-DIALECT` pass with this change (including linting)?\r\n- [x] Have you added new tests to prevent regressions?\r\n- [ ] Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?\r\n- [x] Did you follow the commit message conventions explained in [CONTRIBUTING.md](https://github.com/sequelize/sequelize/blob/master/CONTRIBUTING.md)?\r\n\r\n### Description of change\r\n\r\nImplementation of MariaDB. \r\nThis differs from MySQL mostly for 3 things:\r\n- the driver is different ([mariadb](https://github.com/MariaDB/mariadb-connector-nodejs)\r\n- use of schema\r\n- MariaDB JSON implementation differ from MySQL\r\n\r\nBreaking change is the use of schemas. MySQL/MariaDB have schemas, but no \"default\" public schema. \r\nCurrent implementation for MySQL will create a table with name `mySchema_myTable`, using schema, that is `mySchema`.`myTable`.\r\nI haven't corrected that for MySQL since it will break every existing application, but for new MariaDB implementation, it seems appropriate to use a better base with real schemas. \r\n\r\nTests have been updated accordingly (defaut method that drop all schemas is replace to keep default schema that is needed for MariaDB)\r\n \r\n  \r\n\r\n\r\n\r\n\r\n\r\n","created_at":"2018-11-22T17:02:57Z","updated_at":"2018-12-01T07:04:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a3f8415257920875ce51bb0e897a9f8eccfba73a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/sequelize/sequelize/pulls/10192/commits","review_comments_url":"https://api.github.com/repos/sequelize/sequelize/pulls/10192/comments","review_comment_url":"https://api.github.com/repos/sequelize/sequelize/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/10192/comments","statuses_url":"https://api.github.com/repos/sequelize/sequelize/statuses/7fe7cd101c27c4b7e4108f96409120094f43b356","head":{"label":"rusher:master","ref":"master","sha":"7fe7cd101c27c4b7e4108f96409120094f43b356","user":{"login":"rusher","id":618074,"node_id":"MDQ6VXNlcjYxODA3NA==","avatar_url":"https://avatars2.githubusercontent.com/u/618074?v=4","gravatar_id":"","url":"https://api.github.com/users/rusher","html_url":"https://github.com/rusher","followers_url":"https://api.github.com/users/rusher/followers","following_url":"https://api.github.com/users/rusher/following{/other_user}","gists_url":"https://api.github.com/users/rusher/gists{/gist_id}","starred_url":"https://api.github.com/users/rusher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rusher/subscriptions","organizations_url":"https://api.github.com/users/rusher/orgs","repos_url":"https://api.github.com/users/rusher/repos","events_url":"https://api.github.com/users/rusher/events{/privacy}","received_events_url":"https://api.github.com/users/rusher/received_events","type":"User","site_admin":false},"repo":{"id":158726487,"node_id":"MDEwOlJlcG9zaXRvcnkxNTg3MjY0ODc=","name":"sequelize","full_name":"rusher/sequelize","private":false,"owner":{"login":"rusher","id":618074,"node_id":"MDQ6VXNlcjYxODA3NA==","avatar_url":"https://avatars2.githubusercontent.com/u/618074?v=4","gravatar_id":"","url":"https://api.github.com/users/rusher","html_url":"https://github.com/rusher","followers_url":"https://api.github.com/users/rusher/followers","following_url":"https://api.github.com/users/rusher/following{/other_user}","gists_url":"https://api.github.com/users/rusher/gists{/gist_id}","starred_url":"https://api.github.com/users/rusher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rusher/subscriptions","organizations_url":"https://api.github.com/users/rusher/orgs","repos_url":"https://api.github.com/users/rusher/repos","events_url":"https://api.github.com/users/rusher/events{/privacy}","received_events_url":"https://api.github.com/users/rusher/received_events","type":"User","site_admin":false},"html_url":"https://github.com/rusher/sequelize","description":"An easy-to-use multi SQL dialect ORM for Node.js","fork":true,"url":"https://api.github.com/repos/rusher/sequelize","forks_url":"https://api.github.com/repos/rusher/sequelize/forks","keys_url":"https://api.github.com/repos/rusher/sequelize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rusher/sequelize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rusher/sequelize/teams","hooks_url":"https://api.github.com/repos/rusher/sequelize/hooks","issue_events_url":"https://api.github.com/repos/rusher/sequelize/issues/events{/number}","events_url":"https://api.github.com/repos/rusher/sequelize/events","assignees_url":"https://api.github.com/repos/rusher/sequelize/assignees{/user}","branches_url":"https://api.github.com/repos/rusher/sequelize/branches{/branch}","tags_url":"https://api.github.com/repos/rusher/sequelize/tags","blobs_url":"https://api.github.com/repos/rusher/sequelize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rusher/sequelize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rusher/sequelize/git/refs{/sha}","trees_url":"https://api.github.com/repos/rusher/sequelize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rusher/sequelize/statuses/{sha}","languages_url":"https://api.github.com/repos/rusher/sequelize/languages","stargazers_url":"https://api.github.com/repos/rusher/sequelize/stargazers","contributors_url":"https://api.github.com/repos/rusher/sequelize/contributors","subscribers_url":"https://api.github.com/repos/rusher/sequelize/subscribers","subscription_url":"https://api.github.com/repos/rusher/sequelize/subscription","commits_url":"https://api.github.com/repos/rusher/sequelize/commits{/sha}","git_commits_url":"https://api.github.com/repos/rusher/sequelize/git/commits{/sha}","comments_url":"https://api.github.com/repos/rusher/sequelize/comments{/number}","issue_comment_url":"https://api.github.com/repos/rusher/sequelize/issues/comments{/number}","contents_url":"https://api.github.com/repos/rusher/sequelize/contents/{+path}","compare_url":"https://api.github.com/repos/rusher/sequelize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rusher/sequelize/merges","archive_url":"https://api.github.com/repos/rusher/sequelize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rusher/sequelize/downloads","issues_url":"https://api.github.com/repos/rusher/sequelize/issues{/number}","pulls_url":"https://api.github.com/repos/rusher/sequelize/pulls{/number}","milestones_url":"https://api.github.com/repos/rusher/sequelize/milestones{/number}","notifications_url":"https://api.github.com/repos/rusher/sequelize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rusher/sequelize/labels{/name}","releases_url":"https://api.github.com/repos/rusher/sequelize/releases{/id}","deployments_url":"https://api.github.com/repos/rusher/sequelize/deployments","created_at":"2018-11-22T16:33:56Z","updated_at":"2018-11-30T17:06:22Z","pushed_at":"2018-11-30T17:06:18Z","git_url":"git://github.com/rusher/sequelize.git","ssh_url":"git@github.com:rusher/sequelize.git","clone_url":"https://github.com/rusher/sequelize.git","svn_url":"https://github.com/rusher/sequelize","homepage":"http://docs.sequelizejs.com","size":23996,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"sequelize:master","ref":"master","sha":"f2cafcc4b4a2b7500ff672ebdf527f338ee20bb4","user":{"login":"sequelize","id":3591786,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1OTE3ODY=","avatar_url":"https://avatars0.githubusercontent.com/u/3591786?v=4","gravatar_id":"","url":"https://api.github.com/users/sequelize","html_url":"https://github.com/sequelize","followers_url":"https://api.github.com/users/sequelize/followers","following_url":"https://api.github.com/users/sequelize/following{/other_user}","gists_url":"https://api.github.com/users/sequelize/gists{/gist_id}","starred_url":"https://api.github.com/users/sequelize/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sequelize/subscriptions","organizations_url":"https://api.github.com/users/sequelize/orgs","repos_url":"https://api.github.com/users/sequelize/repos","events_url":"https://api.github.com/users/sequelize/events{/privacy}","received_events_url":"https://api.github.com/users/sequelize/received_events","type":"Organization","site_admin":false},"repo":{"id":790359,"node_id":"MDEwOlJlcG9zaXRvcnk3OTAzNTk=","name":"sequelize","full_name":"sequelize/sequelize","private":false,"owner":{"login":"sequelize","id":3591786,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1OTE3ODY=","avatar_url":"https://avatars0.githubusercontent.com/u/3591786?v=4","gravatar_id":"","url":"https://api.github.com/users/sequelize","html_url":"https://github.com/sequelize","followers_url":"https://api.github.com/users/sequelize/followers","following_url":"https://api.github.com/users/sequelize/following{/other_user}","gists_url":"https://api.github.com/users/sequelize/gists{/gist_id}","starred_url":"https://api.github.com/users/sequelize/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sequelize/subscriptions","organizations_url":"https://api.github.com/users/sequelize/orgs","repos_url":"https://api.github.com/users/sequelize/repos","events_url":"https://api.github.com/users/sequelize/events{/privacy}","received_events_url":"https://api.github.com/users/sequelize/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/sequelize/sequelize","description":"An easy-to-use multi SQL dialect ORM for Node.js","fork":false,"url":"https://api.github.com/repos/sequelize/sequelize","forks_url":"https://api.github.com/repos/sequelize/sequelize/forks","keys_url":"https://api.github.com/repos/sequelize/sequelize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sequelize/sequelize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sequelize/sequelize/teams","hooks_url":"https://api.github.com/repos/sequelize/sequelize/hooks","issue_events_url":"https://api.github.com/repos/sequelize/sequelize/issues/events{/number}","events_url":"https://api.github.com/repos/sequelize/sequelize/events","assignees_url":"https://api.github.com/repos/sequelize/sequelize/assignees{/user}","branches_url":"https://api.github.com/repos/sequelize/sequelize/branches{/branch}","tags_url":"https://api.github.com/repos/sequelize/sequelize/tags","blobs_url":"https://api.github.com/repos/sequelize/sequelize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sequelize/sequelize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sequelize/sequelize/git/refs{/sha}","trees_url":"https://api.github.com/repos/sequelize/sequelize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sequelize/sequelize/statuses/{sha}","languages_url":"https://api.github.com/repos/sequelize/sequelize/languages","stargazers_url":"https://api.github.com/repos/sequelize/sequelize/stargazers","contributors_url":"https://api.github.com/repos/sequelize/sequelize/contributors","subscribers_url":"https://api.github.com/repos/sequelize/sequelize/subscribers","subscription_url":"https://api.github.com/repos/sequelize/sequelize/subscription","commits_url":"https://api.github.com/repos/sequelize/sequelize/commits{/sha}","git_commits_url":"https://api.github.com/repos/sequelize/sequelize/git/commits{/sha}","comments_url":"https://api.github.com/repos/sequelize/sequelize/comments{/number}","issue_comment_url":"https://api.github.com/repos/sequelize/sequelize/issues/comments{/number}","contents_url":"https://api.github.com/repos/sequelize/sequelize/contents/{+path}","compare_url":"https://api.github.com/repos/sequelize/sequelize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sequelize/sequelize/merges","archive_url":"https://api.github.com/repos/sequelize/sequelize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sequelize/sequelize/downloads","issues_url":"https://api.github.com/repos/sequelize/sequelize/issues{/number}","pulls_url":"https://api.github.com/repos/sequelize/sequelize/pulls{/number}","milestones_url":"https://api.github.com/repos/sequelize/sequelize/milestones{/number}","notifications_url":"https://api.github.com/repos/sequelize/sequelize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sequelize/sequelize/labels{/name}","releases_url":"https://api.github.com/repos/sequelize/sequelize/releases{/id}","deployments_url":"https://api.github.com/repos/sequelize/sequelize/deployments","created_at":"2010-07-22T07:11:11Z","updated_at":"2018-12-01T06:50:54Z","pushed_at":"2018-11-30T17:06:21Z","git_url":"git://github.com/sequelize/sequelize.git","ssh_url":"git@github.com:sequelize/sequelize.git","clone_url":"https://github.com/sequelize/sequelize.git","svn_url":"https://github.com/sequelize/sequelize","homepage":"http://docs.sequelizejs.com","size":23891,"stargazers_count":16676,"watchers_count":16676,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2700,"mirror_url":null,"archived":false,"open_issues_count":350,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":2700,"open_issues":350,"watchers":16676,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/10192"},"html":{"href":"https://github.com/sequelize/sequelize/pull/10192"},"issue":{"href":"https://api.github.com/repos/sequelize/sequelize/issues/10192"},"comments":{"href":"https://api.github.com/repos/sequelize/sequelize/issues/10192/comments"},"review_comments":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/10192/comments"},"review_comment":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/10192/commits"},"statuses":{"href":"https://api.github.com/repos/sequelize/sequelize/statuses/7fe7cd101c27c4b7e4108f96409120094f43b356"}},"author_association":"NONE"}}
{"actor":{"display_login":"sushantdhiman"}}