Subject: | Diagram.pm does not generate files on win32 and binary file aware systems, neither jpeg output |
Hi,
I found a little bugs both in Diagram.pm and sqlt-diagram.
Look at attached patch.. this should fix the issues with:
- jpeg is not selected because Diagram.pm waiting for 'output_type' arg but gets 'image_type' from sqlt-diagram
- Diagram.pm should set binmode $fd on GD output file descriptor before outputing data on win32 and binary/text file mode aware OS.
(Howewer I don't have idea how to fix it when i make sqlt-diagram -d MySQL myscript.sql > file.png <- on win32 file.png would be still broken if i don't use "-o file.png" instead.
Another story is that somehow MySQL parser doesn't like statements like that:
CREATE TABLE IF NOT EXISTS tech_profiles (
neither comments in line like that
max_file_size BIGINT UNSIGNED DEFAULT '0', /* '0' == unlimited period of time / units always in bytes */
or at last
COMMIT;
Thank you for your attention..
Best regards and thanks for great db tool,
--- lib/SQL/Translator/Producer/Diagram.pm 4 Mar 2004 14:39:15 -0000 1.11
+++ lib/SQL/Translator/Producer/Diagram.pm 13 Apr 2004 11:55:48 -0000
@@ -509,6 +509,7 @@
#
if ( $out_file ) {
open my $fh, ">$out_file" or die "Can't write '$out_file': $!\n";
+ binmode $fh;
print $fh $gd->$output_type;
close $fh;
}
--- bin/sqlt-diagram 6 Feb 2004 17:48:16 -0000 1.3
+++ bin/sqlt-diagram 13 Apr 2004 11:56:28 -0000
@@ -89,7 +89,7 @@
GetOptions(
'd|db|f|from=s' => \$db_driver,
'o|output:s' => \$out_file,
- 'i|image:s' => \$image_type,
+ 'i|image:s' => \$output_type,
't|title:s' => \$title,
'c|columns:i' => \$no_columns,
'n|no-lines' => \$no_lines,
@@ -108,13 +108,13 @@
pod2usage( -message => "No db driver specified" ) unless $db_driver;
pod2usage( -message => 'No input file' ) unless @files;
my $translator = SQL::Translator->new(
from => $db_driver,
to => 'Diagram',
debug => $debug || 0,
producer_args => {
out_file => $out_file,
- image_type => $image_type,
+ output_type => $output_type,
title => $title,
no_columns => $no_columns,
no_lines => $no_lines,