Exemplo n.º 1
0
//function to get auto incrment column index
wyInt32 
TableView::GetAutoIncrIndex()
{
	wyInt32		colindex = 0;
	MYSQL_ROW	myrow;
	wyInt32		extraval;
	wyString	myrowstr;

    //if no field res
    if(!m_mydata->m_fieldres)
    {
        return -1;
    }

    //get the column index of extra in the field res
	m_wnd->m_tunnel->mysql_data_seek(m_mydata->m_fieldres, 0);
	extraval = GetFieldIndex(m_mydata->m_fieldres, "extra", m_wnd->m_tunnel, &m_wnd->m_mysql);

    //now loop through and check for auto_increment in extra column
	while(myrow = m_wnd->m_tunnel->mysql_fetch_row(m_mydata->m_fieldres))
	{
        if(myrow[extraval] && strstr(myrow[extraval], "auto_increment")) 
        {
            return colindex;
        }
			
        colindex++;
	}

	return -1;
}
Exemplo n.º 2
0
extern int
Dbf_GetFieldIndexFromObj (Tcl_Interp * interp, DBFHandle dbfHandle,
                          Tcl_Obj * objPtr, int *indexPtr)
{
  if (objPtr->typePtr == &dbfFieldType && GetDBFHandle (objPtr) == dbfHandle)
    {  
      *indexPtr = GetFieldIndex (objPtr);
      return TCL_OK;
    }
  else
    {
      if ((*indexPtr =
           DBFGetFieldIndex (dbfHandle, Tcl_GetString (objPtr))) == -1)
        {
          Tcl_SetResult (interp, "missing value to go with key", TCL_STATIC);
          Tcl_SetErrorCode (interp, "DBF", "VALUE", "DICTIONARY", NULL);
          return TCL_ERROR;
        }
      FreeInternalRep (objPtr);
      objPtr->typePtr = &dbfFieldType;
      SetFieldIndex (objPtr, *indexPtr);
      SetDBFHandle (objPtr, dbfHandle);
      return TCL_OK;
    }
}
Exemplo n.º 3
0
	void TerrainCellRenderer::ShortCircuit(
		RenderCore::Metal::DeviceContext& metalContext,
		ShortCircuitBridge& bridge,
		uint64 cellHash, TerrainCoverageId layerId,
		uint32 nodeIndex)
	{
		auto i = LowerBound(_renderInfos, cellHash);
		if (i == _renderInfos.end() || i->first != cellHash) return;

		TileSetPtrs p(*this, *i->second, layerId);
		auto& sourceCell = *i->second->_sourceCell;
		auto nodeInCell = GetNodeInCell(sourceCell, nodeIndex);

		if (!p._tileSet || !p._tiles || nodeIndex >= p._tiles->size()) return;
		const auto& tile = (*p._tiles)[nodeIndex]._tile;
		if (!p._tileSet->IsValid(tile)) return;
		
		auto upd = bridge.GetShortCircuit(cellHash, nodeInCell.first, nodeInCell.second);
		if (upd._srv && upd._cellMinsInResource[0] < upd._cellMaxsInResource[0] && upd._cellMinsInResource[1] < upd._cellMaxsInResource[1]) {
			// LogInfo 
			// 	<< "ShortCircuit " << nodeIndex << " field:" << GetFieldIndex(sourceCell, nodeIndex) 
			// 	<< " (" << nodeInCell.first[0] << "," << nodeInCell.first[1] << ") ("
			// 	<< nodeInCell.second[0] << "," << nodeInCell.second[1] << ") -- update";
			ShortCircuitTileUpdate(
				metalContext, tile,
				(*p._tiles)[nodeIndex], layerId, GetFieldIndex(sourceCell, nodeIndex),
				Float2(0.f, 0.f), Float2(1.f, 1.f), upd);
		}
	}
Exemplo n.º 4
0
void wxStatusBarEx::SetFieldWidth(int field, int width)
{
	field = GetFieldIndex(field);
	m_columnWidths[field] = width;

	FixupFieldWidth(field);

	wxStatusBar::SetStatusWidths(GetFieldsCount(), m_columnWidths);
}
Exemplo n.º 5
0
// return the fieldType of the given fieldname..
// return F_IGNORE if the field is not found.
fieldtype_t GetFieldType(char *fieldname)
{
	int index = GetFieldIndex(fieldname);

	if (index == -1)
	{
		return F_IGNORE;
	}
	return fields[index].type;
}
Exemplo n.º 6
0
	void SmtAttribute::RemoveField(const char * fldname)
	{
		int index = GetFieldIndex(fldname);
		if (index != -1 && index  < m_lFieldCount)
		{
			SMT_SAFE_DELETE(m_pFieldPtrs[index]);
			memmove( m_pFieldPtrs + index, m_pFieldPtrs + index + 1, sizeof(void*) * (m_lFieldCount-index-1) );
			m_lFieldCount--;
		}
	}
