@@ -259,7 +259,8 @@ def initialize_logging(self):
259259 root_logger .debug ('Log file %r.' , log_file )
260260
261261 def connect (self , database = '' , server = '' , user = '' , port = '' , passwd = '' ,
262- dsn = '' , ** kwargs ):
262+ dsn = '' , encrypt = None , trust_server_certificate = None , connection_timeout = None , application_intent = None ,
263+ multi_subnet_failover = None , packet_size = None , ** kwargs ):
263264 # Connect to the database.
264265
265266 if not user and not self .integrated_auth :
@@ -304,7 +305,13 @@ def connect(self, database='', server='', user='', port='', passwd='',
304305
305306 self .mssqlcliclient_query_execution = MssqlCliClient (self .sqltoolsclient , server , user , passwd ,
306307 database = database ,
307- authentication_type = authentication_type , ** kwargs )
308+ authentication_type = authentication_type ,
309+ encrypt = encrypt ,
310+ trust_server_certificate = trust_server_certificate ,
311+ connection_timeout = connection_timeout ,
312+ application_intent = application_intent ,
313+ multi_subnet_failover = multi_subnet_failover ,
314+ packet_size = packet_size ,** kwargs )
308315
309316 if not self .mssqlcliclient_query_execution .connect ():
310317 click .secho (
@@ -674,9 +681,23 @@ def get_last_query(self):
674681 help = 'Skip intro on startup and goodbye on exit.' )
675682@click .option ('--auto-vertical-output' , is_flag = True ,
676683 help = 'Automatically switch to vertical output mode if the result is wider than the terminal width.' )
677- def cli (username , server , prompt_passwd ,
678- database , version , mssqlclirc , row_limit ,
679- less_chatty , auto_vertical_output , integrated_auth ):
684+ @click .option ('-N' , '--encrypt' , is_flag = True , default = False ,
685+ help = 'SQL Server uses SSL encryption for all data if the server has a certificate installed.' )
686+ @click .option ('-C' , '--trust-server-certificate' , is_flag = True , default = False ,
687+ help = 'The channel will be encrypted while bypassing walking the certificate chain to validate trust.' )
688+ @click .option ('-l' , '--connect-timeout' , default = 0 , type = int ,
689+ help = 'Time in seconds to wait for a connection to the server before terminating request.' )
690+ @click .option ('-K' , '--application-intent' , default = '' ,
691+ help = 'Declares the application workload type when connecting to a database in a SQL Server Availability '
692+ 'Group.' )
693+ @click .option ('-M' , '--multi-subnet-failover' , is_flag = True , default = False ,
694+ help = 'If application is connecting to AlwaysOn AG on different subnets, setting this provides faster '
695+ 'detection and connection to currently active server.' )
696+ @click .option ('-a' , '--packet-size' , default = 0 , type = int ,
697+ help = 'Size in bytes of the network packets used to communicate with SQL Server.' )
698+ def cli (username , server , prompt_passwd , database , version , mssqlclirc , row_limit , less_chatty , auto_vertical_output ,
699+ integrated_auth , encrypt , trust_server_certificate , connect_timeout , application_intent , multi_subnet_failover ,
700+ packet_size ):
680701
681702 if version :
682703 print ('Version:' , __version__ )
@@ -695,7 +716,10 @@ def cli(username, server, prompt_passwd,
695716 mssqlclirc_file = mssqlclirc , less_chatty = less_chatty , auto_vertical_output = auto_vertical_output ,
696717 integrated_auth = integrated_auth )
697718
698- mssqlcli .connect (database , server , username , port = '' )
719+ mssqlcli .connect (database , server , username , port = '' , encrypt = encrypt ,
720+ trust_server_certificate = trust_server_certificate , connection_timeout = connect_timeout ,
721+ application_intent = application_intent , multi_subnet_failover = multi_subnet_failover ,
722+ packet_size = packet_size )
699723
700724 mssqlcli .logger .debug ('Launch Params: \n '
701725 '\t database: %r'
0 commit comments