[libparse-dia-sql-perl] 01/04: Imported Upstream version 0.26
gregor herrmann
gregoa at debian.org
Thu Jan 2 20:43:49 UTC 2014
This is an automated email from the git hooks/post-receive script.
gregoa pushed a commit to branch master
in repository libparse-dia-sql-perl.
commit de7e836a04bcb95f6c4ad3127dcdbe7c4d21a1e1
Author: gregor herrmann <gregoa at debian.org>
Date: Thu Jan 2 21:37:43 2014 +0100
Imported Upstream version 0.26
---
Changes | 7 +
MANIFEST | 7 +-
META.yml | 2 +-
installer/parsediasql-setup.nsi | 167 ++++++++
lib/Parse/Dia/SQL.pm | 17 +-
lib/Parse/Dia/SQL/Output.pm | 7 +-
lib/Parse/Dia/SQL/Utils.pm | 4 +-
t/225-parse-classes-pk.t | 2 +-
...0-output-get-schema-create-db-model-nullable.t} | 13 +-
t/620-output-get-schema-create-db-model.t | 2 +-
t/703-utils-get-base-name.t | 4 +-
t/960-rt56357-database-model.t | 27 +-
t/963-rt66031.t | 38 ++
t/data/nullable.dia | Bin 0 -> 921 bytes
t/data/rt56357.dia | Bin 880 -> 909 bytes
t/data/rt66031.dia | 429 +++++++++++++++++++++
16 files changed, 696 insertions(+), 30 deletions(-)
diff --git a/Changes b/Changes
index 452d9be..89b1c6e 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,12 @@
Revision history for Perl module Parse::Dia::SQL.
+0.25 Wed Mar 20 09:29:29 CET 2013
+ - Fixed bug in "nullable" implementation introducted in 0.24.
+
+0.24 Mon Mar 18 08:22:54 CET 2013
+ - Added previously unsupported "nullable" feature for non-primary
+ key columns when using Database shape (added in 0.15).
+
0.23 Tue Aug 28 08:28:19 CEST 2012
- RT #79218 Spelling patch from debian downstream (Thanks to
Gregor Herrmann).
diff --git a/MANIFEST b/MANIFEST
index f509fce..dbab970 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,6 +1,7 @@
AUTHORS
bin/parsediasql
Changes
+installer/parsediasql-setup.nsi
lib/Parse/Dia/SQL.pm
lib/Parse/Dia/SQL/Const.pm
lib/Parse/Dia/SQL/Logger.pm
@@ -21,7 +22,7 @@ lib/Parse/Dia/SQL/Output/Sybase.pm
lib/Parse/Dia/SQL/Utils.pm
LICENSE
Makefile.PL
-MANIFEST This list of files
+MANIFEST
MANIFEST.SKIP
README
t/000-load.t
@@ -49,6 +50,7 @@ t/610-output-getinstance.t
t/611-output-format-columns.t
t/612-output-get-comment.t
t/620-output-get-schema-create-col-comment.t
+t/620-output-get-schema-create-db-model-nullable.t
t/620-output-get-schema-create-db-model.t
t/620-output-get-schema-create-many-to-many.t
t/620-output-get-schema-create.t
@@ -114,6 +116,7 @@ t/953-rt53783-sqlite3.t
t/960-rt56357-database-model.t
t/961-rt57182-charset.t
t/962-rt57842-postsgres-int.t
+t/963-rt66031.t
t/data/association_dia_0_97.dia
t/data/db-model-fk.dia
t/data/db2.pre.dupe.dia
@@ -123,12 +126,14 @@ t/data/long_fk_name.dia
t/data/many_to_many.097.dia
t/data/many_to_many.dia
t/data/non-latin1-chars.dia
+t/data/nullable.dia
t/data/rt50906.dia
t/data/rt51433.dia
t/data/rt52755.dia
t/data/rt53783.dia
t/data/rt56357.dia
t/data/rt57842.dia
+t/data/rt66031.dia
t/data/table.col.comment.dia
t/data/table_output_options.dia
t/data/TestERD.dia
diff --git a/META.yml b/META.yml
index 43729c3..4cf38af 100644
--- a/META.yml
+++ b/META.yml
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Parse-Dia-SQL
-version: 0.23
+version: 0.26
abstract: Convert Dia class diagrams into SQL.
author:
- Andreas Faafeng <aff at cpan.org>
diff --git a/installer/parsediasql-setup.nsi b/installer/parsediasql-setup.nsi
new file mode 100755
index 0000000..4b5bb50
--- /dev/null
+++ b/installer/parsediasql-setup.nsi
@@ -0,0 +1,167 @@
+# Parse-Dia-Sql - Convert Dia class diagrams into SQL
+#
+# Copyright (C) 2009-2012 Steffen Macke <sdteffen at sdteffen.de>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# NOTE: this .NSI script is designed for NSIS v2.0
+
+Name Parse-Dia-Sql
+
+SetCompressor lzma
+
+# Defines
+!define REGKEY "SOFTWARE\$(^Name)"
+!define VERSION 0.23.0
+!define COMPANY "The Parse-Dia-Sql developers"
+!define URL http://dia-installer.de/parse-dia-sql/
+
+# MUI defines
+!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
+!define MUI_FINISHPAGE_NOAUTOCLOSE
+!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
+!define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY}
+!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup
+!define MUI_STARTMENUPAGE_DEFAULTFOLDER Parse-Dia-Sql
+!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
+!define MUI_UNFINISHPAGE_NOAUTOCLOSE
+!define MUI_FINISHPAGE_LINK "dia-installer.de/parse-dia-sql"
+!define MUI_FINISHPAGE_LINK_LOCATION "http://dia-installer.de/parse-dia-sql/"
+
+# Included files
+!include Sections.nsh
+!include MUI.nsh
+!include Library.nsh
+!include WinVer.nsh
+
+# Variables
+Var StartMenuGroup
+
+# Installer pages
+!insertmacro MUI_PAGE_WELCOME
+!insertmacro MUI_PAGE_LICENSE ..\LICENSE
+!insertmacro MUI_PAGE_DIRECTORY
+!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
+!insertmacro MUI_PAGE_INSTFILES
+!insertmacro MUI_PAGE_FINISH
+!insertmacro MUI_UNPAGE_CONFIRM
+!insertmacro MUI_UNPAGE_INSTFILES
+
+!insertmacro MUI_LANGUAGE English
+
+# Installer attributes
+OutFile parse-dia-sql-setup-${VERSION}.exe
+InstallDir $PROGRAMFILES\Parse-Dia-Sql
+CRCCheck on
+XPStyle on
+ShowInstDetails show
+VIProductVersion ${VERSION}.0
+VIAddVersionKey /LANG=${LANG_ENGLISH} ProductName Parse-Dia-SQL
+VIAddVersionKey /LANG=${LANG_ENGLISH} ProductVersion "${VERSION}"
+VIAddVersionKey /LANG=${LANG_ENGLISH} CompanyName "${COMPANY}"
+VIAddVersionKey /LANG=${LANG_ENGLISH} CompanyWebsite "${URL}"
+VIAddVersionKey /LANG=${LANG_ENGLISH} FileVersion "${VERSION}"
+VIAddVersionKey /LANG=${LANG_ENGLISH} FileDescription ""
+VIAddVersionKey /LANG=${LANG_ENGLISH} LegalCopyright ""
+InstallDirRegKey HKLM "${REGKEY}" Path
+ShowUninstDetails show
+
+# Installer sections
+Section -Main SEC0000
+ SetOutPath $INSTDIR\bin
+ SetOverwrite on
+ File parsediasql.exe
+ File C:\strawberry\c\bin\libstdc++-6.dll
+ File C:\strawberry\c\bin\libexpat-1_.dll
+ File c:\strawberry\c\bin\LIBGCC_S_SJLJ-1.DLL
+
+ SetOutPath $INSTDIR
+ File ..\LICENSE
+ File /oname=LIBEXPAT_COPYING C:\strawberry\licenses\libexpat\COPYING
+
+SectionEnd
+
+Section -post SEC0001
+ WriteRegStr HKLM "${REGKEY}" Path $INSTDIR
+ SetOutPath $INSTDIR
+ WriteUninstaller $INSTDIR\uninstall-parse-dia-sql.exe
+ SetOutPath $SMPROGRAMS\$StartMenuGroup
+ CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Parse-Dia-Sql command line.lnk" $SYSDIR\cmd.exe "/K PATH=%PATH%;$INSTDIR\bin"
+
+ WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
+ WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
+ WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
+ WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
+ WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall-parse-dia-sql.exe
+ WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall-parse-dia-sql.exe
+ WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
+ WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
+SectionEnd
+
+# Macro for selecting uninstaller sections
+!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
+ Push $R0
+ ReadRegStr $R0 HKLM "${REGKEY}\Components" "${SECTION_NAME}"
+ StrCmp $R0 1 0 next${UNSECTION_ID}
+ !insertmacro SelectSection "${UNSECTION_ID}"
+ GoTo done${UNSECTION_ID}
+next${UNSECTION_ID}:
+ !insertmacro UnselectSection "${UNSECTION_ID}"
+done${UNSECTION_ID}:
+ Pop $R0
+!macroend
+
+# Uninstaller sections
+Section "Uninstall"
+ Delete /REBOOTOK $INSTDIR\bin\parsediasql.exe
+ Delete /REBOOTOK $INSTDIR\bin\libstdc++-6.dll
+ Delete /REBOOTOK $INSTDIR\bin\libexpat-1_.dll
+ Delete /REBOOTOK $INSTDIR\bin\LIBGCC_S_SJLJ-1.DLL
+ Delete /REBOOTOK $INSTDIR\LICENSE
+ Delete /REBOOTOK $INSTDIR\LIBEXPAT_COPYING
+
+ DeleteRegValue HKLM "${REGKEY}\Components" Main
+ DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
+ Delete /REBOOTOK "$SMPROGRAMS\$MUI_STARTMENUPAGE_DEFAULTFOLDER\Parse-Dia-Sql command line.lnk"
+ Delete /REBOOTOK $INSTDIR\uninstall-parse-dia-sql.exe
+ DeleteRegValue HKLM "${REGKEY}" StartMenuGroup
+ DeleteRegValue HKLM "${REGKEY}" Path
+ DeleteRegKey /IfEmpty HKLM "${REGKEY}\Components"
+ DeleteRegKey /IfEmpty HKLM "${REGKEY}"
+ RmDir /REBOOTOK $SMPROGRAMS\$MUI_STARTMENUPAGE_DEFAULTFOLDER
+ RmDir /REBOOTOK $INSTDIR\bin
+ RmDir /REBOOTOK $INSTDIR
+
+ Push $R0
+ StrCpy $R0 $StartMenuGroup 1
+ StrCmp $R0 ">" no_smgroup
+no_smgroup:
+ Pop $R0
+SectionEnd
+
+# Installer functions
+Function .onInit
+ InitPluginsDir
+ ${If} ${AtLeastWin7}
+ ${Else}
+ MessageBox MB_OK "Windows 7 or higher is required for this Parse-Dia-Sql version."
+ Abort "Windows 7 or higher is required for this Parse-Dia-Sql version."
+ ${EndIf}
+FunctionEnd
+
+# Uninstaller functions
+Function un.onInit
+ ReadRegStr $INSTDIR HKLM "${REGKEY}" Path
+ !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
+FunctionEnd
diff --git a/lib/Parse/Dia/SQL.pm b/lib/Parse/Dia/SQL.pm
index 379a813..5b47541 100644
--- a/lib/Parse/Dia/SQL.pm
+++ b/lib/Parse/Dia/SQL.pm
@@ -200,7 +200,7 @@ use Parse::Dia::SQL::Output::SQLite3fk;
use Parse::Dia::SQL::Output::Sas;
use Parse::Dia::SQL::Output::Sybase;
-our $VERSION = '0.23';
+our $VERSION = '0.26';
my $UML_ASSOCIATION = 'UML - Association';
my $UML_SMALLPACKAGE = 'UML - SmallPackage';
@@ -880,6 +880,11 @@ sub _parse_database_table {
->get_value_from_object( $singleAttrib, "dia:attribute", "name", "comment",
"string", 1 );
+ my $attribNullable =
+ $self->{utils}
+ ->get_value_from_object( $singleAttrib, "dia:attribute", "name", "nullable",
+ "boolean", 1 );
+
# Strip newlines from comments except for HTML output
$attribComment =~ s/\n/ /g if ($self->{db} ne q{html});
chomp($attribComment); # Always strip any trailing newlines
@@ -889,7 +894,7 @@ sub _parse_database_table {
);
my $att = [
$attribName, $attribType, $attribVal,
- $attrib_is_primary_key, $attribComment
+ $attrib_is_primary_key, $attribComment, $attribNullable
];
push @{ $classLookup->{attList} }, $att;
@@ -1257,10 +1262,10 @@ sub _parse_association {
$leftEnd{role} = $self->{utils}->get_string_from_node($currentNode);
} elsif ( $nodeAttrName eq 'role_b' ) {
$rightEnd{role} = $self->{utils}->get_string_from_node($currentNode);
- } elsif ( $nodeAttrName eq 'aggregate_a' ) {
- $leftEnd{aggregate} = $self->{utils}->get_string_from_node($currentNode);
- } elsif ( $nodeAttrName eq 'aggregate_b' ) {
- $rightEnd{aggregate} = $self->{utils}->get_string_from_node($currentNode);
+ } elsif ( $self->{uml} && $nodeAttrName eq 'assoc_type' && $assocDirection == 2 ) {
+ $leftEnd{aggregate} = $self->{utils}->get_num_from_node($currentNode);
+ } elsif ( $self->{uml} && $nodeAttrName eq 'assoc_type' ) {
+ $rightEnd{aggregate} = $self->{utils}->get_num_from_node($currentNode);
} elsif ( $nodeAttrName eq 'class_scope_a' ) {
$leftEnd{class_scope} = $self->{utils}->get_string_from_node($currentNode);
} elsif ( $nodeAttrName eq 'class_scope_b' ) {
diff --git a/lib/Parse/Dia/SQL/Output.pm b/lib/Parse/Dia/SQL/Output.pm
index 33b43b5..094305d 100644
--- a/lib/Parse/Dia/SQL/Output.pm
+++ b/lib/Parse/Dia/SQL/Output.pm
@@ -766,11 +766,14 @@ sub _get_create_table_sql {
$self->{log}->debug("column before: " . join(q{,}, @$column));
# Field sequence:
- my ($col_name, $col_type, $col_val, $col_vis, $col_com) = @$column;
+ my ($col_name, $col_type, $col_val, $col_vis, $col_com, $col_nullable) = @$column;
- # Add 'not null' if field is primary key
+ # Add 'not null' if field is primary key or marked "not nullable"
+ # (Dia database shape only)
if ($col_vis == 2) {
$col_val = 'not null';
+ } elsif ($col_nullable eq q{false}) {
+ $col_val = 'not null';
}
# Add column name to list of primary keys if $col_vis == 2
diff --git a/lib/Parse/Dia/SQL/Utils.pm b/lib/Parse/Dia/SQL/Utils.pm
index 08e4c63..e6fd702 100644
--- a/lib/Parse/Dia/SQL/Utils.pm
+++ b/lib/Parse/Dia/SQL/Utils.pm
@@ -545,11 +545,11 @@ sub get_base_type {
$self->{log}->info(qq{Replaced $typeName with integer}) if $self->{log}->is_info();
return 'integer';
}
- if ( lc($typeName) eq 'int2' ) {
+ if ( lc($typeName) eq 'smallserial' or lc($typeName) eq 'int2' ) {
$self->{log}->info(qq{Replaced $typeName with smallint}) if $self->{log}->is_info();
return 'smallint';
}
- if ( lc($typeName) eq 'int8' ) {
+ if ( lc($typeName) eq 'bigserial' or lc($typeName) eq 'int8' ) {
$self->{log}->info(qq{Replaced $typeName with bigint}) if $self->{log}->is_info();
return 'bigint';
}
diff --git a/t/225-parse-classes-pk.t b/t/225-parse-classes-pk.t
index 35096e8..2760a5b 100644
--- a/t/225-parse-classes-pk.t
+++ b/t/225-parse-classes-pk.t
@@ -26,7 +26,7 @@ cmp_ok(scalar(@$classes), q{==}, 1, q{Expect 1 class});
# Hash with class/view names as keys and primary key as (hashref) elements
my %pk = (
- bar => [ [ 'foo', 'int', '', '2', '' ] ],
+ bar => [ [ 'foo', 'int', '', '2', '', 'false' ] ],
);
diff --git a/t/620-output-get-schema-create-db-model.t b/t/620-output-get-schema-create-db-model-nullable.t
similarity index 76%
copy from t/620-output-get-schema-create-db-model.t
copy to t/620-output-get-schema-create-db-model-nullable.t
index 3ae74fd..60804e0 100644
--- a/t/620-output-get-schema-create-db-model.t
+++ b/t/620-output-get-schema-create-db-model-nullable.t
@@ -18,7 +18,7 @@ use_ok ('Parse::Dia::SQL::Output::DB2');
# 1. parse input
my $db = 'db2';
-my $diasql = Parse::Dia::SQL->new( file => catfile(qw(t data db-model-fk.dia)), db => $db );
+my $diasql = Parse::Dia::SQL->new( file => catfile(qw(t data nullable.dia)), db => $db );
isa_ok($diasql, q{Parse::Dia::SQL}, q{Expect a Parse::Dia::SQL object});
is($diasql->convert(), 1, q{Expect convert to return 1});
@@ -43,20 +43,21 @@ my $create_table = $subclass->get_schema_create();
#diag $create_table;
like($create_table, qr|.*
- create \s+ table \s+ man \s* \(
+ create \s+ table \s+ bar \s* \(
\s* id \s+ int \s+ not \s+ null \s* ,
- \s* name \s+ varchar \s* \( \s* 32 \s* \) \s* ,
+ \s* col1_nullable \s+ int \s* ,
+ \s* col2_not_nullable \s+ int \s+ not \s+ null \s* ,
\s* constraint \s+ pk_\w+ \s+ primary \s+ key \s* \(id\) \s*
\) \s* (;)?
-.*|six, q{Check syntax for sql create table man});
+.*|six, q{Check syntax for sql create table bar with nullable property. (1 col nullable, 1 col not null)});
__END__
=pod
-=head1 TODO
+=head1 SUMMARY
-Add tests for associations when that has been implmenented.
+Related to bug submitted by 'jochenberger' on github.com
=cut
diff --git a/t/620-output-get-schema-create-db-model.t b/t/620-output-get-schema-create-db-model.t
index 3ae74fd..a320979 100644
--- a/t/620-output-get-schema-create-db-model.t
+++ b/t/620-output-get-schema-create-db-model.t
@@ -45,7 +45,7 @@ my $create_table = $subclass->get_schema_create();
like($create_table, qr|.*
create \s+ table \s+ man \s* \(
\s* id \s+ int \s+ not \s+ null \s* ,
- \s* name \s+ varchar \s* \( \s* 32 \s* \) \s* ,
+ \s* name \s+ varchar \s* \( \s* 32 \s* \) \s+ not \s+ null \s* ,
\s* constraint \s+ pk_\w+ \s+ primary \s+ key \s* \(id\) \s*
\) \s* (;)?
.*|six, q{Check syntax for sql create table man});
diff --git a/t/703-utils-get-base-name.t b/t/703-utils-get-base-name.t
index 2146dfb..59c5bb8 100644
--- a/t/703-utils-get-base-name.t
+++ b/t/703-utils-get-base-name.t
@@ -8,7 +8,7 @@ use Test::More;
use File::Spec::Functions;
use lib catdir qw ( blib lib );
-plan tests => 7;
+plan tests => 9;
use lib q{lib};
use_ok ('Parse::Dia::SQL::Utils');
@@ -19,9 +19,11 @@ isa_ok($utils, 'Parse::Dia::SQL::Utils');
# make_name
is($utils->get_base_type('int2', 'postgres'), 'smallint');
+is($utils->get_base_type('smallserial', 'postgres'), 'smallint');
is($utils->get_base_type('int4', 'postgres'), 'integer');
is($utils->get_base_type('serial', 'postgres'), 'integer');
is($utils->get_base_type('int8', 'postgres'), 'bigint');
+is($utils->get_base_type('bigserial', 'postgres'), 'bigint');
is($utils->get_base_type('int2', 'mysql-myisam'), 'int2');
diff --git a/t/960-rt56357-database-model.t b/t/960-rt56357-database-model.t
index b8140cc..a9c6c87 100644
--- a/t/960-rt56357-database-model.t
+++ b/t/960-rt56357-database-model.t
@@ -9,21 +9,30 @@ use Test::Exception;
use File::Spec::Functions;
use lib catdir qw ( blib lib );
-plan tests => 4;
-
+plan tests => 5;
+
use lib q{lib};
-use_ok ('Parse::Dia::SQL');
+use_ok('Parse::Dia::SQL');
-my $diasql =
- Parse::Dia::SQL->new(file => catfile(qw(t data rt56357.dia)), db => 'postgres');
+my $diasql = Parse::Dia::SQL->new(
+ file => catfile(qw(t data rt56357.dia)),
+ db => 'postgres'
+);
isa_ok($diasql, q{Parse::Dia::SQL}, q{Expect a Parse::Dia::SQL object});
can_ok($diasql, q{get_sql});
my $sql = undef;
-lives_ok(
- sub { $sql = $diasql->get_sql() },
- q{get_sql should live on supported model type 'Database - Table'}
- );
+lives_ok(sub { $sql = $diasql->get_sql() },
+ q{get_sql should live on supported model type 'Database - Table'});
+
+diag($sql);
+
+like($sql, qr/.*
+create \s* table \s* bar \s* \( \s*
+ \s* foo \s+ int \s+ not \s+ null \s*, \s*
+ \s* seconds \s+ int \s+ not \s+ null \s*, \s*
+ \s* constraint \s+ pk_bar \s+ primary \s+ key \s+ \( \s* foo \s* \) \s* \)
+.*/six);
__END__
diff --git a/t/963-rt66031.t b/t/963-rt66031.t
new file mode 100644
index 0000000..1891fa4
--- /dev/null
+++ b/t/963-rt66031.t
@@ -0,0 +1,38 @@
+# $Id: 951-rt50906.t,v 1.3 2009/11/17 11:00:02 aff Exp $
+
+use warnings;
+use strict;
+
+use Data::Dumper;
+use Test::More;
+use Test::Exception;
+use File::Spec::Functions;
+use lib catdir qw ( blib lib );
+
+plan tests => 7;
+
+use lib q{lib};
+use_ok ('Parse::Dia::SQL');
+use_ok ('Parse::Dia::SQL::Output');
+use_ok ('Parse::Dia::SQL::Output::Postgres');
+
+my $diasql =
+ Parse::Dia::SQL->new(file => catfile(qw(t data rt66031.dia)), db => 'postgres', uml => 1);
+isa_ok($diasql, q{Parse::Dia::SQL}, q{Expect a Parse::Dia::SQL object});
+can_ok($diasql, q{get_sql});
+my $sql = $diasql->get_sql();
+
+isa_ok(
+ $diasql->get_output_instance(),
+ q{Parse::Dia::SQL::Output::Postgres},
+ q{Expect Parse::Dia::SQL::Output::Postgres to be used as back-end}
+);
+
+like($sql, qr/.*
+alter \s+ table \s+ tbl_detail \s+ add \s+ constraint \s+ tbl_detail_fk_Fk_main \s+
+ foreign \s+ key \s+ \( \s* fk_main \s* \) \s+
+ references \s+ tbl_main \s+ \( \s* pk_main \s* \) \s+ ON \s+ DELETE \s+ CASCADE \s* ;
+.*/six);
+
+
+__END__
diff --git a/t/data/nullable.dia b/t/data/nullable.dia
new file mode 100644
index 0000000..fd543f0
Binary files /dev/null and b/t/data/nullable.dia differ
diff --git a/t/data/rt56357.dia b/t/data/rt56357.dia
index b6d1e0c..e1eac35 100644
Binary files a/t/data/rt56357.dia and b/t/data/rt56357.dia differ
diff --git a/t/data/rt66031.dia b/t/data/rt66031.dia
new file mode 100644
index 0000000..37cbd35
--- /dev/null
+++ b/t/data/rt66031.dia
@@ -0,0 +1,429 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<dia:diagram xmlns:dia="http://www.lysator.liu.se/~alla/dia/">
+ <dia:diagramdata>
+ <dia:attribute name="background">
+ <dia:color val="#ffffff"/>
+ </dia:attribute>
+ <dia:attribute name="pagebreak">
+ <dia:color val="#000099"/>
+ </dia:attribute>
+ <dia:attribute name="paper">
+ <dia:composite type="paper">
+ <dia:attribute name="name">
+ <dia:string>#A4#</dia:string>
+ </dia:attribute>
+ <dia:attribute name="tmargin">
+ <dia:real val="2.8222000598907471"/>
+ </dia:attribute>
+ <dia:attribute name="bmargin">
+ <dia:real val="2.8222000598907471"/>
+ </dia:attribute>
+ <dia:attribute name="lmargin">
+ <dia:real val="2.8222000598907471"/>
+ </dia:attribute>
+ <dia:attribute name="rmargin">
+ <dia:real val="2.8222000598907471"/>
+ </dia:attribute>
+ <dia:attribute name="is_portrait">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="scaling">
+ <dia:real val="1"/>
+ </dia:attribute>
+ <dia:attribute name="fitto">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ </dia:composite>
+ </dia:attribute>
+ <dia:attribute name="grid">
+ <dia:composite type="grid">
+ <dia:attribute name="width_x">
+ <dia:real val="1"/>
+ </dia:attribute>
+ <dia:attribute name="width_y">
+ <dia:real val="1"/>
+ </dia:attribute>
+ <dia:attribute name="visible_x">
+ <dia:int val="1"/>
+ </dia:attribute>
+ <dia:attribute name="visible_y">
+ <dia:int val="1"/>
+ </dia:attribute>
+ <dia:composite type="color"/>
+ </dia:composite>
+ </dia:attribute>
+ <dia:attribute name="color">
+ <dia:color val="#d8e5e5"/>
+ </dia:attribute>
+ <dia:attribute name="guides">
+ <dia:composite type="guides">
+ <dia:attribute name="hguides"/>
+ <dia:attribute name="vguides"/>
+ </dia:composite>
+ </dia:attribute>
+ </dia:diagramdata>
+ <dia:layer name="Sfondo" visible="true" active="true">
+ <dia:object type="UML - Class" version="0" id="O0">
+ <dia:attribute name="obj_pos">
+ <dia:point val="15.3125,11.125"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="15.2625,11.075;22.0225,13.975"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="15.3125,11.125"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="6.6600000000000001"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="2.7999999999999998"/>
+ </dia:attribute>
+ <dia:attribute name="name">
+ <dia:string>#tbl_main#</dia:string>
+ </dia:attribute>
+ <dia:attribute name="stereotype">
+ <dia:string>##</dia:string>
+ </dia:attribute>
+ <dia:attribute name="comment">
+ <dia:string>##</dia:string>
+ </dia:attribute>
+ <dia:attribute name="abstract">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="suppress_attributes">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="suppress_operations">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="visible_attributes">
+ <dia:boolean val="true"/>
+ </dia:attribute>
+ <dia:attribute name="visible_operations">
+ <dia:boolean val="true"/>
+ </dia:attribute>
+ <dia:attribute name="visible_comments">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="wrap_operations">
+ <dia:boolean val="true"/>
+ </dia:attribute>
+ <dia:attribute name="wrap_after_char">
+ <dia:int val="40"/>
+ </dia:attribute>
+ <dia:attribute name="comment_line_length">
+ <dia:int val="17"/>
+ </dia:attribute>
+ <dia:attribute name="comment_tagging">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="line_width">
+ <dia:real val="0.10000000000000001"/>
+ </dia:attribute>
+ <dia:attribute name="line_color">
+ <dia:color val="#000000"/>
+ </dia:attribute>
+ <dia:attribute name="fill_color">
+ <dia:color val="#ffffff"/>
+ </dia:attribute>
+ <dia:attribute name="text_color">
+ <dia:color val="#000000"/>
+ </dia:attribute>
+ <dia:attribute name="normal_font">
+ <dia:font family="monospace" style="0" name="Courier"/>
+ </dia:attribute>
+ <dia:attribute name="abstract_font">
+ <dia:font family="monospace" style="88" name="Courier-BoldOblique"/>
+ </dia:attribute>
+ <dia:attribute name="polymorphic_font">
+ <dia:font family="monospace" style="8" name="Courier-Oblique"/>
+ </dia:attribute>
+ <dia:attribute name="classname_font">
+ <dia:font family="sans" style="80" name="Helvetica-Bold"/>
+ </dia:attribute>
+ <dia:attribute name="abstract_classname_font">
+ <dia:font family="sans" style="88" name="Helvetica-BoldOblique"/>
+ </dia:attribute>
+ <dia:attribute name="comment_font">
+ <dia:font family="sans" style="8" name="Helvetica-Oblique"/>
+ </dia:attribute>
+ <dia:attribute name="normal_font_height">
+ <dia:real val="0.80000000000000004"/>
+ </dia:attribute>
+ <dia:attribute name="polymorphic_font_height">
+ <dia:real val="0.80000000000000004"/>
+ </dia:attribute>
+ <dia:attribute name="abstract_font_height">
+ <dia:real val="0.80000000000000004"/>
+ </dia:attribute>
+ <dia:attribute name="classname_font_height">
+ <dia:real val="1"/>
+ </dia:attribute>
+ <dia:attribute name="abstract_classname_font_height">
+ <dia:real val="1"/>
+ </dia:attribute>
+ <dia:attribute name="comment_font_height">
+ <dia:real val="0.69999999999999996"/>
+ </dia:attribute>
+ <dia:attribute name="attributes">
+ <dia:composite type="umlattribute">
+ <dia:attribute name="name">
+ <dia:string>#pk_main#</dia:string>
+ </dia:attribute>
+ <dia:attribute name="type">
+ <dia:string>#SERIAL#</dia:string>
+ </dia:attribute>
+ <dia:attribute name="value">
+ <dia:string>##</dia:string>
+ </dia:attribute>
+ <dia:attribute name="comment">
+ <dia:string>##</dia:string>
+ </dia:attribute>
+ <dia:attribute name="visibility">
+ <dia:enum val="2"/>
+ </dia:attribute>
+ <dia:attribute name="abstract">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="class_scope">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ </dia:composite>
+ </dia:attribute>
+ <dia:attribute name="operations"/>
+ <dia:attribute name="template">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="templates"/>
+ </dia:object>
+ <dia:object type="UML - Class" version="0" id="O1">
+ <dia:attribute name="obj_pos">
+ <dia:point val="30.4375,5.8125"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="30.3875,5.7625;37.9175,9.4625"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="30.4375,5.8125"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="7.4299999999999997"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="3.6000000000000001"/>
+ </dia:attribute>
+ <dia:attribute name="name">
+ <dia:string>#tbl_detail#</dia:string>
+ </dia:attribute>
+ <dia:attribute name="stereotype">
+ <dia:string>##</dia:string>
+ </dia:attribute>
+ <dia:attribute name="comment">
+ <dia:string>##</dia:string>
+ </dia:attribute>
+ <dia:attribute name="abstract">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="suppress_attributes">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="suppress_operations">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="visible_attributes">
+ <dia:boolean val="true"/>
+ </dia:attribute>
+ <dia:attribute name="visible_operations">
+ <dia:boolean val="true"/>
+ </dia:attribute>
+ <dia:attribute name="visible_comments">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="wrap_operations">
+ <dia:boolean val="true"/>
+ </dia:attribute>
+ <dia:attribute name="wrap_after_char">
+ <dia:int val="40"/>
+ </dia:attribute>
+ <dia:attribute name="comment_line_length">
+ <dia:int val="17"/>
+ </dia:attribute>
+ <dia:attribute name="comment_tagging">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="line_width">
+ <dia:real val="0.10000000000000001"/>
+ </dia:attribute>
+ <dia:attribute name="line_color">
+ <dia:color val="#000000"/>
+ </dia:attribute>
+ <dia:attribute name="fill_color">
+ <dia:color val="#ffffff"/>
+ </dia:attribute>
+ <dia:attribute name="text_color">
+ <dia:color val="#000000"/>
+ </dia:attribute>
+ <dia:attribute name="normal_font">
+ <dia:font family="monospace" style="0" name="Courier"/>
+ </dia:attribute>
+ <dia:attribute name="abstract_font">
+ <dia:font family="monospace" style="88" name="Courier-BoldOblique"/>
+ </dia:attribute>
+ <dia:attribute name="polymorphic_font">
+ <dia:font family="monospace" style="8" name="Courier-Oblique"/>
+ </dia:attribute>
+ <dia:attribute name="classname_font">
+ <dia:font family="sans" style="80" name="Helvetica-Bold"/>
+ </dia:attribute>
+ <dia:attribute name="abstract_classname_font">
+ <dia:font family="sans" style="88" name="Helvetica-BoldOblique"/>
+ </dia:attribute>
+ <dia:attribute name="comment_font">
+ <dia:font family="sans" style="8" name="Helvetica-Oblique"/>
+ </dia:attribute>
+ <dia:attribute name="normal_font_height">
+ <dia:real val="0.80000000000000004"/>
+ </dia:attribute>
+ <dia:attribute name="polymorphic_font_height">
+ <dia:real val="0.80000000000000004"/>
+ </dia:attribute>
+ <dia:attribute name="abstract_font_height">
+ <dia:real val="0.80000000000000004"/>
+ </dia:attribute>
+ <dia:attribute name="classname_font_height">
+ <dia:real val="1"/>
+ </dia:attribute>
+ <dia:attribute name="abstract_classname_font_height">
+ <dia:real val="1"/>
+ </dia:attribute>
+ <dia:attribute name="comment_font_height">
+ <dia:real val="0.69999999999999996"/>
+ </dia:attribute>
+ <dia:attribute name="attributes">
+ <dia:composite type="umlattribute">
+ <dia:attribute name="name">
+ <dia:string>#pk_detail#</dia:string>
+ </dia:attribute>
+ <dia:attribute name="type">
+ <dia:string>#SERIAL#</dia:string>
+ </dia:attribute>
+ <dia:attribute name="value">
+ <dia:string>##</dia:string>
+ </dia:attribute>
+ <dia:attribute name="comment">
+ <dia:string>##</dia:string>
+ </dia:attribute>
+ <dia:attribute name="visibility">
+ <dia:enum val="2"/>
+ </dia:attribute>
+ <dia:attribute name="abstract">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="class_scope">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ </dia:composite>
+ <dia:composite type="umlattribute">
+ <dia:attribute name="name">
+ <dia:string>#fk_main#</dia:string>
+ </dia:attribute>
+ <dia:attribute name="type">
+ <dia:string>#INT4#</dia:string>
+ </dia:attribute>
+ <dia:attribute name="value">
+ <dia:string>##</dia:string>
+ </dia:attribute>
+ <dia:attribute name="comment">
+ <dia:string>##</dia:string>
+ </dia:attribute>
+ <dia:attribute name="visibility">
+ <dia:enum val="0"/>
+ </dia:attribute>
+ <dia:attribute name="abstract">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="class_scope">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ </dia:composite>
+ </dia:attribute>
+ <dia:attribute name="operations"/>
+ <dia:attribute name="template">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="templates"/>
+ </dia:object>
+ <dia:object type="UML - Association" version="2" id="O2">
+ <dia:attribute name="name">
+ <dia:string>#fk_detail_main#</dia:string>
+ </dia:attribute>
+ <dia:attribute name="direction">
+ <dia:enum val="2"/>
+ </dia:attribute>
+ <dia:attribute name="show_direction">
+ <dia:boolean val="true"/>
+ </dia:attribute>
+ <dia:attribute name="assoc_type">
+ <dia:enum val="2"/>
+ </dia:attribute>
+ <dia:attribute name="role_a">
+ <dia:string>#pk_main#</dia:string>
+ </dia:attribute>
+ <dia:attribute name="multipicity_a">
+ <dia:string>##</dia:string>
+ </dia:attribute>
+ <dia:attribute name="visibility_a">
+ <dia:enum val="0"/>
+ </dia:attribute>
+ <dia:attribute name="show_arrow_a">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="role_b">
+ <dia:string>#fk_main#</dia:string>
+ </dia:attribute>
+ <dia:attribute name="multipicity_b">
+ <dia:string>##</dia:string>
+ </dia:attribute>
+ <dia:attribute name="visibility_b">
+ <dia:enum val="0"/>
+ </dia:attribute>
+ <dia:attribute name="show_arrow_b">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="obj_pos">
+ <dia:point val="22.0224,12.525"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="21.9724,6.8125;32.49,13.325"/>
+ </dia:attribute>
+ <dia:attribute name="meta">
+ <dia:composite type="dict"/>
+ </dia:attribute>
+ <dia:attribute name="orth_points">
+ <dia:point val="22.0224,12.525"/>
+ <dia:point val="27,12.525"/>
+ <dia:point val="27,7.6125"/>
+ <dia:point val="30.3872,7.6125"/>
+ </dia:attribute>
+ <dia:attribute name="orth_orient">
+ <dia:enum val="0"/>
+ <dia:enum val="1"/>
+ <dia:enum val="0"/>
+ </dia:attribute>
+ <dia:attribute name="orth_autoroute">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="text_colour">
+ <dia:color val="#000000"/>
+ </dia:attribute>
+ <dia:attribute name="line_colour">
+ <dia:color val="#000000"/>
+ </dia:attribute>
+ <dia:connections>
+ <dia:connection handle="0" to="O0" connection="10"/>
+ <dia:connection handle="1" to="O1" connection="12"/>
+ </dia:connections>
+ </dia:object>
+ </dia:layer>
+</dia:diagram>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libparse-dia-sql-perl.git
More information about the Pkg-perl-cvs-commits
mailing list