Exemplo n.º 7
0
void wxStatusBarEx::AddChild(int field, wxWindow* pChild, int cx)
{
	t_statbar_child data;
	data.field = GetFieldIndex(field);
	data.pChild = pChild;
	data.cx = cx;

	m_children.push_back(data);

	PositionChild(data);
}
Exemplo n.º 8
0
static void
DupFieldInternalRep (Tcl_Obj * srcPtr, Tcl_Obj * dupPtr)
{
  int length;

  dupPtr->typePtr = &dbfFieldType;
  SetFieldIndex (dupPtr, GetFieldIndex (srcPtr));
  SetDBFHandle (dupPtr, GetDBFHandle (srcPtr));
  dupPtr->bytes = ckalloc ((length = srcPtr->length) + 1);
  memcpy (dupPtr->bytes, srcPtr->bytes, length + 1);
  dupPtr->length = length;
}
Exemplo n.º 9
0
const Profile::FIELD* Profile::GetField(const FIT_UINT16 mesgNum, const FIT_UINT8 fieldNum)
{
   const MESG *mesg = GetMesg(mesgNum);

   if (mesg == NULL)
      return NULL;

   FIT_UINT16 fieldIndex = GetFieldIndex(mesgNum, fieldNum);

   if (fieldIndex >= mesg->numFields)
      return NULL;

   return &(mesg->fields[fieldIndex]);
}
Exemplo n.º 10
0
const Profile::FIELD* Profile::GetField(const std::string& mesgName, const std::string& fieldName)
{
   const MESG *mesg = GetMesg(mesgName);

   if (mesg == NULL)
      return NULL;

   FIT_UINT16 fieldIndex = GetFieldIndex(mesgName, fieldName);

   if (fieldIndex >= mesg->numFields)
      return NULL;

   return &(mesg->fields[fieldIndex]);
}
Exemplo n.º 11
0
void wxStatusBarEx::RemoveChild(int field, wxWindow* pChild)
{
	field = GetFieldIndex(field);

	for (std::list<struct t_statbar_child>::iterator iter = m_children.begin(); iter != m_children.end(); iter++)
	{
		if (pChild != iter->pChild)
			continue;

		if (field != iter->field)
			continue;

		m_children.erase(iter);
		break;
	}
}
Exemplo n.º 12
0
bool CWidgetsStatusBar::AddField(int field, int idx, wxWindow* pChild)
{
	field = GetFieldIndex(field);
	if( field < 0 ) {
		return false;
	}

	t_statbar_child data;
	data.field = field;
	data.pChild = pChild;

	m_children[idx] = data;

	PositionChildren(field);

	return true;
}
Exemplo n.º 13
0
const std::string CMysqlStore::GetItemValue(unsigned long row,
											const std::string &fieldname)
{
	int index = 10000;
	if((index = GetFieldIndex(fieldname)) >= 10000)
	{
		m_err = "column index upper bound";
		return "";
	}

	row_t * rowvalue = FindRow(row);
	if(rowvalue ==  NULL)
	{
		m_err = "row index upper bound";
		m_getstatus = false;
		return "";
	}

	return (*rowvalue)[index];
}
Exemplo n.º 14
0
string COperMysql::GetItemValue(DWORD row,string &fieldname)
{
	DWORD index = 0;
	if((index = GetFieldIndex(fieldname)) >= 10000)
	{
		//m_Err = "列索引已经到达上限";
		ZeroMemory(m_szErr, sizeof(m_szErr));
		strcpy(m_szErr, "列索引已经到达上限");
		m_State = false;
		return "";
	}
	
	row_t * rowvalue = FindRow(row);
	if(rowvalue ==  NULL)
	{
		//m_Err = "行索引已经到达上限";
		ZeroMemory(m_szErr, sizeof(m_szErr));
		strcpy(m_szErr, "行索引已经到达上限");
		m_State = false;
		return "";
	}
	
	return (*rowvalue)[index];
}
Exemplo n.º 15
0
bool DatabaseUtils::GetDatabaseResults(const MediaType &mediaType, const FieldList &fields, const std::unique_ptr<dbiplus::Dataset> &dataset, DatabaseResults &results)
{
  if (dataset->num_rows() == 0)
    return true;

  const dbiplus::result_set &resultSet = dataset->get_result_set();
  unsigned int offset = results.size();

  if (fields.empty())
  {
    DatabaseResult result;
    for (unsigned int index = 0; index < resultSet.records.size(); index++)
    {
      result[FieldRow] = index + offset;
      results.push_back(result);
    }

    return true;
  }

  if (resultSet.record_header.size() < fields.size())
    return false;

  std::vector<int> fieldIndexLookup;
  fieldIndexLookup.reserve(fields.size());
  for (FieldList::const_iterator it = fields.begin(); it != fields.end(); ++it)
    fieldIndexLookup.push_back(GetFieldIndex(*it, mediaType));

  results.reserve(resultSet.records.size() + offset);
  for (unsigned int index = 0; index < resultSet.records.size(); index++)
  {
    DatabaseResult result;
    result[FieldRow] = index + offset;

    unsigned int lookupIndex = 0;
    for (FieldList::const_iterator it = fields.begin(); it != fields.end(); ++it)
    {
      int fieldIndex = fieldIndexLookup[lookupIndex++];
      if (fieldIndex < 0)
        return false;

      std::pair<Field, CVariant> value;
      value.first = *it;
      if (!GetFieldValue(resultSet.records[index]->at(fieldIndex), value.second))
        CLog::Log(LOGWARNING, "GetDatabaseResults: unable to retrieve value of field %s", resultSet.record_header[fieldIndex].name.c_str());

      if (value.first == FieldYear &&
         (mediaType == MediaTypeTvShow || mediaType == MediaTypeEpisode))
      {
        CDateTime dateTime;
        dateTime.SetFromDBDate(value.second.asString());
        if (dateTime.IsValid())
        {
          value.second.clear();
          value.second = dateTime.GetYear();
        }
      }

      result.insert(value);
    }

    result[FieldMediaType] = mediaType;
    if (mediaType == MediaTypeMovie || mediaType == MediaTypeVideoCollection ||
        mediaType == MediaTypeTvShow || mediaType == MediaTypeMusicVideo)
      result[FieldLabel] = result.at(FieldTitle).asString();
    else if (mediaType == MediaTypeEpisode)
    {
      std::ostringstream label;
      label << (int)(result.at(FieldSeason).asInteger() * 100 + result.at(FieldEpisodeNumber).asInteger());
      label << ". ";
      label << result.at(FieldTitle).asString();
      result[FieldLabel] = label.str();
    }
    else if (mediaType == MediaTypeAlbum)
      result[FieldLabel] = result.at(FieldAlbum).asString();
    else if (mediaType == MediaTypeSong)
    {
      std::ostringstream label;
      label << (int)result.at(FieldTrackNumber).asInteger();
      label << ". ";
      label << result.at(FieldTitle).asString();
      result[FieldLabel] = label.str();
    }
    else if (mediaType == MediaTypeArtist)
      result[FieldLabel] = result.at(FieldArtist).asString();

    results.push_back(result);
  }

  return true;
}
void hurricane::spout::SpoutOutputCollector::GroupDestination()
{
	_executor->GroupDestination(this, GetFieldIndex());
}
Exemplo n.º 17
0
void OGROSMLayer::SetFieldsFromTags(OGRFeature* poFeature,
                                    GIntBig nID,
                                    int bIsWayID,
                                    unsigned int nTags, OSMTag* pasTags,
                                    OSMInfo* psInfo)
{
    if( !bIsWayID )
    {
        poFeature->SetFID( nID );

        if( bHasOSMId )
        {
            char szID[32];
            sprintf(szID, CPL_FRMT_GIB, nID );
            poFeature->SetField(nIndexOSMId, szID);
        }
    }
    else
    {
        poFeature->SetFID( nID );

        if( nIndexOSMWayId >= 0 )
        {
            char szID[32];
            sprintf(szID, CPL_FRMT_GIB, nID );
            poFeature->SetField(nIndexOSMWayId, szID );
        }
    }

    if( bHasVersion )
    {
        poFeature->SetField("osm_version", psInfo->nVersion);
    }
    if( bHasTimestamp )
    {
        if( psInfo->bTimeStampIsStr )
        {
            OGRField sField;
            if (OGRParseXMLDateTime(psInfo->ts.pszTimeStamp, &sField))
            {
                poFeature->SetField("osm_timestamp", &sField);
            }
        }
        else
        {
            struct tm brokendown;
            CPLUnixTimeToYMDHMS(psInfo->ts.nTimeStamp, &brokendown);
            poFeature->SetField("osm_timestamp",
                                brokendown.tm_year + 1900,
                                brokendown.tm_mon + 1,
                                brokendown.tm_mday,
                                brokendown.tm_hour,
                                brokendown.tm_min,
                                brokendown.tm_sec,
                                0);
        }

    }
    if( bHasUID )
    {
        poFeature->SetField("osm_uid", psInfo->nUID);
    }
    if( bHasUser )
    {
        poFeature->SetField("osm_user", psInfo->pszUserSID);
    }
    if( bHasChangeset )
    {
        poFeature->SetField("osm_changeset", (int) psInfo->nChangeset);
    }

    int nAllTagsOff = 0;
    for(unsigned int j = 0; j < nTags; j++)
    {
        const char* pszK = pasTags[j].pszK;
        const char* pszV = pasTags[j].pszV;
        int nIndex = GetFieldIndex(pszK);
        if( nIndex >= 0 )
        {
            poFeature->SetField(nIndex, pszV);
            if( nIndexAllTags < 0 )
                continue;
        }
        if ( nIndexAllTags >= 0 || nIndexOtherTags >= 0 )
        {
            if ( AddInOtherOrAllTags(pszK) )
            {
                int nLenK = (int)strlen(pszK);
                int nLenV = (int)strlen(pszV);
                if( nAllTagsOff +
                    1 + 2 * nLenK + 1 +
                    2 +
                    1 + 2 * nLenV + 1 +
                    1 >= ALLTAGS_LENGTH - 1 )
                {
                    if( !bHasWarnedAllTagsTruncated )
                        CPLDebug("OSM", "all_tags/other_tags field truncated for feature " CPL_FRMT_GIB, nID);
                    bHasWarnedAllTagsTruncated = TRUE;
                    continue;
                }

                if( nAllTagsOff )
                    pszAllTags[nAllTagsOff++] = ',';
                
                nAllTagsOff += OGROSMFormatForHSTORE(pszK,
                                                     pszAllTags + nAllTagsOff);

                pszAllTags[nAllTagsOff++] = '=';
                pszAllTags[nAllTagsOff++] = '>';
                
                nAllTagsOff += OGROSMFormatForHSTORE(pszV,
                                                     pszAllTags + nAllTagsOff);
            }

#ifdef notdef
            if ( aoSetWarnKeys.find(pszK) ==
                 aoSetWarnKeys.end() )
            {
                aoSetWarnKeys.insert(pszK);
                CPLDebug("OSM_KEY", "Ignored key : %s", pszK);
            }
#endif
        }
    }

    if( nAllTagsOff )
    {
        pszAllTags[nAllTagsOff] = '\0';
        if( nIndexAllTags >= 0 )
            poFeature->SetField(nIndexAllTags, pszAllTags);
        else
            poFeature->SetField(nIndexOtherTags, pszAllTags);
    }

    for(size_t i=0; i<oComputedAttributes.size();i++)
    {
        const OGROSMComputedAttribute& oAttr = oComputedAttributes[i];
        for(size_t j=0;j<oAttr.anIndexToBind.size();j++)
        {
            if( oAttr.anIndexToBind[j] >= 0 )
            {
                if( !poFeature->IsFieldSet(oAttr.anIndexToBind[j]) )
                {
                    sqlite3_bind_null( oAttr.hStmt, j + 1 );
                }
                else
                {
                    OGRFieldType eType = poFeatureDefn->GetFieldDefn(oAttr.anIndexToBind[j])->GetType();
                    if( eType == OFTInteger )
                        sqlite3_bind_int( oAttr.hStmt, j + 1,
                                          poFeature->GetFieldAsInteger(oAttr.anIndexToBind[j]) );
                    else if( eType == OFTInteger64 )
                        sqlite3_bind_int64( oAttr.hStmt, j + 1,
                                          poFeature->GetFieldAsInteger64(oAttr.anIndexToBind[j]) );
                    else if( eType == OFTReal )
                        sqlite3_bind_double( oAttr.hStmt, j + 1,
                                             poFeature->GetFieldAsDouble(oAttr.anIndexToBind[j]) );
                    else
                        sqlite3_bind_text( oAttr.hStmt, j + 1,
                                        poFeature->GetFieldAsString(oAttr.anIndexToBind[j]),
                                        -1, SQLITE_TRANSIENT);
                }
            }
            else
            {
                int bTagFound = FALSE;
                for(unsigned int k = 0; k < nTags; k++)
                {
                    const char* pszK = pasTags[k].pszK;
                    const char* pszV = pasTags[k].pszV;
                    if( strcmp(pszK, oAttr.aosAttrToBind[j]) == 0 )
                    {
                        sqlite3_bind_text( oAttr.hStmt, j + 1, pszV, -1, SQLITE_TRANSIENT);
                        bTagFound = TRUE;
                        break;
                    }
                }
                if( !bTagFound )
                    sqlite3_bind_null( oAttr.hStmt, j + 1 );
            }
        }

        if( sqlite3_step( oAttr.hStmt ) == SQLITE_ROW &&
            sqlite3_column_count( oAttr.hStmt ) == 1 )
        {
            switch( sqlite3_column_type( oAttr.hStmt, 0 ) )
            {
                case SQLITE_INTEGER:
                    poFeature->SetField( oAttr.nIndex,
                            (GIntBig)sqlite3_column_int64(oAttr.hStmt, 0) );
                    break;
                case SQLITE_FLOAT:
                    poFeature->SetField( oAttr.nIndex,
                            sqlite3_column_double(oAttr.hStmt, 0) );
                    break;
                case SQLITE_TEXT:
                    poFeature->SetField( oAttr.nIndex,
                            (const char*)sqlite3_column_text(oAttr.hStmt, 0) );
                    break;
                default:
                    break;
            }
        }

        sqlite3_reset( oAttr.hStmt );
    }
}
Exemplo n.º 18
0
OGRErr OGRFeature::SetFrom( OGRFeature * poSrcFeature, int bForgiving )

