home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / db_util.dbt < prev    next >
Text File  |  1996-07-24  |  919b  |  44 lines

  1. # Template @(#)db_util.dbt    1.4 15 Apr 1996
  2. # Copyright 1995 Cadre Technologies
  3. #
  4.  
  5. #
  6. # Utility procs
  7. #
  8.  
  9. #
  10. # Get the full name of the given table
  11. #
  12. ~[proc tableName {name} {
  13.     return "${name}${tableSuffix}" }]
  14.  
  15. ~[proc table {name} {
  16.     return "table [tableName $name]" }]
  17.  
  18. #
  19. # Get the full name of an index on the given table
  20. #
  21. ~[proc indexName {tbl nr} {
  22.     return "${tbl}${tableSuffix}_i${nr}" }]
  23.  
  24. #
  25. # Utility proc to drop a table
  26. #
  27. ~[proc dropTable {tbl} {
  28.     return "drop [table $tbl]" }]
  29.  
  30. #
  31. # Utility proc to create an index
  32. #
  33. ~[proc createIndex {tbl nr} {
  34.     return "create index [indexName $tbl $nr] on [tableName $tbl]" }]
  35.  
  36. ~[proc createClusteredIndex {tbl nr} {
  37.     return "create index [indexName $tbl $nr] on [tableName $tbl]" }]
  38.  
  39. #
  40. # Utility proc to drop an index
  41. #
  42. ~[proc dropIndex {tbl nr} { 
  43.     return "drop index [tableName $tbl].[indexName $tbl $nr]" }]
  44.