home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 51 / PCGamer51_17Demos.iso / games / CM / CyclingManagerDemoCangas.exe / CyclingManagerDemo / Database / TestDatabase.cnd < prev   
Text File  |  2000-11-23  |  2KB  |  67 lines

  1. func void TestDatabase()
  2. {
  3.     DatabaseManager_SetNumQuery(8);
  4.     DatabaseManager_SetNumJoins(8);
  5.  
  6.     // create subset
  7.     DatabaseSubset_Create( 1, 0);
  8.     Database_AddTables(    1, 2);
  9.     Table_SetName( 1, 0, "DYN_cyclist");
  10.     TableSubset_SelectColumns( 1, 0, "*");
  11.     Table_SetName( 1, 1, "DYN_team");
  12.     TableSubset_SelectColumns( 1, 1, "*");
  13.  
  14.     // create query
  15.     Query_Create(0, 1);
  16.     Query_SetNumJoinTables(    0, 2);
  17.     Query_SelectJoinTable(    0, 0, "DYN_cyclist");
  18.     Query_SelectJoinTable(    0, 1, "DYN_cyclist.fkIDteam.DYN_team");
  19.     Query_SelectWhereStringEqual(0, "DYN_cyclist.fkIDteam.DYN_team.Name", "BANESTO");
  20.     Query_Execute(0);
  21.  
  22.     // read query
  23.     Join_Create(0,1,"DYN_cyclist.Last_name");
  24.     Join_Create(1,1,"DYN_cyclist.fkIDteam.DYN_team.Name");
  25.     //Join_Create(2,0,"DYN_cyclist.fkIDteam.DYN_team.strIDgeneral_informations.STA_localized_string.Localized");
  26.     //Join_Create(3,0,"DYN_cyclist.RO");
  27.  
  28.     var i32x i;
  29.     var f32x fFloat;
  30.     var i32x iInt;
  31.     var szx szString;
  32.     i=0;
  33.     while (i<Join_GetNumRows(0))
  34.     {
  35.         szString = Join_GetStringFromIndex(0,i);
  36.         print(szString);
  37.         print("\t");
  38.         
  39.         szString = Join_GetStringFromIndex(1,i);
  40.         print(szString);
  41.         print("\n");
  42.         
  43.         /*
  44.         szString = Join_GetStringFromIndex(2,i);
  45.         print(szString);
  46.         print("\n");
  47.  
  48.         iInt = Join_GetIntFromIndex(3,i);
  49.         print(itoa(iInt));
  50.         print("\n");
  51.         */
  52.         i=i+1;
  53.     }
  54.  
  55.     /*
  56.     Join_Create(0,0,"STA_monnaie.Conversion_factor");
  57.     i=0;
  58.     while (i<Join_GetNumRows(0))
  59.     {
  60.         fFloat = Join_GetFloatFromIndex(0,i);
  61.         print(ftoa(fFloat));
  62.         print("\n");
  63.  
  64.         i=i+1;
  65.     }
  66.     */
  67. }