Merge pull request #54 from mapbox/finalize
Finalize prepared statement in zxystream
This commit is contained in:
+5
-2
@@ -57,7 +57,11 @@ ZXYStream.prototype._read = function() {
|
|||||||
if (error) {
|
if (error) {
|
||||||
stream.emit('error', error);
|
stream.emit('error', error);
|
||||||
} else {
|
} else {
|
||||||
stream.push(lines || null);
|
if (lines) stream.push(lines);
|
||||||
|
else {
|
||||||
|
stream.statement.finalize();
|
||||||
|
stream.push(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -68,4 +72,3 @@ function toLine(row) {
|
|||||||
var y = row.y = (1 << row.z) - 1 - row.y;
|
var y = row.y = (1 << row.z) - 1 - row.y;
|
||||||
return row.z + '/' + row.x + '/' + y + '\n';
|
return row.z + '/' + row.x + '/' + y + '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-2
@@ -41,6 +41,18 @@ tape('zxystream default batch', function(assert) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tape('zxystream: can close source', function(assert) {
|
||||||
|
new MBTiles(__dirname + '/fixtures/plain_1.mbtiles', function(err, src) {
|
||||||
|
assert.ifError(err);
|
||||||
|
src.createZXYStream()
|
||||||
|
.on('end', function() {
|
||||||
|
src.close(function(err) {
|
||||||
|
assert.ifError(err, 'can close source when zxystream is finished');
|
||||||
|
assert.end();
|
||||||
|
});
|
||||||
|
}).resume();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
tape('zxystream batch = 10', function(assert) {
|
tape('zxystream batch = 10', function(assert) {
|
||||||
var stream = source.createZXYStream({batch:10});
|
var stream = source.createZXYStream({batch:10});
|
||||||
@@ -133,5 +145,3 @@ tape('zxystream empty zxystream', function(assert) {
|
|||||||
assert.end();
|
assert.end();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user