[interchange-cvs] interchange - heins modified code/UI_Tag/backup_database.coretag

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Mon May 15 00:27:10 EDT 2006


User:      heins
Date:      2006-05-15 04:27:08 GMT
Modified:  code/UI_Tag backup_database.coretag
Log:
* Incorporate things suggested by Carl Bailey (carl at carlbailey.net).

* Use Spreadsheet::WriteExcel::Big to allow XLS files > 7MB.

* Only set cells with a length, which makes the sheets "sparse" and
  reduces storage requirements.

Revision  Changes    Path
1.8       +15 -7     interchange/code/UI_Tag/backup_database.coretag


rev 1.8, prev_rev 1.7
Index: backup_database.coretag
===================================================================
RCS file: /var/cvs/interchange/code/UI_Tag/backup_database.coretag,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- backup_database.coretag	8 Nov 2005 18:14:39 -0000	1.7
+++ backup_database.coretag	15 May 2006 04:27:08 -0000	1.8
@@ -1,10 +1,10 @@
 # Copyright 2002-2005 Interchange Development Group (http://www.icdevgroup.org/)
 # Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: backup_database.coretag,v 1.7 2005/11/08 18:14:39 jon Exp $
+# $Id: backup_database.coretag,v 1.8 2006/05/15 04:27:08 mheins Exp $
 
 UserTag backup-database Order    tables
 UserTag backup-database AddAttr
-UserTag backup-database Version  $Revision: 1.7 $
+UserTag backup-database Version  $Revision: 1.8 $
 UserTag backup-database Routine  <<EOR
 sub {
 	my ($tables, $opt) = @_;
@@ -21,16 +21,23 @@
 		require Compress::Zlib;
 	} if $opt ->{compress};
 
+	my $xls;
+
+	eval {
+		require Spreadsheet::WriteExcel::Big;
+		import Spreadsheet::WriteExcel::Big;
+		$xls = Spreadsheet::WriteExcel::Big->new("$backup_dir/DBDOWNLOAD.xls");
+	} if $opt ->{xls};
+
 	eval {
 		require Spreadsheet::WriteExcel;
 		import Spreadsheet::WriteExcel;
-	} if $opt ->{xls};
+		$xls = Spreadsheet::WriteExcel->new("$backup_dir/DBDOWNLOAD.xls");
+	} if $opt ->{xls} and ! $xls;
 
-	undef $opt->{xls} if $@;
+	undef $opt->{xls} unless $xls;
 
-	my $xls;
 	if($opt->{xls}) {
-		$xls = Spreadsheet::WriteExcel->new("$backup_dir/DBDOWNLOAD.xls");
 		if($opt->{max_xls_string}) {
 			$Max_xls_string = int($opt->{max_xls_string}) || 255;
 			$xls->{_xls_strmax} = $Max_xls_string;
@@ -135,7 +142,8 @@
 			my $maxcol = scalar @fields - 1;
 			my $j;
 			for($j = 0; $j <= $maxcol; $j++) {
-				$sheet->write_string(0, $j, $fields[$j]);
+				$sheet->write_string(0, $j, $fields[$j])
+					if length $fields[$j];
 			}
 			my $i = 1;
 			while(<RECENT>) {








More information about the interchange-cvs mailing list