Use DSTR structure to hold TDSCOLUMN->table_column_name

Reuse some code and start making code a bit more consistent.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Do not attempt to write to constant memory

If we try to set 0 length on an empty string do not attempt to write
terminator as doing this we would try to write on a const memory causing
a core on many systems.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Do nothing on out of memory

Rewrite string function in order to leave string untouched on memory
allocation errors.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>