[Dbix-class] Microsoft SQL Server Primary Key Auto-Increment Woes

Matt S Trout dbix-class at trout.me.uk
Mon Jul 21 22:36:16 BST 2008


On Mon, Jul 21, 2008 at 08:56:17AM -0700, Marc Mims wrote:
> * Matt S Trout <dbix-class at trout.me.uk> [080719 18:30]:
> > Are you guys using MSSQL via ODBC?
> > 
> > I think because that tries to wrap $storage->insert it won't work unless
> > the $storage is already connected.
> > 
> > $schema->storage->ensure_connected;
> > 
> > should work as a query-free workaround if so.
> > 
> > Assuming that's true, can Marc Mims (the author) or anybody else who's
> > interested start looking at a fix?
> 
> It appears to me all that is required is $self->ensure_connected in the
> overridden insert.  I'd be happy to make that change if one of the MSSQL
> users will test it.

Not going to work - insert() is called too early.

I think you need to try and wrap _execute() instead and probably add
ensure_connected to insert() and friends.

I think the real solution is to not use reblessing for this stuff, but
that's not really something we can address until 09, I think
 
> Although I wrote the module, I did so without the benefit of access to
> MSSQL.  If the change proves to be more involved, I'd appreciate one of
> the MSSQL users giving me some limited server access so I can test the
> code.
> 
> 	-Marc
> 
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.rawmode.org

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the DBIx-Class mailing list