mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-12 18:34:36 +08:00
Descriptor values were quoted twice.
Fixed some regression test problems.
This commit is contained in:
parent
a3132359fd
commit
54f5527606
@ -2095,7 +2095,6 @@ Mo Aug 14 10:39:59 CEST 2006
|
|||||||
- Fixed broken newline on Windows.
|
- Fixed broken newline on Windows.
|
||||||
- Fixed a nasty buffer underrun that only occured when using Informix
|
- Fixed a nasty buffer underrun that only occured when using Informix
|
||||||
no_indicator NULL setting on timestamps and intervals.
|
no_indicator NULL setting on timestamps and intervals.
|
||||||
<<<<<<< ChangeLog
|
|
||||||
|
|
||||||
Fr 18. Aug 17:32:54 CEST 2006
|
Fr 18. Aug 17:32:54 CEST 2006
|
||||||
|
|
||||||
@ -2107,5 +2106,9 @@ Fr 18. Aug 17:32:54 CEST 2006
|
|||||||
Sa 19. Aug 14:11:32 CEST 2006
|
Sa 19. Aug 14:11:32 CEST 2006
|
||||||
|
|
||||||
- More SoC stuff.
|
- More SoC stuff.
|
||||||
|
|
||||||
|
Tu 22. Aug 13:54:08 CEST 2006
|
||||||
|
|
||||||
|
- Descriptor values were quoted twice.
|
||||||
- Set ecpg library version to 5.2.
|
- Set ecpg library version to 5.2.
|
||||||
- Set ecpg version to 4.2.1.
|
- Set ecpg version to 4.2.1.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.59 2006/08/18 16:30:53 meskes Exp $ */
|
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.60 2006/08/22 12:46:17 meskes Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The aim is to get a simpler inteface to the database routines.
|
* The aim is to get a simpler inteface to the database routines.
|
||||||
@ -39,9 +39,8 @@ static char *
|
|||||||
quote_postgres(char *arg, int lineno)
|
quote_postgres(char *arg, int lineno)
|
||||||
{
|
{
|
||||||
char *res = (char *) ECPGalloc(2 * strlen(arg) + 3, lineno);
|
char *res = (char *) ECPGalloc(2 * strlen(arg) + 3, lineno);
|
||||||
int i,
|
int i, quoted = false,
|
||||||
ri = 0;
|
ri = 0;
|
||||||
|
|
||||||
if (!res)
|
if (!res)
|
||||||
return (res);
|
return (res);
|
||||||
|
|
||||||
@ -51,16 +50,29 @@ quote_postgres(char *arg, int lineno)
|
|||||||
*/
|
*/
|
||||||
if (strchr(arg, '\\') != NULL)
|
if (strchr(arg, '\\') != NULL)
|
||||||
res[ri++] = ESCAPE_STRING_SYNTAX;
|
res[ri++] = ESCAPE_STRING_SYNTAX;
|
||||||
res[ri++] = '\'';
|
|
||||||
|
|
||||||
for (i = 0; arg[i]; i++, ri++)
|
i = 0;
|
||||||
|
res[ri++] = '\'';
|
||||||
|
/* do not quote the string if it is already quoted */
|
||||||
|
if (*arg == '\'' && arg[strlen(arg)-1] == '\'')
|
||||||
|
{
|
||||||
|
quoted = true;
|
||||||
|
i = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; arg[i]; i++, ri++)
|
||||||
{
|
{
|
||||||
if (SQL_STR_DOUBLE(arg[i], true))
|
if (SQL_STR_DOUBLE(arg[i], true))
|
||||||
res[ri++] = arg[i];
|
res[ri++] = arg[i];
|
||||||
res[ri] = arg[i];
|
res[ri] = arg[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* do not quote the string if it is already quoted */
|
||||||
|
if (quoted)
|
||||||
|
ri--;
|
||||||
|
else
|
||||||
res[ri++] = '\'';
|
res[ri++] = '\'';
|
||||||
|
|
||||||
res[ri] = '\0';
|
res[ri] = '\0';
|
||||||
|
|
||||||
ECPGfree(arg);
|
ECPGfree(arg);
|
||||||
|
@ -131,14 +131,13 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
|
|||||||
|
|
||||||
ts1 = PGTYPEStimestamp_from_asc("2003-12-04 17:34:29", NULL);
|
ts1 = PGTYPEStimestamp_from_asc("2003-12-04 17:34:29", NULL);
|
||||||
text = PGTYPEStimestamp_to_asc(ts1);
|
text = PGTYPEStimestamp_to_asc(ts1);
|
||||||
printf("date_day of %s is %d\n", text, PGTYPESdate_dayofweek(ts1));
|
|
||||||
free(text);
|
|
||||||
|
|
||||||
fmt = "(ddd), mmm. dd, yyyy, repeat: (ddd), mmm. dd, yyyy. end";
|
fmt = "(ddd), mmm. dd, yyyy, repeat: (ddd), mmm. dd, yyyy. end";
|
||||||
out = (char*) malloc(strlen(fmt) + 1);
|
out = (char*) malloc(strlen(fmt) + 1);
|
||||||
date1 = PGTYPESdate_from_timestamp(ts1);
|
date1 = PGTYPESdate_from_timestamp(ts1);
|
||||||
PGTYPESdate_fmt_asc(date1, fmt, out);
|
PGTYPESdate_fmt_asc(date1, fmt, out);
|
||||||
|
printf("date_day of %s is %d\n", text, PGTYPESdate_dayofweek(date1));
|
||||||
printf("Above date in format \"%s\" is \"%s\"\n", fmt, out);
|
printf("Above date in format \"%s\" is \"%s\"\n", fmt, out);
|
||||||
|
free(text);
|
||||||
free(out);
|
free(out);
|
||||||
|
|
||||||
/* rdate_defmt_asc() */
|
/* rdate_defmt_asc() */
|
||||||
@ -418,16 +417,16 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
|
|||||||
free(text);
|
free(text);
|
||||||
|
|
||||||
{ ECPGtrans(__LINE__, NULL, "rollback");
|
{ ECPGtrans(__LINE__, NULL, "rollback");
|
||||||
#line 351 "dt_test.pgc"
|
#line 350 "dt_test.pgc"
|
||||||
|
|
||||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||||
#line 351 "dt_test.pgc"
|
#line 350 "dt_test.pgc"
|
||||||
|
|
||||||
{ ECPGdisconnect(__LINE__, "CURRENT");
|
{ ECPGdisconnect(__LINE__, "CURRENT");
|
||||||
#line 352 "dt_test.pgc"
|
#line 351 "dt_test.pgc"
|
||||||
|
|
||||||
if (sqlca.sqlcode < 0) sqlprint ( );}
|
if (sqlca.sqlcode < 0) sqlprint ( );}
|
||||||
#line 352 "dt_test.pgc"
|
#line 351 "dt_test.pgc"
|
||||||
|
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
[NO_PID]: ECPGget_data line 37: RESULT: 2000-07-12 17:34:29 offset: -1 array: Yes
|
[NO_PID]: ECPGget_data line 37: RESULT: 2000-07-12 17:34:29 offset: -1 array: Yes
|
||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
[NO_PID]: ECPGtrans line 351 action = rollback connection = regress1
|
[NO_PID]: ECPGtrans line 350 action = rollback connection = regress1
|
||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
[NO_PID]: ecpg_finish: Connection regress1 closed.
|
[NO_PID]: ecpg_finish: Connection regress1 closed.
|
||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
|
@ -48,7 +48,7 @@ main(void)
|
|||||||
int val1 = 1 ;
|
int val1 = 1 ;
|
||||||
|
|
||||||
#line 13 "desc.pgc"
|
#line 13 "desc.pgc"
|
||||||
char val2 [] = "one" , val2output [] = "AAA" ;
|
char val2 [ 4 ] = "one" , val2output [ 4 ] = "AAA" ;
|
||||||
|
|
||||||
#line 14 "desc.pgc"
|
#line 14 "desc.pgc"
|
||||||
int val1output = 2 , val2i = 0 ;
|
int val1output = 2 , val2i = 0 ;
|
||||||
@ -86,7 +86,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
|||||||
#line 24 "desc.pgc"
|
#line 24 "desc.pgc"
|
||||||
|
|
||||||
{ ECPGset_desc(__LINE__, "indesc", 2,ECPGd_data,
|
{ ECPGset_desc(__LINE__, "indesc", 2,ECPGd_data,
|
||||||
ECPGt_char,&(val2),(long)-1,(long)1,(-1)*sizeof(char), ECPGd_indicator,
|
ECPGt_char,(val2),(long)4,(long)1,(4)*sizeof(char), ECPGd_indicator,
|
||||||
ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGd_EODT);
|
ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGd_EODT);
|
||||||
|
|
||||||
#line 25 "desc.pgc"
|
#line 25 "desc.pgc"
|
||||||
@ -147,7 +147,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
|||||||
#line 36 "desc.pgc"
|
#line 36 "desc.pgc"
|
||||||
|
|
||||||
{ ECPGset_desc(__LINE__, "indesc", 2,ECPGd_data,
|
{ ECPGset_desc(__LINE__, "indesc", 2,ECPGd_data,
|
||||||
ECPGt_char,&(val2),(long)-1,(long)1,(-1)*sizeof(char), ECPGd_indicator,
|
ECPGt_char,(val2),(long)4,(long)1,(4)*sizeof(char), ECPGd_indicator,
|
||||||
ECPGt_int,&(val2null),(long)1,(long)1,sizeof(int), ECPGd_EODT);
|
ECPGt_int,&(val2null),(long)1,(long)1,sizeof(int), ECPGd_EODT);
|
||||||
|
|
||||||
#line 37 "desc.pgc"
|
#line 37 "desc.pgc"
|
||||||
@ -176,7 +176,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
|||||||
#line 41 "desc.pgc"
|
#line 41 "desc.pgc"
|
||||||
|
|
||||||
{ ECPGset_desc(__LINE__, "indesc", 2,ECPGd_data,
|
{ ECPGset_desc(__LINE__, "indesc", 2,ECPGd_data,
|
||||||
ECPGt_char,&(val2),(long)-1,(long)1,(-1)*sizeof(char), ECPGd_indicator,
|
ECPGt_char,(val2),(long)4,(long)1,(4)*sizeof(char), ECPGd_indicator,
|
||||||
ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGd_EODT);
|
ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGd_EODT);
|
||||||
|
|
||||||
#line 42 "desc.pgc"
|
#line 42 "desc.pgc"
|
||||||
@ -199,7 +199,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
|||||||
|
|
||||||
|
|
||||||
{ ECPGget_desc(__LINE__, "outdesc", 1,ECPGd_data,
|
{ ECPGget_desc(__LINE__, "outdesc", 1,ECPGd_data,
|
||||||
ECPGt_char,&(val2output),(long)-1,(long)1,(-1)*sizeof(char), ECPGd_EODT);
|
ECPGt_char,(val2output),(long)4,(long)1,(4)*sizeof(char), ECPGd_EODT);
|
||||||
|
|
||||||
#line 46 "desc.pgc"
|
#line 46 "desc.pgc"
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
|||||||
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch next from c1", ECPGt_EOIT,
|
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch next from c1", ECPGt_EOIT,
|
||||||
ECPGt_int,&(val1output),(long)1,(long)1,sizeof(int),
|
ECPGt_int,&(val1output),(long)1,(long)1,sizeof(int),
|
||||||
ECPGt_int,&(ind1),(long)1,(long)1,sizeof(int),
|
ECPGt_int,&(ind1),(long)1,(long)1,sizeof(int),
|
||||||
ECPGt_char,&(val2output),(long)-1,(long)1,(-1)*sizeof(char),
|
ECPGt_char,(val2output),(long)4,(long)1,(4)*sizeof(char),
|
||||||
ECPGt_int,&(ind2),(long)1,(long)1,sizeof(int), ECPGt_EORT);
|
ECPGt_int,&(ind2),(long)1,(long)1,sizeof(int), ECPGt_EORT);
|
||||||
#line 52 "desc.pgc"
|
#line 52 "desc.pgc"
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
|||||||
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch next from c2", ECPGt_EOIT,
|
{ ECPGdo(__LINE__, 0, 1, NULL, "fetch next from c2", ECPGt_EOIT,
|
||||||
ECPGt_int,&(val1output),(long)1,(long)1,sizeof(int),
|
ECPGt_int,&(val1output),(long)1,(long)1,sizeof(int),
|
||||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
|
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
|
||||||
ECPGt_char,&(val2output),(long)-1,(long)1,(-1)*sizeof(char),
|
ECPGt_char,(val2output),(long)4,(long)1,(4)*sizeof(char),
|
||||||
ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGt_EORT);
|
ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGt_EORT);
|
||||||
#line 64 "desc.pgc"
|
#line 64 "desc.pgc"
|
||||||
|
|
||||||
@ -294,7 +294,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
|||||||
{ ECPGdo(__LINE__, 0, 1, NULL, "select * from test1 where a = 2 ", ECPGt_EOIT,
|
{ ECPGdo(__LINE__, 0, 1, NULL, "select * from test1 where a = 2 ", ECPGt_EOIT,
|
||||||
ECPGt_int,&(val1output),(long)1,(long)1,sizeof(int),
|
ECPGt_int,&(val1output),(long)1,(long)1,sizeof(int),
|
||||||
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
|
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
|
||||||
ECPGt_char,&(val2output),(long)-1,(long)1,(-1)*sizeof(char),
|
ECPGt_char,(val2output),(long)4,(long)1,(4)*sizeof(char),
|
||||||
ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGt_EORT);
|
ECPGt_int,&(val2i),(long)1,(long)1,sizeof(int), ECPGt_EORT);
|
||||||
#line 69 "desc.pgc"
|
#line 69 "desc.pgc"
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
[NO_PID]: ECPGprepare line 32: QUERY: SELECT * from test1 where a = ?
|
[NO_PID]: ECPGprepare line 32: QUERY: SELECT * from test1 where a = ?
|
||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
[NO_PID]: ECPGexecute line 34: QUERY: INSERT INTO test1 VALUES ('1', '''one''') on connection regress1
|
[NO_PID]: ECPGexecute line 34: QUERY: INSERT INTO test1 VALUES ('1', 'one') on connection regress1
|
||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
[NO_PID]: ECPGexecute line 34 Ok: INSERT 0 1
|
[NO_PID]: ECPGexecute line 34 Ok: INSERT 0 1
|
||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
@ -20,7 +20,7 @@
|
|||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
[NO_PID]: ECPGexecute line 39 Ok: INSERT 0 1
|
[NO_PID]: ECPGexecute line 39 Ok: INSERT 0 1
|
||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
[NO_PID]: ECPGexecute line 44: QUERY: SELECT * from test1 where a = '1' and b = '''one''' on connection regress1
|
[NO_PID]: ECPGexecute line 44: QUERY: SELECT * from test1 where a = '1' and b = 'one' on connection regress1
|
||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
[NO_PID]: ECPGexecute line 44: Correctly got 1 tuples with 2 fields
|
[NO_PID]: ECPGexecute line 44: Correctly got 1 tuples with 2 fields
|
||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
@ -30,7 +30,7 @@
|
|||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
[NO_PID]: ECPGget_data line 46: RESULT: 1 offset: -1 array: Yes
|
[NO_PID]: ECPGget_data line 46: RESULT: 1 offset: -1 array: Yes
|
||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
[NO_PID]: ECPGexecute line 50: QUERY: declare c1 cursor for SELECT * from test1 where a = '1' and b = '''one''' on connection regress1
|
[NO_PID]: ECPGexecute line 50: QUERY: declare c1 cursor for SELECT * from test1 where a = '1' and b = 'one' on connection regress1
|
||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
[NO_PID]: ECPGexecute line 50 Ok: DECLARE CURSOR
|
[NO_PID]: ECPGexecute line 50 Ok: DECLARE CURSOR
|
||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
@ -40,7 +40,7 @@
|
|||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
[NO_PID]: ECPGget_data line 52: RESULT: 1 offset: -1 array: Yes
|
[NO_PID]: ECPGget_data line 52: RESULT: 1 offset: -1 array: Yes
|
||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
[NO_PID]: ECPGget_data line 52: RESULT: 'one' offset: -1 array: Yes
|
[NO_PID]: ECPGget_data line 52: RESULT: one offset: -1 array: Yes
|
||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
[NO_PID]: ECPGexecute line 56: QUERY: close c1 on connection regress1
|
[NO_PID]: ECPGexecute line 56: QUERY: close c1 on connection regress1
|
||||||
[NO_PID]: sqlca: code: 0, state: 00000
|
[NO_PID]: sqlca: code: 0, state: 00000
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
output = 1
|
output = 1
|
||||||
val1=1 (ind1: 0) val2='one' (ind2: 0)
|
val1=1 (ind1: 0) val2=one (ind2: 0)
|
||||||
val1=2 val2=null
|
val1=2 val2=null
|
||||||
val1=2 val2=null
|
val1=2 val2=null
|
||||||
|
@ -62,14 +62,13 @@ main(void)
|
|||||||
|
|
||||||
ts1 = PGTYPEStimestamp_from_asc("2003-12-04 17:34:29", NULL);
|
ts1 = PGTYPEStimestamp_from_asc("2003-12-04 17:34:29", NULL);
|
||||||
text = PGTYPEStimestamp_to_asc(ts1);
|
text = PGTYPEStimestamp_to_asc(ts1);
|
||||||
printf("date_day of %s is %d\n", text, PGTYPESdate_dayofweek(ts1));
|
|
||||||
free(text);
|
|
||||||
|
|
||||||
fmt = "(ddd), mmm. dd, yyyy, repeat: (ddd), mmm. dd, yyyy. end";
|
fmt = "(ddd), mmm. dd, yyyy, repeat: (ddd), mmm. dd, yyyy. end";
|
||||||
out = (char*) malloc(strlen(fmt) + 1);
|
out = (char*) malloc(strlen(fmt) + 1);
|
||||||
date1 = PGTYPESdate_from_timestamp(ts1);
|
date1 = PGTYPESdate_from_timestamp(ts1);
|
||||||
PGTYPESdate_fmt_asc(date1, fmt, out);
|
PGTYPESdate_fmt_asc(date1, fmt, out);
|
||||||
|
printf("date_day of %s is %d\n", text, PGTYPESdate_dayofweek(date1));
|
||||||
printf("Above date in format \"%s\" is \"%s\"\n", fmt, out);
|
printf("Above date in format \"%s\" is \"%s\"\n", fmt, out);
|
||||||
|
free(text);
|
||||||
free(out);
|
free(out);
|
||||||
|
|
||||||
/* rdate_defmt_asc() */
|
/* rdate_defmt_asc() */
|
||||||
|
@ -10,7 +10,7 @@ main(void)
|
|||||||
char *stmt3 = "SELECT * from test1 where a = ?";
|
char *stmt3 = "SELECT * from test1 where a = ?";
|
||||||
|
|
||||||
int val1 = 1;
|
int val1 = 1;
|
||||||
char val2[] = "one", val2output[] = "AAA";
|
char val2[4] = "one", val2output[4] = "AAA";
|
||||||
int val1output = 2, val2i = 0;
|
int val1output = 2, val2i = 0;
|
||||||
int val2null = -1;
|
int val2null = -1;
|
||||||
int ind1, ind2;
|
int ind1, ind2;
|
||||||
|
Loading…
Reference in New Issue
Block a user