From 7e8d448ef7ba407e6f663e25041f087282f90e61 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 14 Aug 2023 13:59:50 +0800 Subject: [PATCH] 1 --- dataset.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dataset.go b/dataset.go index 26460d7..ff7027a 100644 --- a/dataset.go +++ b/dataset.go @@ -11,6 +11,7 @@ type DataSet struct { } func (this *DataSet) Next() bool { + ret := this.rows.Next() this.GetColumns() this.values = []interface{}{} for i := 0 ; i < len(this.columns); i++ { @@ -18,7 +19,7 @@ func (this *DataSet) Next() bool { this.values = append(this.values, &str) } this.rows.Scan(this.values...) - return this.rows.Next() + return ret } func (this *DataSet) GetColumns() []string { @@ -32,6 +33,7 @@ func (this *DataSet) GetColumns() []string { } func (this *DataSet) GetByName(name string) *string { + this.GetColumns() for i := 0; i < len(this.columns); i++ { if this.columns[i] == name { return this.GetByIndex(int32(i)) @@ -41,6 +43,7 @@ func (this *DataSet) GetByName(name string) *string { } func (this *DataSet) GetByIndex(index int32) *string { + this.GetColumns() return this.values[index].(*string); }