
<%
Class StringTable
  '======member variables
  Private table
  Public rows
  Public cols
	Public containsNoData
   
  '========================================
  
  Private Sub Class_Initialize()
    Redim table(0, 0)
    rows = 0
    cols = 0
  End Sub
  
  '========================================
  Public Function get_id(ByRef name)
    get_id = -1
    for cur_row = 0 to rows
      if (table(1, cur_row) = name) then
        get_id = table(0, cur_row)
      end if
    next
  End Function
  
  '======================================== 
  Public Function check_exists(ByRef name, ByVal col_number)
    check_exists = "FALSE"
    for cur_row = 0 to rows
      if (table(col_number, cur_row) = name) then
        check_exists = "TRUE"
      end if
    next
  End Function
  
 '========================================
  Public Function get_name_from_id(ByVal col_number, ByVal id)
    get_name_from_id = "no name"
    for cur_row = 0 to rows
    
      if (table(0, cur_row) = id) then
        get_name_from_id = table(col_number, cur_row)
      end if
    next
  End Function
  
  '========================================
  Public Function get_value_from_id(ByVal col_number, ByVal id)
    get_value_from_id = "no name"
    id = CInt(id)
    for cur_row = 0 to rows      
      if (CInt(table(0, cur_row)) = id) then
        get_value_from_id = table(col_number, cur_row)
      end if
    next
  End Function  
  
  '========================================
  Public Function get_data(col, row)
    'make sure in bounds
    get_data = "Out of Bounds"
    If row <= rows Then
      If col <= cols Then
        IF IsNull(table(col,row))then
          get_data = " "
        else
          get_data = table(col, row)
        end if
      End If    
    End If    
  End Function
  
  '========================================
  Public Function set_data(byRef conn, byRef query_string)
		Set record_set = conn.Execute(query_string)
    
		  if ((record_set.EOF=false)AND(record_set.BOF=false))then
				containsNoData = "FALSE"
        tempData = record_set.Getrows
    
        rows = UBound(tempData,2)
        cols = UBound(tempData,1)
        ReDim table (cols, rows)

        for cur_row = 0 to rows
          For cur_col = 0 to cols
            table(cur_col, cur_row) = tempData(cur_col, cur_row)
          Next
        Next      
      else
				containsNoData = "TRUE"       
      end if
    record_set.Close
    set record_set = nothing
  End Function
End Class
%>

<%
'===============
Public Function make_string_table (ByRef conn, ByRef select_string)
  set temp_table = new StringTable
  temp_table.set_data conn, select_string
  set make_string_table = temp_table
End Function

'===============
Public Function makeProcCall (ByRef conn, ByRef select_string)
  dim flag
  flag = conn.Execute(select_string)
  'if(flag=0)then
    'successful
  'else
    'failed
  'end if   
End Function


%>