您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ sqlite_set_result_string函数代码示例

51自学网 2021-06-03 08:16:14
  C++
这篇教程C++ sqlite_set_result_string函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中sqlite_set_result_string函数的典型用法代码示例。如果您正苦于以下问题:C++ sqlite_set_result_string函数的具体用法?C++ sqlite_set_result_string怎么用?C++ sqlite_set_result_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了sqlite_set_result_string函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: quoteFunc

/*** EXPERIMENTAL - This is not an official function.  The interface may** change.  This function may disappear.  Do not write code that depends** on this function.**** Implementation of the QUOTE() function.  This function takes a single** argument.  If the argument is numeric, the return value is the same as** the argument.  If the argument is NULL, the return value is the string** "NULL".  Otherwise, the argument is enclosed in single quotes with** single-quote escapes.*/static void quoteFunc(sqlite_func *context, int argc, const char **argv){  if( argc<1 ) return;  if( argv[0]==0 ){    sqlite_set_result_string(context, "NULL", 4);  }else if( sqliteIsNumber(argv[0]) ){    sqlite_set_result_string(context, argv[0], -1);  }else{    int i,j,n;    char *z;    for(i=n=0; argv[0][i]; i++){ if( argv[0][i]=='/'' ) n++; }    z = sqliteMalloc( i+n+3 );    if( z==0 ) return;    z[0] = '/'';    for(i=0, j=1; argv[0][i]; i++){      z[j++] = argv[0][i];      if( argv[0][i]=='/'' ){        z[j++] = '/'';      }    }    z[j++] = '/'';    z[j] = 0;    sqlite_set_result_string(context, z, j);    sqliteFree(z);  }}
开发者ID:82488059,项目名称:csaori,代码行数:36,


示例2: soundexFunc

/*** Compute the soundex encoding of a word.*/static void soundexFunc(sqlite_func *context, int argc, const char **argv){  char zResult[8];  const char *zIn;  int i, j;  static const unsigned char iCode[] = {    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,    0, 0, 1, 2, 3, 0, 1, 2, 0, 0, 2, 2, 4, 5, 5, 0,    1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0,    0, 0, 1, 2, 3, 0, 1, 2, 0, 0, 2, 2, 4, 5, 5, 0,    1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0,  };  assert( argc==1 );  zIn = argv[0];  for(i=0; zIn[i] && !isalpha(zIn[i]); i++){}  if( zIn[i] ){    zResult[0] = toupper(zIn[i]);    for(j=1; j<4 && zIn[i]; i++){      int code = iCode[zIn[i]&0x7f];      if( code>0 ){        zResult[j++] = code + '0';      }    }    while( j<4 ){      zResult[j++] = '0';    }    zResult[j] = 0;    sqlite_set_result_string(context, zResult, 4);  }else{    sqlite_set_result_string(context, "?000", 4);  }}
开发者ID:82488059,项目名称:csaori,代码行数:37,


示例3: absFunc

/*** Implementation of the abs() function*/static void absFunc(sqlite_func *context, int argc, const char **argv){  const char *z;  assert( argc==1 );  z = argv[0];  if( z==0 ) return;  if( z[0]=='-' && isdigit(z[1]) ) z++;  sqlite_set_result_string(context, z, -1);}
开发者ID:82488059,项目名称:csaori,代码行数:11,


示例4: sqliteExecFunc

/*** Implementation of the x_sqlite_exec() function.  This function takes** a single argument and attempts to execute that argument as SQL code.** This is illegal and should set the SQLITE_MISUSE flag on the database.**** 2004-Jan-07:  We have changed this to make it legal to call sqlite_exec()** from within a function call.  ** ** This routine simulates the effect of having two threads attempt to** use the same database at the same time.*/static void sqliteExecFunc(sqlite_func *context, int argc, const char **argv){  struct dstr x;  memset(&x, 0, sizeof(x));  sqlite_exec((sqlite*)sqlite_user_data(context), argv[0],       execFuncCallback, &x, 0);  sqlite_set_result_string(context, x.z, x.nUsed);  sqliteFree(x.z);}
开发者ID:ErikGartner,项目名称:ardb,代码行数:19,


示例5: ifnullFunc

/*** Implementation of the IFNULL(), NVL(), and COALESCE() functions.  ** All three do the same thing.  They return the first non-NULL** argument.*/static void ifnullFunc(sqlite_func *context, int argc, const char **argv){  int i;  for(i=0; i<argc; i++){    if( argv[i] ){      sqlite_set_result_string(context, argv[i], -1);      break;    }  }}
开发者ID:82488059,项目名称:csaori,代码行数:14,


示例6: timeFunc

/***    time( TIMESTRING, MOD, MOD, ...)**** Return HH:MM:SS*/static void timeFunc(sqlite_func *context, int argc, const char **argv){  DateTime x;  if( isDate(argc, argv, &x)==0 ){    char zBuf[100];    computeHMS(&x);    sprintf(zBuf, "%02d:%02d:%02d", x.h, x.m, (int)x.s);    sqlite_set_result_string(context, zBuf, -1);  }}
开发者ID:open2cerp,项目名称:Open2C-ERP,代码行数:14,


示例7: dateFunc

/***    date( TIMESTRING, MOD, MOD, ...)**** Return YYYY-MM-DD*/static void dateFunc(sqlite_func *context, int argc, const char **argv){  DateTime x;  if( isDate(argc, argv, &x)==0 ){    char zBuf[100];    computeYMD(&x);    sprintf(zBuf, "%04d-%02d-%02d", x.Y, x.M, x.D);    sqlite_set_result_string(context, zBuf, -1);  }}
开发者ID:open2cerp,项目名称:Open2C-ERP,代码行数:14,


示例8: minMaxFinalize

static void minMaxFinalize(sqlite_func *context){  MinMaxCtx *p;  p = sqlite_aggregate_context(context, sizeof(*p));  if( p && p->z && p->zBuf[0]<2 ){    sqlite_set_result_string(context, p->z, strlen(p->z));  }  if( p && p->zBuf[0] ){    sqliteFree(p->z);  }}
开发者ID:82488059,项目名称:csaori,代码行数:10,


示例9: lowerFunc

static void lowerFunc(sqlite_func *context, int argc, const char **argv){  unsigned char *z;  int i;  if( argc<1 || argv[0]==0 ) return;  z = (unsigned char*)sqlite_set_result_string(context, argv[0], -1);  if( z==0 ) return;  for(i=0; z[i]; i++){    if( isupper(z[i]) ) z[i] = tolower(z[i]);  }}
开发者ID:82488059,项目名称:csaori,代码行数:10,


示例10: roundFunc

/*** Implementation of the round() function*/static void roundFunc(sqlite_func *context, int argc, const char **argv){  int n;  double r;  char zBuf[100];  assert( argc==1 || argc==2 );  if( argv[0]==0 || (argc==2 && argv[1]==0) ) return;  n = argc==2 ? atoi(argv[1]) : 0;  if( n>30 ) n = 30;  if( n<0 ) n = 0;  r = sqliteAtoF(argv[0], 0);  sprintf(zBuf,"%.*f",n,r);  sqlite_set_result_string(context, zBuf, -1);}
开发者ID:82488059,项目名称:csaori,代码行数:16,


示例11: substrFunc

/*** Implementation of the substr() function*/static void substrFunc(sqlite_func *context, int argc, const char **argv) {    const char *z;#ifdef SQLITE_UTF8    const char *z2;    int i;#endif    int p1, p2, len;    assert( argc==3 );    z = argv[0];    if( z==0 ) return;    p1 = atoi(argv[1]?argv[1]:0);    p2 = atoi(argv[2]?argv[2]:0);#ifdef SQLITE_UTF8    for(len=0, z2=z; *z2; z2++) {        if( (0xc0&*z2)!=0x80 ) len++;    }#else    len = strlen(z);#endif    if( p1<0 ) {        p1 += len;        if( p1<0 ) {            p2 += p1;            p1 = 0;        }    } else if( p1>0 ) {        p1--;    }    if( p1+p2>len ) {        p2 = len-p1;    }#ifdef SQLITE_UTF8    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++;    }#endif    if( p2<0 ) p2 = 0;    sqlite_set_result_string(context, &z[p1], p2);}
开发者ID:ponapalt,项目名称:csaori,代码行数:53,


示例12: tclSqlFunc

/*** This routine is called to evaluate an SQL function implemented** using TCL script.*/static void tclSqlFunc(sqlite_func *context, int argc, const char **argv){  SqlFunc *p = sqlite_user_data(context);  Tcl_DString cmd;  int i;  int rc;  Tcl_DStringInit(&cmd);  Tcl_DStringAppend(&cmd, p->zScript, -1);  for(i=0; i<argc; i++){    Tcl_DStringAppendElement(&cmd, argv[i] ? argv[i] : "");  }  rc = Tcl_Eval(p->interp, Tcl_DStringValue(&cmd));  if( rc ){    sqlite_set_result_error(context, Tcl_GetStringResult(p->interp), -1);   }else{    sqlite_set_result_string(context, Tcl_GetStringResult(p->interp), -1);  }}
开发者ID:apprisi,项目名称:illumos-gate,代码行数:22,


示例13: testFunc

/*** The following routine is a user-defined SQL function whose purpose** is to test the sqlite_set_result() API.*/static void testFunc(sqlite_func *context, int argc, const char **argv){  while( argc>=2 ){    if( argv[0]==0 ){      sqlite_set_result_error(context, "first argument to test function "         "may not be NULL", -1);    }else if( sqliteStrICmp(argv[0],"string")==0 ){      sqlite_set_result_string(context, argv[1], -1);    }else if( argv[1]==0 ){      sqlite_set_result_error(context, "2nd argument may not be NULL if the "         "first argument is not /"string/"", -1);    }else if( sqliteStrICmp(argv[0],"int")==0 ){      sqlite_set_result_int(context, atoi(argv[1]));    }else if( sqliteStrICmp(argv[0],"double")==0 ){      sqlite_set_result_double(context, sqliteAtoF(argv[1], 0));    }else{      sqlite_set_result_error(context,"first argument should be one of: "          "string int double", -1);    }    argc -= 2;    argv += 2;  }}
开发者ID:ErikGartner,项目名称:ardb,代码行数:26,


示例14: minmaxFunc

/*** Implementation of the non-aggregate min() and max() functions*/static void minmaxFunc(sqlite_func *context, int argc, const char **argv){  const char *zBest;   int i;  int (*xCompare)(const char*, const char*);  int mask;    /* 0 for min() or 0xffffffff for max() */  if( argc==0 ) return;  mask = (int)sqlite_user_data(context);  zBest = argv[0];  if( zBest==0 ) return;  if( argv[1][0]=='n' ){    xCompare = sqliteCompare;  }else{    xCompare = strcmp;  }  for(i=2; i<argc; i+=2){    if( argv[i]==0 ) return;    if( (xCompare(argv[i], zBest)^mask)<0 ){      zBest = argv[i];    }  }  sqlite_set_result_string(context, zBest, -1);}
开发者ID:82488059,项目名称:csaori,代码行数:26,


示例15: randStr

/*** This function generates a string of random characters.  Used for** generating test data.*/static void randStr(sqlite_func *context, int argc, const char **argv){  static const unsigned char zSrc[] =      "abcdefghijklmnopqrstuvwxyz"     "ABCDEFGHIJKLMNOPQRSTUVWXYZ"     "0123456789"     ".-!,:*^+=_|?/<> ";  int iMin, iMax, n, r, i;  unsigned char zBuf[1000];  if( argc>=1 ){    iMin = atoi(argv[0]);    if( iMin<0 ) iMin = 0;    if( iMin>=sizeof(zBuf) ) iMin = sizeof(zBuf)-1;  }else{    iMin = 1;  }  if( argc>=2 ){    iMax = atoi(argv[1]);    if( iMax<iMin ) iMax = iMin;    if( iMax>=sizeof(zBuf) ) iMax = sizeof(zBuf)-1;  }else{    iMax = 50;  }  n = iMin;  if( iMax>iMin ){    sqliteRandomness(sizeof(r), &r);    r &= 0x7fffffff;    n += r%(iMax + 1 - iMin);  }  assert( n<sizeof(zBuf) );  sqliteRandomness(n, zBuf);  for(i=0; i<n; i++){    zBuf[i] = zSrc[zBuf[i]%(sizeof(zSrc)-1)];  }  zBuf[n] = 0;  sqlite_set_result_string(context, zBuf, n);}
开发者ID:82488059,项目名称:csaori,代码行数:40,


示例16: typeofFunc

/*** Return the type of the argument.*/static void typeofFunc(sqlite_func *context, int argc, const char **argv){  assert( argc==2 );  sqlite_set_result_string(context, argv[1], -1);}
开发者ID:82488059,项目名称:csaori,代码行数:7,


示例17: versionFunc

/*** Implementation of the VERSION(*) function.  The result is the version** of the SQLite library that is running.*/static void versionFunc(sqlite_func *context, int argc, const char **argv){  sqlite_set_result_string(context, sqlite_version, -1);}
开发者ID:82488059,项目名称:csaori,代码行数:7,


示例18: nullifFunc

/*** Implementation of the NULLIF(x,y) function.  The result is the first** argument if the arguments are different.  The result is NULL if the** arguments are equal to each other.*/static void nullifFunc(sqlite_func *context, int argc, const char **argv){  if( argv[0]!=0 && sqliteCompare(argv[0],argv[1])!=0 ){    sqlite_set_result_string(context, argv[0], -1);  }}
开发者ID:82488059,项目名称:csaori,代码行数:10,


示例19: sqlite_set_result_error

void sqlite_set_result_error(sqlite_func *p, const char *zMsg, int n){  assert( !p->isStep );  sqlite_set_result_string(p, zMsg, n);  p->isError = 1;}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:5,


示例20: strftimeFunc

//.........这里部分代码省略.........  int n, i, j;  char *z;  const char *zFmt = argv[0];  char zBuf[100];  if( argv[0]==0 || isDate(argc-1, argv+1, &x) ) return;  for(i=0, n=1; zFmt[i]; i++, n++){    if( zFmt[i]=='%' ){      switch( zFmt[i+1] ){        case 'd':        case 'H':        case 'm':        case 'M':        case 'S':        case 'W':          n++;          /* fall thru */        case 'w':        case '%':          break;        case 'f':          n += 8;          break;        case 'j':          n += 3;          break;        case 'Y':          n += 8;          break;        case 's':        case 'J':          n += 50;          break;        default:          return;  /* ERROR.  return a NULL */      }      i++;    }  }  if( n<sizeof(zBuf) ){    z = zBuf;  }else{    z = sqliteMalloc( n );    if( z==0 ) return;  }  computeJD(&x);  computeYMD_HMS(&x);  for(i=j=0; zFmt[i]; i++){    if( zFmt[i]!='%' ){      z[j++] = zFmt[i];    }else{      i++;      switch( zFmt[i] ){        case 'd':  sprintf(&z[j],"%02d",x.D); j+=2; break;        case 'f': {          int s = x.s;          int ms = (x.s - s)*1000.0;          sprintf(&z[j],"%02d.%03d",s,ms);          j += strlen(&z[j]);          break;        }        case 'H':  sprintf(&z[j],"%02d",x.h); j+=2; break;        case 'W': /* Fall thru */        case 'j': {          int n;          DateTime y = x;          y.validJD = 0;          y.M = 1;          y.D = 1;          computeJD(&y);          n = x.rJD - y.rJD + 1;          if( zFmt[i]=='W' ){            sprintf(&z[j],"%02d",(n+6)/7);            j += 2;          }else{            sprintf(&z[j],"%03d",n);            j += 3;          }          break;        }        case 'J':  sprintf(&z[j],"%.16g",x.rJD); j+=strlen(&z[j]); break;        case 'm':  sprintf(&z[j],"%02d",x.M); j+=2; break;        case 'M':  sprintf(&z[j],"%02d",x.m); j+=2; break;        case 's': {          sprintf(&z[j],"%d",(int)((x.rJD-2440587.5)*86400.0 + 0.5));          j += strlen(&z[j]);          break;        }        case 'S':  sprintf(&z[j],"%02d",(int)(x.s+0.5)); j+=2; break;        case 'w':  z[j++] = (((int)(x.rJD+1.5)) % 7) + '0'; break;        case 'Y':  sprintf(&z[j],"%04d",x.Y); j+=strlen(&z[j]); break;        case '%':  z[j++] = '%'; break;      }    }  }  z[j] = 0;  sqlite_set_result_string(context, z, -1);  if( z!=zBuf ){    sqliteFree(z);  }}
开发者ID:open2cerp,项目名称:Open2C-ERP,代码行数:101,



注:本文中的sqlite_set_result_string函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ sqn_pr_enter函数代码示例
C++ sqlite_freemem函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。