@@ -91,6 +91,15 @@ Connection Options:
9191 -w, --password PASSWORD Use PASSWORD for authentication
9292 -t, --timeout SECS Set Timeout for network operations to SECS seconds [default::10]
9393 -c, --compress (NO|LZ4) Use line compression [default::NO]
94+ -z, --zerotext Text ends with 0 value
95+ -m, --memory Use in-memory database
96+ -e, --create Create database if it does not exist
97+ -i, --nonlinearizable Use non-linearizable mode for queries
98+ -a, --apikey KEY Use API key for authentication
99+ -n, --noblob Disable BLOB support
100+ -x, --maxdata SIZE Set maximum data size for queries
101+ -y, --maxrows ROWS Set maximum number of rows for queries
102+ -r, --maxrowset ROWS Set maximum number of rows per rowset for queries
94103 --tls [YES|NO|INTERN|FILE] Encrypt the database connection using the host's root CA set (YES), a custom CA with a PEM from FILE (FILE), the internal SQLiteCloud CA (INTERN), or disable the encryption (NO) [default::YES]
95104`
96105
@@ -131,16 +140,20 @@ type Parameter struct {
131140 Format string `docopt:"--format"`
132141 OutPutFormat int `docopt:"--outputformat"`
133142
134- Host string `docopt:"--host"`
135- Port int `docopt:"--port"`
136- User string `docopt:"--user"`
137- Password string `docopt:"--password"`
138- Database string `docopt:"--dbname"`
139- ApiKey string `docopt:"--apikey"`
140- NoBlob bool `docopt:"--noblob"`
141- MaxData int `docopt:"--maxdata"`
142- MaxRows int `docopt:"--maxrows"`
143- MaxRowset int `docopt:"--maxrowset"`
143+ Host string `docopt:"--host"`
144+ Port int `docopt:"--port"`
145+ User string `docopt:"--user"`
146+ Password string `docopt:"--password"`
147+ Database string `docopt:"--dbname"`
148+ Zerotext bool `docopt:"--zerotext"`
149+ Memory bool `docopt:"--memory"`
150+ Create bool `docopt:"--create"`
151+ NonLinearizable bool `docopt:"--nonlinearizable"`
152+ ApiKey string `docopt:"--apikey"`
153+ NoBlob bool `docopt:"--noblob"`
154+ MaxData int `docopt:"--maxdata"`
155+ MaxRows int `docopt:"--maxrows"`
156+ MaxRowset int `docopt:"--maxrowset"`
144157
145158 Timeout int `docopt:"--timeout"`
146159 Compress string `docopt:"--compress"`
@@ -245,23 +258,46 @@ func parseParameters() (Parameter, error) {
245258 p ["--user" ] = getFirstNoneEmptyString ([]string {dropError (p .String ("--user" )), conf .Username })
246259 p ["--password" ] = getFirstNoneEmptyString ([]string {dropError (p .String ("--password" )), conf .Password })
247260 p ["--dbname" ] = getFirstNoneEmptyString ([]string {dropError (p .String ("--dbname" )), conf .Database })
248- p ["--host" ] = getFirstNoneEmptyString ([]string {dropError (p .String ("--host" )), conf .Host })
249- p ["--compress" ] = getFirstNoneEmptyString ([]string {dropError (p .String ("--compress" )), conf .CompressMode })
250261 if conf .Port > 0 {
251262 p ["--port" ] = getFirstNoneEmptyString ([]string {dropError (p .String ("--port" )), fmt .Sprintf ("%d" , conf .Port )})
252263 }
253264 if conf .Timeout > 0 {
254265 p ["--timeout" ] = getFirstNoneEmptyString ([]string {dropError (p .String ("--timeout" )), fmt .Sprintf ("%d" , conf .Timeout )})
255266 }
267+ if conf .Compression {
268+ p ["--compress" ] = getFirstNoneEmptyString ([]string {dropError (p .String ("--compress" )), conf .CompressMode })
269+ }
270+ if conf .Zerotext {
271+ if b , err := p .Bool ("--zerotext" ); err == nil {
272+ p ["--zerotext" ] = b || conf .Zerotext
273+ }
274+ }
275+ if conf .Memory {
276+ if b , err := p .Bool ("--memory" ); err == nil {
277+ p ["--memory" ] = b || conf .Memory
278+ }
279+ }
280+ if conf .Create {
281+ if b , err := p .Bool ("--create" ); err == nil {
282+ p ["--create" ] = b || conf .Create
283+ }
284+ }
285+ if conf .NonLinearizable {
286+ if b , err := p .Bool ("--nonlinearizable" ); err == nil {
287+ p ["--nonlinearizable" ] = b || conf .NonLinearizable
288+ }
289+ }
256290 p ["--tls" ] = getFirstNoneEmptyString ([]string {dropError (p .String ("--tls" )), conf .Pem })
257- if conf .Secure == false {
291+ if ! conf .Secure {
258292 p ["--tls" ] = "NO"
259- } else if conf .TlsInsecureSkipVerify == true {
293+ } else if conf .TlsInsecureSkipVerify {
260294 p ["--tls" ] = "SKIP"
261295 }
262296 p ["--apikey" ] = getFirstNoneEmptyString ([]string {dropError (p .String ("--apikey" )), conf .ApiKey })
263297 if conf .NoBlob {
264- p ["--noblob" ] = getFirstNoneEmptyString ([]string {dropError (p .String ("--noblob" )), strconv .FormatBool (conf .NoBlob )})
298+ if b , err := p .Bool ("--noblob" ); err == nil {
299+ p ["--noblob" ] = b || conf .NoBlob
300+ }
265301 }
266302 if conf .MaxData > 0 {
267303 p ["--maxdata" ] = getFirstNoneEmptyString ([]string {dropError (p .String ("--maxdata" )), fmt .Sprintf ("%d" , conf .MaxData )})
@@ -284,6 +320,9 @@ func parseParameters() (Parameter, error) {
284320 p ["--compress" ] = getFirstNoneEmptyString ([]string {dropError (p .String ("--compress" )), "NO" })
285321 p ["--tls" ] = getFirstNoneEmptyString ([]string {dropError (p .String ("--tls" )), "YES" })
286322 p ["--separator" ] = getFirstNoneEmptyString ([]string {dropError (p .String ("--separator" )), dropError (sqlitecloud .GetDefaultSeparatorForOutputFormat (outputformat )), "|" })
323+ p ["--maxdata" ] = getFirstNoneEmptyString ([]string {dropError (p .String ("--maxdata" )), "0" })
324+ p ["--maxrows" ] = getFirstNoneEmptyString ([]string {dropError (p .String ("--maxrows" )), "0" })
325+ p ["--maxrowset" ] = getFirstNoneEmptyString ([]string {dropError (p .String ("--maxrowset" )), "0" })
287326
288327 // Fix invalid(=unset) parameters, quotation & control-chars
289328 for k , v := range p {
@@ -375,18 +414,22 @@ func main() {
375414 // print( out, fmt.Sprintf( "%s %s, %s", long_name, version, copyright ), ¶meter )
376415
377416 config := sqlitecloud.SQCloudConfig {
378- Host : parameter .Host ,
379- Port : parameter .Port ,
380- Username : parameter .User ,
381- Password : parameter .Password ,
382- Database : parameter .Database ,
383- Timeout : time .Duration (parameter .Timeout ) * time .Second ,
384- CompressMode : parameter .Compress ,
385- ApiKey : parameter .ApiKey ,
386- NoBlob : parameter .NoBlob ,
387- MaxData : parameter .MaxData ,
388- MaxRows : parameter .MaxRows ,
389- MaxRowset : parameter .MaxRowset ,
417+ Host : parameter .Host ,
418+ Port : parameter .Port ,
419+ Username : parameter .User ,
420+ Password : parameter .Password ,
421+ Database : parameter .Database ,
422+ Timeout : time .Duration (parameter .Timeout ) * time .Second ,
423+ CompressMode : parameter .Compress ,
424+ Zerotext : parameter .Zerotext ,
425+ Memory : parameter .Memory ,
426+ Create : parameter .Create ,
427+ NonLinearizable : parameter .NonLinearizable ,
428+ ApiKey : parameter .ApiKey ,
429+ NoBlob : parameter .NoBlob ,
430+ MaxData : parameter .MaxData ,
431+ MaxRows : parameter .MaxRows ,
432+ MaxRowset : parameter .MaxRowset ,
390433 }
391434
392435 config .Secure , config .TlsInsecureSkipVerify , config .Pem = sqlitecloud .ParseTlsString (parameter .Tls )
@@ -514,7 +557,7 @@ func main() {
514557 case ".timeout" :
515558 parameter .Timeout = getNextTokenValueAsInteger (out , parameter .Timeout , 10 , tokens , & parameter )
516559 case ".compress" :
517- parameter .Compress = getNextTokenValueAsString (out , parameter .Compress , "NO" , "|no|lz4|" , tokens , & parameter )
560+ parameter .Compress = getNextTokenValueAsString (out , parameter .Compress , sqlitecloud . CompressModeNo , "|no|lz4|" , tokens , & parameter )
518561 db .Compress (parameter .Compress )
519562
520563 case ".format" :
0 commit comments