当前位置: 首页>>代码示例>>Java>>正文


Java ColumnDefinitions.toString方法代码示例

本文整理汇总了Java中com.datastax.driver.core.ColumnDefinitions.toString方法的典型用法代码示例。如果您正苦于以下问题:Java ColumnDefinitions.toString方法的具体用法?Java ColumnDefinitions.toString怎么用?Java ColumnDefinitions.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.datastax.driver.core.ColumnDefinitions的用法示例。


在下文中一共展示了ColumnDefinitions.toString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertResultSet

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
private String convertResultSet(ResultSet rs) {
    // TODO Auto-generated method stub
    String colStr = "";
    String rowStr = "";
    JsonObject response = new JsonObject();
    List<Row> rows = rs.all();
    if (!rows.isEmpty() && rows.size() == 1) {
        rowStr = rows.get(0).toString();
    }
    ColumnDefinitions colDefs = rs.getColumnDefinitions();
    colStr = colDefs.toString();
    response.putString("columns", colStr.substring(8, colStr.length() - 1));
    response.putString("values", rowStr.substring(4, rowStr.length() - 1));
    return response.toString();

}
 
开发者ID:Netflix,项目名称:staash,代码行数:17,代码来源:CqlMetaDaoImpl.java

示例2: convertResultSet

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
private String convertResultSet(ResultSet rs) {
    // TODO Auto-generated method stub
    String colStr = "";
    String rowStr = "";
    JsonObject response = new JsonObject();
    List<Row> rows = rs.all();
    if (!rows.isEmpty() && rows.size() == 1) {
        rowStr = rows.get(0).toString();
    }
    ColumnDefinitions colDefs = rs.getColumnDefinitions();
    colStr = colDefs.toString();
    response.putString("columns", colStr.substring(8, colStr.length() - 1));
    response.putString("values", rowStr.substring(4, rowStr.length() - 1));
    return response.toString();
}
 
开发者ID:Netflix,项目名称:staash,代码行数:16,代码来源:CqlDataDaoImpl.java

示例3: formatQueryResult

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
public static String formatQueryResult(com.datastax.driver.core.ResultSet rs) {
    // TODO Auto-generated method stub
    String colStr = "";
    String rowStr = "";
    JsonObject response = new JsonObject();
    List<Row> rows = rs.all();
    if (!rows.isEmpty() && rows.size() == 1) {
        rowStr = rows.get(0).toString();
    }
    ColumnDefinitions colDefs = rs.getColumnDefinitions();
    colStr = colDefs.toString();
    response.putString("columns", colStr.substring(8, colStr.length() - 1));
    response.putString("values", rowStr.substring(4, rowStr.length() - 1));
    return response.toString();
}
 
开发者ID:Netflix,项目名称:staash,代码行数:16,代码来源:QueryUtils.java

示例4: convertResultSet

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
private String convertResultSet(ResultSet rs) {
        // TODO Auto-generated method stub
        String colStr = "";
        String rowStr = "";
        JsonObject response = new JsonObject();
        List<Row> rows = rs.all();
        if (!rows.isEmpty() && rows.size()==1) {
            rowStr = rows.get(0).toString();
        }
        ColumnDefinitions colDefs = rs.getColumnDefinitions();
        colStr = colDefs.toString();
        response.putString("columns", colStr.substring(8,colStr.length()-1));
        response.putString("values", rowStr.substring(4,rowStr.length()-1));
        return response.toString();
        
//        for (Row ro:rows) {
//            Print(ro.toString());
////            ro.getColumnDefinitions()
//        }
//        return null;
//        if (rm.kind == ResultMessage.Kind.ROWS) {
//          //ToDo maybe processInternal
//          boolean bSwitch = true;
//          if (bSwitch) {
//            ResultMessage.Rows cqlRows = (ResultMessage.Rows) rm;
//            List<ColumnSpecification> columnSpecs = cqlRows.result.metadata.names;
//
//            for (List<ByteBuffer> row : cqlRows.result.rows) {
//              Map<String,Object> map = new HashMap<String,Object>();
//              int i = 0;
//              for (ByteBuffer bytes : row) {
//                ColumnSpecification specs = columnSpecs.get(i++);
//                if (specs.name!=null && specs.type!=null && bytes!=null && bytes.hasRemaining()) {
//                System.out.println("name = "+specs.name.toString()+" ,type= "+specs.type.compose(bytes));
//                map.put(specs.name.toString(), specs.type.compose(bytes));
//                }
//              }
//              returnRows.add(map);
//            }
//          } else {
//            boolean convert = true;;
//            CqlResult result = rm.toThriftResult();
//            List<CqlRow> rows = result.getRows();
//            for (CqlRow row: rows) {
//              List<org.apache.cassandra.thrift.Column> columns = row.getColumns();
//              for (org.apache.cassandra.thrift.Column c: columns){
//                HashMap<String,Object> m = new HashMap<String,Object>();
//                if (convert) {
//                  m.put("name" , TypeHelper.getCqlTyped(result.schema.name_types.get(c.name), c.name) );
//                  m.put("value" , TypeHelper.getCqlTyped(result.schema.name_types.get(c.name), c.value) );
//                } else {
//                  m.put("value", TypeHelper.getBytes(c.value));
//                  m.put("name", TypeHelper.getBytes(c.name));
//                }
//                returnRows.add(m);
//              }
//            }
//          }
//        }
//        JsonObject response = new JsonObject();
//        JsonArray array = new JsonArray();
//        for (Map<String,Object> m : returnRows) {
//          array.add(new JsonObject(m));
//        }
//        response.putString(Long.toString(counter.incrementAndGet()), "OK");
//        response.putArray(Long.toString(counter.incrementAndGet()), array);
//        String testQry = "CREATE KEYSPACE testdb WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor': 1};";
////        create("testdb",1);
//        return response.toString();
//        return null;
//    }
    }
 
开发者ID:Netflix,项目名称:staash,代码行数:73,代码来源:CqlMetaDaoImpl.java


注:本文中的com.datastax.driver.core.ColumnDefinitions.toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。