mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
- Fix crash on making an XML table with encoding=XXX
- Set parameters so libxml2 does not anymore add extra characters when retrieving several subnodes of a node. - Make a CONNECT file header (was PlugDB) modified: storage/connect/domdoc.cpp storage/connect/libdoc.cpp storage/connect/tabxml.cpp - Change the version number modified: storage/connect/ha_connect.cc - Begin eliminate use of libmysql functions in MYSQL table type Not finished yet modified: storage/connect/myconn.cpp storage/connect/myconn.h
This commit is contained in:
@@ -217,10 +217,17 @@ PXLIST DOMDOC::NewPlist(PGLOBAL g)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
int DOMDOC::DumpDoc(PGLOBAL g, char *ofn)
|
int DOMDOC::DumpDoc(PGLOBAL g, char *ofn)
|
||||||
{
|
{
|
||||||
if (TestHr(g, Docp->save(ofn)))
|
int rc = 0;
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
try {
|
||||||
|
Docp->save(ofn);
|
||||||
|
} catch(_com_error e) {
|
||||||
|
sprintf(g->Message, "%s: %s", MSG(COM_ERROR),
|
||||||
|
_com_util::ConvertBSTRToString(e.Description()));
|
||||||
|
rc = -1;
|
||||||
|
} catch(...) {}
|
||||||
|
|
||||||
|
return rc;
|
||||||
} // end of Dump
|
} // end of Dump
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
@@ -152,7 +152,7 @@ extern "C" char nmfile[];
|
|||||||
extern "C" char pdebug[];
|
extern "C" char pdebug[];
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
char version[]= "Version 1.01.0001 February 08, 2013";
|
char version[]= "Version 1.01.0002 February 19, 2013";
|
||||||
|
|
||||||
#if defined(XMSG)
|
#if defined(XMSG)
|
||||||
char msglang[]; // Default message language
|
char msglang[]; // Default message language
|
||||||
@@ -2923,7 +2923,9 @@ int ha_connect::external_lock(THD *thd, int lock_type)
|
|||||||
|
|
||||||
} // endif Mode
|
} // endif Mode
|
||||||
|
|
||||||
rc= CloseTable(g);
|
if (CloseTable(g))
|
||||||
|
rc= HA_ERR_INTERNAL_ERROR;
|
||||||
|
|
||||||
} // endif tdbp
|
} // endif tdbp
|
||||||
|
|
||||||
DBUG_RETURN(rc);
|
DBUG_RETURN(rc);
|
||||||
|
@@ -92,7 +92,7 @@ LIBXMLDOC::LIBXMLDOC(char *nsl, char *nsdf, char *enc, PFBLOCK fp)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
bool LIBXMLDOC::Initialize(PGLOBAL g)
|
bool LIBXMLDOC::Initialize(PGLOBAL g)
|
||||||
{
|
{
|
||||||
//int n = xmlKeepBlanksDefault(0);
|
int n = xmlKeepBlanksDefault(1);
|
||||||
return MakeNSlist(g);
|
return MakeNSlist(g);
|
||||||
} // end of Initialize
|
} // end of Initialize
|
||||||
|
|
||||||
@@ -221,7 +221,7 @@ PXLIST LIBXMLDOC::NewPlist(PGLOBAL g)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
int LIBXMLDOC::DumpDoc(PGLOBAL g, char *ofn)
|
int LIBXMLDOC::DumpDoc(PGLOBAL g, char *ofn)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc = 0;
|
||||||
FILE *of;
|
FILE *of;
|
||||||
|
|
||||||
if (!(of= global_fopen(g, MSGID_CANNOT_OPEN, ofn, "w")))
|
if (!(of= global_fopen(g, MSGID_CANNOT_OPEN, ofn, "w")))
|
||||||
@@ -229,7 +229,13 @@ int LIBXMLDOC::DumpDoc(PGLOBAL g, char *ofn)
|
|||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
// This function does not crash (
|
// This function does not crash (
|
||||||
rc = xmlSaveFormatFileEnc((const char *)ofn, Docp, Encoding, 0);
|
if (xmlSaveFormatFileEnc((const char *)ofn, Docp, Encoding, 0) < 0) {
|
||||||
|
xmlErrorPtr err = xmlGetLastError();
|
||||||
|
|
||||||
|
strcpy(g->Message, (err) ? err->message : "Error saving XML doc"
|
||||||
|
);
|
||||||
|
rc = -1;
|
||||||
|
} // endif Save
|
||||||
// rc = xmlDocDump(of, Docp);
|
// rc = xmlDocDump(of, Docp);
|
||||||
#else // 0
|
#else // 0
|
||||||
// Until this function is fixed, do the job ourself
|
// Until this function is fixed, do the job ourself
|
||||||
@@ -465,6 +471,7 @@ char *XML2NODE::GetText(char *buf, int len)
|
|||||||
bool b = false;
|
bool b = false;
|
||||||
int rc = ((PXDOC2)Doc)->Decode(Content, buf, len);
|
int rc = ((PXDOC2)Doc)->Decode(Content, buf, len);
|
||||||
|
|
||||||
|
#if 0
|
||||||
// Eliminate extra characters
|
// Eliminate extra characters
|
||||||
for (p1 = p2 = buf; *p1; p1++)
|
for (p1 = p2 = buf; *p1; p1++)
|
||||||
if (strchr(" \t\r\n", *p1)) {
|
if (strchr(" \t\r\n", *p1)) {
|
||||||
@@ -482,6 +489,7 @@ char *XML2NODE::GetText(char *buf, int len)
|
|||||||
*(p2 - 1) = 0;
|
*(p2 - 1) = 0;
|
||||||
else
|
else
|
||||||
*p2 = 0;
|
*p2 = 0;
|
||||||
|
#endif // 0
|
||||||
|
|
||||||
if (trace)
|
if (trace)
|
||||||
htrc("GetText buf='%s' len=%d rc=%d\n", buf, len, rc);
|
htrc("GetText buf='%s' len=%d rc=%d\n", buf, len, rc);
|
||||||
|
@@ -328,6 +328,7 @@ bool MYSQLC::Connected(void)
|
|||||||
|
|
||||||
} // end of Connected
|
} // end of Connected
|
||||||
|
|
||||||
|
#if 0 // Not used
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Returns the thread ID of the current MySQL connection. */
|
/* Returns the thread ID of the current MySQL connection. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -345,14 +346,15 @@ const char *MYSQLC::ServerInfo(void)
|
|||||||
} // end of ServerInfo
|
} // end of ServerInfo
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Returns the version number of the server as a number that */
|
/* Returns the version number of the server as a number that */
|
||||||
/* represents the MySQL server version in this format: */
|
/* represents the MySQL server version in this format: */
|
||||||
/* major_version*10000 + minor_version *100 + sub_version */
|
/* major_version*10000 + minor_version *100 + sub_version */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
ulong MYSQLC::ServerVersion(void)
|
ulong MYSQLC::ServerVersion(void)
|
||||||
{
|
{
|
||||||
return (m_DB) ? mysql_get_server_version(m_DB) : 0;
|
return (m_DB) ? mysql_get_server_version(m_DB) : 0;
|
||||||
} // end of ServerVersion
|
} // end of ServerVersion
|
||||||
|
#endif // 0
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/* KillQuery: Send MySQL a Kill Query command. */
|
/* KillQuery: Send MySQL a Kill Query command. */
|
||||||
@@ -421,7 +423,8 @@ int MYSQLC::ExecSQL(PGLOBAL g, const char *query, int *w)
|
|||||||
if (m_Rows >= 0)
|
if (m_Rows >= 0)
|
||||||
return RC_OK; // Already done
|
return RC_OK; // Already done
|
||||||
|
|
||||||
if (mysql_query(m_DB, query) != 0) {
|
//if (mysql_query(m_DB, query) != 0) {
|
||||||
|
if (mysql_real_query(m_DB, query, strlen(query))) {
|
||||||
char *msg = (char*)PlugSubAlloc(g, NULL, 512 + strlen(query));
|
char *msg = (char*)PlugSubAlloc(g, NULL, 512 + strlen(query));
|
||||||
|
|
||||||
sprintf(msg, "(%d) %s [%s]", mysql_errno(m_DB),
|
sprintf(msg, "(%d) %s [%s]", mysql_errno(m_DB),
|
||||||
|
@@ -62,8 +62,8 @@ class DllItem MYSQLC {
|
|||||||
int Open(PGLOBAL g, const char *host, const char *db,
|
int Open(PGLOBAL g, const char *host, const char *db,
|
||||||
const char *user= "root", const char *pwd= "*",
|
const char *user= "root", const char *pwd= "*",
|
||||||
int pt= 0);
|
int pt= 0);
|
||||||
ulong GetThreadID(void);
|
//ulong GetThreadID(void);
|
||||||
ulong ServerVersion(void);
|
//ulong ServerVersion(void);
|
||||||
const char *ServerInfo(void);
|
const char *ServerInfo(void);
|
||||||
int KillQuery(ulong id);
|
int KillQuery(ulong id);
|
||||||
int ExecSQL(PGLOBAL g, const char *query, int *w = NULL);
|
int ExecSQL(PGLOBAL g, const char *query, int *w = NULL);
|
||||||
|
@@ -496,8 +496,9 @@ bool TDBXML::Initialize(PGLOBAL g)
|
|||||||
goto error;
|
goto error;
|
||||||
} // endif NewDoc
|
} // endif NewDoc
|
||||||
|
|
||||||
// Add a PlugDB comment node
|
// Add a CONNECT comment node
|
||||||
sprintf(buf, MSG(CREATED_PLUGDB), version);
|
// sprintf(buf, MSG(CREATED_PLUGDB), version);
|
||||||
|
sprintf(buf, " Created by CONNECT %s ", version);
|
||||||
Docp->AddComment(g, buf);
|
Docp->AddComment(g, buf);
|
||||||
|
|
||||||
if (XmlDB) {
|
if (XmlDB) {
|
||||||
@@ -914,7 +915,14 @@ void TDBXML::CloseDB(PGLOBAL g)
|
|||||||
TabNode->AddText(g, "\n");
|
TabNode->AddText(g, "\n");
|
||||||
|
|
||||||
// Save the modified document
|
// Save the modified document
|
||||||
int rc = Docp->DumpDoc(g, filename);
|
if (Docp->DumpDoc(g, filename)) {
|
||||||
|
PushWarning(g, this);
|
||||||
|
Docp->CloseDoc(g, To_Xb);
|
||||||
|
|
||||||
|
// This causes a crash in Diagnostics_area::set_error_status
|
||||||
|
// longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
||||||
|
} // endif DumpDoc
|
||||||
|
|
||||||
} // endif Changed
|
} // endif Changed
|
||||||
|
|
||||||
// Free the document and terminate XML processing
|
// Free the document and terminate XML processing
|
||||||
|
Reference in New Issue
Block a user