Skip to content

Commit 21a8653

Browse files
authored
Merge pull request #9 from sqlitecloud/#3-Fix-GO-cli-for-unnecessary-commands-on-connect
fix(cli): remove useless commands on connect
2 parents 21fa205 + 465a187 commit 21a8653

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

cli/sqlc.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -502,16 +502,12 @@ func main() {
502502
prompt = "\\u@\\H:\\p/\\d > "
503503

504504
refreshDB := false
505-
if parameter.Database != "" {
506-
refreshDB = true
507-
}
508505

509506
Loop:
510507
for {
511508
out.Flush()
512509
if refreshDB {
513510
db.Database, _ = db.GetDatabase()
514-
go func() { dynamic_tokens = db.GetAutocompleteTokens() }() // Update the dynamic tokens in the background...
515511
}
516512

517513
renderdPrompt := prompt

connection.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,11 +463,17 @@ func connectionCommands(config SQCloudConfig) (string, []interface{}) {
463463
buffer += noblobCommand(config.NoBlob)
464464
}
465465

466-
buffer += maxdataCommand(config.MaxData)
466+
if config.MaxData > 0 {
467+
buffer += maxdataCommand(config.MaxData)
468+
}
467469

468-
buffer += maxrowsCommand(config.MaxRows)
470+
if config.MaxRows > 0 {
471+
buffer += maxrowsCommand(config.MaxRows)
472+
}
469473

470-
buffer += maxrowsetCommand(config.MaxRowset)
474+
if config.MaxRowset > 0 {
475+
buffer += maxrowsetCommand(config.MaxRowset)
476+
}
471477

472478
return buffer, args
473479
}

0 commit comments

Comments
 (0)