equals(): value comparison fix, set default schema, doc fix
This commit is contained in:
parent
bf3d49ea95
commit
b220a37f15
|
@ -11,7 +11,7 @@ cd zongji
|
||||||
git checkout fix-143
|
git checkout fix-143
|
||||||
```
|
```
|
||||||
|
|
||||||
Apply SQL commands from *zongji.sql* into DB.
|
Apply *zongji.sql* script into DB.
|
||||||
|
|
||||||
Copy *config.json* to *config.local.json* and place your local configuration
|
Copy *config.json* to *config.local.json* and place your local configuration
|
||||||
there.
|
there.
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
"host": "localhost",
|
"host": "localhost",
|
||||||
"port": 3306,
|
"port": 3306,
|
||||||
"user": "zongji",
|
"user": "zongji",
|
||||||
"password": "password"
|
"password": "password",
|
||||||
|
"database": "util"
|
||||||
},
|
},
|
||||||
"includeEvents": [
|
"includeEvents": [
|
||||||
"tablemap",
|
"tablemap",
|
||||||
|
|
12
index.js
12
index.js
|
@ -65,7 +65,7 @@ async function main() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const [res] = await db.query(
|
const [res] = await db.query(
|
||||||
'SELECT `logName`, `position` FROM `util`.`binlogQueue` WHERE code = ?',
|
'SELECT `logName`, `position` FROM `binlogQueue` WHERE code = ?',
|
||||||
[config.queue]
|
[config.queue]
|
||||||
);
|
);
|
||||||
if (res.length) {
|
if (res.length) {
|
||||||
|
@ -98,7 +98,7 @@ async function flushQueue() {
|
||||||
for (const fk of fks) ids.push([fk]);
|
for (const fk of fks) ids.push([fk]);
|
||||||
await db.query(config.addQuery, [ids]);
|
await db.query(config.addQuery, [ids]);
|
||||||
await db.query(
|
await db.query(
|
||||||
'REPLACE INTO `util`.`binlogQueue` (`code`, `logName`, `position`) VALUES (?, ?, ?)',
|
'REPLACE INTO `binlogQueue` (`code`, `logName`, `position`) VALUES (?, ?, ?)',
|
||||||
[config.queue, filename, nextPosition]
|
[config.queue, filename, nextPosition]
|
||||||
);
|
);
|
||||||
fks.clear();
|
fks.clear();
|
||||||
|
@ -108,10 +108,12 @@ function equals(a, b) {
|
||||||
if (a === b)
|
if (a === b)
|
||||||
return true;
|
return true;
|
||||||
const type = typeof a;
|
const type = typeof a;
|
||||||
if (type !== typeof b)
|
if (a == null || b == null || type !== typeof b)
|
||||||
return false;
|
return false;
|
||||||
if (type == 'object' && a instanceof Date)
|
if (type === 'object' && a.constructor === b.constructor) {
|
||||||
return a.getTime() === b.getTime();
|
if (a instanceof Date)
|
||||||
|
return a.getTime() === b.getTime();
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue