Sub TestGetByteCountRows
Dim strSQL As String
Dim lByteCount As Long
strSQL = "select rowid, * from table1 where rowid < 100"
lByteCount = GetByteCountRows(strSQL, "table1")
Log("TestGetByteCountRows, Bytes: " & lByteCount)
End Sub
Sub GetByteCountRows(strSQL As String, strTable As String) As Long
Dim c As Int
Dim n As Long
Dim strSQL2 As String
Dim lByteCountRow As Long
Dim lByteCountTotal As Long
Dim RS1 As ResultSet
Dim RS2 As ResultSet
Dim iRowID As Int
Dim arrBytes() As Byte
RS1 = General.cConn.SQL1.ExecQuery(strSQL)
RS1.Position = 0
Dim arrColumns(RS1.RowCount) As String
For c = 0 To RS1.ColumnCount - 1
arrColumns(c) = RS1.GetColumnName(c)
Next
RS1.Position = -1
Do While RS1.NextRow
lByteCountRow = 0
iRowID = RS1.GetInt2(0)
For c = 1 To RS1.ColumnCount - 1
strSQL2 = "select cast(coalesce(" & arrColumns(c) & ", '') as blob) from " & strTable & " where rowid = ?"
RS2 = General.cConn.SQL1.ExecQuery2(strSQL2, Array As String(iRowID))
RS2.Position = 0
arrBytes = RS2.GetBlob2(0)
lByteCountRow = lByteCountRow + arrBytes.Length
Next
Log("Record " & n & ": " & lByteCountRow)
n = n + 1
lByteCountTotal = lByteCountTotal + lByteCountRow
Loop
RS1.Close
RS2.Close
Return lByteCountTotal
End Sub
[CODE]
RBS