March 1, 2021
Hot Topics:

Pseudo-Objects in Active Server Pages

  • By Thornton Rose
  • Send Email »
  • More Articles »

' Car2.inc -- Functions and subroutines for Car pseudo-object.
' (Modified version of Car.inc to use Entity as base object.)

' Car_New(): Creates an empty Car object.
function Car_New()
   dim objCar

   ' Create empty Entity.
   set objCar = Entity_New()

   ' Set "hidden" fields.
   objCar("_Table") = "Cars"
   objCar("_PrimaryKey") = "VIN"

   ' Add Car fields.
   objCar.Add "VIN",   ""
   objCar.Add "make",  ""
   objCar.Add "model", ""
   objCar.Add "color", ""
   objCar.Add "year",  0

   ' Return object.
   set Car_New = objCar
end function

' Car_Load(): Loads a list of Car objects from the database for the given
' condition in the given order.
function Car_Load(strConn, where, orderBy)
   set Car_Load = Entity_Load(strConn, Car_New(), "*", where, orderBy)
end function

' Car_Insert(): Inserts the given Car object into the database.
function Car_Insert(strConn, objCar)
   Car_Insert = Entity_Insert(strConn, objCar)
end function

' Car_Update(): Updates the given Car object in the database.
function Car_Update(strConn, objCar)
   Car_Update = Entity_Update(strConn, objCar)
end function

' Car_Delete(): Deletes the given Car object from the database.
function Car_Delete(strConn, objCar)
   Car_Delete = Entity_Delete(strConn, objCar)
end function

Page 7 of 11

This article was originally published on October 14, 1999

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date