Example #1
0
/*
 * show what options the user has for fields for display and filtering
 */
static err_code
listOptions(
    void)
{
    int i,
        j;

    checkErr((!isROA) && (!isCRL) && (!isCert) &&
             (!isManifest) && (!isGBR), BAD_OBJECT_TYPE);
    printf("\nPossible fields to display or use in clauses for a %s:\n",
           objectType);
    for (i = 0; i < getNumFields(); i++)
    {
        if (getFields()[i].description == NULL)
            continue;
        if (((getFields()[i].flags & Q_FOR_ROA) && isROA) ||
            ((getFields()[i].flags & Q_FOR_CRL) && isCRL) ||
            ((getFields()[i].flags & Q_FOR_CERT) && isCert) ||
            ((getFields()[i].flags & Q_FOR_MAN) && isManifest) ||
            ((getFields()[i].flags & Q_FOR_GBR) && isGBR))
        {
            printf("  %s: %s\n", getFields()[i].name,
                   getFields()[i].description);
            if (getFields()[i].flags & Q_JUST_DISPLAY)
            {
                for (j = 0; j < (int)strlen(getFields()[i].name) + 4; j++)
                    printf(" ");
                printf("(Note: This can be used only for display.)\n");
            }
        }
    }
    printf("\n");
    return 0;
}
Example #2
0
// reads PROTO interfaceElements up to ]
GvBool
GvFieldData::readProtoInterface(GvInput *in, GvNode *object,GvBool externProto)
{
    GvBool gotChar;
    char   c;
  
    if (! ((gotChar = in->read(c)) || c != OPEN_BRACE_CHAR))
	return FALSE;

    if (in->read(c) && c == CLOSE_BRACE_CHAR) {
	    return TRUE;
    }

    in->putBack(c);

    GvBool alreadyHasFields = (object->isBuiltIn || getNumFields() != 0);

    // read all field / eventIn / eventOut 
    while (TRUE) {
        if (!readInterfaceElement(in,alreadyHasFields,object,!externProto)) return(FALSE);

	    if (!in->read(c))
	        return FALSE;

	    if (c == CLOSE_BRACE_CHAR)
	        break;
    
        in->putBack(c);

    } // while
	return TRUE;
}
Example #3
0
const QuickString &Record::getField(int fieldNum) const
{
    cerr << endl << "*****" << endl
         << "*****ERROR: requested column " << fieldNum <<
         " , but record only has fields 1 - " << getNumFields() << ". Exiting." << endl
          << endl << "*****" << endl;
    exit(1);
}
Example #4
0
    /** Implementation of Lookup:: method */
    const int* getFieldIDsPtr()
      {
	int len = getNumFields();
	if (len < 1) return(NULL);

	vspace_->getFields(fieldIDs_);
	return(&fieldIDs_[0]);
      }
Example #5
0
GvBool
GvFieldData::readFieldTypes(GvInput *in, GvNode *object)
{
    GvBool gotChar;
    GvName fieldType, fieldName;
    char   c;

    if (! ((gotChar = in->read(c)) || c != OPEN_BRACE_CHAR))
	return FALSE;

    if (in->read(c) && c == CLOSE_BRACE_CHAR)
	return TRUE;

    in->putBack(c);

    GvBool alreadyHasFields = (object->isBuiltIn || getNumFields() != 0);

    while (TRUE) {

        if (! in->read(fieldType, TRUE) || ! in->read(fieldName, TRUE))
            return FALSE;

		if (! alreadyHasFields) {
			GvField *fld = GvField::createInstanceFromName(fieldType);
			if (fld == NULL) {
				GvReadError::post(in,GV_RE_UNKNOWN_FIELD, "%s No such field type \"%s\" ",fieldName.getString(), fieldType.getString());
				return FALSE; // hg 16.11.99
			} else {
				fld->setContainer(object);
				addField(object, fieldName.getString(), fld);
				delete fld; 
				fld = NULL;
			}
        }

	if (! in->read(c))
	    return FALSE;

	if (c == VALUE_SEPARATOR_CHAR) {

	    if (in->read(c)) {
		if (c == CLOSE_BRACE_CHAR)
		    return TRUE;
		else
		    in->putBack(c);
	    }
	}
	else if (c == CLOSE_BRACE_CHAR)
	    return TRUE;
	else
	    return FALSE;
    }
}
Example #6
0
    void CouchbaseRowBuilder::processBeginDataset(const RtlFieldInfo * field)
    {
        /*
         *
         *childRec := RECORD real x; real y; END;
         *parentRec := RECORD
         * childRec child1,                        <-- flatens out the childrec, this function would receive a field of name x
         * dataset(childRec) child2;               <-- keeps nested structure, this funciton would receive a field of name child2
         *END;
        */

        if (getNumFields(field->type->queryChildType()) > 0)
            m_oNestedField.set(m_oResultRow->queryBranch(field->name->queryStr()));
    }
Example #7
0
GvBool
GvFieldData::readScriptInterface(GvInput *in, GvNode *object)
{
    char   c;

    if (in->read(c) && c == CLOSE_BRACE) {
	    return TRUE;
    }
    in->putBack(c);

    GvBool alreadyHasFields = (object->isBuiltIn || getNumFields() != 0);

    // read all field / eventIn / eventOut 
    while (TRUE) {
        GvName fieldName;
        GvBool foundName=FALSE;

        // read a name
        if (!in->read(fieldName, TRUE) || ! fieldName)
                return(FALSE);

         // check if built in field
	     if (! read(in, object, fieldName, foundName)) {
                if (foundName) return FALSE; // couldnĀ“t read value
         }
         
         if (!foundName)    // a field with name not found,
         {
                in->putBack(fieldName.getString());
                if (!readInterfaceElement(in,FALSE,object,TRUE)) return(FALSE);
         }

        // check for terminator 
	    if (!in->read(c))
	        return FALSE;

	    if (c == CLOSE_BRACE) {
            in->putBack(c);
	        return TRUE;
        }
	    else if (c == VALUE_SEPARATOR_CHAR) 
        ;
        else 
        in->putBack(c);

    } // while
	return TRUE;
}
Example #8
0
StoreQueryResult::StoreQueryResult(MYSQL_RES * res_, Connection * conn_, const Query * query_) : ResultBase(res_, conn_, query_)
{
    UInt64 rows = mysql_num_rows(res);
    UInt32 fields = getNumFields();
    reserve(rows);
    lengths.resize(rows * fields);

    for (UInt64 i = 0; MYSQL_ROW row = mysql_fetch_row(res); ++i)
    {
        MYSQL_LENGTHS lengths_for_row = mysql_fetch_lengths(res);
        memcpy(&lengths[i * fields], lengths_for_row, sizeof(lengths[0]) * fields);

        push_back(Row(row, this, &lengths[i * fields]));
    }
    checkError(conn->getDriver());
}
Example #9
0
/*
 * add all fields appropriate for this type (user sent '-d all')
 */
static int addAllFields(
    char *displays[],
    int numDisplays)
{
    int i;

    for (i = 0; i < getNumFields(); ++i)
    {
        if (getFields()[i].description == NULL)
            continue;
        if (((getFields()[i].flags & Q_FOR_ROA) && isROA) ||
            ((getFields()[i].flags & Q_FOR_CRL) && isCRL) ||
            ((getFields()[i].flags & Q_FOR_MAN) && isManifest) ||
            ((getFields()[i].flags & Q_FOR_CERT) && isCert) ||
            ((getFields()[i].flags & Q_FOR_GBR) && isGBR))
        {
            displays[numDisplays++] = getFields()[i].name;
        }
    }
    return numDisplays;
}
Example #10
0
bool lua_details::listTable(lua_State* L, int idx, TableInfo& out, int recursive)
{
	out.clear();

	if (lua_type(L, idx) != LUA_TTABLE)
		return false;

	UInt32 size= getNumFields(L, idx);

	out.reserve(size);

	// table to traverse
	lua_pushvalue(L, idx);

	// push a key
	lua_pushnil(L);

	popStackElements pop(L, 2);	// remove key & table off the stack at the end of this fn
//	popStackElements pop(L, 1);	// remove table off the stack at the end of this fn

	int table= lua_gettop(L) - 1;

	// traverse a table
	while (lua_next(L, table))
	{
		popStackElements pop(L, 1);

        Value Key(L, -2);
        Value Val(L, -1, recursive);
		LuaField field(Key,Val);

		out.push_back(field);
	}

	pop.dec();	// final lua_next call removed key

	return true;
}
Example #11
0
 void CouchbaseRowBuilder::processBeginRow(const RtlFieldInfo * field)
 {
     m_fieldsProcessedCount = 0;
     m_rowFieldCount = getNumFields(field->type);
 }