A list of products available on this site
Documentation for XtraMania's xtras
Prices and links to the online store
Xtras, PDFs, samples
Have a question? Ask us!
Logo. www.xtramaina.com  
Home Search E-mail
ADOxtra Samples/Useful scripts

ADOxtra for Macromedia Director

Several useful scripts for ADOxtra

See ADOxtra castlib in Downloads section for this handler and other useful Lingo for ADOxtra.

-- Handler outputs the current record of a recordset rst
on ShowRecord rst
  if rst.state=0 then
    put "Recordset is closed."
  else if rst.bof or rst.eof then
    put "Current record does not exist."
    repeat with i=0 to rst.Fields.Count-1
      desc=desc&&GetTypeName(rst.Fields[i].type) &&"("&rst.Fields[i].type&")"
      if CheckBit(attributes,rst.adFldIsNullable) then desc=desc&&"Nullable"
      if CheckBit(attributes,rst.adFldMayBeNull) then desc=desc&&"MayBeNull"
      if CheckBit(attributes,rst.adFldRowID) then desc=desc&&"RowId"
      if CheckBit(attributes,rst.adFldUpdatable) then
      end if
      put rst.Fields[i].Name && "="&&QUOTE&rst.Fields[i]&QUOTE&desc
    end repeat
  end if

-- Handler outputs all dynamic properties of the recordset or connection object
-- Note that list of dynamic properties may very depending on whether object is opened or not
-- Also the most of properties are read only when object is opened
on ShowProperties ref
  repeat with i = 0 to ref.Properties.count - 1
    if CheckBit(attributes,ref.adPropRequired) then desc=desc&&"Required"
    if CheckBit(attributes,ref.adPropOptional) then desc=desc&&"Optional"
    if CheckBit(attributes,ref.adPropRead) then desc=desc&&"Read"
    if CheckBit(attributes,ref.adPropWrite) then desc=desc&&"Write"
    put ref.Properties[i].Name & "=" &QUOTE&ref.Properties[i]&QUOTE&desc
  end repeat

-- Handler returns the string description of the type returned by type property of ADO objects
on GetTypeName type
  case type of
    11: return "boolean"
    8,129,203,202,200,130: return "string"
    6: return "currency"
    7: return "date"
    14,131,139: return "numeric"
    5,4: return "float"
    0: return "empty"
    3,2,16,19,18,17: return "integer"
    72: return "GUID"
    132: return "user-defined"
    204: return "binary"
    otherwise: return "unknown:"&type
  end case

-- Handler returns true if all bits in bitMask are set in val
on CheckBit val, bitMask
  return BitAnd(val,bitMask)=bitMask

Site homeSearchContact author © Eugene Shoustrov. www.xtramania.com