#$result = $mdb->query($query, true, true, 'MDB2_BufferedIterator');
$result =& $mdb->query($query, true, true);
# now that we have a result set, we can get the field types
# as an array:
$dt = new DatabaseTable();
$dt->set_raw_table_name($tablename);
$dt->set_tablename_prefix($tablename_prefix);
$dt->set_raw_field_names($table_field_names);
$dt->set_db_field_types($result->types);
$dt->set_field_is_reqd($field_is_reqd);
# this is needed, esp. for the play_field_types
# assign all the smarty variables we support
$smarty->assign('classname', $dt->get_camelcase_table_name());
$smarty->assign('objectname', $dt->get_java_object_name());
$smarty->assign('tablename', $tablename);
$smarty->assign('tablename_clean', $dt->get_clean_table_name());
$smarty->assign('tablename_clean_singular', $dt->get_clean_table_name_singular());
$smarty->assign('fields', $table_field_names);
# NEW
$smarty->assign('field_is_reqd', $dt->get_field_is_reqd());
$smarty->assign('camelcase_fields', $dt->get_camelcase_field_names());
$smarty->assign('fields_as_insert_csv_string', $dt->get_fields_as_insert_stmt_csv_list());
$smarty->assign('prep_stmt_as_insert_csv_string', $dt->get_prep_stmt_insert_csv_string());
$smarty->assign('prep_stmt_as_update_csv_string', $dt->get_fields_as_update_stmt_csv_list());
$smarty->assign('types', $dt->get_java_field_types());
$smarty->assign('scala_field_types', $dt->get_scala_field_types());
$smarty->assign('play_field_types', $dt->get_play_field_types());
$smarty->assign('play_json_field_types', $dt->get_play_json_field_types());
$smarty->assign('db_types', $dt->get_db_field_types());
$smarty->assign('dt', $dt);
# try to disable caching so template changes are picked up immediately