| | @@ -24112,12 +24112,12 @@ |
| 24112 | 24112 | ** Change the mode to eMode |
| 24113 | 24113 | */ |
| 24114 | 24114 | static void modeChange(ShellState *p, unsigned char eMode){ |
| 24115 | 24115 | const ModeInfo *pI; |
| 24116 | 24116 | if( eMode<ArraySize(aModeInfo) ){ |
| 24117 | | - pI = &aModeInfo[eMode]; |
| 24118 | 24117 | Mode *pM = &p->mode; |
| 24118 | + pI = &aModeInfo[eMode]; |
| 24119 | 24119 | pM->eMode = eMode; |
| 24120 | 24120 | if( pI->eCSep ) modeSetStr(&pM->spec.zColumnSep, aModeStr[pI->eCSep]); |
| 24121 | 24121 | if( pI->eRSep ) modeSetStr(&pM->spec.zRowSep, aModeStr[pI->eRSep]); |
| 24122 | 24122 | if( pI->eNull ) modeSetStr(&pM->spec.zNull, aModeStr[pI->eNull]); |
| 24123 | 24123 | pM->spec.eText = pI->eText; |
| | @@ -24613,38 +24613,41 @@ |
| 24613 | 24613 | } |
| 24614 | 24614 | |
| 24615 | 24615 | /* Try to determine the screen width. Use the default if unable. |
| 24616 | 24616 | */ |
| 24617 | 24617 | int shellScreenWidth(void){ |
| 24618 | | - if( stdout_tty_width>0 ) return stdout_tty_width; |
| 24618 | + if( stdout_tty_width>0 ){ |
| 24619 | + return stdout_tty_width; |
| 24620 | + }else{ |
| 24619 | 24621 | #if defined(TIOCGSIZE) |
| 24620 | | - struct ttysize ts; |
| 24621 | | - if( ioctl(STDIN_FILENO, TIOCGSIZE, &ts)>=0 |
| 24622 | | - || ioctl(STDOUT_FILENO, TIOCGSIZE, &ts)>=0 |
| 24623 | | - || ioctl(STDERR_FILENO, TIOCGSIZE, &ts)>=0 |
| 24624 | | - ){ |
| 24625 | | - return ts.ts_cols; |
| 24626 | | - } |
| 24622 | + struct ttysize ts; |
| 24623 | + if( ioctl(STDIN_FILENO, TIOCGSIZE, &ts)>=0 |
| 24624 | + || ioctl(STDOUT_FILENO, TIOCGSIZE, &ts)>=0 |
| 24625 | + || ioctl(STDERR_FILENO, TIOCGSIZE, &ts)>=0 |
| 24626 | + ){ |
| 24627 | + return ts.ts_cols; |
| 24628 | + } |
| 24627 | 24629 | #elif defined(TIOCGWINSZ) |
| 24628 | | - struct winsize ws; |
| 24629 | | - if( ioctl(STDIN_FILENO, TIOCGWINSZ, &ws)>=0 |
| 24630 | | - || ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws)>=0 |
| 24631 | | - || ioctl(STDERR_FILENO, TIOCGWINSZ, &ws)>=0 |
| 24632 | | - ){ |
| 24633 | | - return ws.ws_col; |
| 24634 | | - } |
| 24630 | + struct winsize ws; |
| 24631 | + if( ioctl(STDIN_FILENO, TIOCGWINSZ, &ws)>=0 |
| 24632 | + || ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws)>=0 |
| 24633 | + || ioctl(STDERR_FILENO, TIOCGWINSZ, &ws)>=0 |
| 24634 | + ){ |
| 24635 | + return ws.ws_col; |
| 24636 | + } |
| 24635 | 24637 | #elif defined(_WIN32) |
| 24636 | | - CONSOLE_SCREEN_BUFFER_INFO csbi; |
| 24637 | | - if( GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi) |
| 24638 | | - || GetConsoleScreenBufferInfo(GetStdHandle(STD_ERROR_HANDLE), &csbi) |
| 24639 | | - || GetConsoleScreenBufferInfo(GetStdHandle(STD_INPUT_HANDLE), &csbi) |
| 24640 | | - ){ |
| 24641 | | - return csbi.srWindow.Right - csbi.srWindow.Left + 1; |
| 24642 | | - } |
| 24638 | + CONSOLE_SCREEN_BUFFER_INFO csbi; |
| 24639 | + if( GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi) |
| 24640 | + || GetConsoleScreenBufferInfo(GetStdHandle(STD_ERROR_HANDLE), &csbi) |
| 24641 | + || GetConsoleScreenBufferInfo(GetStdHandle(STD_INPUT_HANDLE), &csbi) |
| 24642 | + ){ |
| 24643 | + return csbi.srWindow.Right - csbi.srWindow.Left + 1; |
| 24644 | + } |
| 24643 | 24645 | #endif |
| 24644 | 24646 | #define DEFAULT_SCREEN_WIDTH 80 |
| 24645 | | - return DEFAULT_SCREEN_WIDTH; |
| 24647 | + return DEFAULT_SCREEN_WIDTH; |
| 24648 | + } |
| 24646 | 24649 | } |
| 24647 | 24650 | |
| 24648 | 24651 | #if (defined(_WIN32) || defined(WIN32)) && !defined(_WIN32_WCE) |
| 24649 | 24652 | /* |
| 24650 | 24653 | ** This routine runs for console events (e.g. Ctrl-C) on Win32 |
| | @@ -31876,12 +31879,12 @@ |
| 31876 | 31879 | data.mode.spec.nCharLimit = 0; |
| 31877 | 31880 | data.mode.spec.zRowSep = "\n"; |
| 31878 | 31881 | rc = shell_exec(&data,zSql,0); |
| 31879 | 31882 | sqlite3_free(zSql); |
| 31880 | 31883 | if( rc==SQLITE_OK ){ |
| 31881 | | - memset(hasStat, 0, sizeof(hasStat)); |
| 31882 | 31884 | sqlite3_stmt *pStmt; |
| 31885 | + memset(hasStat, 0, sizeof(hasStat)); |
| 31883 | 31886 | rc = sqlite3_prepare_v2(p->db, |
| 31884 | 31887 | "SELECT substr(name,12,1) FROM sqlite_schema" |
| 31885 | 31888 | " WHERE name GLOB 'sqlite_stat[134]'", |
| 31886 | 31889 | -1, &pStmt, 0); |
| 31887 | 31890 | if( rc==SQLITE_OK ){ |
| 31888 | 31891 | |