mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
- Fix MDEV-16672 Connect: Warnings with 10.0
filamtxt.cpp: DOSFAM::RenameTempFile: Change sprintf to snprintf. filamvct.cpp: VECFAM::RenameTempFile: Change sprintf to snprintf. javaconn.cpp: Add JAVAConn::GetUTFString function. Use it instead of env->GetStringUTFChars. Fix wrong identation. javaconn.h: Add GetUTFString declaration. jdbconn.cpp: Use GetUTFString function instead of env->GetStringUTFChars. jmgoconn.cpp: Use GetUTFString function instead of env->GetStringUTFChars. Fix wrong identation. jsonudf.cpp: change 139 to BMX line 4631. tabjmg.cpp: Add ReleaseStringUTF. Fix wrong identation. tabpivot.cpp: Fix wrong identation. tabutil.cpp: TDBPRX::GetSubTable: Change sprintf to snprintf. modified: storage/connect/filamtxt.cpp modified: storage/connect/filamvct.cpp modified: storage/connect/javaconn.cpp modified: storage/connect/javaconn.h modified: storage/connect/jdbconn.cpp modified: storage/connect/jmgoconn.cpp modified: storage/connect/jsonudf.cpp modified: storage/connect/tabjmg.cpp modified: storage/connect/tabpivot.cpp modified: storage/connect/tabutil.cpp - Fix MDEV-16895 CONNECT engine's get_error_message can cause buffer overflow and server crash with long queries ha_connect_cc: Update version. get_error_message: Remove charset conversion. modified: storage/connect/ha_connect.cc - Fix a server crash on inserting bigint to a JDBC table JDBConn::SetUUID: Suppress check on ctyp that causes a server crash because ctyp can be negative and this triggers an DEBUG_ASSERT on return. modified: storage/connect/jdbconn.cpp - Update jdbc.result mysql-test/connect/r/jdbc.result: Recorded to reflect a message change. modified: storage/connect/mysql-test/connect/r/jdbc.result
This commit is contained in:
parent
c69efab396
commit
9644415fa9
12 changed files with 144 additions and 149 deletions
|
@ -1173,11 +1173,11 @@ int DOSFAM::RenameTempFile(PGLOBAL g)
|
|||
remove(filetemp); // May still be there from previous error
|
||||
|
||||
if (rename(filename, filetemp)) { // Save file for security
|
||||
sprintf(g->Message, MSG(RENAME_ERROR),
|
||||
snprintf(g->Message, MAX_STR, MSG(RENAME_ERROR),
|
||||
filename, filetemp, strerror(errno));
|
||||
throw 51;
|
||||
} else if (rename(tempname, filename)) {
|
||||
sprintf(g->Message, MSG(RENAME_ERROR),
|
||||
snprintf(g->Message, MAX_STR, MSG(RENAME_ERROR),
|
||||
tempname, filename, strerror(errno));
|
||||
rc = rename(filetemp, filename); // Restore saved file
|
||||
throw 52;
|
||||
|
|
|
@ -353,7 +353,7 @@ int VCTFAM::Cardinality(PGLOBAL g)
|
|||
|
||||
} // endif split
|
||||
|
||||
return (Block) ? ((Block - 1) * Nrec + Last) : 0;
|
||||
return (Block) ? ((Block - 1) * Nrec + Last) : 0;
|
||||
} // end of Cardinality
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -2458,11 +2458,11 @@ int VECFAM::RenameTempFile(PGLOBAL g)
|
|||
remove(filetemp); // May still be there from previous error
|
||||
|
||||
if (rename(filename, filetemp)) { // Save file for security
|
||||
sprintf(g->Message, MSG(RENAME_ERROR),
|
||||
snprintf(g->Message, MAX_STR, MSG(RENAME_ERROR),
|
||||
filename, filetemp, strerror(errno));
|
||||
rc = RC_FX;
|
||||
} else if (rename(tempname, filename)) {
|
||||
sprintf(g->Message, MSG(RENAME_ERROR),
|
||||
snprintf(g->Message, MAX_STR, MSG(RENAME_ERROR),
|
||||
tempname, filename, strerror(errno));
|
||||
rc = rename(filetemp, filename); // Restore saved file
|
||||
rc = RC_FX;
|
||||
|
|
|
@ -170,7 +170,7 @@
|
|||
#define JSONMAX 10 // JSON Default max grp size
|
||||
|
||||
extern "C" {
|
||||
char version[]= "Version 1.06.0007 March 11, 2018";
|
||||
char version[]= "Version 1.06.0007 August 06, 2018";
|
||||
#if defined(__WIN__)
|
||||
char compver[]= "Version 1.06.0007 " __DATE__ " " __TIME__;
|
||||
char slash= '\\';
|
||||
|
@ -3303,23 +3303,15 @@ bool ha_connect::get_error_message(int error, String* buf)
|
|||
{
|
||||
DBUG_ENTER("ha_connect::get_error_message");
|
||||
|
||||
if (xp && xp->g) {
|
||||
PGLOBAL g= xp->g;
|
||||
char msg[3072]; // MAX_STR * 3
|
||||
uint dummy_errors;
|
||||
uint32 len= copy_and_convert(msg, strlen(g->Message) * 3,
|
||||
system_charset_info,
|
||||
g->Message, strlen(g->Message),
|
||||
&my_charset_latin1,
|
||||
&dummy_errors);
|
||||
if (xp && xp->g) {
|
||||
PGLOBAL g = xp->g;
|
||||
|
||||
if (trace(1))
|
||||
htrc("GEM(%d): len=%u %s\n", error, len, g->Message);
|
||||
if (trace(1))
|
||||
htrc("GEM(%d): %s\n", error, g->Message);
|
||||
|
||||
msg[len]= '\0';
|
||||
buf->copy(msg, (uint)strlen(msg), system_charset_info);
|
||||
} else
|
||||
buf->copy("Cannot retrieve msg", 19, system_charset_info);
|
||||
buf->append(g->Message);
|
||||
} else
|
||||
buf->append("Cannot retrieve error message");
|
||||
|
||||
DBUG_RETURN(false);
|
||||
} // end of get_error_message
|
||||
|
|
|
@ -138,6 +138,16 @@ JAVAConn::JAVAConn(PGLOBAL g, PCSZ wrapper)
|
|||
// EndCom();
|
||||
|
||||
// } // end of ~JAVAConn
|
||||
char *JAVAConn::GetUTFString(jstring s)
|
||||
{
|
||||
char *str;
|
||||
const char *utf = env->GetStringUTFChars(s, nullptr);
|
||||
|
||||
str = PlugDup(m_G, utf);
|
||||
env->ReleaseStringUTFChars(s, utf);
|
||||
env->DeleteLocalRef(s);
|
||||
return str;
|
||||
} // end of GetUTFString
|
||||
|
||||
/***********************************************************************/
|
||||
/* Screen for errors. */
|
||||
|
@ -152,17 +162,15 @@ bool JAVAConn::Check(jint rc)
|
|||
"toString", "()Ljava/lang/String;");
|
||||
|
||||
if (exc != nullptr && tid != nullptr) {
|
||||
jstring s = (jstring)env->CallObjectMethod(exc, tid);
|
||||
const char *utf = env->GetStringUTFChars(s, (jboolean)false);
|
||||
env->DeleteLocalRef(s);
|
||||
Msg = PlugDup(m_G, utf);
|
||||
s = (jstring)env->CallObjectMethod(exc, tid);
|
||||
Msg = GetUTFString(s);
|
||||
} else
|
||||
Msg = "Exception occured";
|
||||
|
||||
env->ExceptionClear();
|
||||
} else if (rc < 0) {
|
||||
s = (jstring)env->CallObjectMethod(job, errid);
|
||||
Msg = (char*)env->GetStringUTFChars(s, (jboolean)false);
|
||||
Msg = GetUTFString(s);
|
||||
} else
|
||||
Msg = NULL;
|
||||
|
||||
|
|
|
@ -90,6 +90,7 @@ public:
|
|||
|
||||
// Java operations
|
||||
protected:
|
||||
char *GetUTFString(jstring s);
|
||||
bool gmID(PGLOBAL g, jmethodID& mid, const char *name, const char *sig);
|
||||
bool Check(jint rc = 0);
|
||||
|
||||
|
|
|
@ -707,20 +707,13 @@ bool JDBConn::SetUUID(PGLOBAL g, PTDBJDBC tjp)
|
|||
goto err;
|
||||
} // endif rc
|
||||
|
||||
// Returns 666 is case of error
|
||||
//jtyp = env->CallIntMethod(job, typid, 5, nullptr);
|
||||
|
||||
//if (Check((jtyp == 666) ? -1 : 1)) {
|
||||
// sprintf(g->Message, "Getting jtyp: %s", Msg);
|
||||
// goto err;
|
||||
//} // endif ctyp
|
||||
|
||||
// Should return 666 is case of error (not done yet)
|
||||
ctyp = (int)env->CallIntMethod(job, intfldid, 5, nullptr);
|
||||
|
||||
if (Check(ctyp)) {
|
||||
sprintf(g->Message, "Getting ctyp: %s", Msg);
|
||||
goto err;
|
||||
} // endif ctyp
|
||||
//if (Check((ctyp == 666) ? -1 : 1)) {
|
||||
// sprintf(g->Message, "Getting ctyp: %s", Msg);
|
||||
// goto err;
|
||||
//} // endif ctyp
|
||||
|
||||
if (ctyp == 1111)
|
||||
((PJDBCCOL)colp)->uuid = true;
|
||||
|
@ -836,11 +829,11 @@ bool JDBConn::Connect(PJPARM sop)
|
|||
jstring s = (jstring)env->CallObjectMethod(job, qcid);
|
||||
|
||||
if (s != nullptr) {
|
||||
char *qch = (char*)env->GetStringUTFChars(s, (jboolean)false);
|
||||
char *qch = GetUTFString(s);
|
||||
m_IDQuoteChar[0] = *qch;
|
||||
} else {
|
||||
s = (jstring)env->CallObjectMethod(job, errid);
|
||||
Msg = (char*)env->GetStringUTFChars(s, (jboolean)false);
|
||||
Msg = GetUTFString(s);
|
||||
} // endif s
|
||||
|
||||
} // endif qcid
|
||||
|
@ -1018,7 +1011,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val)
|
|||
cn = nullptr;
|
||||
|
||||
if (cn) {
|
||||
field = env->GetStringUTFChars(cn, (jboolean)false);
|
||||
field = GetUTFString(cn);
|
||||
val->SetValue_psz((PSZ)field);
|
||||
} else
|
||||
val->Reset();
|
||||
|
@ -1092,8 +1085,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val)
|
|||
cn = nullptr;
|
||||
|
||||
if (cn) {
|
||||
const char *field = env->GetStringUTFChars(cn, (jboolean)false);
|
||||
val->SetValue_psz((PSZ)field);
|
||||
val->SetValue_psz((PSZ)GetUTFString(cn));
|
||||
} else
|
||||
val->Reset();
|
||||
|
||||
|
@ -1372,19 +1364,19 @@ bool JDBConn::SetParam(JDBCCOL *colp)
|
|||
for (i = 0, n = 0; i < size; i++) {
|
||||
crp = qrp->Colresp;
|
||||
js = (jstring)env->GetObjectArrayElement(s, n++);
|
||||
sval = (PSZ)env->GetStringUTFChars(js, 0);
|
||||
sval = GetUTFString(js);
|
||||
crp->Kdata->SetValue(sval, i);
|
||||
crp = crp->Next;
|
||||
js = (jstring)env->GetObjectArrayElement(s, n++);
|
||||
sval = (PSZ)env->GetStringUTFChars(js, 0);
|
||||
sval = GetUTFString(js);
|
||||
crp->Kdata->SetValue(sval, i);
|
||||
crp = crp->Next;
|
||||
js = (jstring)env->GetObjectArrayElement(s, n++);
|
||||
sval = (PSZ)env->GetStringUTFChars(js, 0);
|
||||
sval = GetUTFString(js);
|
||||
crp->Kdata->SetValue(sval, i);
|
||||
crp = crp->Next;
|
||||
js = (jstring)env->GetObjectArrayElement(s, n++);
|
||||
sval = (PSZ)env->GetStringUTFChars(js, 0);
|
||||
sval = GetUTFString(js);
|
||||
crp->Kdata->SetValue(sval, i);
|
||||
} // endfor i
|
||||
|
||||
|
@ -1470,7 +1462,7 @@ bool JDBConn::SetParam(JDBCCOL *colp)
|
|||
return NULL;
|
||||
} // endif label
|
||||
|
||||
name = env->GetStringUTFChars(label, (jboolean)false);
|
||||
name = GetUTFString(label);
|
||||
crp = qrp->Colresp; // Column_Name
|
||||
crp->Kdata->SetValue((char*)name, i);
|
||||
n = env->GetIntArrayElements(val, 0);
|
||||
|
|
|
@ -522,7 +522,7 @@ PSZ JMgoConn::GetDocument(void)
|
|||
jdc = (jstring)env->CallObjectMethod(job, getdocid);
|
||||
|
||||
if (jdc)
|
||||
doc = (PSZ)env->GetStringUTFChars(jdc, (jboolean)false);
|
||||
doc = (PSZ)GetUTFString(jdc);
|
||||
|
||||
} // endif getdocid
|
||||
|
||||
|
@ -690,7 +690,7 @@ jobject JMgoConn::MakeDoc(PGLOBAL g, PJNCOL jcp)
|
|||
|
||||
} // endif Jncolp
|
||||
|
||||
return parent;
|
||||
return parent;
|
||||
} // end of MakeDoc
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -807,7 +807,7 @@ PSZ JMgoConn::GetColumnValue(PSZ path)
|
|||
fn = (jstring)env->CallObjectMethod(job, objfldid, jn);
|
||||
|
||||
if (fn)
|
||||
fld = (PSZ)env->GetStringUTFChars(fn, (jboolean)false);
|
||||
fld = (PSZ)GetUTFString(fn);
|
||||
|
||||
} // endif objfldid
|
||||
|
||||
|
|
|
@ -4631,7 +4631,7 @@ char *jbin_array(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
|||
bsp = NULL;
|
||||
|
||||
if (!bsp && (bsp = JbinAlloc(g, args, initid->max_length, NULL)))
|
||||
strncpy(bsp->Msg, g->Message, 139);
|
||||
strncpy(bsp->Msg, g->Message, BMX);
|
||||
|
||||
// Keep result of constant function
|
||||
g->Xchk = (initid->const_item) ? bsp : NULL;
|
||||
|
|
|
@ -238,8 +238,7 @@ DROP TABLE t1, connect.emp;
|
|||
CREATE TABLE t2 (command varchar(128) not null,number int(5) not null flag=1,message varchar(255) flag=2) ENGINE=CONNECT TABLE_TYPE=JDBC CONNECTION='jdbc:mariadb://localhost:PORT/connect' OPTION_LIST='User=root,Execsrc=1';
|
||||
SELECT * FROM t2 WHERE command='drop table tx1';
|
||||
command number message
|
||||
drop table tx1 0 Execute: java.sql.SQLSyntaxErrorException: Unknown table 'connect.tx1'
|
||||
Query is : drop table tx1
|
||||
drop table tx1 0 Execute: java.sql.SQLSyntaxErrorException: (conn:24) Unknown table 'connect.tx1'
|
||||
SELECT * FROM t2 WHERE command = 'create table tx1 (a int not null, b char(32), c double(8,2))';
|
||||
command number message
|
||||
create table tx1 (a int not null, b char(32), c double(8,2)) 0 Affected rows
|
||||
|
|
|
@ -72,7 +72,7 @@ bool JMGDISC::Find(PGLOBAL g)
|
|||
bool JMGDISC::ColDesc(PGLOBAL g, jobject obj, char *pcn, char *pfmt,
|
||||
int ncol, int k)
|
||||
{
|
||||
const char *key;
|
||||
const char *key, *utf;
|
||||
char colname[65];
|
||||
char fmt[129];
|
||||
bool rc = true;
|
||||
|
@ -101,7 +101,10 @@ bool JMGDISC::ColDesc(PGLOBAL g, jobject obj, char *pcn, char *pfmt,
|
|||
continue;
|
||||
|
||||
jkey = (jstring)Jcp->env->CallObjectMethod(Jcp->job, bvnameid);
|
||||
key = Jcp->env->GetStringUTFChars(jkey, (jboolean)false);
|
||||
utf = Jcp->env->GetStringUTFChars(jkey, nullptr);
|
||||
key = PlugDup(g, utf);
|
||||
Jcp->env->ReleaseStringUTFChars(jkey, utf);
|
||||
Jcp->env->DeleteLocalRef(jkey);
|
||||
|
||||
if (pcn) {
|
||||
strncpy(colname, pcn, 64);
|
||||
|
@ -457,8 +460,8 @@ PSZ JMGCOL::GetJpath(PGLOBAL g, bool proj)
|
|||
} else
|
||||
*p2++ = *p1;
|
||||
|
||||
*p2 = 0;
|
||||
return projpath;
|
||||
*p2 = 0;
|
||||
return projpath;
|
||||
} else
|
||||
return Jpath;
|
||||
|
||||
|
|
|
@ -107,12 +107,12 @@ bool PIVAID::SkipColumn(PCOLRES crp, char *skc)
|
|||
/***********************************************************************/
|
||||
PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
|
||||
{
|
||||
char *p, *query, *colname, *skc, buf[64];
|
||||
int ndif, nblin, w = 0;
|
||||
bool b = false;
|
||||
PVAL valp;
|
||||
PQRYRES qrp;
|
||||
PCOLRES *pcrp, crp, fncrp = NULL;
|
||||
char *p, *query, *colname, *skc, buf[64];
|
||||
int ndif, nblin, w = 0;
|
||||
bool b = false;
|
||||
PVAL valp;
|
||||
PQRYRES qrp;
|
||||
PCOLRES *pcrp, crp, fncrp = NULL;
|
||||
|
||||
try {
|
||||
// Are there columns to skip?
|
||||
|
@ -186,7 +186,7 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
|
|||
|
||||
} // endif picol
|
||||
|
||||
// Prepare the column list
|
||||
// Prepare the column list
|
||||
for (pcrp = &Qryp->Colresp; crp = *pcrp; )
|
||||
if (SkipColumn(crp, skc)) {
|
||||
// Ignore this column
|
||||
|
@ -205,95 +205,95 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
|
|||
} else
|
||||
pcrp = &crp->Next;
|
||||
|
||||
if (!Rblkp) {
|
||||
strcpy(g->Message, MSG(NO_DEF_PIVOTCOL));
|
||||
goto err;
|
||||
} else if (!fncrp) {
|
||||
strcpy(g->Message, MSG(NO_DEF_FNCCOL));
|
||||
goto err;
|
||||
} // endif
|
||||
if (!Rblkp) {
|
||||
strcpy(g->Message, MSG(NO_DEF_PIVOTCOL));
|
||||
goto err;
|
||||
} else if (!fncrp) {
|
||||
strcpy(g->Message, MSG(NO_DEF_FNCCOL));
|
||||
goto err;
|
||||
} // endif
|
||||
|
||||
if (Tabsrc) {
|
||||
Myc.Close();
|
||||
b = false;
|
||||
if (Tabsrc) {
|
||||
Myc.Close();
|
||||
b = false;
|
||||
|
||||
// Before calling sort, initialize all
|
||||
nblin = Qryp->Nblin;
|
||||
// Before calling sort, initialize all
|
||||
nblin = Qryp->Nblin;
|
||||
|
||||
Index.Size = nblin * sizeof(int);
|
||||
Index.Sub = TRUE; // Should be small enough
|
||||
Index.Size = nblin * sizeof(int);
|
||||
Index.Sub = TRUE; // Should be small enough
|
||||
|
||||
if (!PlgDBalloc(g, NULL, Index))
|
||||
goto err;
|
||||
|
||||
Offset.Size = (nblin + 1) * sizeof(int);
|
||||
Offset.Sub = TRUE; // Should be small enough
|
||||
|
||||
if (!PlgDBalloc(g, NULL, Offset))
|
||||
goto err;
|
||||
|
||||
ndif = Qsort(g, nblin);
|
||||
|
||||
if (ndif < 0) // error
|
||||
goto err;
|
||||
|
||||
} else {
|
||||
// The query was limited, we must get pivot column values
|
||||
// Returned values must be in their original character set
|
||||
// if (Myc.ExecSQL(g, "SET character_set_results=NULL", &w) == RC_FX)
|
||||
// goto err;
|
||||
|
||||
query = (char*)PlugSubAlloc(g, NULL, 0);
|
||||
sprintf(query, "SELECT DISTINCT `%s` FROM `%s`", Picol, Tabname);
|
||||
PlugSubAlloc(g, NULL, strlen(query) + 1);
|
||||
Myc.FreeResult();
|
||||
|
||||
// Send the source command to MySQL
|
||||
if (Myc.ExecSQL(g, query, &w) == RC_FX)
|
||||
goto err;
|
||||
|
||||
// We must have a storage query to get pivot column values
|
||||
if (!(qrp = Myc.GetResult(g, true)))
|
||||
goto err;
|
||||
|
||||
Myc.Close();
|
||||
b = false;
|
||||
|
||||
// Get the column list
|
||||
crp = qrp->Colresp;
|
||||
Rblkp = crp->Kdata;
|
||||
ndif = qrp->Nblin;
|
||||
} // endif Tabsrc
|
||||
|
||||
// Allocate the Value used to retieve column names
|
||||
if (!(valp = AllocateValue(g, Rblkp->GetType(),
|
||||
Rblkp->GetVlen(),
|
||||
Rblkp->GetPrec())))
|
||||
if (!PlgDBalloc(g, NULL, Index))
|
||||
goto err;
|
||||
|
||||
// Now make the functional columns
|
||||
for (int i = 0; i < ndif; i++) {
|
||||
if (i) {
|
||||
crp = (PCOLRES)PlugSubAlloc(g, NULL, sizeof(COLRES));
|
||||
memcpy(crp, fncrp, sizeof(COLRES));
|
||||
} else
|
||||
crp = fncrp;
|
||||
Offset.Size = (nblin + 1) * sizeof(int);
|
||||
Offset.Sub = TRUE; // Should be small enough
|
||||
|
||||
// Get the value that will be the generated column name
|
||||
if (Tabsrc)
|
||||
valp->SetValue_pvblk(Rblkp, Pex[Pof[i]]);
|
||||
else
|
||||
valp->SetValue_pvblk(Rblkp, i);
|
||||
if (!PlgDBalloc(g, NULL, Offset))
|
||||
goto err;
|
||||
|
||||
colname = valp->GetCharString(buf);
|
||||
crp->Name = PlugDup(g, colname);
|
||||
crp->Flag = 1;
|
||||
ndif = Qsort(g, nblin);
|
||||
|
||||
// Add this column
|
||||
*pcrp = crp;
|
||||
crp->Next = NULL;
|
||||
pcrp = &crp->Next;
|
||||
} // endfor i
|
||||
if (ndif < 0) // error
|
||||
goto err;
|
||||
|
||||
} else {
|
||||
// The query was limited, we must get pivot column values
|
||||
// Returned values must be in their original character set
|
||||
// if (Myc.ExecSQL(g, "SET character_set_results=NULL", &w) == RC_FX)
|
||||
// goto err;
|
||||
|
||||
query = (char*)PlugSubAlloc(g, NULL, 0);
|
||||
sprintf(query, "SELECT DISTINCT `%s` FROM `%s`", Picol, Tabname);
|
||||
PlugSubAlloc(g, NULL, strlen(query) + 1);
|
||||
Myc.FreeResult();
|
||||
|
||||
// Send the source command to MySQL
|
||||
if (Myc.ExecSQL(g, query, &w) == RC_FX)
|
||||
goto err;
|
||||
|
||||
// We must have a storage query to get pivot column values
|
||||
if (!(qrp = Myc.GetResult(g, true)))
|
||||
goto err;
|
||||
|
||||
Myc.Close();
|
||||
b = false;
|
||||
|
||||
// Get the column list
|
||||
crp = qrp->Colresp;
|
||||
Rblkp = crp->Kdata;
|
||||
ndif = qrp->Nblin;
|
||||
} // endif Tabsrc
|
||||
|
||||
// Allocate the Value used to retieve column names
|
||||
if (!(valp = AllocateValue(g, Rblkp->GetType(),
|
||||
Rblkp->GetVlen(),
|
||||
Rblkp->GetPrec())))
|
||||
goto err;
|
||||
|
||||
// Now make the functional columns
|
||||
for (int i = 0; i < ndif; i++) {
|
||||
if (i) {
|
||||
crp = (PCOLRES)PlugSubAlloc(g, NULL, sizeof(COLRES));
|
||||
memcpy(crp, fncrp, sizeof(COLRES));
|
||||
} else
|
||||
crp = fncrp;
|
||||
|
||||
// Get the value that will be the generated column name
|
||||
if (Tabsrc)
|
||||
valp->SetValue_pvblk(Rblkp, Pex[Pof[i]]);
|
||||
else
|
||||
valp->SetValue_pvblk(Rblkp, i);
|
||||
|
||||
colname = valp->GetCharString(buf);
|
||||
crp->Name = PlugDup(g, colname);
|
||||
crp->Flag = 1;
|
||||
|
||||
// Add this column
|
||||
*pcrp = crp;
|
||||
crp->Next = NULL;
|
||||
pcrp = &crp->Next;
|
||||
} // endfor i
|
||||
|
||||
// We added ndif columns and removed 2 (picol and fncol)
|
||||
Qryp->Nbcol += (ndif - 2);
|
||||
|
@ -306,10 +306,10 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
|
|||
} // end catch
|
||||
|
||||
err:
|
||||
if (b)
|
||||
Myc.Close();
|
||||
if (b)
|
||||
Myc.Close();
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
} // end of MakePivotColumns
|
||||
|
||||
/***********************************************************************/
|
||||
|
|
|
@ -429,7 +429,7 @@ PTDB TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp, bool b)
|
|||
char buf[MAX_STR];
|
||||
|
||||
strcpy(buf, g->Message);
|
||||
sprintf(g->Message, "Error accessing %s.%s: %s", db, name, buf);
|
||||
snprintf(g->Message, MAX_STR, "Error accessing %s.%s: %s", db, name, buf);
|
||||
hc->tshp = NULL;
|
||||
goto err;
|
||||
} // endif Define
|
||||
|
|
Loading…
Reference in a new issue