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

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

?? func.c

?? sqlite 3.3.8 支持加密的版本
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
** 2002 February 23
**
** 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 the C functions that implement various SQL
** functions of SQLite.  
**
** There is only one exported symbol in this file - the function
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope.
**
** $Id: func.c,v 1.26 2006/10/12 21:34:21 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
/* #include <math.h> */
#include <stdlib.h>
#include <assert.h>
#include "vdbeInt.h"
#include "os.h"

/*
** Return the collating function associated with a function.
*/
static CollSeq *sqlite3GetFuncCollSeq(sqlite3_context *context){
  return context->pColl;
}

/*
** Implementation of the non-aggregate min() and max() functions
*/
static void minmaxFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  int i;
  int mask;    /* 0 for min() or 0xffffffff for max() */
  int iBest;
  CollSeq *pColl;

  if( argc==0 ) return;
  mask = sqlite3_user_data(context)==0 ? 0 : -1;
  pColl = sqlite3GetFuncCollSeq(context);
  assert( pColl );
  assert( mask==-1 || mask==0 );
  iBest = 0;
  if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
  for(i=1; i<argc; i++){
    if( sqlite3_value_type(argv[i])==SQLITE_NULL ) return;
    if( (sqlite3MemCompare(argv[iBest], argv[i], pColl)^mask)>=0 ){
      iBest = i;
    }
  }
  sqlite3_result_value(context, argv[iBest]);
}

/*
** Return the type of the argument.
*/
static void typeofFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  const char *z = 0;
  switch( sqlite3_value_type(argv[0]) ){
    case SQLITE_NULL:    z = "null";    break;
    case SQLITE_INTEGER: z = "integer"; break;
    case SQLITE_TEXT:    z = "text";    break;
    case SQLITE_FLOAT:   z = "real";    break;
    case SQLITE_BLOB:    z = "blob";    break;
  }
  sqlite3_result_text(context, z, -1, SQLITE_STATIC);
}


/*
** Implementation of the length() function
*/
static void lengthFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  int len;

  assert( argc==1 );
  switch( sqlite3_value_type(argv[0]) ){
    case SQLITE_BLOB:
    case SQLITE_INTEGER:
    case SQLITE_FLOAT: {
      sqlite3_result_int(context, sqlite3_value_bytes(argv[0]));
      break;
    }
    case SQLITE_TEXT: {
      const unsigned char *z = sqlite3_value_text(argv[0]);
      for(len=0; *z; z++){ if( (0xc0&*z)!=0x80 ) len++; }
      sqlite3_result_int(context, len);
      break;
    }
    default: {
      sqlite3_result_null(context);
      break;
    }
  }
}

/*
** Implementation of the abs() function
*/
static void absFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  assert( argc==1 );
  switch( sqlite3_value_type(argv[0]) ){
    case SQLITE_INTEGER: {
      i64 iVal = sqlite3_value_int64(argv[0]);
      if( iVal<0 ){
        if( (iVal<<1)==0 ){
          sqlite3_result_error(context, "integer overflow", -1);
          return;
        }
        iVal = -iVal;
      } 
      sqlite3_result_int64(context, iVal);
      break;
    }
    case SQLITE_NULL: {
      sqlite3_result_null(context);
      break;
    }
    default: {
      double rVal = sqlite3_value_double(argv[0]);
      if( rVal<0 ) rVal = -rVal;
      sqlite3_result_double(context, rVal);
      break;
    }
  }
}

/*
** Implementation of the substr() function
*/
static void substrFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  const unsigned char *z;
  const unsigned char *z2;
  int i;
  int p1, p2, len;

  assert( argc==3 );
  z = sqlite3_value_text(argv[0]);
  if( z==0 ) return;
  p1 = sqlite3_value_int(argv[1]);
  p2 = sqlite3_value_int(argv[2]);
  for(len=0, z2=z; *z2; z2++){ if( (0xc0&*z2)!=0x80 ) len++; }
  if( p1<0 ){
    p1 += len;
    if( p1<0 ){
      p2 += p1;
      p1 = 0;
    }
  }else if( p1>0 ){
    p1--;
  }
  if( p1+p2>len ){
    p2 = len-p1;
  }
  for(i=0; i<p1 && z[i]; i++){
    if( (z[i]&0xc0)==0x80 ) p1++;
  }
  while( z[i] && (z[i]&0xc0)==0x80 ){ i++; p1++; }
  for(; i<p1+p2 && z[i]; i++){
    if( (z[i]&0xc0)==0x80 ) p2++;
  }
  while( z[i] && (z[i]&0xc0)==0x80 ){ i++; p2++; }
  if( p2<0 ) p2 = 0;
  sqlite3_result_text(context, (char*)&z[p1], p2, SQLITE_TRANSIENT);
}

