MCPcopy Create free account
hub / github.com/audacity/audacity / expertDotCommand

Function expertDotCommand

lib-src/sqlite/shell.c:13503–13555  ·  view source on GitHub ↗

** Implementation of ".expert" dot command. */

Source from the content-addressed store, hash-verified

13501** Implementation of ".expert" dot command.
13502*/
13503static int expertDotCommand(
13504 ShellState *pState, /* Current shell tool state */
13505 char **azArg, /* Array of arguments passed to dot command */
13506 int nArg /* Number of entries in azArg[] */
13507){
13508 int rc = SQLITE_OK;
13509 char *zErr = 0;
13510 int i;
13511 int iSample = 0;
13512
13513 assert( pState->expert.pExpert==0 );
13514 memset(&pState->expert, 0, sizeof(ExpertInfo));
13515
13516 for(i=1; rc==SQLITE_OK && i<nArg; i++){
13517 char *z = azArg[i];
13518 int n;
13519 if( z[0]=='-' && z[1]=='-' ) z++;
13520 n = strlen30(z);
13521 if( n>=2 && 0==strncmp(z, "-verbose", n) ){
13522 pState->expert.bVerbose = 1;
13523 }
13524 else if( n>=2 && 0==strncmp(z, "-sample", n) ){
13525 if( i==(nArg-1) ){
13526 raw_printf(stderr, "option requires an argument: %s\n", z);
13527 rc = SQLITE_ERROR;
13528 }else{
13529 iSample = (int)integerValue(azArg[++i]);
13530 if( iSample<0 || iSample>100 ){
13531 raw_printf(stderr, "value out of range: %s\n", azArg[i]);
13532 rc = SQLITE_ERROR;
13533 }
13534 }
13535 }
13536 else{
13537 raw_printf(stderr, "unknown option: %s\n", z);
13538 rc = SQLITE_ERROR;
13539 }
13540 }
13541
13542 if( rc==SQLITE_OK ){
13543 pState->expert.pExpert = sqlite3_expert_new(pState->db, &zErr);
13544 if( pState->expert.pExpert==0 ){
13545 raw_printf(stderr, "sqlite3_expert_new: %s\n", zErr);
13546 rc = SQLITE_ERROR;
13547 }else{
13548 sqlite3_expert_config(
13549 pState->expert.pExpert, EXPERT_CONFIG_SAMPLE, iSample
13550 );
13551 }
13552 }
13553
13554 return rc;
13555}
13556#endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */
13557
13558/*

Callers 1

do_meta_commandFunction · 0.85

Calls 4

strlen30Function · 0.85
integerValueFunction · 0.85
sqlite3_expert_newFunction · 0.85
sqlite3_expert_configFunction · 0.85

Tested by

no test coverage detected