359-grn_output.diff

Nobuyoshi Nakada, 06/29/2010 04:28 pm

Download (2.5 kB)

 
w/lib/output.c
40 40
  case GRN_CONTENT_JSON:
41 41
    if (level < 2) { return; }
42 42
    GRN_TEXT_PUTC(ctx, outbuf, ((level & 3) == 3) ? ':' : ',');
43
    if (DEPTH == 1 && ((level & 3) != 3)) { GRN_TEXT_PUTC(ctx, outbuf, '\n'); }
43
    if (DEPTH == 1 && ((level & 3) == 1)) { GRN_TEXT_PUTC(ctx, outbuf, '\n'); }
44 44
    break;
45 45
  case GRN_CONTENT_XML:
46 46
    if (!DEPTH) { return; }
w/lib/proc.c
1542 1542
    if (i) { GRN_TEXT_PUTC(ctx, outbuf, ','); }
1543 1543
    GRN_BULK_REWIND(&column_name);
1544 1544
    grn_column_name_(ctx, column, &column_name);
1545
    grn_text_otoj(ctx, outbuf, &column_name, NULL);
1545
    grn_output_obj(ctx, outbuf, GRN_CONTENT_JSON, &column_name, NULL);
1546 1546
  }
1547 1547
  GRN_TEXT_PUTS(ctx, outbuf, "],\n");
1548 1548

  
......
1594 1594
              GRN_OBJ_KEY_VAR_SIZE) {
1595 1595
            GRN_OBJ_INIT(&buf, GRN_VECTOR, 0, range);
1596 1596
            grn_obj_get_value(ctx, column, id, &buf);
1597
            grn_text_otoj(ctx, outbuf, &buf, NULL);
1597
            grn_output_obj(ctx, outbuf, GRN_CONTENT_JSON, &buf, NULL);
1598 1598
            grn_obj_unlink(ctx, &buf);
1599 1599
          } else {
1600 1600
            GRN_OBJ_INIT(&buf, GRN_UVECTOR, 0, range);
1601 1601
            grn_obj_get_value(ctx, column, id, &buf);
1602
            grn_text_otoj(ctx, outbuf, &buf, NULL);
1602
            grn_output_obj(ctx, outbuf, GRN_CONTENT_JSON, &buf, NULL);
1603 1603
            grn_obj_unlink(ctx, &buf);
1604 1604
          }
1605 1605
          break;
......
1607 1607
          {
1608 1608
            GRN_OBJ_INIT(&buf, GRN_BULK, 0, range);
1609 1609
            grn_obj_get_value(ctx, column, id, &buf);
1610
            grn_text_otoj(ctx, outbuf, &buf, NULL);
1610
            grn_output_obj(ctx, outbuf, GRN_CONTENT_JSON, &buf, NULL);
1611 1611
            grn_obj_unlink(ctx, &buf);
1612 1612
          }
1613 1613
          break;
......
1628 1628
          if (is_value_column) {
1629 1629
            buf.header.domain = ((grn_db_obj *)table)->range;
1630 1630
          }
1631
          grn_text_otoj(ctx, outbuf, &buf, NULL);
1631
          grn_output_obj(ctx, outbuf, GRN_CONTENT_JSON, &buf, NULL);
1632 1632
          grn_obj_unlink(ctx, &buf);
1633 1633
        }
1634 1634
        break;