summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2013-02-20 01:30:37 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2013-02-20 01:30:37 +0100
commitc448839c4fd3d097d0d7271ce4752b28d6f6e1f5 (patch)
tree41a0bc55190848d71f649b1aee3133fbc388d992 /storage
parent2f48842a0fd61cfd3268293e64077bb7773dbea1 (diff)
downloadmariadb-git-c448839c4fd3d097d0d7271ce4752b28d6f6e1f5.tar.gz
- 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
Diffstat (limited to 'storage')
-rw-r--r--storage/connect/domdoc.cpp13
-rw-r--r--storage/connect/ha_connect.cc6
-rw-r--r--storage/connect/libdoc.cpp14
-rw-r--r--storage/connect/myconn.cpp9
-rw-r--r--storage/connect/myconn.h4
-rw-r--r--storage/connect/tabxml.cpp14
6 files changed, 44 insertions, 16 deletions
diff --git a/storage/connect/domdoc.cpp b/storage/connect/domdoc.cpp
index 08092d7bca5..48aef29d6d8 100644
--- a/storage/connect/domdoc.cpp
+++ b/storage/connect/domdoc.cpp
@@ -217,10 +217,17 @@ PXLIST DOMDOC::NewPlist(PGLOBAL g)
/******************************************************************/
int DOMDOC::DumpDoc(PGLOBAL g, char *ofn)
{
- if (TestHr(g, Docp->save(ofn)))
- return -1;
+ int rc = 0;
- 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
/******************************************************************/
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index 5245dab28bb..9aa0fa5b141 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -152,7 +152,7 @@ extern "C" char nmfile[];
extern "C" char pdebug[];
extern "C" {
- char version[]= "Version 1.01.0001 February 08, 2013";
+ char version[]= "Version 1.01.0002 February 19, 2013";
#if defined(XMSG)
char msglang[]; // Default message language
@@ -2923,7 +2923,9 @@ int ha_connect::external_lock(THD *thd, int lock_type)
} // endif Mode
- rc= CloseTable(g);
+ if (CloseTable(g))
+ rc= HA_ERR_INTERNAL_ERROR;
+
} // endif tdbp
DBUG_RETURN(rc);
diff --git a/storage/connect/libdoc.cpp b/storage/connect/libdoc.cpp
index d60cc49e94a..6b6e070917d 100644
--- a/storage/connect/libdoc.cpp
+++ b/storage/connect/libdoc.cpp
@@ -92,7 +92,7 @@ LIBXMLDOC::LIBXMLDOC(char *nsl, char *nsdf, char *enc, PFBLOCK fp)
/******************************************************************/
bool LIBXMLDOC::Initialize(PGLOBAL g)
{
-//int n = xmlKeepBlanksDefault(0);
+ int n = xmlKeepBlanksDefault(1);
return MakeNSlist(g);
} // end of Initialize
@@ -221,7 +221,7 @@ PXLIST LIBXMLDOC::NewPlist(PGLOBAL g)
/******************************************************************/
int LIBXMLDOC::DumpDoc(PGLOBAL g, char *ofn)
{
- int rc;
+ int rc = 0;
FILE *of;
if (!(of= global_fopen(g, MSGID_CANNOT_OPEN, ofn, "w")))
@@ -229,7 +229,13 @@ int LIBXMLDOC::DumpDoc(PGLOBAL g, char *ofn)
#if 1
// 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);
#else // 0
// Until this function is fixed, do the job ourself
@@ -465,6 +471,7 @@ char *XML2NODE::GetText(char *buf, int len)
bool b = false;
int rc = ((PXDOC2)Doc)->Decode(Content, buf, len);
+#if 0
// Eliminate extra characters
for (p1 = p2 = buf; *p1; p1++)
if (strchr(" \t\r\n", *p1)) {
@@ -482,6 +489,7 @@ char *XML2NODE::GetText(char *buf, int len)
*(p2 - 1) = 0;
else
*p2 = 0;
+#endif // 0
if (trace)
htrc("GetText buf='%s' len=%d rc=%d\n", buf, len, rc);
diff --git a/storage/connect/myconn.cpp b/storage/connect/myconn.cpp
index 027d37b86c6..dd41b16c411 100644
--- a/storage/connect/myconn.cpp
+++ b/storage/connect/myconn.cpp
@@ -328,6 +328,7 @@ bool MYSQLC::Connected(void)
} // end of Connected
+#if 0 // Not used
/***********************************************************************/
/* Returns the thread ID of the current MySQL connection. */
/***********************************************************************/
@@ -345,14 +346,15 @@ const char *MYSQLC::ServerInfo(void)
} // end of ServerInfo
/***********************************************************************/
-/* Returns the version number of the server as a number that */
-/* represents the MySQL server version in this format: */
+/* Returns the version number of the server as a number that */
+/* represents the MySQL server version in this format: */
/* major_version*10000 + minor_version *100 + sub_version */
/***********************************************************************/
ulong MYSQLC::ServerVersion(void)
{
return (m_DB) ? mysql_get_server_version(m_DB) : 0;
} // end of ServerVersion
+#endif // 0
/**************************************************************************/
/* 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)
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));
sprintf(msg, "(%d) %s [%s]", mysql_errno(m_DB),
diff --git a/storage/connect/myconn.h b/storage/connect/myconn.h
index 1aab55f1e01..f5716dcfb33 100644
--- a/storage/connect/myconn.h
+++ b/storage/connect/myconn.h
@@ -62,8 +62,8 @@ class DllItem MYSQLC {
int Open(PGLOBAL g, const char *host, const char *db,
const char *user= "root", const char *pwd= "*",
int pt= 0);
- ulong GetThreadID(void);
- ulong ServerVersion(void);
+//ulong GetThreadID(void);
+//ulong ServerVersion(void);
const char *ServerInfo(void);
int KillQuery(ulong id);
int ExecSQL(PGLOBAL g, const char *query, int *w = NULL);
diff --git a/storage/connect/tabxml.cpp b/storage/connect/tabxml.cpp
index 25d7e03073b..ea0d48dbddb 100644
--- a/storage/connect/tabxml.cpp
+++ b/storage/connect/tabxml.cpp
@@ -496,8 +496,9 @@ bool TDBXML::Initialize(PGLOBAL g)
goto error;
} // endif NewDoc
- // Add a PlugDB comment node
- sprintf(buf, MSG(CREATED_PLUGDB), version);
+ // Add a CONNECT comment node
+// sprintf(buf, MSG(CREATED_PLUGDB), version);
+ sprintf(buf, " Created by CONNECT %s ", version);
Docp->AddComment(g, buf);
if (XmlDB) {
@@ -914,7 +915,14 @@ void TDBXML::CloseDB(PGLOBAL g)
TabNode->AddText(g, "\n");
// 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
// Free the document and terminate XML processing