good morning!!!!

Skip to content
Snippets Groups Projects
Commit 94337206 authored by José Carlos Nieto's avatar José Carlos Nieto
Browse files

SQLite: Don't attempt to allocate a new slice if we don't need it.

parent 47135dba
Branches
Tags
No related merge requests found
...@@ -558,6 +558,7 @@ func (s *source) getPrimaryKey(tableName string) ([]string, error) { ...@@ -558,6 +558,7 @@ func (s *source) getPrimaryKey(tableName string) ([]string, error) {
} }
} }
if maxValue > 0 {
tableSchema.PrimaryKey = make([]string, maxValue) tableSchema.PrimaryKey = make([]string, maxValue)
for i := range s.columns[tableName] { for i := range s.columns[tableName] {
...@@ -565,6 +566,7 @@ func (s *source) getPrimaryKey(tableName string) ([]string, error) { ...@@ -565,6 +566,7 @@ func (s *source) getPrimaryKey(tableName string) ([]string, error) {
tableSchema.PrimaryKey[s.columns[tableName][i].PK-1] = s.columns[tableName][i].Name tableSchema.PrimaryKey[s.columns[tableName][i].PK-1] = s.columns[tableName][i].Name
} }
} }
}
return tableSchema.PrimaryKey, nil return tableSchema.PrimaryKey, nil
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment