src/java/org/apache/cassandra/cli/CliClient.java
/**
     * Writes the supplied ColumnDef to the StringBuilder as a cli script.
     * @param sb
     * @param cfDef
     * @param colDef
     */
Writes the supplied ColumnDef to the StringBuilder as a cli script.
Writes the supplied ColumnDef to the StringBuilder as a cli script .
private void showColumnMeta(StringBuilder sb, CfDef cfDef, ColumnDef colDef)
    {
        sb.append(NEWLINE + TAB + TAB + "{");
        final AbstractType comparator = getFormatType(cfDef.column_type.equals("Super")
                                                      ? cfDef.subcomparator_type
                                                      : cfDef.comparator_type);
        sb.append("column_name : '" + CliUtils.escapeSQLString(comparator.getString(colDef.name)) + "'," + NEWLINE);
        String validationClass = normaliseType(colDef.validation_class, "org.apache.cassandra.db.marshal");
        sb.append(TAB + TAB + "validation_class : " + CliUtils.escapeSQLString(validationClass));
        if (colDef.isSetIndex_name())
        {
            sb.append("," + NEWLINE);
            sb.append(TAB + TAB + "index_name : '" + CliUtils.escapeSQLString(colDef.index_name) + "'," + NEWLINE);
            sb.append(TAB + TAB + "index_type : " + CliUtils.escapeSQLString(Integer.toString(colDef.index_type.getValue())));
            if (colDef.index_options != null)
            {
                sb.append("," + NEWLINE);
                sb.append(TAB + TAB + "index_options : {" + NEWLINE);
                int numOpts = colDef.index_options.size();
                for (Map.Entry<String, String> entry : colDef.index_options.entrySet())
                {
                    sb.append(TAB + TAB + TAB + CliUtils.escapeSQLString(entry.getKey()) + ": '" + CliUtils.escapeSQLString(entry.getValue()) + "'");
                    if (--numOpts > 0)
                        sb.append("," + NEWLINE);
                }
                sb.append("}");
            }
        }
        sb.append("}");
    }
private void showColumnMeta ( StringBuilder sb , CfDef cfDef , ColumnDef colDef ) { sb . append ( NEWLINE + TAB + TAB + "{" ) ; final AbstractType comparator = getFormatType ( cfDef . column_type . equals ( "Super" ) ? cfDef . subcomparator_type : cfDef . comparator_type ) ; sb . append ( "column_name : '" + CliUtils . escapeSQLString ( comparator . getString ( colDef . name ) ) + "'," + NEWLINE ) ; String validationClass = normaliseType ( colDef . validation_class , "org.apache.cassandra.db.marshal" ) ; sb . append ( TAB + TAB + "validation_class : " + CliUtils . escapeSQLString ( validationClass ) ) ; if ( colDef . isSetIndex_name ( ) ) { sb . append ( "," + NEWLINE ) ; sb . append ( TAB + TAB + "index_name : '" + CliUtils . escapeSQLString ( colDef . index_name ) + "'," + NEWLINE ) ; sb . append ( TAB + TAB + "index_type : " + CliUtils . escapeSQLString ( Integer . toString ( colDef . index_type . getValue ( ) ) ) ) ; if ( colDef . index_options != null ) { sb . append ( "," + NEWLINE ) ; sb . append ( TAB + TAB + "index_options : {" + NEWLINE ) ; int numOpts = colDef . index_options . size ( ) ; for ( Map . Entry < String , String > entry : colDef . index_options . entrySet ( ) ) { sb . append ( TAB + TAB + TAB + CliUtils . escapeSQLString ( entry . getKey ( ) ) + ": '" + CliUtils . escapeSQLString ( entry . getValue ( ) ) + "'" ) ; if ( -- numOpts > 0 ) sb . append ( "," + NEWLINE ) ; } sb . append ( "}" ) ; } } sb . append ( "}" ) ; }
Writes the supplied ColumnDef to the StringBuilder as a cli script.
Writes the supplied ColumnDef to the StringBuilder as a cli script .