亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? shell.c

?? sqlite 3.3.8 支持加密的版本
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.24 2006/10/12 21:34:22 rmsimpson Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "sqlite3.h"
#include <ctype.h>

#if !defined(_WIN32) && !defined(WIN32) && !defined(__MACOS__) && !defined(__OS2__)
# include <signal.h>
# include <pwd.h>
# include <unistd.h>
# include <sys/types.h>
#endif

#ifdef __MACOS__
# include <console.h>
# include <signal.h>
# include <unistd.h>
# include <extras.h>
# include <Files.h>
# include <Folders.h>
#endif

#ifdef __OS2__
# include <unistd.h>
#endif

#if defined(HAVE_READLINE) && HAVE_READLINE==1
# include <readline/readline.h>
# include <readline/history.h>
#else
# define readline(p) local_getline(p,stdin)
# define add_history(X)
# define read_history(X)
# define write_history(X)
# define stifle_history(X)
#endif

#if defined(_WIN32) || defined(WIN32)
# include <io.h>
#else
/* Make sure isatty() has a prototype.
*/
extern int isatty();
#endif

/*
** The following is the open SQLite database.  We make a pointer
** to this database a static variable so that it can be accessed
** by the SIGINT handler to interrupt database processing.
*/
static sqlite3 *db = 0;

/*
** True if an interrupt (Control-C) has been received.
*/
static volatile int seenInterrupt = 0;

/*
** This is the name of our program. It is set in main(), used
** in a number of other places, mostly for error messages.
*/
static char *Argv0;

/*
** Prompt strings. Initialized in main. Settable with
**   .prompt main continue
*/
static char mainPrompt[20];     /* First line prompt. default: "sqlite> "*/
static char continuePrompt[20]; /* Continuation prompt. default: "   ...> " */


/*
** Determines if a string is a number of not.
*/
static int isNumber(const char *z, int *realnum){
  if( *z=='-' || *z=='+' ) z++;
  if( !isdigit(*z) ){
    return 0;
  }
  z++;
  if( realnum ) *realnum = 0;
  while( isdigit(*z) ){ z++; }
  if( *z=='.' ){
    z++;
    if( !isdigit(*z) ) return 0;
    while( isdigit(*z) ){ z++; }
    if( realnum ) *realnum = 1;
  }
  if( *z=='e' || *z=='E' ){
    z++;
    if( *z=='+' || *z=='-' ) z++;
    if( !isdigit(*z) ) return 0;
    while( isdigit(*z) ){ z++; }
    if( realnum ) *realnum = 1;
  }
  return *z==0;
}

/*
** A global char* and an SQL function to access its current value 
** from within an SQL statement. This program used to use the 
** sqlite_exec_printf() API to substitue a string into an SQL statement.
** The correct way to do this with sqlite3 is to use the bind API, but
** since the shell is built around the callback paradigm it would be a lot
** of work. Instead just use this hack, which is quite harmless.
*/
static const char *zShellStatic = 0;
static void shellstaticFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  assert( 0==argc );
  assert( zShellStatic );
  sqlite3_result_text(context, zShellStatic, -1, SQLITE_STATIC);
}


/*
** This routine reads a line of text from FILE in, stores
** the text in memory obtained from malloc() and returns a pointer
** to the text.  NULL is returned at end of file, or if malloc()
** fails.
**
** The interface is like "readline" but no command-line editing
** is done.
*/
static char *local_getline(char *zPrompt, FILE *in){
  char *zLine;
  int nLine;
  int n;
  int eol;

  if( zPrompt && *zPrompt ){
    printf("%s",zPrompt);
    fflush(stdout);
  }
  nLine = 100;
  zLine = malloc( nLine );
  if( zLine==0 ) return 0;
  n = 0;
  eol = 0;
  while( !eol ){
    if( n+100>nLine ){
      nLine = nLine*2 + 100;
      zLine = realloc(zLine, nLine);
      if( zLine==0 ) return 0;
    }
    if( fgets(&zLine[n], nLine - n, in)==0 ){
      if( n==0 ){
        free(zLine);
        return 0;
      }
      zLine[n] = 0;
      eol = 1;
      break;
    }
    while( zLine[n] ){ n++; }
    if( n>0 && zLine[n-1]=='\n' ){
      n--;
      zLine[n] = 0;
      eol = 1;
    }
  }
  zLine = realloc( zLine, n+1 );
  return zLine;
}

