当前位置: 首页>>代码示例>>C++>>正文


C++ DBObjTable::DeleteField方法代码示例

本文整理汇总了C++中DBObjTable::DeleteField方法的典型用法代码示例。如果您正苦于以下问题:C++ DBObjTable::DeleteField方法的具体用法?C++ DBObjTable::DeleteField怎么用?C++ DBObjTable::DeleteField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBObjTable的用法示例。


在下文中一共展示了DBObjTable::DeleteField方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RGlibPointSubbasinCenter

DBInt RGlibPointSubbasinCenter(DBObjData *pntData, DBObjData *netData) {
    DBCoordinate massCoord;
    DBVPointIF *pntIF = new DBVPointIF(pntData);
    DBObjTable *pointTable = pntData->Table(DBrNItems);
    DBObjTableField *massCoordXFLD = pointTable->Field(RGlibMassCoordX);
    DBObjTableField *massCoordYFLD = pointTable->Field(RGlibMassCoordY);
    DBNetworkIF *netIF = new DBNetworkIF(netData);
    DBObjRecord *pointRec, *cellRec;

    if (massCoordXFLD == NULL) {
        massCoordXFLD = new DBObjTableField(RGlibMassCoordX, DBTableFieldFloat, "%10.3f", sizeof(DBFloat4));
        pointTable->AddField(massCoordXFLD);
    }
    if (massCoordYFLD == NULL) {
        massCoordYFLD = new DBObjTableField(RGlibMassCoordY, DBTableFieldFloat, "%10.3f", sizeof(DBFloat4));
        pointTable->AddField(massCoordYFLD);
    }

    for (pointRec = pntIF->FirstItem(); pointRec != (DBObjRecord *) NULL; pointRec = pntIF->NextItem()) {
        if ((pointRec->Flags() & DBObjectFlagIdle) == DBObjectFlagIdle) {
            massCoordXFLD->Float(pointRec, massCoordXFLD->FloatNoData());
            massCoordYFLD->Float(pointRec, massCoordYFLD->FloatNoData());
            continue;
        }
        if (DBPause(pointRec->RowID() * 100 / pntIF->ItemNum())) goto Stop;
        if ((cellRec = netIF->Cell(pntIF->Coordinate(pointRec))) == (DBObjRecord *) NULL)
            massCoord = pntIF->Coordinate(pointRec);
        else {
            if (netIF->CellBasinCells(cellRec) > 1) {
                massCoord.X = 0.0;
                massCoord.Y = 0.0;
                netIF->UpStreamSearch(cellRec, (DBNetworkACTION) _RGlibSubbasinCenterAction, &massCoord);
                massCoord.X = massCoord.X / (DBFloat) netIF->CellBasinCells(cellRec);
                massCoord.Y = massCoord.Y / (DBFloat) netIF->CellBasinCells(cellRec);
            }
            else massCoord = netIF->Center(cellRec);
        }
        massCoordXFLD->Float(pointRec, massCoord.X);
        massCoordYFLD->Float(pointRec, massCoord.Y);
    }
    Stop:
    if (pointRec != (DBObjRecord *) NULL) {
        pointTable->DeleteField(massCoordXFLD);
        pointTable->DeleteField(massCoordYFLD);
        return (DBFault);
    }
    return (DBSuccess);
}
开发者ID:bmfekete,项目名称:RGIS,代码行数:48,代码来源:RGlibPoint.C

示例2: _RGISGrpPanelDeleteCBK

static void _RGISGrpPanelDeleteCBK (Widget widget,RGISGrpPanel *grpPanel,XmAnyCallbackStruct *callData)

	{
	DBDataset *dataset = UIDataset ();
	DBObjData *dbData  = dataset->Data ();
	DBObjTable *groupTable = dbData->Table (DBrNGroups);
	DBObjTableField *group = grpPanel->Current ();
	static Widget fieldSelect = (Widget) NULL;

	if (fieldSelect == (Widget) NULL) fieldSelect = UISelectionCreate ((char *) "Group Selection");

	if ((groupTable == (DBObjTable *) NULL) || (group == (DBObjTableField *) NULL)) return;
	if (groupTable->FieldNum () == 1) grpPanel->Groups ((DBObjectLIST<DBObjTableField> *) NULL);
	grpPanel->Remove (group);
	groupTable->DeleteField (group);
	if (groupTable->FieldNum () == 0)
		{
		DBObjectLIST<DBObjTable> *tables  = dbData->Tables ();
		tables->Remove (groupTable);
		delete groupTable;
		}
	}
