Skip to content

Commit 54b2e43

Browse files
committed
split font statements for better MySQL import
1 parent 0090066 commit 54b2e43

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ SAXON := saxonb-xslt
1818

1919
PYTHON := virtualenv/bin/python
2020

21-
FONTFORGE := fontforge
22-
2321
BSDTAR := bsdtar
2422

2523
MYSQL := mysql

bin/fonts_to_sql.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,18 @@ async function main() {
4848
}
4949
}
5050

51-
process.stdout.write('INSERT INTO codepoint_image ( cp, font, width, height, image ) VALUES\n');
52-
process.stdout.write(sql.join(',\n'));
53-
process.stdout.write(';');
51+
let buffer = [];
52+
while (sql.length) {
53+
buffer.push(sql.shift());
54+
if (buffer.length === 500 || !sql.length) {
55+
process.stdout.write('INSERT INTO codepoint_image ( cp, font, width, height, image ) VALUES\n');
56+
process.stdout.write(buffer.join(',\n'));
57+
process.stdout.write(';\n');
58+
if (buffer.length === 500) {
59+
buffer = [];
60+
}
61+
}
62+
}
5463
}
5564

5665
/**

0 commit comments

Comments
 (0)