Versions in this module Expand all Collapse all v0 v0.8.2 Aug 28, 2022 Changes in this version + const ErrorPrefix + const NotSpecified + const SQLCMDCOLSEP + const SQLCMDCOLWIDTH + const SQLCMDDBNAME + const SQLCMDEDITOR + const SQLCMDERRORLEVEL + const SQLCMDFORMAT + const SQLCMDHEADERS + const SQLCMDINI + const SQLCMDLOGINTIMEOUT + const SQLCMDMAXFIXEDTYPEWIDTH + const SQLCMDMAXVARTYPEWIDTH + const SQLCMDPACKETSIZE + const SQLCMDPASSWORD + const SQLCMDSERVER + const SQLCMDSTATTIMEOUT + const SQLCMDUSEAAD + const SQLCMDUSER + const SQLCMDWORKSTATION + const SqlPassword + const SqlcmdEol — darwin/amd64, linux/amd64, windows/amd64 + const WarningPrefix + var ErrCtrlC = errors.New(...) + var ErrExitRequested = errors.New("exit") + var ErrNeedPassword = errors.New("need password") + var InvalidServerName = ArgumentError + func GetTokenBasedConnection(connstr string, authenticationMethod string) (driver.Connector, error) + func InvalidFileError(err error, path string) error + func ParseValue(val string) (string, error) + func ValidIdentifier(name string) error + type ArgumentError struct + Parameter string + Rule string + func (e *ArgumentError) Error() string + type Batch struct + Buffer []rune + Length int + func NewBatch(reader batchScan, cmd Commands) *Batch + func (b *Batch) Next() (*Command, []string, error) + func (b *Batch) Reset(r []rune) + func (b *Batch) State() string + func (b *Batch) String() string + type Command struct + type CommandError struct + Command string + LineNumber uint + func InvalidCommandError(command string, lineNumber uint) *CommandError + func (e *CommandError) Error() string + type Commands map[string]*Command + func (c Commands) SetBatchTerminator(terminator string) error + type ConnectSettings struct + ApplicationIntent string + AuthenticationMethod string + Database string + DisableEnvironmentVariables bool + DisableVariableSubstitution bool + Encrypt string + ErrorSeverityLevel uint8 + ExitOnError bool + LogLevel int + LoginTimeoutSeconds int + PacketSize int + Password string + ServerName string + TrustServerCertificate bool + UseTrustedConnection bool + UserName string + WorkstationName string + func (connect ConnectSettings) ConnectionString() (connectionString string, err error) + type Console interface + Close func() + ReadPassword func(prompt string) ([]byte, error) + Readline func() (string, error) + SetPrompt func(s string) + type ControlCharacterBehavior int + const ControlIgnore + const ControlRemove + const ControlReplace + const ControlReplaceConsecutive + type Formatter interface + AddError func(err error) + AddMessage func(string) + AddRow func(*sql.Rows) string + BeginBatch func(query string, vars *Variables, out io.Writer, err io.Writer) + BeginResultSet func([]*sql.ColumnType) + EndBatch func() + EndResultSet func() + func NewSQLCmdDefaultFormatter(removeTrailingSpaces bool) Formatter + type Sqlcmd struct + Cmd Commands + Connect ConnectSettings + Exitcode int + Format Formatter + PrintError func(msg string, severity uint8) bool + Query string + UnicodeOutputFile bool + func New(l Console, workingDirectory string, vars *Variables) *Sqlcmd + func (s *Sqlcmd) ConnectDb(connect *ConnectSettings, nopw bool) error + func (s *Sqlcmd) GetError() io.Writer + func (s *Sqlcmd) GetOutput() io.Writer + func (s *Sqlcmd) IncludeFile(path string, processAll bool) error + func (s *Sqlcmd) Prompt() string + func (s *Sqlcmd) Run(once bool, processAll bool) error + func (s *Sqlcmd) RunCommand(cmd *Command, args []string) error + func (s *Sqlcmd) SetError(e io.WriteCloser) + func (s *Sqlcmd) SetOutput(o io.WriteCloser) + func (s Sqlcmd) Log(_ context.Context, _ msdsn.Log, msg string) + type VariableError struct + MessageFormat string + Variable string + func ReadOnlyVariable(variable string) *VariableError + func UndefinedVariable(variable string) *VariableError + func (e *VariableError) Error() string + type Variables map[string]string + func InitializeVariables(fromEnvironment bool) *Variables + func (v Variables) All() map[string]string + func (v Variables) ColumnSeparator() string + func (v Variables) ErrorLevel() int64 + func (v Variables) Format() string + func (v Variables) Get(name string) (string, bool) + func (v Variables) MaxFixedColumnWidth() int64 + func (v Variables) MaxVarColumnWidth() int64 + func (v Variables) RowsBetweenHeaders() int64 + func (v Variables) SQLCmdDatabase() string + func (v Variables) SQLCmdServer() (serverName string, instance string, port uint64, err error) + func (v Variables) SQLCmdUser() string + func (v Variables) ScreenWidth() int64 + func (v Variables) Set(name, value string) + func (v Variables) Unset(name string) + func (v Variables) UseAad() bool + func (variables *Variables) Setvar(name, value string) error