summaryrefslogtreecommitdiff
path: root/storage/connect/filamdbf.cpp
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2013-02-11 00:31:03 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2013-02-11 00:31:03 +0100
commitf6ca3b05f230498ede5f4d2467719d529abbb14a (patch)
tree837b0f2bc017208312a51b1b546bc693c09d5e7c /storage/connect/filamdbf.cpp
parentb93db097a3bca6273e2906de4cafe2a1a60ededf (diff)
downloadmariadb-git-f6ca3b05f230498ede5f4d2467719d529abbb14a.tar.gz
Bug fixed: Column charset were not handled on read.
Modified: ha_connect.cc (MakeRecord) Moved PlgAllocResult to plgdbutl.cpp Modified: mycat.cpp plgdbutl.cpp Continuing implementing the "catalog" tables (ex "info"). Already existing were the ODBC data source table and the WMI column info table. The common way to handle them was modified to enable each table types to send personalized data. Now takes care of all existing catalog functions for table types that can retrieve and use such information. Modified: ha_connect.cc odbconn.cpp tabodbc.h tabodbc.cpp tabfmt.h tabfmt.cpp tabmysql.h tabmysql.cpp tabwmi.h tabwmi.cpp myconn.h myconn.cpp filamdbf.cpp plgdbsem.h reldef.h reldef.cpp tabdos.h tabdos.cpp tabfix.h xtable.h table.cpp
Diffstat (limited to 'storage/connect/filamdbf.cpp')
-rw-r--r--storage/connect/filamdbf.cpp74
1 files changed, 38 insertions, 36 deletions
diff --git a/storage/connect/filamdbf.cpp b/storage/connect/filamdbf.cpp
index e8aace3fc06..29cfb70c116 100644
--- a/storage/connect/filamdbf.cpp
+++ b/storage/connect/filamdbf.cpp
@@ -48,8 +48,6 @@
/***********************************************************************/
#include "global.h"
#include "plgdbsem.h"
-//#include "catalog.h"
-//#include "kindex.h"
#include "filamdbf.h"
#include "tabdos.h"
#include "valblk.h"
@@ -65,12 +63,6 @@
#define DBFTYPE 3 /* value of bits 0 and 1 if .dbf */
#define EOH 0x0D /* end-of-header marker in .dbf file */
-/****************************************************************************/
-/* Catalog utility function. */
-/****************************************************************************/
-PQRYRES PlgAllocResult(PGLOBAL, int, int, int, int *, int *,
- unsigned int *, bool blank = true, bool nonull = false);
-
extern "C" int trace; // The general trace value
/****************************************************************************/
@@ -186,10 +178,12 @@ static int dbfhead(PGLOBAL g, FILE *file, PSZ fn, DBFHEADER *buf)
/****************************************************************************/
PQRYRES DBFColumns(PGLOBAL g, char *fn, BOOL info)
{
- static int dbtype[] = {DB_CHAR, DB_SHORT, DB_CHAR,
- DB_INT, DB_INT, DB_SHORT};
- static int buftyp[] = {TYPE_STRING, TYPE_SHORT, TYPE_STRING,
- TYPE_INT, TYPE_INT, TYPE_SHORT};
+ static int dbtype[] = {DB_CHAR, DB_SHORT, DB_CHAR,
+ DB_INT, DB_INT, DB_SHORT};
+ static int buftyp[] = {TYPE_STRING, TYPE_SHORT, TYPE_STRING,
+ TYPE_INT, TYPE_INT, TYPE_SHORT};
+ static XFLD fldtyp[] = {FLD_NAME, FLD_TYPE, FLD_TYPENAME,
+ FLD_PREC, FLD_LENGTH, FLD_SCALE};
static unsigned int length[] = {11, 6, 8, 10, 10, 6};
char buf[2], filename[_MAX_PATH];
int ncol = sizeof(dbtype) / sizeof(int);
@@ -204,35 +198,41 @@ PQRYRES DBFColumns(PGLOBAL g, char *fn, BOOL info)
if (trace)
htrc("DBFColumns: File %s\n", SVP(fn));
- if (!fn) {
- strcpy(g->Message, MSG(MISSING_FNAME));
- return NULL;
- } // endif fn
+ if (!info) {
+ if (!fn) {
+ strcpy(g->Message, MSG(MISSING_FNAME));
+ return NULL;
+ } // endif fn
- /**************************************************************************/
- /* Open the input file. */
- /**************************************************************************/
- PlugSetPath(filename, fn, PlgGetDataPath(g));
+ /************************************************************************/
+ /* Open the input file. */
+ /************************************************************************/
+ PlugSetPath(filename, fn, PlgGetDataPath(g));
- if (!(infile= global_fopen(g, MSGID_CANNOT_OPEN, filename, "rb")))
- return NULL;
+ if (!(infile= global_fopen(g, MSGID_CANNOT_OPEN, filename, "rb")))
+ return NULL;
- /**************************************************************************/
- /* Get the first 32 bytes of the header. */
- /**************************************************************************/
- if ((rc = dbfhead(g, infile, filename, &mainhead)) == RC_FX) {
- fclose(infile);
- return NULL;
- } // endif dbfhead
+ /************************************************************************/
+ /* Get the first 32 bytes of the header. */
+ /************************************************************************/
+ if ((rc = dbfhead(g, infile, filename, &mainhead)) == RC_FX) {
+ fclose(infile);
+ return NULL;
+ } // endif dbfhead
+
+ /************************************************************************/
+ /* Allocate the structures used to refer to the result set. */
+ /************************************************************************/
+ fields = mainhead.Fields;
+ } else
+ fields = 0;
- /**************************************************************************/
- /* Allocate the structures used to refer to the result set. */
- /**************************************************************************/
-//fields = (mainhead.Headlen - 33) / 32;
- fields = mainhead.Fields;
qrp = PlgAllocResult(g, ncol, fields, IDS_COLUMNS + 3,
- dbtype, buftyp, length);
- qrp->Info = info || (rc == RC_INFO);
+ dbtype, buftyp, fldtyp, length, true, false);
+//qrp->Info = info || (rc == RC_INFO);
+
+ if (info)
+ return qrp;
if (trace) {
htrc("Structure of %s\n", filename);
@@ -316,6 +316,7 @@ PQRYRES DBFColumns(PGLOBAL g, char *fn, BOOL info)
qrp->Nblin = field;
fclose(infile);
+#if 0
if (info) {
/************************************************************************/
/* Prepare return message for dbfinfo command. */
@@ -330,6 +331,7 @@ PQRYRES DBFColumns(PGLOBAL g, char *fn, BOOL info)
strcat(g->Message, buf);
} // endif info
+#endif // 0
/**************************************************************************/
/* Return the result pointer for use by GetData routines. */