Porting MSSQL::DBlib to other platforms
The interface of MSSQL::Sqllib does not contain many things that are specific
to MS SQL Server, but is a high-level interface, kind of analogue to DBI if you
like. Well, that's not perfectly true, since the elaborate structures for
error and message handling is based on the model provided by DB-Library.
Now, in difference to DBI, there are no hooks for using an alternative
"driver", so using anything else than MSSQL::DBlib (or Sybase::DBlib, see below)
would call for a complete rewrite. You might share my opinion that the interface
is really cool, but with DBI/DBD becoming the de facto standard in the
Perl world, it might not be the best way of spending precious time to go
implementing competitors to DBI/DBD.
But there is one exception. If you are using MSSQL::Sqllib, and find that you want
to move to Sybase, or just move the client to a Unix platform, you should be
able to replace MSSQL::DBlib as the ancestor module with Sybase::DBlib instead.
I don't have any plans to develop such a version myself, because I neither have
the need nor do I have Open Client (Sybase's client libraries). As MSSQL::DBlib
was developed from Sybase::DBlib 2.03, and Sybase::DBlib is now at 2.10. Both I
and Michael Peppler has added our own incompatible changes, there is a little
more work than replace the use statements. Here are some things
i know of:
- The first thing is to replace use MSSQL::DBlib with use
Sybase::DBlib.
- I think you need to compile Sybperl to not use tied hashes, so that the attributes
of MSSQL::Sqllib can sneak through.
- Sybase::DBlib does not have dbnextrow2 and dbretdata2,
but provides a similar functionality by means of an extra parameter to
dbnextrow and dbretdata.
- The conversion stuff is likely to be Microsoft specific. The calls to dbsetopt
in sql_init should probably be removed. As long as you are on an
NT platform, you could still use sql_set_conversion and
sql_unset_conversion, but as they read NT system files, they will fail on
Unix. But would you really need them, you can copy these file from your
neighbourhood NT system.
The above list is by means exhaustive. But in any case, I believe my test scripts
are fairly elaborate, so keep on running make test until all tests pass.
(Hm, if you are running the tests against a Sybase database, the SQL might cause
problems, but you'll find out.)
It goes without saying that if you intend to undertake a port to Sybase you need
to have some experience of Perl programming, and you must not be afraid of digging
into other people's code. Of course if you get stuck it's OK to
mail me.
Back to the MSSQL home page.
Last updated 04-05-30 21:33