/*
** Retrieve a single line of input text.  "isatty" is true if text
** is coming from a terminal.  In that case, we issue a prompt and
** attempt to use "readline" for command-line editing.  If "isatty"
** is false, use "local_getline" instead of "readline" and issue no prompt.
**
** zPrior is a string of prior text retrieved.  If not the empty
** string, then issue a continuation prompt.
*/
static char *one_input_line(const char *zPrior, FILE *in){
  char *zPrompt;
  char *zResult;
  if( in!=0 ){
    return local_getline(0, in);
  }
  if( zPrior && zPrior[0] ){
    zPrompt = continuePrompt;
  }else{
    zPrompt = mainPrompt;
  }
  zResult = readline(zPrompt);
#if defined(HAVE_READLINE) && HAVE_READLINE==1
  if( zResult && *zResult ) add_history(zResult);
#endif
  return zResult;
}

struct previous_mode_data {
  int valid;        /* Is there legit data in here? */
  int mode;
  int showHeader;
  int colWidth[100];
};
/*
** An pointer to an instance of this structure is passed from
** the main program to the callback.  This is used to communicate
** state and mode information.
*/
struct callback_data {
  sqlite3 *db;            /* The database */
  int echoOn;            /* True to echo input commands */
  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 */
  char *zDestTable;      /* 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 */
  char nullvalue[20];    /* The text to print when a NULL comes back from
                         ** the database */
  struct previous_mode_data explainPrev;
                         /* Holds the mode information just before
                         ** .explain ON */
  char outfile[FILENAME_MAX]; /* Filename for *out */
  const char *zDbFilename;    /* name of the database file */
};

/*
** 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 */
#define MODE_List     2  /* One record per line with a separator */
#define MODE_Semi     3  /* Same as MODE_List but append ";" to each line */
#define MODE_Html     4  /* Generate an XHTML table */
#define MODE_Insert   5  /* Generate SQL "insert" statements */
#define MODE_Tcl      6  /* Generate ANSI-C or TCL quoted elements */
#define MODE_Csv      7  /* Quote strings, numbers are plain */
#define MODE_NUM_OF   8  /* The number of modes (not a mode itself) */

static const char *modeDescr[MODE_NUM_OF] = {
  "line",
  "column",
  "list",
  "semi",
  "html",
  "insert",
  "tcl",
  "csv",
};

/*
** Number of elements in an array
*/
#define ArraySize(X)  (sizeof(X)/sizeof(X[0]))

/*
** Output the given string as a quoted string using SQL quoting conventions.
*/
static void output_quoted_string(FILE *out, const char *z){
  int i;
  int nSingle = 0;
  for(i=0; z[i]; i++){
    if( z[i]=='\'' ) nSingle++;
  }
  if( nSingle==0 ){
    fprintf(out,"'%s'",z);
  }else{
    fprintf(out,"'");
    while( *z ){
      for(i=0; z[i] && z[i]!='\''; i++){}
      if( i==0 ){
        fprintf(out,"''");
        z++;
      }else if( z[i]=='\'' ){
        fprintf(out,"%.*s''",i,z);
        z += i+1;
      }else{
        fprintf(out,"%s",z);
        break;
      }
    }
    fprintf(out,"'");
  }
}

/*
** Output the given string as a quoted according to C or TCL quoting rules.
*/
static void output_c_string(FILE *out, const char *z){
  unsigned int c;
  fputc('"', out);
  while( (c = *(z++))!=0 ){
    if( c=='\\' ){
      fputc(c, out);
      fputc(c, out);
    }else if( c=='\t' ){
      fputc('\\', out);
      fputc('t', out);
    }else if( c=='\n' ){
      fputc('\\', out);
      fputc('n', out);
    }else if( c=='\r' ){
      fputc('\\', out);
      fputc('r', out);
    }else if( !isprint(c) ){
      fprintf(out, "\\%03o", c&0xff);
    }else{
      fputc(c, out);
    }
  }
  fputc('"', out);
}

/*
** Output the given string with characters that are special to
** HTML escaped.
*/
static void output_html_string(FILE *out, const char *z){
  int i;
  while( *z ){
    for(i=0; z[i] && z[i]!='<' && z[i]!='&'; i++){}
    if( i>0 ){
      fprintf(out,"%.*s",i,z);
    }
    if( z[i]=='<' ){
      fprintf(out,"&lt;");
    }else if( z[i]=='&' ){
      fprintf(out,"&amp;");
    }else{
      break;
    }
    z += i + 1;
  }
}

