-
Notifications
You must be signed in to change notification settings - Fork 91
Open
Description
AFAICT SQLServer -> SQLite is the only combination where it even almost works, and yet:
$ cat create-view.sql
CREATE VIEW testview
AS
select 1
GO
$ perl -Ilib ./script/sqlt --from SQLServer --to SQLite create-view.sql --no-comments
BEGIN TRANSACTION;
CREATE VIEW "testview" AS
CREATE VIEW testview AS # <<<--- oops
select 1
;
COMMIT;
This is because while SQL::Translator:::Producer::SQLite's create_view does this:
if (my $sql = $view->sql) {
$create_view .= " AS\n ${sql}";
}and yet the production in SQL/Translator/Parser/SQLServer.pm has already stuff all of the sql including the CREATE VIEW part into the sql field:
create_view : /create/i /view/i WORD not_go GO
{
@table_comments = ();
my $view_name = $item[3];
my $sql = "$item[1] $item[2] $item[3] $item[4]";
$views{ $view_name }{'order'} = ++$view_order;
$views{ $view_name }{'name'} = $view_name;
$views{ $view_name }{'sql'} = $sql;
}Perhaps a better approach would be what the Sybase producer does:
# text of view is already a 'create view' statement so no need
# to do anything fancy.
push @output, join("\n\n", @comments, $view->sql(),);Metadata
Metadata
Assignees
Labels
No labels