|
8 | 8 | * |
9 | 9 | * |
10 | 10 | * IDENTIFICATION |
11 | | - * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.276 2007/02/20 17:32:13 tgl Exp $ |
| 11 | + * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.277 2007/03/03 19:32:54 neilc Exp $ |
12 | 12 | * |
13 | 13 | *------------------------------------------------------------------------- |
14 | 14 | */ |
@@ -466,9 +466,7 @@ CopySendEndOfRow(CopyState cstate) |
466 | 466 | break; |
467 | 467 | } |
468 | 468 |
|
469 | | - /* Reset fe_msgbuf to empty */ |
470 | | - fe_msgbuf->len = 0; |
471 | | - fe_msgbuf->data[0] = '\0'; |
| 469 | + resetStringInfo(fe_msgbuf); |
472 | 470 | } |
473 | 471 |
|
474 | 472 | /* |
@@ -2193,9 +2191,7 @@ CopyReadLine(CopyState cstate) |
2193 | 2191 | { |
2194 | 2192 | bool result; |
2195 | 2193 |
|
2196 | | - /* Reset line_buf to empty */ |
2197 | | - cstate->line_buf.len = 0; |
2198 | | - cstate->line_buf.data[0] = '\0'; |
| 2194 | + resetStringInfo(&cstate->line_buf); |
2199 | 2195 |
|
2200 | 2196 | /* Mark that encoding conversion hasn't occurred yet */ |
2201 | 2197 | cstate->line_buf_converted = false; |
@@ -2262,8 +2258,7 @@ CopyReadLine(CopyState cstate) |
2262 | 2258 | if (cvt != cstate->line_buf.data) |
2263 | 2259 | { |
2264 | 2260 | /* transfer converted data back to line_buf */ |
2265 | | - cstate->line_buf.len = 0; |
2266 | | - cstate->line_buf.data[0] = '\0'; |
| 2261 | + resetStringInfo(&cstate->line_buf); |
2267 | 2262 | appendBinaryStringInfo(&cstate->line_buf, cvt, strlen(cvt)); |
2268 | 2263 | pfree(cvt); |
2269 | 2264 | } |
@@ -2686,9 +2681,7 @@ CopyReadAttributesText(CopyState cstate, int maxfields, char **fieldvals) |
2686 | 2681 | return 0; |
2687 | 2682 | } |
2688 | 2683 |
|
2689 | | - /* reset attribute_buf to empty */ |
2690 | | - cstate->attribute_buf.len = 0; |
2691 | | - cstate->attribute_buf.data[0] = '\0'; |
| 2684 | + resetStringInfo(&cstate->attribute_buf); |
2692 | 2685 |
|
2693 | 2686 | /* |
2694 | 2687 | * The de-escaped attributes will certainly not be longer than the input |
@@ -2886,9 +2879,7 @@ CopyReadAttributesCSV(CopyState cstate, int maxfields, char **fieldvals) |
2886 | 2879 | return 0; |
2887 | 2880 | } |
2888 | 2881 |
|
2889 | | - /* reset attribute_buf to empty */ |
2890 | | - cstate->attribute_buf.len = 0; |
2891 | | - cstate->attribute_buf.data[0] = '\0'; |
| 2882 | + resetStringInfo(&cstate->attribute_buf); |
2892 | 2883 |
|
2893 | 2884 | /* |
2894 | 2885 | * The de-escaped attributes will certainly not be longer than the input |
@@ -3040,12 +3031,9 @@ CopyReadBinaryAttribute(CopyState cstate, |
3040 | 3031 | errmsg("invalid field size"))); |
3041 | 3032 |
|
3042 | 3033 | /* reset attribute_buf to empty, and load raw data in it */ |
3043 | | - cstate->attribute_buf.len = 0; |
3044 | | - cstate->attribute_buf.data[0] = '\0'; |
3045 | | - cstate->attribute_buf.cursor = 0; |
| 3034 | + resetStringInfo(&cstate->attribute_buf); |
3046 | 3035 |
|
3047 | 3036 | enlargeStringInfo(&cstate->attribute_buf, fld_size); |
3048 | | - |
3049 | 3037 | if (CopyGetData(cstate, cstate->attribute_buf.data, |
3050 | 3038 | fld_size, fld_size) != fld_size) |
3051 | 3039 | ereport(ERROR, |
|
0 commit comments