/*
** Output a single term of CSV.  Actually, p->separator is used for
** the separator, which may or may not be a comma.  p->nullvalue is
** the null value.  Strings are quoted using ANSI-C rules.  Numbers
** appear outside of quotes.
*/
static void output_csv(struct callback_data *p, const char *z, int bSep){
  if( z==0 ){
    fprintf(p->out,"%s",p->nullvalue);
  }else if( isNumber(z, 0) ){
    fprintf(p->out,"%s",z);
  }else{
    output_c_string(p->out, z);
  }
  if( bSep ){
    fprintf(p->out, p->separator);
  }
}

#ifdef SIGINT
/*
** This routine runs when the user presses Ctrl-C
*/
static void interrupt_handler(int NotUsed){
  seenInterrupt = 1;
  if( db ) sqlite3_interrupt(db);
}
#endif

/*
** This is the callback routine that the SQLite library
** invokes for each row of a query result.
*/
static int callback(void *pArg, int nArg, char **azArg, char **azCol){
  int i;
  struct callback_data *p = (struct callback_data*)pArg;
  switch( p->mode ){
    case MODE_Line: {
      int w = 5;
      if( azArg==0 ) break;
      for(i=0; i<nArg; i++){
        int len = strlen(azCol[i] ? azCol[i] : "");
        if( len>w ) w = len;
      }
      if( p->cnt++>0 ) fprintf(p->out,"\n");
      for(i=0; i<nArg; i++){
        fprintf(p->out,"%*s = %s\n", w, azCol[i],
                azArg[i] ? azArg[i] : p->nullvalue);
      }
      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] ? azCol[i] : "");
            if( w<10 ) w = 10;
            n = strlen(azArg && azArg[i] ? azArg[i] : p->nullvalue);
            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": "  ");
          }
        }
      }
      if( azArg==0 ) break;
      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] : p->nullvalue, i==nArg-1 ? "\n": "  ");
      }
      break;
    }
    case MODE_Semi:
    case MODE_List: {
      if( p->cnt++==0 && p->showHeader ){
        for(i=0; i<nArg; i++){
          fprintf(p->out,"%s%s",azCol[i], i==nArg-1 ? "\n" : p->separator);
        }
      }
      if( azArg==0 ) break;
      for(i=0; i<nArg; i++){
        char *z = azArg[i];
        if( z==0 ) z = p->nullvalue;
        fprintf(p->out, "%s", z);
        if( i<nArg-1 ){

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美区自拍先锋| 麻豆精品一二三| 一区二区不卡在线播放| 日本免费新一区视频| 成人av在线资源网站| 欧美在线观看一区| 久久久久久久久久久久久夜| 亚洲天堂精品在线观看| 久久99久久久久久久久久久| 91丝袜高跟美女视频| 日韩欧美的一区| 一卡二卡三卡日韩欧美| 国产盗摄女厕一区二区三区| 精品视频在线免费观看| 中文字幕高清一区| 韩国成人精品a∨在线观看| 欧美中文字幕一区二区三区亚洲| 国产色产综合色产在线视频| 天天色综合天天| 日本韩国欧美一区二区三区| 国产日韩三级在线| 精品一区二区三区久久| 欧美日本不卡视频| 亚洲精品成人天堂一二三| 国产成人欧美日韩在线电影| 欧美一级国产精品| 图片区小说区国产精品视频| 在线影院国内精品| 亚洲美女区一区| 白白色亚洲国产精品| 国产视频一区二区在线观看| 国产一区二区主播在线| 日韩视频在线你懂得| 日韩av成人高清| 欧美日韩高清在线播放| 亚洲国产成人av网| 欧美美女喷水视频| 午夜精品国产更新| 欧美精品一二三| 五月婷婷激情综合| 欧美性生交片4| 亚洲一区二区三区精品在线| 91国在线观看| 亚洲一区二区高清| 欧美日韩亚洲高清一区二区| 亚洲成av人片在线| 91精品国产色综合久久久蜜香臀| 日韩国产欧美一区二区三区| 欧美一区在线视频| 免费久久精品视频| 久久精品水蜜桃av综合天堂| 高清不卡一区二区| 亚洲欧洲成人av每日更新| 99久久精品免费看国产免费软件| 综合激情网...| 一本大道久久精品懂色aⅴ| 亚洲午夜免费视频| 777久久久精品| 精一区二区三区| 国产精品久久夜| 欧美性xxxxxxxx| 另类综合日韩欧美亚洲| 久久久99精品久久| 欧美性视频一区二区三区| 免费成人结看片| 欧美激情中文字幕| 在线亚洲高清视频| 韩国成人在线视频| 亚洲色图另类专区| 欧美一区二区日韩| 丁香一区二区三区| 亚洲高清三级视频| 久久综合色婷婷| 欧美综合亚洲图片综合区| 久久97超碰色| 亚洲男人电影天堂| 久久奇米777| 欧美色视频一区| 国产成人精品网址| 午夜视频一区二区三区| 国产欧美精品一区二区色综合| 在线视频中文字幕一区二区| 国产精品一区二区果冻传媒| 亚洲最色的网站| 久久久国际精品| 欧美吞精做爰啪啪高潮| 国产成a人亚洲| 日韩极品在线观看| 亚洲欧美偷拍另类a∨色屁股| 欧美变态tickle挠乳网站| 色婷婷久久99综合精品jk白丝| 激情五月婷婷综合网| 亚洲一区二区美女| 亚洲欧洲综合另类| 久久精品夜夜夜夜久久| 欧美一区二区视频在线观看2020| 99久久久精品| 粉嫩嫩av羞羞动漫久久久| 婷婷六月综合网| 亚洲欧美色综合| 国产午夜精品久久久久久免费视| 91精品午夜视频| 欧美亚一区二区| 色噜噜狠狠成人中文综合| 福利电影一区二区三区| 精品一区二区三区视频| 天天色天天爱天天射综合| 一区二区三区在线免费视频| 国产精品乱码妇女bbbb| 久久综合九色综合久久久精品综合| 欧美日韩国产影片| 在线精品视频一区二区三四| 91美女蜜桃在线| 97精品久久久久中文字幕| 大白屁股一区二区视频| 国产综合色精品一区二区三区| 美女诱惑一区二区| 日本美女一区二区三区| 日韩制服丝袜av| 丝袜a∨在线一区二区三区不卡 | 国产色产综合产在线视频| 日韩三级精品电影久久久| 欧美三级乱人伦电影| 色偷偷成人一区二区三区91| 97精品电影院| 欧美无砖专区一中文字| 欧美日韩激情一区| 欧美电影一区二区| 日韩视频一区二区在线观看| 日韩精品一区二区三区老鸭窝| 日韩欧美一区二区视频| 久久影音资源网| 国产欧美日韩激情| 亚洲色图清纯唯美| 亚洲成人动漫在线观看| 天天射综合影视| 久久99精品视频| 国产不卡在线一区| 色哟哟亚洲精品| 欧美三级在线看| 欧美v日韩v国产v| 国产日韩欧美一区二区三区乱码| 国产精品国产三级国产a| 夜夜精品视频一区二区| 日本vs亚洲vs韩国一区三区 | 中文字幕一区二区三区视频| 亚洲精品水蜜桃| 日韩av电影免费观看高清完整版在线观看| 日本不卡一区二区三区高清视频| 久久99国内精品| 91一区一区三区| 宅男在线国产精品| 欧美经典一区二区| 亚洲无人区一区| 国产一区二区美女诱惑| 91视频免费观看| 日韩一区二区三区四区| 中文字幕一区二区三| 首页亚洲欧美制服丝腿| 国产成人丝袜美腿| 欧美人狂配大交3d怪物一区| 久久网站最新地址| 亚洲综合精品久久| 国产精品自拍毛片| 欧美亚洲图片小说| 欧美国产日韩精品免费观看| 亚洲午夜免费电影| 成年人网站91| 日韩欧美国产综合| 亚洲一区二区av在线| 国产成人一区在线| 91精品久久久久久蜜臀| 国产精品久久二区二区| 久久成人久久鬼色| 欧美日韩国产123区| 中文字幕日本不卡| 国产一区二区h| 在线电影一区二区三区| 亚洲日本护士毛茸茸| 国产精品一区一区| 欧美一级一区二区| 亚洲综合无码一区二区| aaa欧美大片| 国产亚洲女人久久久久毛片| 麻豆精品国产传媒mv男同| 色悠久久久久综合欧美99| 国产日韩欧美精品一区| 九色porny丨国产精品| 在线综合视频播放| 亚洲国产sm捆绑调教视频 | 国产精品成人在线观看| 国产在线视视频有精品| 欧美一级日韩免费不卡| 亚洲线精品一区二区三区八戒| k8久久久一区二区三区| 日本一区二区在线不卡| 国产成人av电影在线播放| 久久久99精品久久| 国产精品一区二区久激情瑜伽| 欧美成人性战久久|