I'm afraid "letting us know" won't do much good, there are few developers,
they are really busy
with business work. What we can offer is a code review of your pull
request, if you make one, and
it satisfies the PR checklist
<https://github.com/geotools/geotools/blob/main/.github/PULL_REQUEST_TEMPLATE.md>
.

Cheers
Andrea


On Wed, Dec 15, 2021 at 10:42 PM acefael <e...@acefael.es> wrote:

> In that case, I would like to make known to you, that there is some
> strange behaviour in GeoTools.
>
> When connecting to SqlServer and using the GT_PK_METADATA facility with
> the sequence policy, the SqlServer dialect consistently fails to get a new
> primary key, and does not even try to call the named database sequence.
> Thus no insert will ever work.  I validated with logging set to FINEST.
>
> Example (approx):
>
>   create sequence my_seq as BIGINT ;
>   create table foo ( id BIGINT PRIMARY KEY , geom geometry );
>   insert into GT_PK_METADATA( 'schema' , 'foo' , 'id' , null , 'sequence'
> , 'my_seq' );
>
> Pseudocode:
>
>   feature_source.addFeatures( [ foo_feature ] )
>
> https://hub.docker.com/_/microsoft-mssql-server could perhaps help in
> reproduction of the issue.
>
> yours
> acefael
>
> On Tue, Dec 14, 2021 at 07:10:35AM -0800, Jody Garnett wrote:
> > Can you submit your change as a pull request please, we have contributing
> > guidelines online for participation in the project covering what is
> needed.
> >
> > In the specific case of SQLServer not many developers have access to a
> > database to test against. I know I do not …
> >
> > Jody
> >
> > On Mon, Dec 13, 2021 at 1:10 PM acefael <e...@acefael.es> wrote:
> >
> > > hi,
> > >
> > > the default implementation of SQLDialect returns null for any
> invocation
> > > of getNextSequenceValue and SQLServerDialect does not override that.
> > > Therefore using GT_PK_METADATA with pk_policy 'sequence' will never
> work.
> > > Could anyone with enough access apply my implementation of
> > > getNextSequenceValue to SQLServerDialect ?
> > >
> > > My implementation
> > >
> > >     @Override
> > >     public Object getNextSequenceValue(String schemaName, String
> > > sequenceName, Connection cx)
> > >             throws SQLException {
> > >          Statement st = cx.createStatement();
> > >          try {
> > >              ResultSet rs =
> > >                  st.executeQuery( "SELECT NEXT VALUE FOR " +
> sequenceName
> > > );
> > >              try {
> > >                  if (!rs.next()) {
> > >                      throw new SQLException("Could not find next
> sequence
> > > value");
> > >                  }
> > >                  return rs.getInt(1);
> > >              } finally {
> > >                  dataStore.closeSafe(rs);
> > >              }
> > >         } finally {
> > >             dataStore.closeSafe(st);
> > >         }
> > >     }
> > >
> > > This is basically the method copied from the oracle-dialect and with
> the
> > > sql modified to work with sqlserver.  Using getInt instead of getLong
> is
> > > asking for trouble, imo, but you probably had your reasons.
> > >
> > > yours
> > > acefael
> > >
> > >
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > GeoTools-Devel mailing list
> > > GeoTools-Devel@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/geotools-devel
> > >
> > --
> > --
> > Jody Garnett
>
>
> _______________________________________________
> GeoTools-Devel mailing list
> GeoTools-Devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>


-- 

Regards,

Andrea Aime

==
GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax:     +39 0584 1660272

mob:   +39  333 8128928

https://www.geosolutionsgroup.com/

http://twitter.com/geosolutions_it

-------------------------------------------------------

Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE
2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si
precisa che ogni circostanza inerente alla presente email (il suo
contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è
riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il
messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra
operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is
addressed and may contain information that is privileged, confidential or
otherwise protected from disclosure. We remind that - as provided by
European Regulation 2016/679 “GDPR” - copying, dissemination or use of this
e-mail or the information herein by anyone other than the intended
recipient is prohibited. If you have received this email by mistake, please
notify us immediately by telephone or e-mail
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to