You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is what i did. (i did not want to export empty csv)
RowCount, _ := db.Query(sqlQuery)
i := RowCountToExport
for RowCount.Next() {
i++ //Lets count the rows
}
if i == 0 { // If there are no rows, then there is no file :).
println("There are 0 rows, so there will be no file!")
} else {//what ever you want to do}
Iterating all the rows is a potentially very expensive operation, and sqltocsv already does it - I wouldn't want to do it twice just to get a row count. If I really did need it I'd do with the CsvPreProcessorFunc, but it just seems like something that would nice to build into sqltocsv.
There doesn't seem to be a facility for getting the number of rows converted?
The text was updated successfully, but these errors were encountered: