Commit Graph

12 Commits

Author SHA1 Message Date
Dimitri Fontaine
9e4938cea4 Implement PostgreSQL catalogs data structure.
In order to share more code in between the different source types,
finally have a go at the quite horrible mess of anonymous data
structures floating around.

Having a catalog and schema instances not only allows for code cleanup,
but will also allow to implement some bug fixes and wishlist items such
as mapping tables from a schema to another one.

Also, supporting database sources having a notion of "schema" (in
between "catalog" and "table") should get easier, including getting
on-par with MySQL in the MS SQL support (materialized views has been
asked for already).

See #320, #316, #224 for references and a notion of progress being made.

In passing, also clean up the copy-databases methods for database source
types, so that they all use a fetch-metadata generic function and a
prepare-pgsql-database and a complete-pgsql-database generic function.
Actually, a single method does the job here.

The responsibility of introspecting the source to populate the internal
catalog/schema representation is now held by the fetch-metadata generic
function, which in turn will call the specialized versions of
list-all-columns and friends implementations. Once the catalog has been
fetched, an explicit CAST call is then needed before we can continue.

Finally, the fields/columns/transforms slots in the copy objects are
still being used by the operative code, so the internal catalog
representation is only used up to starting the data copy step, where the
copy class instances are then all that's used.

This might be refactored again in a follow-up patch.
2015-12-30 21:53:01 +01:00
Dimitri Fontaine
3e3ebf2333 Fix numeric casting support for MS SQL.
It's possible to get a numeric column with nil precision and scale, and
the code wasn't ready for this situation. Bug found while seeing about
2015-08-15 16:02:21 +02:00
Dimitri Fontaine
5b19776d5b MS SQL casting rules for floats: there's no scale. See #177. 2015-02-19 10:15:35 +01:00
Dimitri Fontaine
7fd1ddaa5f Handle MS SQL columns of float types without scale, fix #177.
The default for MS SQL float types is to only have a precision defined,
as described in https://msdn.microsoft.com/en-us/library/ms173773.aspx,
but the pgloader code didn't know what to do with a float without scale.
2015-02-18 23:43:27 +01:00
Dimitri Fontaine
7ccbb45763 Be smarter about MS SQL bit to boolean conversion, should fix #162.
This is a blind patch given that I couldn't CREATE TABLE as per the bug
report to try and see by myself what's happening. Better have some tests
going on though.
2015-02-03 13:39:09 +01:00
Dimitri Fontaine
1a083af950 Fix MS SQL decimal conversion.
Register decimal data type in MS SQL to use the float-to-string
transformation function.
2014-12-19 15:05:01 +01:00
Dimitri Fontaine
5b87b1a85e Refactor *identifier-case* option into a dynamic binding.
That makes it much easier to use from about anywhere in the code, which
is what is needed. In passing, fix #129.
2014-11-21 23:32:02 +01:00
Dimitri Fontaine
5b2fb40578 TIL that MS SQL also has a "datetime2" data type.
For real.
2014-11-18 23:25:07 +01:00
Dimitri Fontaine
87e157bee2 Add a new database source type in the parser.
Now it's possible to parse a command to load data from MS SQL. The
parser was until now parsing all database URI within the same common
rule and that isn't possible anymore if we want to distinguish in
between source database right from the parser, which we actually want to
do.

This patch also implement in-passing fixes all over the place, including
the transformation function float-to-string that only happened to work
on double-float data.
2014-11-17 00:23:06 +01:00
Dimitri Fontaine
c94164c05c Fix MS SQL convertion of money to numeric. 2014-11-16 21:54:13 +01:00
Dimitri Fontaine
87e2e16582 Implement data transfer from SQL Server. 2014-11-10 03:15:22 +01:00
Dimitri Fontaine
03bba5f486 Some more SQL Server support (schema conversion).
Converting the table definitions (with type casting) seems to work. Also
did experiment a little with actuallt fetching some data... and had to
edit the cl-mssql driver, which is temporarily monkey patched.
2014-11-10 01:16:10 +01:00