{
    OGRErr      eErr;

    SetFID( OGRNullFID );

/* -------------------------------------------------------------------- */
/*      Set the geometry.                                               */
/* -------------------------------------------------------------------- */
    eErr = SetGeometry( poSrcFeature->GetGeometryRef() );
    if( eErr != OGRERR_NONE )
        return eErr;

/* -------------------------------------------------------------------- */
/*      Set the fields by name.                                         */
/* -------------------------------------------------------------------- */
    int         iField, iDstField;

    for( iField = 0; iField < poSrcFeature->GetFieldCount(); iField++ )
    {
        iDstField = GetFieldIndex(
            poSrcFeature->GetFieldDefnRef(iField)->GetNameRef() );

        if( iDstField == -1 )
        {
            if( bForgiving )
                continue;
            else
                return OGRERR_FAILURE;
        }

        if( !poSrcFeature->IsFieldSet(iField) )
        {
            UnsetField( iField );
            continue;
        }

        switch( poSrcFeature->GetFieldDefnRef(iField)->GetType() )
        {
          case OFTInteger:
            SetField( iDstField, poSrcFeature->GetFieldAsInteger( iField ) );
            break;

          case OFTReal:
            SetField( iDstField, poSrcFeature->GetFieldAsDouble( iField ) );
            break;

          case OFTString:
            SetField( iDstField, poSrcFeature->GetFieldAsString( iField ) );
            break;

          default:
            if( poSrcFeature->GetFieldDefnRef(iField)->GetType()
                == GetFieldDefnRef(iDstField)->GetType() )
            {
                SetField( iDstField, poSrcFeature->GetRawFieldRef(iField) );
            }
            else if( !bForgiving )
                return OGRERR_FAILURE;
            break;
        }
    }

    return OGRERR_NONE;
}
Exemplo n.º 19
0
BOOL CODBCRecordset::GetFieldValue(CHAR *szFieldName, DOUBLE *dblData)
{
	return GetFieldValue(GetFieldIndex(szFieldName), dblData);	
}
Exemplo n.º 20
0
BOOL CODBCRecordset::GetFieldValue(CHAR *szFieldName, struct tm* time)
{
	return GetFieldValue(GetFieldIndex(szFieldName), time);	
}
Exemplo n.º 21
0
bool 
QDRecordset::GetFieldValue(const char* szFieldName, unsigned char& cData)
{
	return GetFieldValue(GetFieldIndex(szFieldName), cData);	
}
Exemplo n.º 22
0
BOOL CODBCRecordset::GetFieldValue(CHAR *szFieldName, LONG *lData)
{
	return GetFieldValue(GetFieldIndex(szFieldName), lData);	
}
Exemplo n.º 23
0
bool 
QDRecordset::GetFieldValue(const char* szFieldName, long* lData)
{
	return GetFieldValue(GetFieldIndex(szFieldName), lData);	
}
Exemplo n.º 24
0
bool 
QDRecordset::GetFieldValue(const char* szFieldName, short* sData)
{
	return GetFieldValue(GetFieldIndex(szFieldName), sData);	
}
Exemplo n.º 25
0
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* ConstantFolder::LoadFromAddress(Operand* op, const Type* loadType, 
                                         __int64 offset) {
	// If the operand has a defining instruction then we try to compute
	// the offset from which we should load. If it's a variable reference
	// we try to load from the offset that was already computed.
	if(op->HasDefiningInstruction() == false) {
		return LoadFromGlobal(op, loadType, offset);
	}

	auto instr = op->DefiningInstruction();

	switch(instr->GetOpcode()) {
		case Instr_Index: {
			// If the index operand is not a constant give up.
			auto indexInstr = instr->As<IndexInstr>();
			auto indexConst = indexInstr->IndexOp()->As<IntConstant>();
			
            if(indexConst == nullptr) {
                return nullptr;
            }

			// The type of the base is 'pointer-to-array', so we need to strip the pointer.
			auto elementType = indexInstr->GetElementType();
			__int64 index = indexConst->Value();
			__int64 elemSize = TypeInfo::GetSize(elementType, target_);

			// The offset is incremented by the index multiplied with the element size.
			__int64 newOffset = offset + (index * elemSize);
			return LoadFromAddress(indexInstr->BaseOp(), loadType, newOffset);
		}
		case Instr_Element: {
			auto elemInstr = instr->As<ElementInstr>();
			__int64 index = elemInstr->GetFieldIndex();

			// The type of the base is 'pointer-to-record', 
            // so we need to strip the pointer.
			auto recordType = elemInstr->GetRecordType();

			// Obtain the offset of the selected field.
			// The new offset is the old one added with the field offset.
			__int64 fieldOffset = recordType->Fields()[index].FieldOffset;
			__int64 newOffset = offset + fieldOffset;
			return LoadFromAddress(elemInstr->BaseOp(), loadType, newOffset);
		}
		case Instr_Address: {
			// If the index operand is not a constant give up.
			auto addrInstr = instr->As<AddressInstr>();
			auto indexConst = addrInstr->IndexOp()->As<IntConstant>();

			if(indexConst == nullptr) {
                return nullptr;
            }

			// The type of the base is 'pointer-to-object',
            // so we need to strip the pointer.
			auto objectType = addrInstr->GetPointeeType();
			__int64 index = indexConst->Value();
			__int64 elemSize = TypeInfo::GetSize(objectType, target_);

			// The offset is incremented by the index multiplied with the object size.
			__int64 newOffset = offset + (index * elemSize);
			return LoadFromAddress(addrInstr->BaseOp(), loadType, newOffset);
		}
		case Instr_Ptop: {
			// This instruction is ignored (the previous recursion step
			// has already taken care about its effects).
			auto ptopInstr = instr->As<PtopInstr>();
			auto targetInstr = ptopInstr->TargetOp()->DefiningInstruction();
			return LoadFromAddress(ptopInstr->TargetOp(), loadType, offset);
		}
		case Instr_Load: {
			// This happens when the variable is a pointer.
			auto loadInstr = instr->As<LoadInstr>();
			return LoadFromAddress(loadInstr->SourceOp(), loadType, offset);
		}
		default: {
			// All other cases don't lead to a constant operand.
			return nullptr;
		}
	}
}
Exemplo n.º 26
0
bool 
QDRecordset::GetFieldValue(const char* szFieldName, float* fltData)
{
	return GetFieldValue(GetFieldIndex(szFieldName), fltData);	
}
Exemplo n.º 27
0
bool 
QDRecordset::GetFieldValue(const char* szFieldName, double* dblData)
{
	return GetFieldValue(GetFieldIndex(szFieldName), dblData);	
}
Exemplo n.º 28
0
int ASOS_Core::Process(ASOS_message *in_msg, ASOS_Node *in_node, ASOS_Protocolv1_info *pinfo){
  int ret=0;
  int index;
  ASOS_message res_msg;  res_msg.copy(in_msg);    res_msg.ModifyToResponse();
  ASOS_Object *object=NULL;

  index = GetFieldIndex((char *)in_msg->object_field_identification, in_msg->object_field_identification_length);
  printf("ASOS_Core::Process Field ID = %d\n", index);

  if(index >= 0 && MAX_OBJECT_FIELD_SIZE > index){

    if(pinfo->flag_permit_owner_only == 1 && in_msg->is_own != 1) {
      printf("Error: This command is only permitted to a owner.\n");
      res_msg.response_state = 0x03;
    }else{
      switch(pinfo->target){
      case ASOSP_FIELD: 
	Process_for_ObjectField(&(fields[index]), in_msg, &res_msg, in_node);
	break;
      case ASOSP_OBJECT: 
	object = fields[index].FindObject((char *)in_msg->object_field_extension, (char *)in_msg->object_identification, 
					  in_msg->object_identification_length);
	if(object != NULL){
	  Process_for_Object(object, in_msg, &res_msg, in_node);
	}else{
	  res_msg.response_state = 0x01;
	}
	break;
      default:
	printf("ASOS_Core::Process [ERROR] wrong taget\n");
	ret = -1;
	break;
      }    
    }
  }else{
    res_msg.response_state = 0x01;
  }

  //********************************************
  //  Send response
  //********************************************
  if(in_node != NULL && res_msg.long_polling_flag != 1 ){
    in_node->SendMessage(&res_msg);
  }
  
  //********************************************
  //  After processing
  //********************************************
  if(ret != -1 && res_msg.response_state == 0x00){
    if(index >= 0 && MAX_OBJECT_FIELD_SIZE > index){
      switch(pinfo->target){
      case ASOSP_FIELD: 
	AfterProcess_for_ObjectField(&(fields[index]), in_msg, &res_msg, in_node);
	break;
      case ASOSP_OBJECT: 
	if(object != NULL){
	  AfterProcess_for_Object(object, in_msg, &res_msg, in_node);
	}
      }
    }
  }

  //********************************************
  //  Clear temporary message buffer 
  //********************************************
  if(object != NULL){
    if(object->temp_app_message.message != NULL){
      free(object->temp_app_message.message);
      object->temp_app_message.message = NULL;
    }
  }
  
  return ret;
}
Exemplo n.º 29
0
//function to execute SELECT * query
wyInt32
TableView::ExecuteTableData()
{
	wyString        query;
    wyInt32         ret,extraindex,j=0,no_row;
    MySQLDataEx*    pdata;
	MYSQL_ROW        fieldrow;

    query.Sprintf("select * from `%s`.`%s`", m_mydata->m_db.GetString(), m_mydata->m_table.GetString());

    //get filter info
    GetFilterInfo(query);

    //get sort info
    GetSortInfo(query);

    //get limits
    GetLimits(query);

    //execut query
    m_mydata->m_datares = ExecuteQuery(query);

    //is thread stopped
	if(ThreadStopStatus())
	{	
        return TE_STOPPED;
	}

    //any error? show error dialog
	if(!m_mydata->m_datares)
	{
        return HandleErrors(query);
	}

    //allocate row array, if the thread is stopped, delete them
    if((ret = AllocateRowsExArray()) != TE_SUCCESS || 
        (ret = GetTableDetails()) != TE_SUCCESS)
    {
        pdata = ResetData(m_data);
        delete pdata;
        return ret;
    }
	extraindex = GetFieldIndex(m_wnd->m_tunnel, m_data->m_fieldres, "Extra");
	no_row = m_wnd->m_tunnel->mysql_num_rows(m_data->m_fieldres);
	m_data->m_colvirtual = (wyInt32*)calloc(no_row, sizeof(wyInt32));

	while(fieldrow = m_wnd->m_tunnel->mysql_fetch_row(m_data->m_fieldres)){

	if(!strstr(fieldrow[extraindex], "VIRTUAL") && !strstr(fieldrow[extraindex], "PERSISTENT") && !strstr(fieldrow[extraindex], "STORED"))
		{
			m_data->m_colvirtual[j++] = 0;
		}

		else 
		{
			m_data->m_colvirtual[j++] = 1;
		}
	
	}

    //add new row in the end
    AddNewRow();

    return TE_SUCCESS;
}