On 23 April 2010 16:42, Derek Martin <demar...@akamai.com> wrote:
> On Fri, Apr 23, 2010 at 08:52:37AM -0500, Jay A. Kreibich wrote:
>> On Thu, Apr 22, 2010 at 06:31:07PM -0400, Derek Martin scratched on the wall:
>> > Hi,
>
> Sadly that was the conclusion I had reached before asking here.
> Needless to say, that was not the answer I was hoping for.
>
> Column mode (without any truncation) is the format desired for these
> reports...  Picking large enough values is bad, because it means that
> I'd need to specify very large column widths for most of the columns,

Pick the right width for the columns as per the following

rem
rem  Produce tst db
rem
echo create table tst( a text, b text, c text );> creTable.sql

echo insert into tst values( '1111', '22', '3' );>> creTable.sql
echo insert into tst values( '1111111', '2', '3333333333' );>> creTable.sql
echo insert into tst values( '111', '22222', '33333333' );>> creTable.sql
echo insert into tst values( '111111111111111111111', '22222', '3333'
);>> creTable.sql
echo insert into tst values( '111', '222222', '3333333' );>> creTable.sql
echo insert into tst values( '1111111', '22222222', '33333333333333'
);>> creTable.sql
echo insert into tst values( '1111', '2222222', '3333333' );>> creTable.sql

sqlite3 tst.db < creTable.sql

rem
rem  Generate report from tst db
rem
sqlite3 tst.db "select '.width ' || max( length( a ) ) ||', ' || max(
length( b ) ) ||', ' || max( length( c ) ) from tst;" > setWidth.sql
echo .mode column> report.sql
echo .read 'setWidth.sql'>> report.sql
echo .output rpt.txt>>report.sql
echo select * from tst;>> report.sql

sqlite3 tst.db < report.sql


> which in many cases would needlessly make the report tediously wide,
> to accomodate some less common cases where the reports generate very
> wide columns.  Avoiding this is sort of the point of databases doing
> this for you... ;-)
>
> It would be swell if sqlite3 had a -notruncate option or some such,
> though adding one now wouldn't really solve my immediate problem,
> since that wouldn't be available on our desktop image.  With its
> current behavior, column mode seems fairly worthless to me.  I guess
> I'll need to convince folks that HTML output is suitable, or that they
> need to install some other database thingy to run this stuff.  Using
> sqlite3 for this seemed perfect, since it's already available to
> everyone.
>
> Thanks
>

Regards,
Simon
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to