なぜこれがうまくいかないのか、私にはよくわかりません。私のテーブルはシンプルで (当面はすべてを varchar に変更しました)、cqlsh を使用すれば INSERT を実行できます。
var Connection = require('cassandra-client').Connection;
var db = new Connection({host: 'cassbx01.qualcomm.com', port: 9160, keyspace: 'foursq'});
db.execute("INSERT INTO checkins (fqid, name, address, city, state, zip, country, lat, lng, hereNow) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
[value.id, value.name, value.location.address, value.location.city,
value.location.state, value.location.postalCode, value.location.country,
value.location.lat, value.location.lng, value.hereNow.count],
function (err) {
if (err || !saved) {
throw err;
}
});
実行すると、次のエラーが表示されます。
self.client.execute_cql_query(cql, ttypes.Compression.NONE, function(err,
^
TypeError: Cannot call method 'execute_cql_query' of null
at Connection.execute (/usr2/lsacco/nodejs/foursq-poc/node_modules/cassandra-client/lib/driver.js:407:17)
at exports.poller (/usr2/lsacco/nodejs/foursq-poc/controller/api.js:80:29)
at Array.forEach (native)
at Function._.each._.forEach (/usr2/lsacco/nodejs/foursq-poc/node_modules/underscore/underscore.js:76:11)
at IncomingMessage.exports.poller (/usr2/lsacco/nodejs/foursq-poc/controller/api.js:77:19)
at IncomingMessage.EventEmitter.emit (events.js:115:20)
at IncomingMessage._emitEnd (http.js:366:10)
at HTTPParser.parserOnMessageComplete [as onMessageComplete] (http.js:149:23)
at CleartextStream.socketOnData [as ondata] (http.js:1366:20)
at CleartextStream.CryptoStream._push (tls.js:495:27)