Public paste
Undefined
By: Guest | Date: Oct 28 2011 20:17 | Format: UnrealScript | Expires: never | Size: 1.45 KB | Hits: 992

  1. function getDBRefArchetypes(int aDatabaseIdx, out array<UGDB_Ref_Archetyp> aArchetypes)
  2. {
  3.   local string lQuery;
  4.   local UGDB_Ref_Archetyp lNewArchetyp;
  5.   local array<UGDB_Ref_Archetyp> lArchetypes;
  6.   local int lResIdx;
  7.  
  8.   aArchetypes.Length = 0;
  9.  
  10.   if(mRefArchetypes.Length > 0){
  11.     aArchetypes = mRefArchetypes;
  12.     return;
  13.   }
  14.  
  15.   lQuery = UGDB_Manager(GetDBManager()).getDBStatement("Cache_GetArchetypes");
  16.  
  17.   mDLLAPI.SQL_selectDatabase(aDatabaseIdx);
  18.   lResIdx = mDLLAPI.SQL_queryDatabase(lQuery);
  19.   if(lResIdx >= 0){
  20.     while(mDLLAPI.SQL_nextResult(lResIdx)){
  21.       lNewArchetyp = Spawn(class'UGDB_Ref_Archetyp');
  22.       lNewArchetyp.mDBTable = "UG_ARCHETYPES";
  23.  
  24.       `UGDB_InitString(lNewArchetyp.mName,30);
  25.       `UGDB_InitString(lNewArchetyp.mIdent,30);
  26.  
  27.       mDLLAPI.SQL_getIntVal(lResIdx, "ID", lNewArchetyp.mDBId);
  28.       mDLLAPI.SQL_getStringVal(lResIdx, "Name", lNewArchetyp.mName);
  29.       mDLLAPI.SQL_getStringVal(lResIdx, "Ident", lNewArchetyp.mIdent);
  30.  
  31.       lArchetypes[lArchetypes.Length] = lNewArchetyp;      
  32.     }
  33.   }
  34.   mRefArchetypes = lArchetypes;
  35.   aArchetypes = lArchetypes;
  36. }
  37.  
  38.  
  39.  
  40. <---
  41.  
  42. WILL BE
  43.  
  44. --->
  45. class UGDB_DataProvider_Archetyp extends DB_DataProvider;
  46.  
  47. DefaultProperties
  48. {
  49.   mCommands(0)="SELECT ID, Name, Ident FROM UG_ARCHETYPES;"
  50. }
  51.  
  52. AND
  53.  
  54.   mDPArchetypes = DB_Manager(Owner).RegisterDataProvider(mDLLAPI.Current(), class'UGDB_DataProvider_Archetyp');
  55.   mDPArchetypes.Select();