Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | better column names in the shell (CVS 111) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
57022a9d504e553d862f363b164c42ba |
User & Date: | drh 2000-07-29 13:20:21.000 |
Context
2000-07-30
| ||
20:04 | documentation updates (CVS 112) (check-in: c686c6076a user: drh tags: trunk) | |
2000-07-29
| ||
13:20 | better column names in the shell (CVS 111) (check-in: 57022a9d50 user: drh tags: trunk) | |
13:06 | better column labels in select results (CVS 110) (check-in: 3bf434d93a user: drh tags: trunk) | |
Changes
Changes to src/shell.c.
︙ | ︙ | |||
20 21 22 23 24 25 26 | ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ************************************************************************* ** This file contains code to implement the "sqlite" command line ** utility for accessing SQLite databases. ** | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ************************************************************************* ** This file contains code to implement the "sqlite" command line ** utility for accessing SQLite databases. ** ** $Id: shell.c,v 1.17 2000/07/29 13:20:21 drh Exp $ */ #include <stdlib.h> #include <string.h> #include <stdio.h> #include "sqlite.h" #include <unistd.h> #include <ctype.h> |
︙ | ︙ | |||
126 127 128 129 130 131 132 | int cnt; /* Number of records displayed so far */ FILE *out; /* Write results here */ int mode; /* An output mode setting */ int showHeader; /* True to show column names in List or Column mode */ int escape; /* Escape this character when in MODE_List */ char zDestTable[250]; /* Name of destination table when MODE_Insert */ char separator[20]; /* Separator character for MODE_List */ | | > | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | int cnt; /* Number of records displayed so far */ FILE *out; /* Write results here */ int mode; /* An output mode setting */ int showHeader; /* True to show column names in List or Column mode */ int escape; /* Escape this character when in MODE_List */ char zDestTable[250]; /* Name of destination table when MODE_Insert */ char separator[20]; /* Separator character for MODE_List */ int colWidth[100]; /* Requested width of each column when in column mode*/ int actualWidth[100]; /* Actual width of each column */ }; /* ** These are the allowed modes. */ #define MODE_Line 0 /* One column per line. Blank line between records */ #define MODE_Column 1 /* One record per line in neat columns */ |
︙ | ︙ | |||
239 240 241 242 243 244 245 | if( p->cnt++>0 ) fprintf(p->out,"\n"); for(i=0; i<nArg; i++){ fprintf(p->out,"%s = %s\n", azCol[i], azArg[i] ? azArg[i] : 0); } break; } case MODE_Column: { | | | | | | > > > > > > > > > > | | > > | | | | | | | | | | | | > | | | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | if( p->cnt++>0 ) fprintf(p->out,"\n"); for(i=0; i<nArg; i++){ fprintf(p->out,"%s = %s\n", azCol[i], azArg[i] ? azArg[i] : 0); } break; } case MODE_Column: { if( p->cnt++==0 ){ for(i=0; i<nArg; i++){ int w, n; if( i<ArraySize(p->colWidth) ){ w = p->colWidth[i]; }else{ w = 0; } if( w<=0 ){ w = strlen(azCol[i]); if( w<10 ) w = 10; n = strlen(azArg[i]); if( w<n ) w = n; } if( i<ArraySize(p->actualWidth) ){ p->actualWidth[i] = w; } if( p->showHeader ){ fprintf(p->out,"%-*.*s%s",w,w,azCol[i], i==nArg-1 ? "\n": " "); } } if( p->showHeader ){ for(i=0; i<nArg; i++){ int w; if( i<ArraySize(p->actualWidth) ){ w = p->actualWidth[i]; }else{ w = 10; } fprintf(p->out,"%-*.*s%s",w,w,"-----------------------------------" "----------------------------------------------------------", i==nArg-1 ? "\n": " "); } } } for(i=0; i<nArg; i++){ int w; if( i<ArraySize(p->actualWidth) ){ w = p->actualWidth[i]; }else{ w = 10; } fprintf(p->out,"%-*.*s%s",w,w, azArg[i] ? azArg[i] : "", i==nArg-1 ? "\n": " "); } break; |
︙ | ︙ |