/* ** Return the name of a wildcard parameter. Return NULL if the index ** is out of range or if the wildcard is unnamed. ** ** The result is always UTF-8. */ const char *sqlite3_bind_parameter_name(sqlite3_stmt *pStmt, int i){ Vdbe *p = (Vdbe*)pStmt; if( p==0 || i<1 || i>p->nVar ){ return 0; } createVarMap(p); return p->azVar[i-1]; }
void ASTtoByteCodeTranslator::visitBlockNode(BlockNode* node) { scopeStack.push(node->scope()); createVarMap(node->scope()); createFunMap(node->scope()); uint32_t nodesNumber = node->nodes(); for(uint32_t i = 0; i < nodesNumber; ++i) { node->nodeAt(i)->visit(this); } scopeStack.pop(); }
/* ** Given a wildcard parameter name, return the index of the variable ** with that name. If there is no variable with the given name, ** return 0. */ int sqlite3VdbeParameterIndex(Vdbe *p, const char *zName, int nName){ int i; if( p==0 ){ return 0; } createVarMap(p); if( zName ){ for(i=0; i<p->nVar; i++){ const char *z = p->azVar[i]; if( z && memcmp(z,zName,nName)==0 && z[nName]==0 ){ return i+1; } } } return 0; }
/* ** Given a wildcard parameter name, return the index of the variable ** with that name. If there is no variable with the given name, ** return 0. */ int sqlite3_bind_parameter_index(sqlite3_stmt *pStmt, const char *zName){ Vdbe *p = (Vdbe*)pStmt; int i; if( p==0 ){ return 0; } createVarMap(p); if( zName ){ for(i=0; i<p->nVar; i++){ const char *z = p->azVar[i]; if( z && strcmp(z,zName)==0 ){ return i+1; } } } return 0; }
gem_var initVariable(void * varAddr, size_t varSize, gem_type t) { char buffer[32]; gem_var handle; reg_var * v = malloc(sizeof(reg_var)); sendGemCmd("(INIT_VAR)"); fdreadline(buffer, sizeof(buffer)); sscanf(buffer, "%d", &handle); v->memory = varAddr; v->size = varSize; v->handle = handle; if (!registeredVars) createVarMap(); if (rb_insert(registeredVars, v)) { // Should return NULL on success printf("ERROR: Duplicate variable registered: %d\n", handle); } // Init value if (t != GEM_NULL) { gem_value val = { t, varSize, { .ptr = varAddr } };