@@ -475,9 +475,46 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
475475memset (& stmt ,0 ,sizeof stmt );
476476stmt .lineno = lineno ;
477477
478+ /* Make sure we do NOT honor the locale for numeric input */
479+ /* since the database gives the standard decimal point */
480+ /* (see comments in execute.c) */
481+ #ifdef HAVE_USELOCALE
482+
483+ /*
484+ * To get here, the above PQnfields() test must have found nonzero
485+ * fields. One needs a connection to create such a descriptor. (EXEC
486+ * SQL SET DESCRIPTOR can populate the descriptor's "items", but it
487+ * can't change the descriptor's PQnfields().) Any successful
488+ * connection initializes ecpg_clocale.
489+ */
490+ Assert (ecpg_clocale );
491+ stmt .oldlocale = uselocale (ecpg_clocale );
492+ #else
493+ #ifdef WIN32
494+ stmt .oldthreadlocale = _configthreadlocale (_ENABLE_PER_THREAD_LOCALE );
495+ #endif
496+ stmt .oldlocale = ecpg_strdup (setlocale (LC_NUMERIC ,NULL ),lineno );
497+ setlocale (LC_NUMERIC ,"C" );
498+ #endif
499+
478500/* desperate try to guess something sensible */
479501stmt .connection = ecpg_get_connection (NULL );
480502ecpg_store_result (ECPGresult ,index ,& stmt ,& data_var );
503+
504+ #ifdef HAVE_USELOCALE
505+ if (stmt .oldlocale != (locale_t )0 )
506+ uselocale (stmt .oldlocale );
507+ #else
508+ if (stmt .oldlocale )
509+ {
510+ setlocale (LC_NUMERIC ,stmt .oldlocale );
511+ ecpg_free (stmt .oldlocale );
512+ }
513+ #ifdef WIN32
514+ if (stmt .oldthreadlocale != -1 )
515+ _configthreadlocale (stmt .oldthreadlocale );
516+ #endif
517+ #endif
481518}
482519else if (data_var .ind_type != ECPGt_NO_INDICATOR && data_var .ind_pointer != NULL )
483520