check the return value of sqlite3_column_text() against NULL in get_sql_string()

The return value of sqlite3_column_text() was not checked and passed
directly to strdup() causing a SIGSEV from libc. This patch ensure that
a NULL returned value will not be given to strdup().