开发者ID:gyelnats,项目名称:RGIS,代码行数:22,代码来源:RGISPanels.C

示例3: main

int main (int argc,char *argv [])

	{
	int argPos, argNum = argc, ret, i, fieldNum = 0, verbose = false;
	DBObjData *data;
	char *tableName = (char *) NULL, **fieldNames;
	DBObjTable *table;
	DBObjTableField *field;

	for (argPos = 1;argPos < argNum; )
		{
		if (CMargTest (argv [argPos],"-a","--table"))
			{
			if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos)
				{ CMmsgPrint (CMmsgUsrError,"Missing table name!");   return (CMfailed); }
			tableName = argv [argPos];
			if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) break;
			continue;
			}
		if (CMargTest (argv [argPos],"-f","--field"))
			{
			if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos)
				{ CMmsgPrint (CMmsgUsrError,"Missing field name!");   return (CMfailed); }
			fieldNames = fieldNum > 0 ? (char **) realloc (fieldNames,(fieldNum + 1) * sizeof (char *)) :
												 (char **) calloc (1,sizeof (char *));
			if (fieldNames == (char **) NULL)
				{ CMmsgPrint (CMmsgSysError, "Memory allocation error in: %s %d",__FILE__,__LINE__); return (CMfailed); }
			fieldNames [fieldNum++] = argv [argPos];
			if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) break;
			continue;
			}
		if (CMargTest (argv [argPos],"-V","--verbose"))
			{
			verbose = true;
			if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) break;
			continue;
			}
		if (CMargTest (argv [argPos],"-h","--help"))
			{
			CMmsgPrint (CMmsgInfo,"%s [options] <input file> <output file>",CMprgName(argv[0]));
			CMmsgPrint (CMmsgInfo,"     -a,--table     [table name]");
			CMmsgPrint (CMmsgInfo,"     -f,--field     [field name]");
			CMmsgPrint (CMmsgInfo,"     -V,--verbose");
			CMmsgPrint (CMmsgInfo,"     -h,--help");
			return (DBSuccess);
			}
		if ((argv [argPos][0] == '-') && (strlen (argv [argPos]) > 1))
			{ CMmsgPrint (CMmsgUsrError,"Unknown option: %s!",argv [argPos]); return (CMfailed); }
		argPos++;
		}

	if (argNum > 3) { CMmsgPrint (CMmsgUsrError,"Extra arguments!"); return (CMfailed); }
	if (verbose) RGlibPauseOpen (argv[0]);

	if (tableName == (char *) NULL) tableName = DBrNItems;
	if (fieldNum < 1) { CMmsgPrint (CMmsgUsrError,"Missing field name!"); return (CMfailed); }

	data = new DBObjData ();
	if (((argNum > 1) && (strcmp (argv [1],"-") != 0) ? data->Read (argv [1]) : data->Read (stdin)) == DBFault)
		{ delete data; return (CMfailed); }

	if ((table = data->Table (tableName)) == (DBObjTable *) NULL)
		{ CMmsgPrint (CMmsgUsrError,"Invalid table: %s!",tableName); delete data; return (CMfailed); }

	for (i = 0;i < fieldNum;++i)
		{
		if ((field = table->Field (fieldNames [i])) == (DBObjTableField *) NULL)
			{ CMmsgPrint (CMmsgUsrError,"Invalid field: %s!",fieldNames [i]); continue; }
		if (DBTableFieldIsOptional (field) != true)
			{ CMmsgPrint (CMmsgUsrError,"Required field!"); continue; }
		table->DeleteField (field); 
		}

	ret = (argNum > 2) && (strcmp (argv [2],"-") != 0) ? data->Write (argv [2]) : data->Write (stdout);

	free (fieldNames);
	delete data;
	if (verbose) RGlibPauseClose ();
	return (ret);
	}
开发者ID:amiara,项目名称:RGIS,代码行数:80,代码来源:CMDtblDeleteField.C


注:本文中的DBObjTable::DeleteField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。