home *** CD-ROM | disk | FTP | other *** search
/ MACup: Giveaway 1996 / Image.iso / Shareware & Demos / Web-Publishing / SNAP PrimeBase / PrimeBase™ Server 68K / Setup / Scripts / setting.dal < prev    next >
Encoding:
Text File  |  1996-07-13  |  3.1 KB  |  139 lines  |  [TEXT/ds30]

  1. /*
  2. blaster
  3. ds
  4. ds
  5. open database master;
  6. execute file "setting";
  7. setting;
  8. go
  9. */
  10.  
  11. declare procedure hello()
  12. {
  13.     cursor    vars, userinfo;
  14.  
  15.     set $maxrows = $null;
  16.     describe open dbms into vars;
  17.     fetch of vars;
  18.     print 'Hello "' + $user + '" you are using brand "' + vars->brand 
  19.         + '" version "' + vars->rev + '"';
  20.     
  21.     describe open databases into vars;
  22.     if ($rows(vars))
  23.     {
  24.         fetch of vars;
  25.         print "The current database alias is :", vars->alias;
  26.         
  27.         select    CreatorName, AbortTimeout
  28.         from    System.SysUsers
  29.         where    Name = $user
  30.         into    userinfo;
  31.         
  32.         fetch of userinfo;
  33.         if ($sqlcode = 0)
  34.         {
  35.             print $format("\tALTER CREATOR %s;", userinfo->CreatorName);
  36.             print $format("\tALTER ABORT TIME %s;", userinfo->AbortTimeout);
  37.         }
  38.     }
  39. }
  40. end procedure hello;
  41.  
  42. declare procedure str(x)
  43. returns varchar;
  44. argument generic x;
  45. {
  46.     if (x IS NULL) return("NULL");
  47.     return varchar x;
  48. }
  49. end procedure str;
  50.  
  51. declare procedure results()
  52. returns varchar;
  53. {
  54.     varchar    text;
  55.     
  56.     text = 'CURRENT RESULTS:'
  57.         + $format ('\n\t$sqlcode = %d', $sqlcode)
  58.         + $format (',  $rowcnt = %s', str($rowcnt))
  59.         + $format (',  $colcnt = %s', str($colcnt))
  60.         + $format (',  $rowsaffected = %s', str($rowsaffected));
  61.     return text;
  62. }
  63. end procedure results;
  64.  
  65. declare procedure setting (level)
  66. argument int level = 4;
  67. {
  68.     cursor    vars;
  69.     varchar    text;
  70.     
  71.     text = results();
  72.     hello();
  73.     print text;
  74.     if (level == 1)
  75.         return;
  76.     print 'RESOURCE LIMITING:';
  77.     print '    SET $maxrows =', $maxrows, 
  78.             ';  $rowsperpage =', $rowsperpage, 
  79.             ';  $locktimeout =', $locktimeout, 
  80.             ';  $rowlocking = ', $rowlocking, ';';
  81.  
  82.     if (level == 2)
  83.         return;
  84.  
  85.     print 'DECIMAL AND MONEY:';
  86.     print '    SET $decfmt = "' + $decfmt + '";  $moneyfmt = "' + $moneyfmt + '";';
  87.  
  88.     print 'DATE AND TIME:';
  89.     print '    SET $tsfmt = "' + $tsfmt + '";  $datefmt = "' + $datefmt
  90.           + '";  $timefmt = "' + $timefmt + '";';
  91.     print '    SET $month = "' + $month + '";' ;
  92.     print '    SET $day = "' + $day + '";  $ampm = "' + $ampm + '";';
  93.         
  94.     if (level == 3)
  95.         return;
  96.     print 'GLOBAL SYSTEM VARIABLES:';
  97.     errorctl 1;
  98.     open database Master;
  99.     errorctl 0;
  100.     use database Master;
  101.     
  102.     set $maxrows = $null;
  103.  
  104.     select        B.Name, int A.Value as Value
  105.     from        Master!System.SysVariables    as A,
  106.                 Master!System.SysObjects    as B
  107.     where        A.DBID                 /= B.DBID
  108.     and            A.DataType            == $integer
  109.     and            A.VariableType        == 'Par'
  110.     into        vars;
  111.     for each vars
  112.         print $format("\tSET VARIABLE %-25s = %d;", vars->Name, vars->Value);
  113.     
  114.     select        B.Name, boolean A.Value as Value
  115.     from        Master!System.SysVariables    as A,
  116.                 Master!System.SysObjects    as B
  117.     where        A.DBID                 /= B.DBID
  118.     and            A.DataType            == $boolean
  119.     and            A.VariableType        == 'Par'
  120.     into        vars;
  121.     for each vars
  122.         print $format("\tSET VARIABLE %-25s = %d;", vars->Name, vars->Value);
  123.  
  124.     select        B.Name, varchar A.Value as Value
  125.     from        Master!System.SysVariables    as A,
  126.                 Master!System.SysObjects    as B
  127.     where        A.DBID                 /= B.DBID
  128.     and            A.DataType            == $varchar
  129.     and            A.VariableType        == 'Par'
  130.     into        vars;
  131.     for each vars
  132.         print $format("\tSET VARIABLE %-25s = '%s';", vars->Name, vars->Value);
  133.     
  134.     print "Database 'Master' is open, to receive your settings";    
  135. }
  136. end procedure setting;
  137.  
  138.  
  139. setting;