| Bug #2570 | Random changes in decimal point | ||
|---|---|---|---|
| Submitted: | 29 Jan 2004 19:53 | Modified: | 6 Dec 2006 21:07 |
| Reporter: | Boyd Gerber | Email Updates: | |
| Status: | Can't repeat | Impact on me: | |
| Category: | Connector / ODBC | Severity: | S3 (Non-critical) |
| Version: | 3.51.06/7 | OS: | Windows (windows) |
| Assigned to: | Jess Balint | CPU Architecture: | Any |
| Tags: | Contribution | ||
[29 Jan 2004 19:53]
Boyd Gerber
[30 Jan 2004 7:53]
Boyd Gerber
Here is the patch.
Index: driver/dll.c
===================================================================
RCS file: /cvsroot/MyODBC/driver/dll.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 dll.c
--- driver/dll.c 2004/01/29 13:17:26 1.1.1.1
+++ driver/dll.c 2004/01/29 17:54:43
@@ -33,7 +33,7 @@
char *default_locale, *decimal_point, *thousands_sep;
uint decimal_point_length,thousands_sep_length;
static my_bool myodbc_inited=0;
-
+static int myodbc_init_counter=0;
/*
@type : myodbc3 internal
@purpose : initializations
@@ -42,8 +42,12 @@
void myodbc_init(void)
{
if (myodbc_inited)
+ {
+ myodbc_init_counter++;
return;
+ }
myodbc_inited=1;
+ myodbc_init_counter=1;
my_init();
{
struct lconv *tmp;
@@ -80,14 +84,18 @@
{
if (myodbc_inited)
{
- myodbc_inited=0;
- my_free(decimal_point,MYF(0));
- my_free(default_locale,MYF(0));
- my_free(thousands_sep,MYF(0));
+ myodbc_init_counter--;
+ if (myodbc_init_counter==0)
+ {
+ myodbc_inited=0;
+ my_free(decimal_point,MYF(0));
+ my_free(default_locale,MYF(0));
+ my_free(thousands_sep,MYF(0));
+ myodbc_init_counter--;
+ if (myodbc_init_counter==0)
+ {
+ myodbc_inited=0;
+ my_free(decimal_point,MYF(0));
+ my_free(default_locale,MYF(0));
+ my_free(thousands_sep,MYF(0));
#ifdef NOT_YET_USED
- mysql_server_end();
+ mysql_server_end();
#endif
- my_end(0);
+ my_end(0);
+ }
}
}
[6 Dec 2006 21:05]
Jess Balint
Test Case
Attachment: mysql_bug_2570_t1.cpp (plain/text, text), 2.63 KiB.
[6 Dec 2006 21:07]
Jess Balint
Cannot repeat on Windows w/3.51.12. See attached test case. I have not attempted to look into the driver code in regards to this issue.
[6 Dec 2006 21:23]
Mark Matthews
Note that we added reference counting for initialization as a fix for a different bug, but it ends up taking care of this one too.
