Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdc05a99

Browse files
committed
Fix the setlocale problem in a way that actually works. setlocale
returns a string corresponding to the new setting, not the old,therefore the previous patch was quite wrong.
1 parent742d0f2 commitdc05a99

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

‎src/interfaces/ecpg/lib/execute.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.24 2001/09/25 18:37:17 meskes Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.25 2001/09/29 20:12:07 tgl Exp $ */
22

33
/*
44
* The aim is to get a simpler inteface to the database routines.
@@ -1006,23 +1006,26 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
10061006
va_listargs;
10071007
structstatement*stmt;
10081008
structconnection*con=get_connection(connection_name);
1009-
boolstatus= true;
1010-
char*locale;
1009+
boolstatus;
1010+
char*oldlocale;
10111011

10121012
/* Make sure we do NOT honor the locale for numeric input/output */
10131013
/* since the database wants the standard decimal point */
1014-
locale=setlocale(LC_NUMERIC,"C");
1014+
oldlocale=strdup(setlocale(LC_NUMERIC,NULL));
1015+
setlocale(LC_NUMERIC,"C");
10151016

10161017
if (!ecpg_init(con,connection_name,lineno))
10171018
{
1018-
setlocale(LC_NUMERIC,locale);
1019+
setlocale(LC_NUMERIC,oldlocale);
1020+
free(oldlocale);
10191021
return (false);
10201022
}
10211023

10221024
va_start(args,query);
10231025
if (create_statement(lineno,con,&stmt,query,args)== false)
10241026
{
1025-
setlocale(LC_NUMERIC,locale);
1027+
setlocale(LC_NUMERIC,oldlocale);
1028+
free(oldlocale);
10261029
return (false);
10271030
}
10281031
va_end(args);
@@ -1033,15 +1036,18 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
10331036
free_statement(stmt);
10341037
ECPGlog("ECPGdo: not connected to %s\n",con->name);
10351038
ECPGraise(lineno,ECPG_NOT_CONN,NULL);
1036-
setlocale(LC_NUMERIC,locale);
1039+
setlocale(LC_NUMERIC,oldlocale);
1040+
free(oldlocale);
10371041
return false;
10381042
}
10391043

10401044
status=ECPGexecute(stmt);
10411045
free_statement(stmt);
10421046

10431047
/* and reset locale value so our application is not affected */
1044-
setlocale(LC_NUMERIC,locale);
1048+
setlocale(LC_NUMERIC,oldlocale);
1049+
free(oldlocale);
1050+
10451051
return (status);
10461052
}
10471053

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp