Esempio n. 1
0
	/** Moves to the first record in the set. */
	virtual void MoveToFirst()
	{
		if( !ADORecordSet->BOF || !ADORecordSet->ADOEOF )
		{
			ADORecordSet->MoveFirst();
		}
	}
Esempio n. 2
0
	/**
	 * Returns the set of column names for this Recordset.  This is useful for determining  
	 * what you can actually ask the record set for without having to hard code those ahead of time.  
	 */  
	virtual TArray<FDatabaseColumnInfo> GetColumnNames() const
	{  
		TArray<FDatabaseColumnInfo> Retval;  

		if( !ADORecordSet->BOF || !ADORecordSet->ADOEOF ) 
		{  
			ADORecordSet->MoveFirst();

			for( SWORD i = 0; i < ADORecordSet->Fields->Count; ++i )  
			{  
				_bstr_t bstrName = ADORecordSet->Fields->Item[i]->Name;  
				_variant_t varValue = ADORecordSet->Fields->Item[i]->Value;  
				ADODB::DataTypeEnum DataType = ADORecordSet->Fields->Item[i]->Type;  

				FDatabaseColumnInfo NewInfo;  
				NewInfo.ColumnName = FString((TCHAR*)_bstr_t(bstrName));  

				// from http://www.w3schools.com/ado/prop_field_type.asp#datatypeenum  
				switch( DataType )  
				{  
				case ADODB::adInteger:  
				case ADODB::adBigInt:
					NewInfo.DataType = DBT_INT;  
					break;  
				case ADODB::adSingle:  
				case ADODB::adDouble:  
					NewInfo.DataType = DBT_FLOAT;  
					break;  

				case ADODB::adWChar:
				case ADODB::adVarWChar:
					NewInfo.DataType = DBT_STRING;
					break;

				default:  
					warnf( NAME_DevDataBase, TEXT("Unable to find a EDataBaseUE3Types (%s) from DODB::DataTypeEnum DataType: %d "), *NewInfo.ColumnName, static_cast<INT>(DataType) );  
					NewInfo.DataType = DBT_UNKOWN;  
					break;  
				}  


				Retval.AddItem( NewInfo );  
			}  
		}  

		// here for debugging as this code is new.
		for( INT i = 0; i < Retval.Num(); ++ i )  
		{  
			warnf( TEXT( "ColumnName %d: Name: %s  Type: %d"), i, *Retval(i).ColumnName, static_cast<INT>(Retval(i).DataType) );  
		}  

		return Retval;  
	}