Thanks for the patch Mike! Looks good to me expect that I think we also do
need to handle the case of schema being null. Simple change though.

Created a jira issue for tracking purposes.

http://jira.codehaus.org/browse/GEOT-3265

Will apply the patch shortly. Thanks again!

-Justin

On Fri, Sep 10, 2010 at 4:48 AM, Mike Fowler <[email protected]>wrote:

>
> Hi,
>
> I've started using the SQLServer plugin in geoserver over a database that
> is organised with schemas. Geoserver correctly identifies the tables in the
> named schema, however when you attempt to publish a table it fails to parse.
> Looking in the logs I was able to identify that the SQLServerDialect isn't
> pre-pending the schema name in some of the queries. The following diff
> resolves the problem.
>
> Kind regards,
>
> --
> Mike Fowler
> Senior Software Engineer, Dotted Eyes ltd.
>
>
> Index:
> trunk/modules/plugin/jdbc/jdbc-sqlserver/src/main/java/org/geotools/data/sqlserver/SQLServerDialect.java
> ===================================================================
> ---
> trunk/modules/plugin/jdbc/jdbc-sqlserver/src/main/java/org/geotools/data/sqlserver/SQLServerDialect.java
> (revision 36182)
> +++
> trunk/modules/plugin/jdbc/jdbc-sqlserver/src/main/java/org/geotools/data/sqlserver/SQLServerDialect.java
> (working copy)
> @@ -153,6 +153,8 @@
>          sql.append( ".STSrid");
>
>          sql.append( " FROM ");
> +        encodeSchemaName(schemaName, sql );
> +        sql.append( ".");
>          encodeTableName(tableName, sql );
>
>          sql.append( " WHERE ");
> @@ -278,9 +280,9 @@
>              throws SQLException {
>
>          StringBuffer sql = new StringBuffer("SELECT");
> -        sql.append( " IDENT_CURRENT('").append( tableName ).append("')");
> +        sql.append( "
> IDENT_CURRENT('").append(schemaName).append(".").append( tableName
> ).append("')");
>          sql.append( " + ");
> -        sql.append( " IDENT_INCR('").append( tableName ).append("')");
> +        sql.append( "
> IDENT_INCR('").append(schemaName).append(".").append( tableName
> ).append("')");
>
>          dataStore.getLogger().fine( sql.toString() );
>
> *Simplify. Automate. Integrate.
>
> Dotted Eyes*
>  Hanbury Court, Harris Business Park,
> Stoke Prior, Bromsgrove, B60 4JJ, UK
>
> *New! OS OpenData - free datasets*
> Visit our OS OpenData page for details<http://www.dottedeyes.com/opendata>
>
> *Join us at seminars and exhibitions*
> View our event calendar <http://www.dottedeyes.com/events/index.php>
>
>  *Buy training, support and SuperpOSe Service online*
>
> Visit our website <http://www.dottedeyes.com>
>
>  ResponseMX dynamic web maps: www.dottedeyes.com/rmx
>  Spatial data loading: www.dottedeyes.com/spatial
>  Ready-to-use digital maps & data: www.dottedeyes.com/data
>  For a sales enquiry email: [email protected]
>  For technical support login to: http://dottedeyes.helpserve.com
>
>  Dotted Eyes Ltd is registered in England and Wales, reg no 4471760.
> This email may contain confidential information, not to be disclosed.
> Contents are personal and not necessarily the views of Dotted Eyes.
> Emails and attachments may be monitored without notice in advance.
>
>   Email has been scanned for viruses and spam by Altman 
> Technologies<http://www.altman.co.uk/emailsystems/>
>
>
>
> ------------------------------------------------------------------------------
> Automate Storage Tiering Simply
> Optimize IT performance and efficiency through flexible, powerful,
> automated storage tiering capabilities. View this brief to learn how
> you can reduce costs and improve performance.
> http://p.sf.net/sfu/dell-sfdev2dev
> _______________________________________________
> Geotools-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>
>


-- 
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to