+ revert to "limit 1" logic

+ discard everything after table name when building 
  table descriptor to avoid seq scan
This commit is contained in:
Artem Pavlenko 2009-02-23 23:26:50 +00:00
parent 7537c14d77
commit 2cb4265091

View file

@ -182,8 +182,11 @@ sqlite_datasource::sqlite_datasource(parameters const& params)
we cannot determine the right columns types and names we cannot determine the right columns types and names
as all column_type are SQLITE_NULL as all column_type are SQLITE_NULL
*/ */
std::string::size_type idx = table_.find(table_name);
std::ostringstream s; std::ostringstream s;
s << "select * from " << table_ << " limit 0"; s << "select * from (" << table_.substr(0,idx + table_name.length()) << ") limit 1";
boost::scoped_ptr<sqlite_resultset> rs (dataset_->execute_query (s.str())); boost::scoped_ptr<sqlite_resultset> rs (dataset_->execute_query (s.str()));
if (rs->is_valid () && rs->step_next()) if (rs->is_valid () && rs->step_next())
{ {