Bug 5978 - crash with prepared statements

Extra check for table type for prepare statement, in case the "s"
structure is not initialized.