Skip to content

Commit cbe3511

Browse files
committed
Merge branch 'ob-10.0' into 10.0
2 parents 433c8a8 + c1efc4a commit cbe3511

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

storage/connect/tabmysql.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int)
334334
Delayed = !!GetIntCatInfo("Delayed", 0);
335335
} else {
336336
// MYSQL access from a PROXY table
337-
Database = GetStringCatInfo(g, "Database", Schema ? Schema : (PSZ)"*");
337+
Database = GetStringCatInfo(g, "Database", Schema ? Schema : PlugDup(g, "*"));
338338
Isview = GetBoolCatInfo("View", false);
339339

340340
// We must get other connection parms from the calling table

storage/connect/value.cpp

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,10 +1344,13 @@ bool TYPVAL<PSZ>::SetValue_pval(PVAL valp, bool chktype)
13441344
/***********************************************************************/
13451345
bool TYPVAL<PSZ>::SetValue_char(char *p, int n)
13461346
{
1347-
bool rc;
1347+
bool rc = false;
13481348

1349-
if (p && n > 0) {
1350-
rc = n > Len;
1349+
if (!p || n == 0) {
1350+
Reset();
1351+
Null = Nullable;
1352+
} else if (p != Strp) {
1353+
rc = n > Len;
13511354

13521355
if ((n = MY_MIN(n, Len))) {
13531356
strncpy(Strp, p, n);
@@ -1366,10 +1369,6 @@ bool TYPVAL<PSZ>::SetValue_char(char *p, int n)
13661369
Reset();
13671370

13681371
Null = false;
1369-
} else {
1370-
rc = false;
1371-
Reset();
1372-
Null = Nullable;
13731372
} // endif p
13741373

13751374
return rc;
@@ -1380,12 +1379,12 @@ bool TYPVAL<PSZ>::SetValue_char(char *p, int n)
13801379
/***********************************************************************/
13811380
void TYPVAL<PSZ>::SetValue_psz(PSZ s)
13821381
{
1383-
if (s) {
1384-
strncpy(Strp, s, Len);
1382+
if (!s) {
1383+
Reset();
1384+
Null = Nullable;
1385+
} else if (s != Strp) {
1386+
strncpy(Strp, s, Len);
13851387
Null = false;
1386-
} else {
1387-
Reset();
1388-
Null = Nullable;
13891388
} // endif s
13901389

13911390
} // end of SetValue_psz
@@ -1643,19 +1642,19 @@ bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
16431642
assert(np == 1 || np == 2);
16441643

16451644
if (np == 2)
1646-
strncpy(Strp, p[0], Len);
1645+
SetValue_psz(p[0]);
16471646

16481647
if ((i = Len - (signed)strlen(Strp)) > 0)
16491648
strncat(Strp, p[np - 1], i);
16501649

16511650
break;
16521651
case OP_MIN:
16531652
assert(np == 2);
1654-
strcpy(Strp, (strcmp(p[0], p[1]) < 0) ? p[0] : p[1]);
1653+
SetValue_psz((strcmp(p[0], p[1]) < 0) ? p[0] : p[1]);
16551654
break;
16561655
case OP_MAX:
16571656
assert(np == 2);
1658-
strcpy(Strp, (strcmp(p[0], p[1]) > 0) ? p[0] : p[1]);
1657+
SetValue_psz((strcmp(p[0], p[1]) > 0) ? p[0] : p[1]);
16591658
break;
16601659
default:
16611660
// sprintf(g->Message, MSG(BAD_EXP_OPER), op);

0 commit comments

Comments
 (0)