counter in Bind can be member property.
make where clause using beginWhere~endWhere; introduce interfaces for Sql and Query.