48 changed files with 4001 additions and 1360 deletions
-
13storage/connect/array.cpp
-
10storage/connect/catalog.h
-
7storage/connect/checklvl.h
-
78storage/connect/connect.cc
-
8storage/connect/connect.h
-
100storage/connect/filamap.cpp
-
5storage/connect/filamap.h
-
44storage/connect/filamdbf.cpp
-
11storage/connect/filamdbf.h
-
471storage/connect/filamfix.cpp
-
6storage/connect/filamfix.h
-
397storage/connect/filamtxt.cpp
-
17storage/connect/filamtxt.h
-
278storage/connect/filamvct.cpp
-
4storage/connect/filamvct.h
-
147storage/connect/ha_connect.cc
-
3storage/connect/ha_connect.h
-
14storage/connect/maputil.cpp
-
8storage/connect/mycat.cc
-
6storage/connect/mycat.h
-
2storage/connect/mysql-test/connect/r/part_file.result
-
2storage/connect/mysql-test/connect/r/part_table.result
-
2570storage/connect/mysql-test/connect/r/updelx.result
-
4storage/connect/mysql-test/connect/t/part_file.test
-
7storage/connect/mysql-test/connect/t/part_table.test
-
25storage/connect/mysql-test/connect/t/updelx.inc
-
96storage/connect/mysql-test/connect/t/updelx.test
-
5storage/connect/plgdbsem.h
-
36storage/connect/plgdbutl.cpp
-
12storage/connect/reldef.cpp
-
7storage/connect/reldef.h
-
71storage/connect/tabdos.cpp
-
5storage/connect/tabdos.h
-
29storage/connect/tabfix.cpp
-
5storage/connect/tabfix.h
-
70storage/connect/tabfmt.cpp
-
381storage/connect/tabfmt.h
-
7storage/connect/table.cpp
-
4storage/connect/tabmul.cpp
-
3storage/connect/tabmysql.cpp
-
7storage/connect/tabodbc.cpp
-
14storage/connect/tabvct.cpp
-
247storage/connect/tabvct.h
-
4storage/connect/valblk.cpp
-
1storage/connect/value.h
-
114storage/connect/xindex.cpp
-
1storage/connect/xindex.h
-
5storage/connect/xtable.h
2570
storage/connect/mysql-test/connect/r/updelx.result
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,25 @@ |
|||
DELETE FROM t1; |
|||
INSERT INTO t1 VALUES(4, 'four'),(7,'seven'),(10,'ten'),(40,'forty'),(60,'sixty'),(81,'eighty one'),(72,'seventy two'),(11,'eleven'),(1,'one'),(35,'thirty five'),(8,'eight'); |
|||
SELECT * FROM t1; |
|||
UPDATE t1 SET msg = 'bof' WHERE id = 35; |
|||
SELECT * FROM t1; |
|||
UPDATE t1 SET msg = 'big' WHERE id > 50; |
|||
SELECT * FROM t1; |
|||
UPDATE t1 SET msg = 'updated' WHERE id IN (8,35,60,72); |
|||
SELECT * FROM t1; |
|||
UPDATE t1 SET msg = 'twin' WHERE id IN (81,10); |
|||
SELECT * FROM t1; |
|||
UPDATE t1 SET msg = 'sixty' WHERE id = 60; |
|||
SELECT * FROM t1 WHERE id = 60; |
|||
DELETE FROM t1 WHERE id = 4; |
|||
SELECT * FROM t1; |
|||
DELETE FROM t1 WHERE id IN (40,11,35); |
|||
SELECT * FROM t1; |
|||
DELETE FROM t1 WHERE id IN (4,60,1); |
|||
SELECT msg FROM t1; |
|||
DELETE FROM t1 WHERE id IN (81,72); |
|||
SELECT id FROM t1; |
|||
DELETE FROM t1 WHERE id IN (7,10); |
|||
SELECT * FROM t1; |
|||
DELETE FROM t1 WHERE id = 8; |
|||
SELECT * FROM t1; |
|||
@ -0,0 +1,96 @@ |
|||
-- source include/not_embedded.inc |
|||
let $MYSQLD_DATADIR= `select @@datadir`; |
|||
|
|||
--echo # |
|||
--echo # Testing indexed UPDATE and DELETE for all table types |
|||
--echo # |
|||
|
|||
--echo # CSV table |
|||
CREATE TABLE t1 ( |
|||
id INT KEY NOT NULL, |
|||
msg VARCHAR(32)) |
|||
ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=6; |
|||
-- source updelx.inc |
|||
ALTER TABLE t1 MAPPED=YES; |
|||
-- source updelx.inc |
|||
ALTER TABLE t1 MAPPED=NO BLOCK_SIZE=6; |
|||
-- source updelx.inc |
|||
ALTER TABLE t1 MAPPED=YES; |
|||
-- source updelx.inc |
|||
DROP TABLE t1; |
|||
|
|||
--echo # DOS table |
|||
CREATE TABLE t1 ( |
|||
id INT(4) KEY NOT NULL, |
|||
msg VARCHAR(16)) |
|||
ENGINE=CONNECT TABLE_TYPE=DOS; |
|||
-- source updelx.inc |
|||
ALTER TABLE t1 MAPPED=YES; |
|||
-- source updelx.inc |
|||
ALTER TABLE t1 MAPPED=NO BLOCK_SIZE=4; |
|||
-- source updelx.inc |
|||
ALTER TABLE t1 MAPPED=YES; |
|||
-- source updelx.inc |
|||
DROP TABLE t1; |
|||
|
|||
--echo # FIX table |
|||
CREATE TABLE t1 ( |
|||
id INT(4) KEY NOT NULL, |
|||
msg VARCHAR(16) CHARSET BINARY DISTRIB=CLUSTERED) |
|||
ENGINE=CONNECT TABLE_TYPE=FIX BLOCK_SIZE=4; |
|||
-- source updelx.inc |
|||
ALTER TABLE t1 MAPPED=YES; |
|||
-- source updelx.inc |
|||
ALTER TABLE t1 MAPPED=NO HUGE=YES; |
|||
-- source updelx.inc |
|||
DROP TABLE t1; |
|||
|
|||
--echo # BIN table |
|||
CREATE TABLE t1 ( |
|||
id INT(4) KEY NOT NULL, |
|||
msg VARCHAR(16) CHARSET BINARY DISTRIB=CLUSTERED) |
|||
ENGINE=CONNECT TABLE_TYPE=BIN BLOCK_SIZE=8; |
|||
-- source updelx.inc |
|||
ALTER TABLE t1 MAPPED=YES; |
|||
-- source updelx.inc |
|||
ALTER TABLE t1 MAPPED=NO HUGE=YES; |
|||
-- source updelx.inc |
|||
DROP TABLE t1; |
|||
|
|||
--echo # DBF table |
|||
CREATE TABLE t1 ( |
|||
id INT(4) KEY NOT NULL, |
|||
msg VARCHAR(16)) |
|||
ENGINE=CONNECT TABLE_TYPE=DBF BLOCK_SIZE=12; |
|||
-- source updelx.inc |
|||
ALTER TABLE t1 MAPPED=YES; |
|||
-- source updelx.inc |
|||
#ALTER TABLE t1 MAPPED=NO HUGE=YES; |
|||
#-- source updelx.inc |
|||
DROP TABLE t1; |
|||
|
|||
--echo # VEC table |
|||
CREATE TABLE t1 ( |
|||
id INT(4) KEY NOT NULL, |
|||
msg VARCHAR(16)) |
|||
ENGINE=CONNECT TABLE_TYPE=VEC BLOCK_SIZE=6 MAX_ROWS=16; |
|||
-- source updelx.inc |
|||
ALTER TABLE t1 MAPPED=YES; |
|||
-- source updelx.inc |
|||
ALTER TABLE t1 MAPPED=NO HUGE=YES; |
|||
-- source updelx.inc |
|||
DROP TABLE t1; |
|||
|
|||
--echo # Split VEC table (outward) |
|||
CREATE TABLE t1 ( |
|||
id INT(4) KEY NOT NULL, |
|||
msg VARCHAR(16)) |
|||
ENGINE=CONNECT TABLE_TYPE=VEC BLOCK_SIZE=6 FILE_NAME='tx.vec'; |
|||
-- source updelx.inc |
|||
ALTER TABLE t1 MAPPED=YES; |
|||
-- source updelx.inc |
|||
DROP TABLE t1; |
|||
|
|||
# Cleanup |
|||
--remove_file $MYSQLD_DATADIR/test/tx1.vec |
|||
--remove_file $MYSQLD_DATADIR/test/tx2.vec |
|||
@ -1,188 +1,193 @@ |
|||
/*************** TabFmt H Declares Source Code File (.H) ***************/ |
|||
/* Name: TABFMT.H Version 2.4 */ |
|||
/* */ |
|||
/* (C) Copyright to the author Olivier BERTRAND 2001-2014 */ |
|||
/* */ |
|||
/* This file contains the CSV and FMT classes declares. */ |
|||
/***********************************************************************/ |
|||
#include "xtable.h" // Base class declares |
|||
#include "tabdos.h" |
|||
|
|||
typedef class TDBFMT *PTDBFMT; |
|||
|
|||
/***********************************************************************/ |
|||
/* Functions used externally. */ |
|||
/***********************************************************************/ |
|||
PQRYRES CSVColumns(PGLOBAL g, const char *fn, char sep, char q, |
|||
int hdr, int mxr, bool info); |
|||
|
|||
/***********************************************************************/ |
|||
/* CSV table. */ |
|||
/***********************************************************************/ |
|||
class DllExport CSVDEF : public DOSDEF { /* Logical table description */ |
|||
friend class TDBCSV; |
|||
friend class TDBCCL; |
|||
public: |
|||
// Constructor |
|||
CSVDEF(void); |
|||
|
|||
// Implementation |
|||
virtual const char *GetType(void) {return "CSV";} |
|||
char GetSep(void) {return Sep;} |
|||
char GetQot(void) {return Qot;} |
|||
|
|||
// Methods |
|||
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); |
|||
virtual PTDB GetTable(PGLOBAL g, MODE mode); |
|||
|
|||
protected: |
|||
// Members |
|||
bool Fmtd; /* true for formatted files */ |
|||
//bool Accept; /* true if wrong lines are accepted */ |
|||
bool Header; /* true if first line contains headers */ |
|||
//int Maxerr; /* Maximum number of bad records */ |
|||
int Quoted; /* Quoting level for quoted fields */ |
|||
char Sep; /* Separator for standard CSV files */ |
|||
char Qot; /* Character for quoted strings */ |
|||
}; // end of CSVDEF |
|||
|
|||
/***********************************************************************/ |
|||
/* This is the DOS/UNIX Access Method class declaration for files */ |
|||
/* that are CSV files with columns separated by the Sep character. */ |
|||
/***********************************************************************/ |
|||
class TDBCSV : public TDBDOS { |
|||
friend class CSVCOL; |
|||
public: |
|||
// Constructor |
|||
TDBCSV(PCSVDEF tdp, PTXF txfp); |
|||
TDBCSV(PGLOBAL g, PTDBCSV tdbp); |
|||
|
|||
// Implementation |
|||
virtual AMT GetAmType(void) {return TYPE_AM_CSV;} |
|||
virtual PTDB Duplicate(PGLOBAL g) |
|||
{return (PTDB)new(g) TDBCSV(g, this);} |
|||
|
|||
// Methods |
|||
virtual PTDB CopyOne(PTABS t); |
|||
//virtual bool IsUsingTemp(PGLOBAL g); |
|||
virtual int GetBadLines(void) {return (int)Nerr;} |
|||
|
|||
// Database routines |
|||
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); |
|||
virtual bool OpenDB(PGLOBAL g); |
|||
virtual int WriteDB(PGLOBAL g); |
|||
virtual int CheckWrite(PGLOBAL g); |
|||
virtual int ReadBuffer(PGLOBAL g); // Physical file read |
|||
|
|||
// Specific routines |
|||
virtual int EstimatedLength(PGLOBAL g); |
|||
virtual bool SkipHeader(PGLOBAL g); |
|||
virtual bool CheckErr(void); |
|||
|
|||
protected: |
|||
// Members |
|||
PSZ *Field; // Field to write to current line |
|||
int *Offset; // Column offsets for current record |
|||
int *Fldlen; // Column field length for current record |
|||
bool *Fldtyp; // true for numeric fields |
|||
int Fields; // Number of fields to handle |
|||
int Nerr; // Number of bad records |
|||
int Maxerr; // Maximum number of bad records |
|||
int Quoted; // Quoting level for quoted fields |
|||
bool Accept; // true if bad lines are accepted |
|||
bool Header; // true if first line contains column headers |
|||
char Sep; // Separator |
|||
char Qot; // Quoting character |
|||
}; // end of class TDBCSV |
|||
|
|||
/***********************************************************************/ |
|||
/* Class CSVCOL: CSV access method column descriptor. */ |
|||
/* This A.M. is used for Comma Separated V(?) files. */ |
|||
/***********************************************************************/ |
|||
class CSVCOL : public DOSCOL { |
|||
friend class TDBCSV; |
|||
friend class TDBFMT; |
|||
public: |
|||
// Constructors |
|||
CSVCOL(PGLOBAL g, PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i); |
|||
CSVCOL(CSVCOL *colp, PTDB tdbp); // Constructor used in copy process |
|||
|
|||
// Implementation |
|||
virtual int GetAmType() {return TYPE_AM_CSV;} |
|||
|
|||
// Methods |
|||
virtual bool VarSize(void); |
|||
virtual void ReadColumn(PGLOBAL g); |
|||
virtual void WriteColumn(PGLOBAL g); |
|||
|
|||
protected: |
|||
// Default constructor not to be used |
|||
CSVCOL(void) {} |
|||
|
|||
// Members |
|||
int Fldnum; // Field ordinal number (0 based) |
|||
}; // end of class CSVCOL |
|||
|
|||
/***********************************************************************/ |
|||
/* This is the DOS/UNIX Access Method class declaration for files */ |
|||
/* whose record format is described by a Format keyword. */ |
|||
/***********************************************************************/ |
|||
class TDBFMT : public TDBCSV { |
|||
friend class CSVCOL; |
|||
//friend class FMTCOL; |
|||
public: |
|||
// Standard constructor |
|||
TDBFMT(PCSVDEF tdp, PTXF txfp) : TDBCSV(tdp, txfp) |
|||
{FldFormat = NULL; To_Fld = NULL; FmtTest = NULL; Linenum = 0;} |
|||
|
|||
// Copy constructor |
|||
TDBFMT(PGLOBAL g, PTDBFMT tdbp); |
|||
|
|||
// Implementation |
|||
virtual AMT GetAmType(void) {return TYPE_AM_FMT;} |
|||
virtual PTDB Duplicate(PGLOBAL g) |
|||
{return (PTDB)new(g) TDBFMT(g, this);} |
|||
|
|||
// Methods |
|||
virtual PTDB CopyOne(PTABS t); |
|||
|
|||
// Database routines |
|||
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); |
|||
//virtual int GetMaxSize(PGLOBAL g); |
|||
virtual bool OpenDB(PGLOBAL g); |
|||
virtual int WriteDB(PGLOBAL g); |
|||
//virtual int CheckWrite(PGLOBAL g); |
|||
virtual int ReadBuffer(PGLOBAL g); // Physical file read |
|||
|
|||
// Specific routines |
|||
virtual int EstimatedLength(PGLOBAL g); |
|||
|
|||
protected: |
|||
// Members |
|||
PSZ *FldFormat; // Field read format |
|||
void *To_Fld; // To field test buffer |
|||
int *FmtTest; // Test on ending by %n or %m |
|||
int Linenum; // Last read line |
|||
}; // end of class TDBFMT |
|||
|
|||
/***********************************************************************/ |
|||
/* This is the class declaration for the CSV catalog table. */ |
|||
/***********************************************************************/ |
|||
class TDBCCL : public TDBCAT { |
|||
public: |
|||
// Constructor |
|||
TDBCCL(PCSVDEF tdp); |
|||
|
|||
protected: |
|||
// Specific routines |
|||
virtual PQRYRES GetResult(PGLOBAL g); |
|||
|
|||
// Members |
|||
char *Fn; // The CSV file (path) name |
|||
bool Hdr; // true if first line contains headers |
|||
int Mxr; // Maximum number of bad records |
|||
int Qtd; // Quoting level for quoted fields |
|||
char Sep; // Separator for standard CSV files |
|||
}; // end of class TDBCCL |
|||
|
|||
/* ------------------------- End of TabFmt.H ------------------------- */ |
|||
/*************** TabFmt H Declares Source Code File (.H) ***************/ |
|||
/* Name: TABFMT.H Version 2.4 */ |
|||
/* */ |
|||
/* (C) Copyright to the author Olivier BERTRAND 2001-2014 */ |
|||
/* */ |
|||
/* This file contains the CSV and FMT classes declares. */ |
|||
/***********************************************************************/ |
|||
#include "xtable.h" // Base class declares |
|||
#include "tabdos.h" |
|||
|
|||
typedef class TDBFMT *PTDBFMT; |
|||
|
|||
/***********************************************************************/ |
|||
/* Functions used externally. */ |
|||
/***********************************************************************/ |
|||
PQRYRES CSVColumns(PGLOBAL g, char *dp, const char *fn, char sep, |
|||
char q, int hdr, int mxr, bool info); |
|||
|
|||
/***********************************************************************/ |
|||
/* CSV table. */ |
|||
/***********************************************************************/ |
|||
class DllExport CSVDEF : public DOSDEF { /* Logical table description */ |
|||
friend class TDBCSV; |
|||
friend class TDBCCL; |
|||
public: |
|||
// Constructor |
|||
CSVDEF(void); |
|||
|
|||
// Implementation |
|||
virtual const char *GetType(void) {return "CSV";} |
|||
char GetSep(void) {return Sep;} |
|||
char GetQot(void) {return Qot;} |
|||
|
|||
// Methods |
|||
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); |
|||
virtual PTDB GetTable(PGLOBAL g, MODE mode); |
|||
|
|||
protected: |
|||
// Members |
|||
bool Fmtd; /* true for formatted files */ |
|||
//bool Accept; /* true if wrong lines are accepted */ |
|||
bool Header; /* true if first line contains headers */ |
|||
//int Maxerr; /* Maximum number of bad records */ |
|||
int Quoted; /* Quoting level for quoted fields */ |
|||
char Sep; /* Separator for standard CSV files */ |
|||
char Qot; /* Character for quoted strings */ |
|||
}; // end of CSVDEF |
|||
|
|||
/***********************************************************************/ |
|||
/* This is the DOS/UNIX Access Method class declaration for files */ |
|||
/* that are CSV files with columns separated by the Sep character. */ |
|||
/***********************************************************************/ |
|||
class TDBCSV : public TDBDOS { |
|||
friend class CSVCOL; |
|||
public: |
|||
// Constructor |
|||
TDBCSV(PCSVDEF tdp, PTXF txfp); |
|||
TDBCSV(PGLOBAL g, PTDBCSV tdbp); |
|||
|
|||
// Implementation |
|||
virtual AMT GetAmType(void) {return TYPE_AM_CSV;} |
|||
virtual PTDB Duplicate(PGLOBAL g) |
|||
{return (PTDB)new(g) TDBCSV(g, this);} |
|||
|
|||
// Methods |
|||
virtual PTDB CopyOne(PTABS t); |
|||
//virtual bool IsUsingTemp(PGLOBAL g); |
|||
virtual int GetBadLines(void) {return (int)Nerr;} |
|||
|
|||
// Database routines |
|||
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); |
|||
virtual bool OpenDB(PGLOBAL g); |
|||
virtual int WriteDB(PGLOBAL g); |
|||
virtual int CheckWrite(PGLOBAL g); |
|||
virtual int ReadBuffer(PGLOBAL g); // Physical file read |
|||
|
|||
// Specific routines |
|||
virtual int EstimatedLength(PGLOBAL g); |
|||
virtual bool SkipHeader(PGLOBAL g); |
|||
virtual bool CheckErr(void); |
|||
|
|||
protected: |
|||
virtual bool PrepareWriting(PGLOBAL g); |
|||
|
|||
// Members |
|||
PSZ *Field; // Field to write to current line |
|||
int *Offset; // Column offsets for current record |
|||
int *Fldlen; // Column field length for current record |
|||
bool *Fldtyp; // true for numeric fields |
|||
int Fields; // Number of fields to handle |
|||
int Nerr; // Number of bad records |
|||
int Maxerr; // Maximum number of bad records |
|||
int Quoted; // Quoting level for quoted fields |
|||
bool Accept; // true if bad lines are accepted |
|||
bool Header; // true if first line contains column headers |
|||
char Sep; // Separator |
|||
char Qot; // Quoting character |
|||
}; // end of class TDBCSV |
|||
|
|||
/***********************************************************************/ |
|||
/* Class CSVCOL: CSV access method column descriptor. */ |
|||
/* This A.M. is used for Comma Separated V(?) files. */ |
|||
/***********************************************************************/ |
|||
class CSVCOL : public DOSCOL { |
|||
friend class TDBCSV; |
|||
friend class TDBFMT; |
|||
public: |
|||
// Constructors |
|||
CSVCOL(PGLOBAL g, PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i); |
|||
CSVCOL(CSVCOL *colp, PTDB tdbp); // Constructor used in copy process |
|||
|
|||
// Implementation |
|||
virtual int GetAmType() {return TYPE_AM_CSV;} |
|||
|
|||
// Methods |
|||
virtual bool VarSize(void); |
|||
virtual void ReadColumn(PGLOBAL g); |
|||
virtual void WriteColumn(PGLOBAL g); |
|||
|
|||
protected: |
|||
// Default constructor not to be used |
|||
CSVCOL(void) {} |
|||
|
|||
// Members |
|||
int Fldnum; // Field ordinal number (0 based) |
|||
}; // end of class CSVCOL |
|||
|
|||
/***********************************************************************/ |
|||
/* This is the DOS/UNIX Access Method class declaration for files */ |
|||
/* whose record format is described by a Format keyword. */ |
|||
/***********************************************************************/ |
|||
class TDBFMT : public TDBCSV { |
|||
friend class CSVCOL; |
|||
//friend class FMTCOL; |
|||
public: |
|||
// Standard constructor |
|||
TDBFMT(PCSVDEF tdp, PTXF txfp) : TDBCSV(tdp, txfp) |
|||
{FldFormat = NULL; To_Fld = NULL; FmtTest = NULL; Linenum = 0;} |
|||
|
|||
// Copy constructor |
|||
TDBFMT(PGLOBAL g, PTDBFMT tdbp); |
|||
|
|||
// Implementation |
|||
virtual AMT GetAmType(void) {return TYPE_AM_FMT;} |
|||
virtual PTDB Duplicate(PGLOBAL g) |
|||
{return (PTDB)new(g) TDBFMT(g, this);} |
|||
|
|||
// Methods |
|||
virtual PTDB CopyOne(PTABS t); |
|||
|
|||
// Database routines |
|||
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); |
|||
//virtual int GetMaxSize(PGLOBAL g); |
|||
virtual bool OpenDB(PGLOBAL g); |
|||
virtual int WriteDB(PGLOBAL g); |
|||
//virtual int CheckWrite(PGLOBAL g); |
|||
virtual int ReadBuffer(PGLOBAL g); // Physical file read |
|||
|
|||
// Specific routines |
|||
virtual int EstimatedLength(PGLOBAL g); |
|||
|
|||
protected: |
|||
virtual bool PrepareWriting(PGLOBAL g) |
|||
{strcpy(g->Message, "FMT is read only"); return true;} |
|||
|
|||
// Members |
|||
PSZ *FldFormat; // Field read format |
|||
void *To_Fld; // To field test buffer |
|||
int *FmtTest; // Test on ending by %n or %m |
|||
int Linenum; // Last read line |
|||
}; // end of class TDBFMT |
|||
|
|||
/***********************************************************************/ |
|||
/* This is the class declaration for the CSV catalog table. */ |
|||
/***********************************************************************/ |
|||
class TDBCCL : public TDBCAT { |
|||
public: |
|||
// Constructor |
|||
TDBCCL(PCSVDEF tdp); |
|||
|
|||
protected: |
|||
// Specific routines |
|||
virtual PQRYRES GetResult(PGLOBAL g); |
|||
|
|||
// Members |
|||
char *Fn; // The CSV file (path) name |
|||
bool Hdr; // true if first line contains headers |
|||
int Mxr; // Maximum number of bad records |
|||
int Qtd; // Quoting level for quoted fields |
|||
char Sep; // Separator for standard CSV files |
|||
}; // end of class TDBCCL |
|||
|
|||
/* ------------------------- End of TabFmt.H ------------------------- */ |
|||
@ -1,123 +1,124 @@ |
|||
/*************** TabVct H Declares Source Code File (.H) ***************/ |
|||
/* Name: TABVCT.H Version 3.4 */ |
|||
/* */ |
|||
/* (C) Copyright to the author Olivier BERTRAND 1999-2011 */ |
|||
/* */ |
|||
/* This file contains the TDBVCT class declares. */ |
|||
/***********************************************************************/ |
|||
#ifndef __TABVCT__ |
|||
#define __TABVCT__ |
|||
|
|||
#include "tabfix.h" |
|||
#if defined(UNIX) |
|||
//#include <string.h.SUNWCCh> |
|||
#endif |
|||
|
|||
typedef class TDBVCT *PTDBVCT; |
|||
typedef class VCTCOL *PVCTCOL; |
|||
|
|||
/***********************************************************************/ |
|||
/* VCT table. */ |
|||
/***********************************************************************/ |
|||
class DllExport VCTDEF : public DOSDEF { /* Logical table description */ |
|||
friend class TDBVCT; |
|||
friend class VCTFAM; |
|||
friend class VECFAM; |
|||
friend class VMPFAM; |
|||
public: |
|||
// Constructor |
|||
VCTDEF(void) {Split = false; Estimate = Header = 0;} |
|||
|
|||
// Implementation |
|||
virtual const char *GetType(void) {return "VCT";} |
|||
int GetEstimate(void) {return Estimate;} |
|||
|
|||
// Methods |
|||
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); |
|||
virtual PTDB GetTable(PGLOBAL g, MODE mode); |
|||
|
|||
protected: |
|||
int MakeFnPattern(char *fpat); |
|||
|
|||
// Members |
|||
bool Split; /* Columns in separate files */ |
|||
int Estimate; /* Estimated maximum size of table */ |
|||
int Header; /* 0: no, 1: separate, 2: in data file */ |
|||
}; // end of VCTDEF |
|||
|
|||
/***********************************************************************/ |
|||
/* This is the DOS/UNIX Access Method class declaration for files */ |
|||
/* in blocked vector format. In each block containing "Elements" */ |
|||
/* records, values of each columns are consecutively stored (vector). */ |
|||
/***********************************************************************/ |
|||
class DllExport TDBVCT : public TDBFIX { |
|||
friend class VCTCOL; |
|||
friend class VCTFAM; |
|||
friend class VCMFAM; |
|||
friend class VECFAM; |
|||
friend class VMPFAM; |
|||
public: |
|||
// Constructors |
|||
TDBVCT(PVCTDEF tdp, PTXF txfp); |
|||
TDBVCT(PGLOBAL g, PTDBVCT tdbp); |
|||
|
|||
// Implementation |
|||
virtual AMT GetAmType(void) {return TYPE_AM_VCT;} |
|||
virtual PTDB Duplicate(PGLOBAL g) |
|||
{return (PTDB)new(g) TDBVCT(g, this);} |
|||
bool IsSplit(void) {return ((VCTDEF*)To_Def)->Split;} |
|||
|
|||
// Methods |
|||
virtual PTDB CopyOne(PTABS t); |
|||
|
|||
// Database routines |
|||
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); |
|||
virtual bool OpenDB(PGLOBAL g); |
|||
virtual int ReadDB(PGLOBAL g); |
|||
virtual void CloseDB(PGLOBAL g); |
|||
|
|||
protected: |
|||
// Members |
|||
}; // end of class TDBVCT |
|||
|
|||
/***********************************************************************/ |
|||
/* Class VCTCOL: VCT access method column descriptor. */ |
|||
/* This A.M. is used for file having column wise organization. */ |
|||
/***********************************************************************/ |
|||
class DllExport VCTCOL : public DOSCOL { |
|||
friend class TDBVCT; |
|||
friend class VCTFAM; |
|||
friend class VCMFAM; |
|||
friend class VECFAM; |
|||
friend class VMPFAM; |
|||
friend class BGVFAM; |
|||
public: |
|||
// Constructors |
|||
VCTCOL(PGLOBAL g, PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i); |
|||
VCTCOL(VCTCOL *colp, PTDB tdbp); // Constructor used in copy process |
|||
|
|||
// Implementation |
|||
virtual int GetAmType(void) {return TYPE_AM_VCT;} |
|||
|
|||
// Methods |
|||
virtual void ReadColumn(PGLOBAL g); |
|||
virtual void WriteColumn(PGLOBAL g); |
|||
virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check); |
|||
virtual void SetOk(void); |
|||
|
|||
protected: |
|||
virtual void ReadBlock(PGLOBAL g); |
|||
virtual void WriteBlock(PGLOBAL g); |
|||
|
|||
VCTCOL(void) {} // Default constructor not to be used |
|||
|
|||
// Members |
|||
PVBLK Blk; // Block buffer |
|||
int Clen; // Internal length in table |
|||
int ColBlk; // Block pointed by column |
|||
int ColPos; // Last position read |
|||
int Modif; // Number of modified lines in block |
|||
}; // end of class VCTCOL |
|||
|
|||
#endif // __TABVCT__ |
|||
|
|||
/*************** TabVct H Declares Source Code File (.H) ***************/ |
|||
/* Name: TABVCT.H Version 3.4 */ |
|||
/* */ |
|||
/* (C) Copyright to the author Olivier BERTRAND 1999-2011 */ |
|||
/* */ |
|||
/* This file contains the TDBVCT class declares. */ |
|||
/***********************************************************************/ |
|||
#ifndef __TABVCT__ |
|||
#define __TABVCT__ |
|||
|
|||
#include "tabfix.h" |
|||
#if defined(UNIX) |
|||
//#include <string.h.SUNWCCh> |
|||
#endif |
|||
|
|||
typedef class TDBVCT *PTDBVCT; |
|||
typedef class VCTCOL *PVCTCOL; |
|||
|
|||
/***********************************************************************/ |
|||
/* VCT table. */ |
|||
/***********************************************************************/ |
|||
class DllExport VCTDEF : public DOSDEF { /* Logical table description */ |
|||
friend class TDBVCT; |
|||
friend class VCTFAM; |
|||
friend class VECFAM; |
|||
friend class VMPFAM; |
|||
public: |
|||
// Constructor |
|||
VCTDEF(void) {Split = false; Estimate = Header = 0;} |
|||
|
|||
// Implementation |
|||
virtual const char *GetType(void) {return "VCT";} |
|||
int GetEstimate(void) {return Estimate;} |
|||
|
|||
// Methods |
|||
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); |
|||
virtual PTDB GetTable(PGLOBAL g, MODE mode); |
|||
|
|||
protected: |
|||
int MakeFnPattern(char *fpat); |
|||
|
|||
// Members |
|||
bool Split; /* Columns in separate files */ |
|||
int Estimate; /* Estimated maximum size of table */ |
|||
int Header; /* 0: no, 1: separate, 2: in data file */ |
|||
}; // end of VCTDEF |
|||
|
|||
/***********************************************************************/ |
|||
/* This is the DOS/UNIX Access Method class declaration for files */ |
|||
/* in blocked vector format. In each block containing "Elements" */ |
|||
/* records, values of each columns are consecutively stored (vector). */ |
|||
/***********************************************************************/ |
|||
class DllExport TDBVCT : public TDBFIX { |
|||
friend class VCTCOL; |
|||
friend class VCTFAM; |
|||
friend class VCMFAM; |
|||
friend class VECFAM; |
|||
friend class VMPFAM; |
|||
public: |
|||
// Constructors |
|||
TDBVCT(PVCTDEF tdp, PTXF txfp); |
|||
TDBVCT(PGLOBAL g, PTDBVCT tdbp); |
|||
|
|||
// Implementation |
|||
virtual AMT GetAmType(void) {return TYPE_AM_VCT;} |
|||
virtual PTDB Duplicate(PGLOBAL g) |
|||
{return (PTDB)new(g) TDBVCT(g, this);} |
|||
bool IsSplit(void) {return ((VCTDEF*)To_Def)->Split;} |
|||
|
|||
// Methods |
|||
virtual PTDB CopyOne(PTABS t); |
|||
virtual bool IsUsingTemp(PGLOBAL g); |
|||
|
|||
// Database routines |
|||
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); |
|||
virtual bool OpenDB(PGLOBAL g); |
|||
virtual int ReadDB(PGLOBAL g); |
|||
virtual void CloseDB(PGLOBAL g); |
|||
|
|||
protected: |
|||
// Members |
|||
}; // end of class TDBVCT |
|||
|
|||
/***********************************************************************/ |
|||
/* Class VCTCOL: VCT access method column descriptor. */ |
|||
/* This A.M. is used for file having column wise organization. */ |
|||
/***********************************************************************/ |
|||
class DllExport VCTCOL : public DOSCOL { |
|||
friend class TDBVCT; |
|||
friend class VCTFAM; |
|||
friend class VCMFAM; |
|||
friend class VECFAM; |
|||
friend class VMPFAM; |
|||
friend class BGVFAM; |
|||
public: |
|||
// Constructors |
|||
VCTCOL(PGLOBAL g, PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i); |
|||
VCTCOL(VCTCOL *colp, PTDB tdbp); // Constructor used in copy process |
|||
|
|||
// Implementation |
|||
virtual int GetAmType(void) {return TYPE_AM_VCT;} |
|||
|
|||
// Methods |
|||
virtual void ReadColumn(PGLOBAL g); |
|||
virtual void WriteColumn(PGLOBAL g); |
|||
virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check); |
|||
virtual void SetOk(void); |
|||
|
|||
protected: |
|||
virtual void ReadBlock(PGLOBAL g); |
|||
virtual void WriteBlock(PGLOBAL g); |
|||
|
|||
VCTCOL(void) {} // Default constructor not to be used |
|||
|
|||
// Members |
|||
PVBLK Blk; // Block buffer |
|||
int Clen; // Internal length in table |
|||
int ColBlk; // Block pointed by column |
|||
int ColPos; // Last position read |
|||
int Modif; // Number of modified lines in block |
|||
}; // end of class VCTCOL |
|||
|
|||
#endif // __TABVCT__ |
|||
|
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue