+ applied postgis_schema patch from dodobas

This commit is contained in:
Artem Pavlenko 2008-11-21 13:21:41 +00:00
parent c95002a0e3
commit c4b003f568

View file

@ -122,9 +122,25 @@ postgis_datasource::postgis_datasource(parameters const& params)
desc_.set_encoding(conn->client_encoding());
std::string table_name=table_from_sql(table_);
std::string schema_name="";
std::string::size_type idx=table_name.find_last_of('.');
if (idx!=std::string::npos)
{
schema_name=table_name.substr(0,idx);
table_name=table_name.substr(idx+1);
}
else
{
table_name=table_name.substr(0);
}
std::ostringstream s;
s << "select f_geometry_column,srid,type from ";
s << GEOMETRY_COLUMNS <<" where f_table_name='" << table_name<<"'";
if (schema_name.length() > 0)
s <<" and f_table_schema='"<< schema_name <<"'";
if (geometry_field_.length() > 0)
s << " and f_geometry_column = '" << geometry_field_ << "'";