/*
** Implementation of the round() function
*/
static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  int n = 0;
  double r;
  char zBuf[500];  /* larger than the %f representation of the largest double */
  assert( argc==1 || argc==2 );
  if( argc==2 ){
    if( SQLITE_NULL==sqlite3_value_type(argv[1]) ) return;
    n = sqlite3_value_int(argv[1]);
    if( n>30 ) n = 30;
    if( n<0 ) n = 0;
  }
  if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
  r = sqlite3_value_double(argv[0]);
  sqlite3_snprintf(sizeof(zBuf),zBuf,"%.*f",n,r);
  sqlite3AtoF(zBuf, &r);
  sqlite3_result_double(context, r);
}

/*
** Implementation of the upper() and lower() SQL functions.
*/
static void upperFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  unsigned char *z;
  int i;
  if( argc<1 || SQLITE_NULL==sqlite3_value_type(argv[0]) ) return;
  z = sqliteMalloc(sqlite3_value_bytes(argv[0])+1);
  if( z==0 ) return;
  strcpy((char*)z, (char*)sqlite3_value_text(argv[0]));
  for(i=0; z[i]; i++){
    z[i] = toupper(z[i]);
  }
  sqlite3_result_text(context, (char*)z, -1, SQLITE_TRANSIENT);
  sqliteFree(z);
}
static void lowerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  unsigned char *z;
  int i;
  if( argc<1 || SQLITE_NULL==sqlite3_value_type(argv[0]) ) return;
  z = sqliteMalloc(sqlite3_value_bytes(argv[0])+1);
  if( z==0 ) return;
  strcpy((char*)z, (char*)sqlite3_value_text(argv[0]));
  for(i=0; z[i]; i++){
    z[i] = tolower(z[i]);
  }
  sqlite3_result_text(context, (char*)z, -1, SQLITE_TRANSIENT);
  sqliteFree(z);
}

/*
** Implementation of the IFNULL(), NVL(), and COALESCE() functions.  
** All three do the same thing.  They return the first non-NULL
** argument.
*/
static void ifnullFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  int i;
  for(i=0; i<argc; i++){
    if( SQLITE_NULL!=sqlite3_value_type(argv[i]) ){
      sqlite3_result_value(context, argv[i]);
      break;
    }
  }
}

/*
** Implementation of random().  Return a random integer.  
*/
static void randomFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  sqlite_int64 r;
  sqlite3Randomness(sizeof(r), &r);
  if( (r<<1)==0 ) r = 0;  /* Prevent 0x8000.... as the result so that we */
                          /* can always do abs() of the result */
  sqlite3_result_int64(context, r);
}

/*
** Implementation of the last_insert_rowid() SQL function.  The return
** value is the same as the sqlite3_last_insert_rowid() API function.
*/
static void last_insert_rowid(
  sqlite3_context *context, 
  int arg, 
  sqlite3_value **argv
){
  sqlite3 *db = sqlite3_user_data(context);
  sqlite3_result_int64(context, sqlite3_last_insert_rowid(db));
}

/*
** Implementation of the changes() SQL function.  The return value is the
** same as the sqlite3_changes() API function.
*/
static void changes(
  sqlite3_context *context,
  int arg,
  sqlite3_value **argv
){
  sqlite3 *db = sqlite3_user_data(context);
  sqlite3_result_int(context, sqlite3_changes(db));
}

/*
** Implementation of the total_changes() SQL function.  The return value is
** the same as the sqlite3_total_changes() API function.
*/
static void total_changes(
  sqlite3_context *context,
  int arg,
  sqlite3_value **argv
){
  sqlite3 *db = sqlite3_user_data(context);
  sqlite3_result_int(context, sqlite3_total_changes(db));
}

/*
** A structure defining how to do GLOB-style comparisons.
*/
struct compareInfo {
  u8 matchAll;
  u8 matchOne;
  u8 matchSet;
  u8 noCase;
};

static const struct compareInfo globInfo = { '*', '?', '[', 0 };
/* The correct SQL-92 behavior is for the LIKE operator to ignore
** case.  Thus  'a' LIKE 'A' would be true. */
static const struct compareInfo likeInfoNorm = { '%', '_',   0, 1 };
/* If SQLITE_CASE_SENSITIVE_LIKE is defined, then the LIKE operator
** is case sensitive causing 'a' LIKE 'A' to be false */
static const struct compareInfo likeInfoAlt = { '%', '_',   0, 0 };

