2014-11-14 52 views
1

我使用this驅動程序作爲cassandra和我的節點js應用程序之間的橋樑。一切似乎到現在工作得很好,除了以下問題:cassandra節點驅動程序不接受破折號分隔字符串

問題 我有varchar類型的列,當我將它有破折號的字符串 - 在它然後卡桑德拉拋出錯誤String didn't validate.()。

我使用批處理語句這就好比以下

var queryset_insert_user = { 
    query: query_insert_user, 
    params: query_insert_user_params, 
    hints:[ dataTypes.varchar, dataTypes.varchar, dataTypes.varchar, dataTypes.varchar, 
    dataTypes.varchar, dataTypes.varchar, dataTypes.varchar] 
} 

其中VARCHAR是

var dataTypes = {}; 
dataTypes.varchar = 0x000d; //couldn't find how to get this from API itself so just copied value from types.js of cassandra driver. 

批量語句是

var batchQueries = [queryset_insert_iidMetadata, queryset_insert_user]; 
client.batch(batchQueries,__queryOptions(), function(err, result){ 
     // getting err here... 
}); 

輸入參數:

query2 params are = ["4fde84c173232d25641db25ba1b0","+0012255446633",["1415957771074"],"CGFnzVSuGwkOrVI","NEW","+001","53a985bd-bc28-3768-a1ea-e366409cb996"] 

注意 我試圖使用提示,當我看到this問題。

如何解決此錯誤

回答

2

在DataStax Node.js的驅動程序卡桑德拉,參數提示傳遞的查詢選項:

//queries with the parameters 
var queries = [queryset_insert_iidMetadata, queryset_insert_user]; 
//parameter hints are passed with the rest of the queryOptions 
client.batch(queries, {hints: [hintForIidMeta, hintForUser]}, callback); 
相關問題