本文整理汇总了C++中PCOLDEF::GetOffset方法的典型用法代码示例。如果您正苦于以下问题:C++ PCOLDEF::GetOffset方法的具体用法?C++ PCOLDEF::GetOffset怎么用?C++ PCOLDEF::GetOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PCOLDEF
的用法示例。
在下文中一共展示了PCOLDEF::GetOffset方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeCol
PCOL TDBPIVOT::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
{
PCOL colp;
if (cdp->GetOffset()) {
colp = new(g) FNCCOL(cdp, this, cprec, n);
if (cdp->GetOffset() > 1)
Dcolp = colp;
} else
colp = new(g) SRCCOL(cdp, this, cprec, n);
return colp;
} // end of MakeCol
示例2: DefineAM
bool CSVDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{
char buf[8];
// Double check correctness of offset values
if (Catfunc == FNC_NO)
for (PCOLDEF cdp = To_Cols; cdp; cdp = cdp->GetNext())
if (cdp->GetOffset() < 1 && !cdp->IsSpecial()) {
strcpy(g->Message, MSG(BAD_OFFSET_VAL));
return true;
} // endif Offset
// Call DOSDEF DefineAM with am=CSV so FMT is not confused with FIX
if (DOSDEF::DefineAM(g, "CSV", poff))
return true;
GetCharCatInfo("Separator", ",", buf, sizeof(buf));
Sep = (strlen(buf) == 2 && buf[0] == '\\' && buf[1] == 't') ? '\t' : *buf;
Quoted = GetIntCatInfo("Quoted", -1);
GetCharCatInfo("Qchar", "", buf, sizeof(buf));
Qot = *buf;
if (Qot && Quoted < 0)
Quoted = 0;
else if (!Qot && Quoted >= 0)
Qot = '"';
Fmtd = (!Sep || (am && (*am == 'F' || *am == 'f')));
Header = (GetIntCatInfo("Header", 0) != 0);
Maxerr = GetIntCatInfo("Maxerr", 0);
Accept = (GetIntCatInfo("Accept", 0) != 0);
return false;
} // end of DefineAM
示例3: COLBLK
CATCOL::CATCOL(PCOLDEF cdp, PTDB tdbp, int n)
: COLBLK(cdp, tdbp, n)
{
Tdbp = (PTDBCAT)tdbp;
Crp = NULL;
Flag = cdp->GetOffset();
} // end of WMICOL constructor
示例4: COLBLK
INICOL::INICOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am)
: COLBLK(cdp, tdbp, i)
{
if (cprec) {
Next = cprec->GetNext();
cprec->SetNext(this);
} else {
Next = tdbp->GetColumns();
tdbp->SetColumns(this);
} // endif cprec
// Set additional INI access method information for column.
Valbuf = NULL;
Flag = cdp->GetOffset();
Long = cdp->GetLong();
To_Val = NULL;
} // end of INICOL constructor
示例5: COLBLK
PRXCOL::PRXCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am)
: COLBLK(cdp, tdbp, i)
{
if (cprec) {
Next = cprec->GetNext();
cprec->SetNext(this);
} else {
Next = tdbp->GetColumns();
tdbp->SetColumns(this);
} // endif cprec
// Set additional Dos access method information for column.
Long = cdp->GetLong(); // Useful ???
//strcpy(F_Date, cdp->F_Date);
Colp = NULL;
To_Val = NULL;
Pseudo = false;
Colnum = cdp->GetOffset(); // If columns are retrieved by number
if (trace)
htrc(" making new %sCOL C%d %s at %p\n", am, Index, Name, this);
} // end of PRXCOL constructor
示例6: GetSourceTable
bool TDBPIVOT::GetSourceTable(PGLOBAL g)
{
if (Tdbp)
return false; // Already done
if (!Tabsrc && Tabname) {
// Get the table description block of this table
if (!(Tdbp = GetSubTable(g, ((PPIVOTDEF)To_Def)->Tablep, true)))
return true;
if (!GBdone) {
char *colist;
PCOLDEF cdp;
if (FindDefaultColumns(g))
return true;
// Locate the suballocated colist (size is not known yet)
*(colist = (char*)PlugSubAlloc(g, NULL, 0)) = 0;
// Make the column list
for (cdp = To_Def->GetCols(); cdp; cdp = cdp->GetNext())
if (!cdp->GetOffset())
strcat(strcat(colist, cdp->GetName()), ", ");
// Add the Pivot column at the end of the list
strcat(colist, Picol);
// Now we know how much was suballocated
PlugSubAlloc(g, NULL, strlen(colist) + 1);
// Locate the source string (size is not known yet)
Tabsrc = (char*)PlugSubAlloc(g, NULL, 0);
// Start making the definition
strcat(strcat(strcpy(Tabsrc, "SELECT "), colist), ", ");
// Make it suitable for Pivot by doing the group by
strcat(strcat(Tabsrc, Function), "(");
strcat(strcat(strcat(Tabsrc, Fncol), ") "), Fncol);
strcat(strcat(Tabsrc, " FROM "), Tabname);
strcat(strcat(Tabsrc, " GROUP BY "), colist);
if (Tdbp->IsView()) // Until MariaDB bug is fixed
strcat(strcat(Tabsrc, " ORDER BY "), colist);
// Now we know how much was suballocated
PlugSubAlloc(g, NULL, strlen(Tabsrc) + 1);
} // endif !GBdone
} else if (!Tabsrc) {
strcpy(g->Message, MSG(SRC_TABLE_UNDEF));
return true;
} // endif
if (Tabsrc) {
// Get the new table description block of this source table
PTABLE tablep = new(g) XTAB("whatever", Tabsrc);
tablep->SetQualifier(Database);
if (!(Tdbp = GetSubTable(g, tablep, true)))
return true;
} // endif Tabsrc
return false;
} // end of GetSourceTable
示例7: SkipHeader
bool TDBCSV::SkipHeader(PGLOBAL g)
{
int len = GetFileLength(g);
bool rc = false;
#if defined(_DEBUG)
if (len < 0)
return true;
#endif // _DEBUG
if (Header) {
if (Mode == MODE_INSERT) {
if (!len) {
// New file, the header line must be constructed and written
int i, n = 0;
int hlen = 0;
bool q = Qot && Quoted > 0;
PCOLDEF cdp;
// Estimate the length of the header list
for (cdp = To_Def->GetCols(); cdp; cdp = cdp->GetNext()) {
hlen += (1 + strlen(cdp->GetName()));
hlen += ((q) ? 2 : 0);
n++; // Calculate the number of columns
} // endfor cdp
if (hlen > Lrecl) {
sprintf(g->Message, MSG(LRECL_TOO_SMALL), hlen);
return true;
} // endif hlen
// File is empty, write a header record
memset(To_Line, 0, Lrecl);
// The column order in the file is given by the offset value
for (i = 1; i <= n; i++)
for (cdp = To_Def->GetCols(); cdp; cdp = cdp->GetNext())
if (cdp->GetOffset() == i) {
if (q)
To_Line[strlen(To_Line)] = Qot;
strcat(To_Line, cdp->GetName());
if (q)
To_Line[strlen(To_Line)] = Qot;
if (i < n)
To_Line[strlen(To_Line)] = Sep;
} // endif Offset
rc = (Txfp->WriteBuffer(g) == RC_FX);
} // endif !FileLength
} else if (Mode == MODE_DELETE) {
if (len)
rc = (Txfp->SkipRecord(g, true) == RC_FX);
} else if (len) // !Insert && !Delete
rc = (Txfp->SkipRecord(g, false) == RC_FX || Txfp->RecordPos(g));
} // endif Header
return rc;
} // end of SkipHeader
示例8: OpenDB
bool TDBCSV::OpenDB(PGLOBAL g)
{
bool rc = false;
PCOLDEF cdp;
PDOSDEF tdp = (PDOSDEF)To_Def;
if (Use != USE_OPEN && (Columns || Mode == MODE_UPDATE)) {
// Allocate the storage used to read (or write) records
int i, len;
PCSVCOL colp;
if (!Fields) // May have been set in TABFMT::OpenDB
if (Mode != MODE_UPDATE && Mode != MODE_INSERT) {
for (colp = (PCSVCOL)Columns; colp; colp = (PCSVCOL)colp->Next)
if (!colp->IsSpecial() && !colp->IsVirtual())
Fields = MY_MAX(Fields, (int)colp->Fldnum);
if (Columns)
Fields++; // Fldnum was 0 based
} else
for (cdp = tdp->GetCols(); cdp; cdp = cdp->GetNext())
if (!cdp->IsVirtual())
Fields++;
Offset = (int*)PlugSubAlloc(g, NULL, sizeof(int) * Fields);
Fldlen = (int*)PlugSubAlloc(g, NULL, sizeof(int) * Fields);
if (Mode == MODE_INSERT || Mode == MODE_UPDATE) {
Field = (PSZ*)PlugSubAlloc(g, NULL, sizeof(PSZ) * Fields);
Fldtyp = (bool*)PlugSubAlloc(g, NULL, sizeof(bool) * Fields);
} // endif Mode
for (i = 0; i < Fields; i++) {
Offset[i] = 0;
Fldlen[i] = 0;
if (Field) {
Field[i] = NULL;
Fldtyp[i] = false;
} // endif Field
} // endfor i
if (Field)
// Prepare writing fields
if (Mode != MODE_UPDATE) {
for (colp = (PCSVCOL)Columns; colp; colp = (PCSVCOL)colp->Next)
if (!colp->IsSpecial() && !colp->IsVirtual()) {
i = colp->Fldnum;
len = colp->GetLength();
Field[i] = (PSZ)PlugSubAlloc(g, NULL, len + 1);
Field[i][len] = '\0';
Fldlen[i] = len;
Fldtyp[i] = IsTypeNum(colp->GetResultType());
} // endif colp
} else // MODE_UPDATE
for (cdp = tdp->GetCols(); cdp; cdp = cdp->GetNext())
if (!cdp->IsVirtual()) {
i = cdp->GetOffset() - 1;
len = cdp->GetLength();
Field[i] = (PSZ)PlugSubAlloc(g, NULL, len + 1);
Field[i][len] = '\0';
Fldlen[i] = len;
Fldtyp[i] = IsTypeNum(cdp->GetType());
} // endif cdp
} // endif Use
if (Header) {
// Check that the Lrecl is at least equal to the header line length
int headlen = 0;
PCOLDEF cdp;
PDOSDEF tdp = (PDOSDEF)To_Def;
for (cdp = tdp->GetCols(); cdp; cdp = cdp->GetNext())
headlen += strlen(cdp->GetName()) + 3; // 3 if names are quoted
if (headlen > Lrecl) {
Lrecl = headlen;
Txfp->Lrecl = headlen;
} // endif headlen
} // endif Header
Nerr = 0;
rc = TDBDOS::OpenDB(g);
if (!rc && Mode == MODE_UPDATE && To_Kindex)
// Because KINDEX::Init is executed in mode READ, we must restore
// the Fldlen array that was modified when reading the table file.
for (cdp = tdp->GetCols(); cdp; cdp = cdp->GetNext())
Fldlen[cdp->GetOffset() - 1] = cdp->GetLength();
return rc;
} // end of OpenDB