/*
** X is a pointer to the first byte of a UTF-8 character.  Increment
** X so that it points to the next character.  This only works right
** if X points to a well-formed UTF-8 string.
*/
#define sqliteNextChar(X)  while( (0xc0&*++(X))==0x80 ){}
#define sqliteCharVal(X)   sqlite3ReadUtf8(X)


/*
** Compare two UTF-8 strings for equality where the first string can
** potentially be a "glob" expression.  Return true (1) if they
** are the same and false (0) if they are different.
**
** Globbing rules:
**
**      '*'       Matches any sequence of zero or more characters.
**
**      '?'       Matches exactly one character.
**
**     [...]      Matches one character from the enclosed list of
**                characters.
**
**     [^...]     Matches one character not in the enclosed list.
**
** With the [...] and [^...] matching, a ']' character can be included
** in the list by making it the first character after '[' or '^'.  A
** range of characters can be specified using '-'.  Example:
** "[a-z]" matches any single lower-case letter.  To match a '-', make
** it the last character in the list.
**
** This routine is usually quick, but can be N**2 in the worst case.
**
** Hints: to match '*' or '?', put them in "[]".  Like this:
**
**         abc[*]xyz        Matches "abc*xyz" only
*/
static int patternCompare(
  const u8 *zPattern,              /* The glob pattern */
  const u8 *zString,               /* The string to compare against the glob */
  const struct compareInfo *pInfo, /* Information about how to do the compare */
  const int esc                    /* The escape character */
){
  register int c;
  int invert;
  int seen;
  int c2;
  u8 matchOne = pInfo->matchOne;
  u8 matchAll = pInfo->matchAll;
  u8 matchSet = pInfo->matchSet;
  u8 noCase = pInfo->noCase; 
  int prevEscape = 0;     /* True if the previous character was 'escape' */

  while( (c = *zPattern)!=0 ){
    if( !prevEscape && c==matchAll ){
      while( (c=zPattern[1]) == matchAll || c == matchOne ){
        if( c==matchOne ){
          if( *zString==0 ) return 0;
          sqliteNextChar(zString);
        }
        zPattern++;
      }
      if( c && esc && sqlite3ReadUtf8(&zPattern[1])==esc ){

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人自拍网| 亚洲免费高清视频在线| 欧美日韩中文一区| aaa欧美色吧激情视频| 99在线精品视频| av成人老司机| 91黄色激情网站| 欧美日韩一区二区三区视频| 欧美午夜寂寞影院| 欧美区视频在线观看| 日韩片之四级片| 国产亚洲婷婷免费| 黄色小说综合网站| 亚洲va中文字幕| 三级在线观看一区二区| 日韩国产高清在线| 国产一本一道久久香蕉| 欧美一区二区在线免费播放 | 欧美日本在线一区| 日韩一区二区免费在线电影| 欧美大尺度电影在线| 久久综合色8888| 中文字幕日本不卡| 午夜视黄欧洲亚洲| 国产麻豆精品theporn| av高清不卡在线| 欧美视频一区在线| 精品国产伦理网| 国产精品成人网| 亚洲国产视频直播| 国产一区二区在线免费观看| 成人av在线资源网| 欧美精品一卡二卡| 国产三级精品三级| 亚洲综合区在线| 老司机一区二区| 成人黄色软件下载| 91精品欧美久久久久久动漫| 国产天堂亚洲国产碰碰| 一区二区三区在线观看欧美| 久久国产精品露脸对白| www.亚洲激情.com| 欧美一区二区三区啪啪| ...xxx性欧美| 欧美日韩一本到| 久久久久久电影| 亚洲高清不卡在线| 国产成人精品免费网站| 欧美在线|欧美| 久久国产三级精品| 91小视频在线免费看| 日韩欧美国产三级| 夜夜嗨av一区二区三区| 国产经典欧美精品| 欧美日韩国产在线播放网站| 中文字幕精品三区| 奇米在线7777在线精品| 91在线精品一区二区三区| 精品国产乱码久久久久久蜜臀| 成人免费一区二区三区视频| 精久久久久久久久久久| 欧美三级电影网| 亚洲欧洲在线观看av| 国产一区二区三区香蕉 | 欧美激情一区二区在线| 蜜臀久久99精品久久久久宅男 | 欧美一级黄色录像| 亚洲人成网站在线| 国产精品99久久久久久久女警 | 亚洲超丰满肉感bbw| 成人免费毛片片v| 精品久久五月天| 日日嗨av一区二区三区四区| 91麻豆精品视频| 国产欧美精品国产国产专区| 美女脱光内衣内裤视频久久影院| 欧美性色黄大片手机版| 国产精品福利av| 成人激情小说乱人伦| 亚洲精品一区二区精华| 日本va欧美va瓶| 欧美吻胸吃奶大尺度电影 | 青草av.久久免费一区| 欧美羞羞免费网站| 成人欧美一区二区三区| 成人网男人的天堂| 国产欧美精品一区二区色综合 | 日本中文字幕一区二区有限公司| 色婷婷亚洲精品| 亚洲免费观看在线观看| av午夜一区麻豆| 国产精品毛片大码女人| 国产大陆a不卡| 久久久久成人黄色影片| 国产一区二区美女诱惑| 精品少妇一区二区三区在线视频| 青青草国产精品亚洲专区无| 91精品国产91久久久久久一区二区| 一区二区三区日韩欧美精品| 91浏览器打开| 一区二区视频免费在线观看| 91国产丝袜在线播放| 亚洲欧美激情在线| 欧美亚洲尤物久久| 亚洲成人av电影在线| 欧美日韩一区二区欧美激情| 偷窥少妇高潮呻吟av久久免费| 欧美肥妇毛茸茸| 免费精品视频在线| 精品sm捆绑视频| 国产成人综合网| 中文字幕免费不卡| 91亚洲男人天堂| 亚洲国产日韩av| 欧美一区二区三区在线观看| 美洲天堂一区二卡三卡四卡视频| 精品国产自在久精品国产| 国产美女精品在线| 国产精品嫩草99a| 色屁屁一区二区| 无吗不卡中文字幕| www激情久久| 成人免费高清在线| 亚洲激情中文1区| 91精品国产全国免费观看| 精品一区精品二区高清| 国产精品无遮挡| 在线视频综合导航| 六月丁香综合在线视频| 中文字幕免费观看一区| 欧美午夜电影网| 加勒比av一区二区| 专区另类欧美日韩| 制服丝袜亚洲精品中文字幕| 国产在线精品一区二区三区不卡| 国产精品不卡在线观看| 欧美日韩高清在线播放| 精品在线免费视频| 亚洲欧美一区二区三区国产精品| 欧美美女bb生活片| 国产69精品久久久久毛片| 亚洲美女在线一区| 精品国产一区二区三区av性色| 成人国产精品免费网站| 手机精品视频在线观看| 国产亚洲福利社区一区| 欧美日韩亚洲综合一区| 国产精品一区二区在线观看网站| 亚洲人精品一区| 欧美岛国在线观看| 91丨国产丨九色丨pron| 久久精品国产久精国产爱| 国产精品久久久久久久久久久免费看| 欧美二区三区91| 97精品超碰一区二区三区| 免费不卡在线视频| 亚洲男人的天堂在线aⅴ视频| 日韩欧美国产一区二区在线播放 | 欧美一级午夜免费电影| 成人h动漫精品一区二| 久久国产福利国产秒拍| 一区二区三区四区在线免费观看| 久久这里只有精品6| 欧美日韩在线播放| 成人免费毛片高清视频| 免费成人深夜小野草| 樱花草国产18久久久久| 国产女人水真多18毛片18精品视频| 69精品人人人人| 色哟哟精品一区| 国产美女一区二区三区| 欧美aaaaaa午夜精品| 亚洲与欧洲av电影| 中文字幕色av一区二区三区| 精品成a人在线观看| 欧美肥妇bbw| 欧美性受xxxx| 成人av综合在线| 国产一区欧美一区| 久久国产乱子精品免费女| 午夜激情久久久| 亚洲国产欧美在线| 一区二区三区不卡在线观看 | 亚洲一区二区三区四区中文字幕| 国产欧美一区二区精品性色超碰 | 韩国女主播一区二区三区| 日韩精品成人一区二区三区| 亚洲女人的天堂| 日韩美女啊v在线免费观看| 中文一区二区完整视频在线观看| 欧美v亚洲v综合ⅴ国产v| 欧美一区二区三区在线看| 欧美精品九九99久久| 欧美在线不卡一区| 欧美日免费三级在线| 欧美三级三级三级爽爽爽| 欧美三级电影一区| 欧美伦理电影网| 欧美日韩精品一区二区天天拍小说| 欧美在线观看18|