strip unneded whitespaces; Make line endings in UNIX-style (without ^M)

Signed-off-by: Vadim A. Misbakh-Soloviov <mva@mva.name>
SQL optimisations. Originally authored by @toporchillo.

Signed-off-by: Vadim A. Misbakh-Soloviov <mva@mva.name>