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
|
||||
```
|
||||
|
||||
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
|
||||
there.
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
"host": "localhost",
|
||||
"port": 3306,
|
||||
"user": "zongji",
|
||||
"password": "password"
|
||||
"password": "password",
|
||||
"database": "util"
|
||||
},
|
||||
"includeEvents": [
|
||||
"tablemap",
|
||||
|
|
12
index.js
12
index.js
|
@ -65,7 +65,7 @@ async function main() {
|
|||
};
|
||||
|
||||
const [res] = await db.query(
|
||||
'SELECT `logName`, `position` FROM `util`.`binlogQueue` WHERE code = ?',
|
||||
'SELECT `logName`, `position` FROM `binlogQueue` WHERE code = ?',
|
||||
[config.queue]
|
||||
);
|
||||
if (res.length) {
|
||||
|
@ -98,7 +98,7 @@ async function flushQueue() {
|
|||
for (const fk of fks) ids.push([fk]);
|
||||
await db.query(config.addQuery, [ids]);
|
||||
await db.query(
|
||||
'REPLACE INTO `util`.`binlogQueue` (`code`, `logName`, `position`) VALUES (?, ?, ?)',
|
||||
'REPLACE INTO `binlogQueue` (`code`, `logName`, `position`) VALUES (?, ?, ?)',
|
||||
[config.queue, filename, nextPosition]
|
||||
);
|
||||
fks.clear();
|
||||
|
@ -108,10 +108,12 @@ function equals(a, b) {
|
|||
if (a === b)
|
||||
return true;
|
||||
const type = typeof a;
|
||||
if (type !== typeof b)
|
||||
if (a == null || b == null || type !== typeof b)
|
||||
return false;
|
||||
if (type == 'object' && a instanceof Date)
|
||||
return a.getTime() === b.getTime();
|
||||
if (type === 'object' && a.constructor === b.constructor) {
|
||||
if (a instanceof Date)
|
||||
return a.getTime() === b.getTime();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue