virtual bool get_field(doid_t do_id, const Field* field, vector<uint8_t> &value) { // Get class from the objects table const Class* dcc = get_class(do_id); if(!dcc) { return false; // Object does not exist } bool stored = is_storable(dcc->get_id()); if(!stored) { return false; // Class has no database fields } FieldList fields; fields.push_back(field); FieldValues values; get_fields_from_table(do_id, dcc, fields, values); auto val_it = values.find(field); if(val_it == values.end()) { return false; } value = val_it->second; return true; }
virtual void del_field(doid_t do_id, const Field* field) { const Class *dcc = get_class(do_id); bool storable = is_storable(dcc->get_id()); if(storable) { FieldList fields; fields.push_back(field); del_fields_in_table(do_id, dcc, fields); } }
void be_exception::getter ( ostream & os, be_Tab & tab, const DDS_StdString & sptr, unsigned long uid ) { DDS_StdString uids = BE_Globals::ulong_to_string(uid); if (m_marshalInCore) { get_core_fields(os, tab, sptr, m_fields, uid); } else { FieldList coreFields; FieldList::iterator it; for (it = m_fields.begin(); it != m_fields.end(); it++) { if ((*it)->is_core_marshaled()) { coreFields.push_back(*it); } else { if (coreFields.size()) { get_core_fields(os, tab, sptr, coreFields, uid++); coreFields.erase(); } (*it)->get_for_struct(os, tab, sptr, uid++); } } if (coreFields.size()) { get_core_fields(os, tab, sptr, coreFields, uid++); coreFields.erase(); } } }
bool DatabaseUtils::GetSelectFields(const Fields &fields, const MediaType &mediaType, FieldList &selectFields) { if (mediaType == MediaTypeNone || fields.empty()) return false; Fields sortFields = fields; // add necessary fields to create the label if (mediaType == MediaTypeSong || mediaType == MediaTypeVideo || mediaType == MediaTypeVideoCollection || mediaType == MediaTypeMusicVideo || mediaType == MediaTypeMovie || mediaType == MediaTypeTvShow || mediaType == MediaTypeEpisode) sortFields.insert(FieldTitle); if (mediaType == MediaTypeEpisode) { sortFields.insert(FieldSeason); sortFields.insert(FieldEpisodeNumber); } else if (mediaType == MediaTypeAlbum) sortFields.insert(FieldAlbum); else if (mediaType == MediaTypeSong) sortFields.insert(FieldTrackNumber); else if (mediaType == MediaTypeArtist) sortFields.insert(FieldArtist); selectFields.clear(); for (Fields::const_iterator it = sortFields.begin(); it != sortFields.end(); ++it) { // ignore FieldLabel because it needs special handling (see further up) if (*it == FieldLabel) continue; if (GetField(*it, mediaType, DatabaseQueryPartSelect).empty()) { CLog::Log(LOGDEBUG, "DatabaseUtils::GetSortFieldList: unknown field %d", *it); continue; } selectFields.push_back(*it); } return !selectFields.empty(); }
FieldList ValidateCommand :: ReadFields( const string & line, unsigned int & pos ) const { SkipSpaces( line, pos ); FieldList fl; if ( pos < line.size() && line[pos] == '*' ) { pos++; return fl; } string sf; while( pos < line.size() && ! isspace( line[pos] ) ) { sf += line[pos++]; } pos++; vector <string> tmp; ALib::Split( sf, ',', tmp ); for ( unsigned int i = 0; i < tmp.size(); i++ ) { if ( ALib::IsInteger( tmp[i] ) ) { int n = ALib::ToInteger( tmp[i] ); if ( n > 0 ) { fl.push_back ( n - 1 ); continue; } } CSVTHROW( "Invalid field list: " << sf ); } if ( fl.size() == 0 ) { CSVTHROW( "Need at least one field in rule: " << line ); } return fl; }
void MamaEntitle::parseCommandLine (int argc, const char* argv[]) { int i = 0; for (i = 1; i < argc; ) { if ((strcmp (argv[i], "-S") == 0) || (strcmp (argv[i], "-source") == 0)) { mSource = argv[i + 1]; i += 2; } else if (strcmp (argv[i], "-d") == 0) { mDictSourceName = argv[i + 1]; i += 2; } else if (strcmp (argv[i], "-dict_tport") == 0) { mDictTport = argv[i+1]; i += 2; } else if (strcmp (argv[i], "-I") == 0) { mRequireInitial = 0; i++; } else if ((strcmp (argv[i], "-h") == 0) || (strcmp (argv[i], "-?") == 0)) { usage (0); i++; } else if (strcmp (argv[i], "-s") == 0) { mSymbolList.push_back (argv[i + 1]); i += 2; } else if (strcmp (argv[i], "-f") == 0) { mFilename = argv[i + 1]; i += 2; } else if (strcmp (argv[i], "-1") == 0) { mSnapshot = 1; i++; } else if (strcmp (argv[i], "-g") == 0) { mGroupSubscription = 1; i++; } else if (strcmp (argv[i], "-q") == 0) { mQuietness++; i++; } else if (strcmp (argv[i], "-threads") == 0) { mThreads = atoi (argv[i + 1]); i += 2; } else if (strcmp (argv[i], "-tport") == 0) { mTport = argv[i+1]; i += 2; } else if (strcmp (argv[i], "-v") == 0) { if (mMamaLogLevel == MAMA_LOG_LEVEL_WARN) { mMamaLogLevel = MAMA_LOG_LEVEL_NORMAL; mama_enableLogging (stderr, MAMA_LOG_LEVEL_NORMAL); } else if (mMamaLogLevel == MAMA_LOG_LEVEL_NORMAL) { mMamaLogLevel = MAMA_LOG_LEVEL_FINE; mama_enableLogging (stderr, MAMA_LOG_LEVEL_FINE); } else if (mMamaLogLevel == MAMA_LOG_LEVEL_FINE) { mMamaLogLevel = MAMA_LOG_LEVEL_FINER; mama_enableLogging (stderr, MAMA_LOG_LEVEL_FINER); } else { mMamaLogLevel = MAMA_LOG_LEVEL_FINEST; mama_enableLogging (stderr, MAMA_LOG_LEVEL_FINEST); } i++; } else if (strcmp ("-m", argv[i]) == 0) { mMiddleware = argv[i+1]; i += 2; } else if (strcmp (argv[i], "-V") == 0) { if (mSubscLogLevel == MAMA_LOG_LEVEL_NORMAL) { mSubscLogLevel = MAMA_LOG_LEVEL_FINE; } else if (mSubscLogLevel == MAMA_LOG_LEVEL_FINE) { mSubscLogLevel = MAMA_LOG_LEVEL_FINER; } else { mSubscLogLevel = MAMA_LOG_LEVEL_FINEST; } i++; } else if (strcmp (argv[i], "-version") == 0) { printf ("%s\n", Mama::getVersion (mBridgeImpl)); exit (0); } else if (strcmp (argv[i], "-t") == 0) { mShutdownTimeout = strtol (argv[i+1], NULL, 10); i+=2; } else { mFieldList.push_back (argv[i]); i++; } } }