# $Header: /home/cvsroot/tcldb/wisql/Tlib/doSaveAs,v 1.2 1998/02/16 04:40:56 de Exp $
# tcl procs saved on Tue Sep 05 09:32:40 PDT 1995

proc doSaveAs {win filename} {

  global currentFile
  global cmdIdx
  global cmdLast
  set cmdIdx $cmdLast
  global MsgW

  set openrc [catch {set f [open $filename w]}]
  
  if $openrc==1 {
    setMsg $MsgW "Error: $filename could not be opened, not saved"
    return
  }

  set currentFile $filename
  .m.s.l   configure -text "SQL (${currentFile})"

  puts $f [.m.s.sql get 1.0 end]
  close $f
  setMsg $MsgW "SQL saved to $currentFile"

  destroy $win
}

