Re: [sqlite] sqlite3 column widths

2012-04-26 Thread Pete
Hi TIm,
sqlite3 already includes the ability to define the width manually with the
.width command.  I was hoping that there might be a way to use the defined
string length as part of the default when .width is not used.
Pete

On Thu, Apr 26, 2012 at 9:00 AM,  wrote:

> Nothing to stop you adding some code to the sqlite3 CLI program to have
> extra commands, allowing you to define column widths for display purposes.
> E.g:
>
> sqlite3> .colwidth x 27
>
> where x is the name of a column in some table.
>
> --
> Cheers  --  Tim
>



-- 
Pete
Molly's Revenge 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3 column widths

2012-04-25 Thread Tim Streater
On 25 Apr 2012 at 17:36, Pete  wrote: 

> So I guess that's a "No" then?
>
> I'm fully aware of how sqlite3 treats datatypes and column width
> specifications, but surely if someone defines a column with a specific max
> width, it's reasonable to assume that's the max width they want, otherwise
> why bother defining it?  That would seem to be a lot less arbitrary than
> the current logic for determining the default column width.

If you're talking about the CLI program called "sqlite3", then as has been 
stated, it has no information pertaining to how wide you want the column to be. 
As I understand it, classical SQL (if that's the term) allowed you in your 
table definition to define and thereby limit a column width. Personally I see 
no merit in that and am glad that SQLite doesn't enforce it, just as PHP, for 
example, doesn't expect you to pre-define the length of a string. I suppose 
SQLite allows you to give a width but then ignores it, as is well documented.

Nothing to stop you adding some code to the sqlite3 CLI program to have extra 
commands, allowing you to define column widths for display purposes. E.g:

sqlite3> .colwidth x 27

where x is the name of a column in some table.

--
Cheers  --  Tim
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3 column widths

2012-04-25 Thread Brian Curley
I'd imagine you could just off-load your needs to your application and
parse the DDL itself.  Use PRAGMA table_info() and parse out the column
lengths from there...assuming you're consistently adding this info...

On Wed, Apr 25, 2012 at 12:36 PM, Pete  wrote:

> So I guess that's a "No" then?
>
> I'm fully aware of how sqlite3 treats datatypes and column width
> specifications, but surely if someone defines a column with a specific max
> width, it's reasonable to assume that's the max width they want, otherwise
> why bother defining it?  That would seem to be a lot less arbitrary than
> the current logic for determining the default column width.
>
> On Wed, Apr 25, 2012 at 9:00 AM,  wrote:
>
> > Message: 23
> > Date: Tue, 24 Apr 2012 13:43:25 -0700
> > From: Roger Binns 
> > To: General Discussion of SQLite Database 
> > Subject: Re: [sqlite] sqlite3 column widths
> > Message-ID: <4f97106d.7080...@rogerbinns.com>
> > Content-Type: text/plain; charset=ISO-8859-1
> >
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA1
> >
> > On 24/04/12 13:26, Pete wrote:
> > > Is there way to have sqlite3 display the columns in the result of a
> > > SELECT statement using their defined widths in the schema?  For example
> > > if a column is defined as "Name(40) TEXT", I want the column to be 40
> > > chars wide.
> >
> > Those numbers you put in the schema are ignored by SQLite and do not
> limit
> > or provide any hints to any SQLite code.  How SQLite deals with types is
> > detailed here:
> >
> >  http://www.sqlite.org/datatype3.html
> >
> > Separately from that the SQLite source code is public domain and you have
> > the full rights to modify it, redistribute it etc.  You can modify the
> > code to work however you want.
> >
> > Roger
> >
> > -BEGIN PGP SIGNATURE-
> > Version: GnuPG v1.4.11 (GNU/Linux)
> >
> > iEYEARECAAYFAk+XEG0ACgkQmOOfHg372QRCpgCdEVfimkFYA8kx3WQixtfEVEAs
> > DpEAoLY1FVYSbQVNZoRM0dTa1fmUbsKj
> > =uuvW
> > -END PGP SIGNATURE-
> >
>
>
>
> --
> Pete
> Molly's Revenge <http://www.mollysrevenge.com>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
Regards.

Brian P Curley
  home: 845 778-5937
  cell: 845 548-4377
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3 column widths

2012-04-25 Thread Pete
So I guess that's a "No" then?

I'm fully aware of how sqlite3 treats datatypes and column width
specifications, but surely if someone defines a column with a specific max
width, it's reasonable to assume that's the max width they want, otherwise
why bother defining it?  That would seem to be a lot less arbitrary than
the current logic for determining the default column width.

On Wed, Apr 25, 2012 at 9:00 AM,  wrote:

> Message: 23
> Date: Tue, 24 Apr 2012 13:43:25 -0700
> From: Roger Binns 
> To: General Discussion of SQLite Database 
> Subject: Re: [sqlite] sqlite3 column widths
> Message-ID: <4f97106d.7080...@rogerbinns.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On 24/04/12 13:26, Pete wrote:
> > Is there way to have sqlite3 display the columns in the result of a
> > SELECT statement using their defined widths in the schema?  For example
> > if a column is defined as "Name(40) TEXT", I want the column to be 40
> > chars wide.
>
> Those numbers you put in the schema are ignored by SQLite and do not limit
> or provide any hints to any SQLite code.  How SQLite deals with types is
> detailed here:
>
>  http://www.sqlite.org/datatype3.html
>
> Separately from that the SQLite source code is public domain and you have
> the full rights to modify it, redistribute it etc.  You can modify the
> code to work however you want.
>
> Roger
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.11 (GNU/Linux)
>
> iEYEARECAAYFAk+XEG0ACgkQmOOfHg372QRCpgCdEVfimkFYA8kx3WQixtfEVEAs
> DpEAoLY1FVYSbQVNZoRM0dTa1fmUbsKj
> =uuvW
> -END PGP SIGNATURE-
>



-- 
Pete
Molly's Revenge <http://www.mollysrevenge.com>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3 column widths

2012-04-24 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 24/04/12 13:26, Pete wrote:
> Is there way to have sqlite3 display the columns in the result of a
> SELECT statement using their defined widths in the schema?  For example
> if a column is defined as "Name(40) TEXT", I want the column to be 40
> chars wide.

Those numbers you put in the schema are ignored by SQLite and do not limit
or provide any hints to any SQLite code.  How SQLite deals with types is
detailed here:

  http://www.sqlite.org/datatype3.html

Separately from that the SQLite source code is public domain and you have
the full rights to modify it, redistribute it etc.  You can modify the
code to work however you want.

Roger

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk+XEG0ACgkQmOOfHg372QRCpgCdEVfimkFYA8kx3WQixtfEVEAs
DpEAoLY1FVYSbQVNZoRM0dTa1fmUbsKj
=uuvW
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users