Fix bug in sql tabular output

During conversion from Fortran to C++ a bug was introduced causing the row and column
labels of tabular reports in sqlite db to be mixed up.  The origins
having to do with FArray being column major and the offending sqlite
output code using the linearized index.

[#83704438]
Fixes #4602
Fix array bound for sql lastDayOfMonth

[#1306026]