这篇教程C++ sqlite3_create_function函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中sqlite3_create_function函数的典型用法代码示例。如果您正苦于以下问题:C++ sqlite3_create_function函数的具体用法?C++ sqlite3_create_function怎么用?C++ sqlite3_create_function使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了sqlite3_create_function函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: registerEncodingExtensionsvoid registerEncodingExtensions(sqlite3* db) { sqlite3_create_function(db, "conditional_to_base64", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, nullptr, sqliteB64ConditionalEncFunc, nullptr, nullptr); sqlite3_create_function(db, "to_base64", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, nullptr, sqliteB64EncFunc, nullptr, nullptr); sqlite3_create_function(db, "from_base64", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, nullptr, sqliteB64DecFunc, nullptr, nullptr);}
开发者ID:FritzX6,项目名称:osquery,代码行数:26,
示例2: sqlite3Fts3InitHashTable/*** Set up SQL objects in database db used to access the contents of** the hash table pointed to by argument pHash. The hash table must** been initialised to use string keys, and to take a private copy ** of the key when a value is inserted. i.e. by a call similar to:**** sqlite3Fts3HashInit(pHash, FTS3_HASH_STRING, 1);**** This function adds a scalar function (see header comment above** scalarFunc() in this file for details) and, if ENABLE_TABLE is** defined at compilation time, a temporary virtual table (see header ** comment above struct HashTableVtab) to the database schema. Both ** provide read/write access to the contents of *pHash.**** The third argument to this function, zName, is used as the name** of both the scalar and, if created, the virtual table.*/int sqlite3Fts3InitHashTable( sqlite3 *db, fts3Hash *pHash, const char *zName){ int rc = SQLITE_OK; void *p = (void *)pHash; const int any = SQLITE_ANY; char *zTest = 0; char *zTest2 = 0;#ifdef SQLITE_TEST void *pdb = (void *)db; zTest = sqlite3_mprintf("%s_test", zName); zTest2 = sqlite3_mprintf("%s_internal_test", zName); if( !zTest || !zTest2 ){ rc = SQLITE_NOMEM; }#endif if( rc!=SQLITE_OK || (rc = sqlite3_create_function(db, zName, 1, any, p, scalarFunc, 0, 0)) || (rc = sqlite3_create_function(db, zName, 2, any, p, scalarFunc, 0, 0))#ifdef SQLITE_TEST || (rc = sqlite3_create_function(db, zTest, 2, any, p, testFunc, 0, 0)) || (rc = sqlite3_create_function(db, zTest, 3, any, p, testFunc, 0, 0)) || (rc = sqlite3_create_function(db, zTest2, 0, any, pdb, intTestFunc, 0, 0))#endif ); sqlite3_free(zTest); sqlite3_free(zTest2); return rc;}
开发者ID:shenjian74,项目名称:Bitcoin-History,代码行数:51,
示例3: registerTestFunctionsstatic int registerTestFunctions(sqlite3 *db){ static const struct { char *zName; signed char nArg; unsigned char eTextRep; /* 1: UTF-16. 0: UTF-8 */ void (*xFunc)(sqlite3_context*,int,sqlite3_value **); } aFuncs[] = { { "randstr", 2, SQLITE_UTF8, randStr }, { "test_destructor", 1, SQLITE_UTF8, test_destructor},#ifndef SQLITE_OMIT_UTF16 { "test_destructor16", 1, SQLITE_UTF8, test_destructor16}, { "hex_to_utf16be", 1, SQLITE_UTF8, testHexToUtf16be}, { "hex_to_utf16le", 1, SQLITE_UTF8, testHexToUtf16le},#endif { "hex_to_utf8", 1, SQLITE_UTF8, testHexToUtf8}, { "test_destructor_count", 0, SQLITE_UTF8, test_destructor_count}, { "test_auxdata", -1, SQLITE_UTF8, test_auxdata}, { "test_error", 1, SQLITE_UTF8, test_error}, { "test_error", 2, SQLITE_UTF8, test_error}, { "test_eval", 1, SQLITE_UTF8, test_eval}, { "test_isolation", 2, SQLITE_UTF8, test_isolation}, { "test_counter", 1, SQLITE_UTF8, counterFunc}, }; int i; for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){ sqlite3_create_function(db, aFuncs[i].zName, aFuncs[i].nArg, aFuncs[i].eTextRep, 0, aFuncs[i].xFunc, 0, 0); } sqlite3_create_function(db, "test_agg_errmsg16", 0, SQLITE_ANY, 0, 0, test_agg_errmsg16_step, test_agg_errmsg16_final); return SQLITE_OK;}
开发者ID:7kbird,项目名称:chrome,代码行数:35,
示例4: Java_com_tencent_mobileqq_persistence_FTSDatatbaseDao_initFTSjint Java_com_tencent_mobileqq_persistence_FTSDatatbaseDao_initFTS(JNIEnv* env, jobject thiz){ int errCode = sqlite3_open_v2(DB_FILE, &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); if (SQLITE_OK != errCode) { logError("Can't open database IndexQQMsg.db, ", sqlite3_errmsg(db)); sqlite3_close(db); return errCode; } errCode = sqlite3_exec(db, "PRAGMA cache_size=4000;", NULL, NULL, NULL); if (SQLITE_OK != errCode) { logError("Can't set PRAGMA cache_size = 4000, ", sqlite3_errmsg(db)); sqlite3_close(db); return errCode; } errCode = sqlite3_create_function(db, "qqcompress", 1, SQLITE_UTF8, NULL, qqcompress, NULL, NULL); if (SQLITE_OK != errCode) { logError("Can't create function, ", sqlite3_errmsg(db)); sqlite3_close(db); return errCode; } errCode = sqlite3_create_function(db, "qquncompress", 1, SQLITE_UTF8, NULL, qquncompress, NULL, NULL); if (SQLITE_OK != errCode) { logError("Can't create function, ", sqlite3_errmsg(db)); sqlite3_close(db); return errCode; } char* sql = "CREATE VIRTUAL TABLE IF NOT EXISTS IndexMsg USING fts4(type, content, contentindex, oid, ext1, ext2,ext3,exts, compress=qqcompress, uncompress=qquncompress);"; // char* sql = "CREATE VIRTUAL TABLE IF NOT EXISTS IndexMsg USING fts4(type, content, contentindex, oid, ext1, ext2,ext3,exts);"; errCode = sqlite3_exec(db, sql, NULL, NULL, NULL); if (SQLITE_OK != errCode) { logError("Can't create virtual table IndexMsg, ", sqlite3_errmsg(db)); sqlite3_close(db); return errCode; }#ifdef ZIP const char* version = zlibVersion(); logInfo("FTS init zlib version = ", version);#endif logInfo("FTS init...", NULL); return 0;}
开发者ID:qyqx,项目名称:SQLite3-ICU,代码行数:57,
示例5: cflRegister/*** Register the SQL functions.*/static int cflRegister(sqlite3 *db){ int rc = sqlite3_create_function( db, "sqlite_readint32", -1, SQLITE_UTF8, 0, readint_function, 0, 0 ); if( rc!=SQLITE_OK ) return rc; rc = sqlite3_create_function( db, "checkfreelist", 1, SQLITE_UTF8, 0, checkfreelist_function, 0, 0 ); return rc;}
开发者ID:cznic,项目名称:cc,代码行数:13,
示例6: db_get_tableint db_get_table(char *command){ sqlite3 *db; char *zErrMsg = 0; int rc;#if (GTKVER == 3) G_LOCK(table_mutex);#else g_static_mutex_lock(&table_mutex);#endif if (tablep) { g_print("ERROR: TABLE NOT CLOSED BEFORE OPENING!/n"); sqlite3_free_table(tablep); } tablep = NULL; G_LOCK(db); rc = sqlite3_open(db_name, &db); if (rc) { fprintf(stderr, "Can't open database: %s/n", sqlite3_errmsg(db)); G_UNLOCK(db);#if (GTKVER == 3) G_UNLOCK(table_mutex);#else g_static_mutex_unlock(&table_mutex);#endif return -1; } sqlite3_create_function(db, "utf8error", 1, SQLITE_UTF8, NULL, utf8error, NULL, NULL); sqlite3_create_function(db, "getweight", 1, SQLITE_UTF8, NULL, getweight, NULL, NULL); //g_print("/nSQL: %s:/n %s/n", db_name, cmd); rc = sqlite3_get_table(db, command, &tablep, &tablerows, &tablecols, &zErrMsg); if (rc != SQLITE_OK && zErrMsg) { g_print("SQL error: %s/n", zErrMsg); sqlite3_free(zErrMsg); sqlite3_close(db); G_UNLOCK(db);#if (GTKVER == 3) G_UNLOCK(table_mutex);#else g_static_mutex_unlock(&table_mutex);#endif return -1; } sqlite3_close(db); G_UNLOCK(db); return tablerows;}
开发者ID:mahiso,项目名称:JudoShiai,代码行数:55,
示例7: sqlite3Fts3ExprInitTestInterface/*** Register the query expression parser test function fts3_exprtest() ** with database connection db. */int sqlite3Fts3ExprInitTestInterface(sqlite3* db){ int rc = sqlite3_create_function( db, "fts3_exprtest", -1, SQLITE_UTF8, 0, fts3ExprTest, 0, 0 ); if( rc==SQLITE_OK ){ rc = sqlite3_create_function(db, "fts3_exprtest_rebalance", -1, SQLITE_UTF8, (void *)1, fts3ExprTest, 0, 0 ); } return rc;}
开发者ID:HappyDanger,项目名称:sqlcipher,代码行数:15,
示例8: register_sqlite_funcsint register_sqlite_funcs(sqlite3 *db, sqlite_registration_func_t *reg_funcs){ int lpc; assert(db != NULL); assert(reg_funcs != NULL); for (lpc = 0; reg_funcs[lpc]; lpc++) { const struct FuncDef *basic_funcs = NULL; const struct FuncDefAgg *agg_funcs = NULL; int i; reg_funcs[lpc](&basic_funcs, &agg_funcs); for (i = 0; basic_funcs && basic_funcs[i].zName; i++) { void *pArg = 0; switch (basic_funcs[i].argType) { case 1: pArg = db; break; case 2: pArg = (void *)(-1); break; } //sqlite3CreateFunc /* LMH no error checking */ sqlite3_create_function(db, basic_funcs[i].zName, basic_funcs[i].nArg, basic_funcs[i].eTextRep, pArg, basic_funcs[i].xFunc, 0, 0); } for (i = 0; agg_funcs && agg_funcs[i].zName; i++) { void *pArg = 0; switch (agg_funcs[i].argType) { case 1: pArg = db; break; case 2: pArg = (void *)(-1); break; } //sqlite3CreateFunc sqlite3_create_function(db, agg_funcs[i].zName, agg_funcs[i].nArg, SQLITE_UTF8, pArg, 0, agg_funcs[i].xStep, agg_funcs[i].xFinalize); } } return 0;}
开发者ID:DNIWE-Systems,项目名称:lnav,代码行数:54,
示例9: sqlite3_extension_initSQLITE_EXTENSION_INIT1extern int sqlite3_extension_init(sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi) { SQLITE_EXTENSION_INIT2(pApi) (void)setlocale(LC_ALL, "en_US.UTF-8"); sqlite3_create_function(db, "tan", 1, SQLITE_UTF8, 0, ora_tan, 0, 0); // -1 means variable number of arguments sqlite3_create_function(db, "monthname", 1, SQLITE_UTF8, 0, my_monthname, 0, 0); return 0;}
开发者ID:kevb10,项目名称:sqlassignment,代码行数:14,
示例10: testloadext_init/*** Extension load function.*/int testloadext_init( sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi){ int nErr = 0; SQLITE_EXTENSION_INIT2(pApi); nErr |= sqlite3_create_function(db, "half", 1, SQLITE_ANY, 0, halfFunc, 0, 0); nErr |= sqlite3_create_function(db, "sqlite3_status", 1, SQLITE_ANY, 0, statusFunc, 0, 0); nErr |= sqlite3_create_function(db, "sqlite3_status", 2, SQLITE_ANY, 0, statusFunc, 0, 0); return nErr ? SQLITE_ERROR : SQLITE_OK;}
开发者ID:520060628,项目名称:Sqlite3.07.14,代码行数:17,
示例11: define_aggregator/* call-seq: define_aggregator(name, aggregator) * * Define an aggregate function named +name+ using the object +aggregator+. * +aggregator+ must respond to +step+ and +finalize+. +step+ will be called * with row information and +finalize+ must return the return value for the * aggregator function. */static VALUE define_aggregator(VALUE self, VALUE name, VALUE aggregator){ sqlite3RubyPtr ctx; int arity, status; Data_Get_Struct(self, sqlite3Ruby, ctx); REQUIRE_OPEN_DB(ctx); arity = sqlite3_obj_method_arity(aggregator, rb_intern("step")); status = sqlite3_create_function( ctx->db, StringValuePtr(name), arity, SQLITE_UTF8, (void *)aggregator, NULL, rb_sqlite3_step, rb_sqlite3_final ); rb_iv_set(self, "@agregator", aggregator); CHECK(ctx->db, status); return self;}
开发者ID:kashif,项目名称:sqlite3-ruby,代码行数:34,
示例12: HHVM_METHODbool HHVM_METHOD(SQLite3, createfunction, const String& name, const Variant& callback, int64_t argcount /* = -1 */) { auto *data = Native::data<SQLite3>(this_); data->validate(); if (name.empty()) { return false; } if (!is_callable(callback)) { raise_warning("Not a valid callback function %s", callback.toString().data()); return false; } auto udf = std::make_shared<SQLite3::UserDefinedFunc>(); if (sqlite3_create_function(data->m_raw_db, name.data(), argcount, SQLITE_UTF8, udf.get(), php_sqlite3_callback_func, nullptr, nullptr) == SQLITE_OK) { udf->func = callback; udf->argc = argcount; data->m_udfs.push_back(udf); return true; } return false;}
开发者ID:nurulimamnotes,项目名称:hhvm,代码行数:26,
示例13: sqlite3_eval_initint sqlite3_eval_init( sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi){ int rc = SQLITE_OK; SQLITE_EXTENSION_INIT2(pApi); (void)pzErrMsg; /* Unused parameter */ rc = sqlite3_create_function(db, "eval", 1, SQLITE_UTF8, 0, sqlEvalFunc, 0, 0); if( rc==SQLITE_OK ){ rc = sqlite3_create_function(db, "eval", 2, SQLITE_UTF8, 0, sqlEvalFunc, 0, 0); } return rc;}
开发者ID:cris-auts,项目名称:linux_c_study,代码行数:16,
示例14: define_function/* call-seq: define_function(name) { |args,...| } * * Define a function named +name+ with +args+. The arity of the block * will be used as the arity for the function defined. */static VALUE define_function(VALUE self, VALUE name){ sqlite3RubyPtr ctx; VALUE block; int status; Data_Get_Struct(self, sqlite3Ruby, ctx); REQUIRE_OPEN_DB(ctx); block = rb_block_proc(); status = sqlite3_create_function( ctx->db, StringValuePtr(name), rb_proc_arity(block), SQLITE_UTF8, (void *)block, rb_sqlite3_func, NULL, NULL ); CHECK(ctx->db, status); return self;}
开发者ID:kashif,项目名称:sqlite3-ruby,代码行数:31,
示例15: sfuserdata_mtgcstatic int sfuserdata_mtgc(lua_State *l) { lua_settop(l, 1); //[u] assert(lua_type(l, -1) == LUA_TUSERDATA); //clear the function lua_getuservalue(l, 1); //[ut] lua_getfield(l, -1, "dbud"); //[utu] struct dbuserdata *uddb = (struct dbuserdata *)lua_touserdata(l, 3); assert(uddb != NULL); assert(uddb->db != NULL); lua_pop(l, 1); //[ut] lua_getfield(l, -1, "name"); //[uts] sqlite3_create_function(uddb->db, lua_tostring(l, -1), -1, SQLITE_ANY, NULL, NULL, NULL, NULL); struct sfuserdata *ud = (struct sfuserdata *)lua_touserdata(l, 1); if(ud->funcref != -1) { luaL_unref(l, LUA_REGISTRYINDEX, ud->funcref); } return 0;}
开发者ID:kev82,项目名称:LuaTableQuery,代码行数:26,
示例16: tracker_fts_register_functionsstatic voidtracker_fts_register_functions (sqlite3 *db){ sqlite3_create_function (db, "tracker_rank", 2, SQLITE_ANY, NULL, &function_rank, NULL, NULL); sqlite3_create_function (db, "tracker_offsets", 2, SQLITE_ANY, NULL, &function_offsets, NULL, NULL); sqlite3_create_function (db, "fts_column_weights", 0, SQLITE_ANY, NULL, &function_weights, NULL, NULL); sqlite3_create_function (db, "fts_property_names", 0, SQLITE_ANY, NULL, &function_property_names, NULL, NULL);}
开发者ID:Pelagicore,项目名称:tracker-ivi,代码行数:16,
示例17: create_function_helper/* create function if pos is non-negative, aggregate if agg is true */int create_function_helper(sqlite3 *db, const char *name, int pos, int agg){ return sqlite3_create_function(db, name, -1, SQLITE_ANY, (void*)pos, pos>=0 && !agg ? &xFunc_helper : 0, pos>=0 && agg ? &xStep_helper : 0, pos>=0 && agg ? &xFinal_helper : 0);}
开发者ID:GYGG,项目名称:sqlitejdbc,代码行数:8,
示例18: raise_warningbool PDOSqliteResource::createFunction(const String& name, const Variant& callback, int argcount) { if (!is_callable(callback)) { raise_warning("function '%s' is not callable", callback.toString().data()); return false; } auto udf = req::make_unique<UDF>(); udf->func = callback; udf->argc = argcount; udf->name = name.toCppString(); auto stat = sqlite3_create_function( conn()->m_db, udf->name.c_str(), argcount, SQLITE_UTF8, static_cast<SQLite3::UserDefinedFunc*>(udf.get()), php_sqlite3_callback_func, nullptr, nullptr ); if (stat != SQLITE_OK) { return false; } m_udfs.emplace_back(std::move(udf)); return true;}
开发者ID:fredemmott,项目名称:hhvm,代码行数:32,
示例19: raise_warningbool PDOSqliteConnection::createFunction(const String& name, const Variant& callback, int argcount) { if (!is_callable(callback)) { raise_warning("function '%s' is not callable", callback.toString().data()); return false; } auto udf = std::make_shared<UDF>(); udf->func = callback; udf->argc = argcount; udf->name = name.toCppString(); auto stat = sqlite3_create_function(m_db, udf->name.c_str(), argcount, SQLITE_UTF8, udf.get(), php_sqlite3_callback_func, nullptr, nullptr); if (stat != SQLITE_OK) { return false; } m_udfs.push_back(udf); return true;}
开发者ID:neuroidss,项目名称:hhvm,代码行数:25,
示例20: sqlite3_create_functionvoid PDOSqliteConnection::clearFunctions() { for (auto& udf : m_udfs) { sqlite3_create_function(m_db, udf->name.data(), 0, SQLITE_UTF8, nullptr, nullptr, nullptr, nullptr); } m_udfs.clear();}
开发者ID:neuroidss,项目名称:hhvm,代码行数:7,
示例21: mainint main(int argc, char **argv){ int rc; sqlite3 *db; const char* sql; sqlite3_open("test.db", &db); sqlite3_create_function( db, "function", -1, SQLITE_UTF8, NULL, function, NULL, NULL); /* Turn on SQL logging */ log_sql(db, 1); /* Call function with one text argument. */ execute(db, "select function(1)"); /* Call function with several arguments of various types. */ execute(db, "select function(1, 2.71828)"); /* Call function with variable arguments, the first argument’s value ** being 'fail'. This will trigger the function to call ** sqlite3_result_error(). */ execute(db, "select function('fail', 1, 2.71828, 'three', X'0004', NULL)"); /* Done */ sqlite3_close(db); return 0; }
开发者ID:PengJi,项目名称:sql_prac,代码行数:29,
示例22: R_registerSQLFuncSEXPR_registerSQLFunc(SEXP rdb, SEXP r_func, SEXP rname, SEXP rnargs, SEXP userData){ sqlite3 *db = GET_SQLITE_DB(rdb); void *udata = NULL; SQLiteFunc fun; int nargs = INTEGER(rnargs)[0]; if(TYPEOF(r_func) == EXTPTRSXP) { fun = (SQLiteFunc) R_ExternalPtrAddr(r_func); if(Rf_length(userData)) udata = R_ExternalPtrAddr(userData); sqlite3_create_function(db, CHAR(STRING_ELT(rname, 0)), nargs, SQLITE_UTF8, udata, fun, NULL, NULL); } else { SEXP expr; if(nargs > -1) { expr = allocVector(LANGSXP, nargs + 1); R_PreserveObject(expr); SETCAR(expr, r_func); udata = expr; fun = R_callFunc; } else { R_PreserveObject(r_func); udata = r_func; fun = R_mkCallFunc; } sqlite3_create_function_v2(db, CHAR(STRING_ELT(rname, 0)), nargs, SQLITE_UTF8, udata, fun, NULL, NULL, Rsqlite_Release); } return(R_NilValue); // return a ticket to be able to release the fun.}
开发者ID:duncantl,项目名称:RSQLiteUDF,代码行数:31,
示例23: OGRSQLiteRegisterRegExpFunctionstaticvoid* OGRSQLiteRegisterRegExpFunction(#ifndef HAVE_PCRECPL_UNUSED#endif sqlite3* hDB){#ifdef HAVE_PCRE /* For debugging purposes mostly */ if( !CSLTestBoolean(CPLGetConfigOption("OGR_SQLITE_REGEXP", "YES")) ) return NULL; /* Check if we really need to define our own REGEXP function */ int rc = sqlite3_exec(hDB, "SELECT 'a' REGEXP 'a'", NULL, NULL, NULL); if( rc == SQLITE_OK ) { CPLDebug("SQLITE", "REGEXP already available"); return NULL; } cache_entry *cache = (cache_entry*) CPLCalloc(CACHE_SIZE, sizeof(cache_entry)); sqlite3_create_function(hDB, "REGEXP", 2, SQLITE_UTF8, cache, OGRSQLiteREGEXPFunction, NULL, NULL); /* To clear the error flag */ sqlite3_exec(hDB, "SELECT 1", NULL, NULL, NULL); return cache;#else // HAVE_PCRE return NULL;#endif // HAVE_PCRE}
开发者ID:GeospatialDaryl,项目名称:VS2013__00_GDAL_111_x64,代码行数:33,
示例24: sqlite3_extension_init/* SQLite invokes this routine once when it loads the extension.** Create new functions, collating sequences, and virtual table** modules here. This is usually the only exported symbol in** the shared library.*/int sqlite3_extension_init(sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi) { SQLITE_EXTENSION_INIT2(pApi) // rank call sqlite3_create_function(db, "rank", 3, SQLITE_ANY, 0, &rank, 0, 0); return 0;}
开发者ID:abhishekbh,项目名称:SQLite-Rank-Extension,代码行数:12,
示例25: PHP_METHODstatic PHP_METHOD(SQLite, sqliteCreateAggregate){ struct pdo_sqlite_func *func; zval *step_callback, *fini_callback; char *func_name; size_t func_name_len; zend_long argc = -1; zend_string *cbname = NULL; pdo_dbh_t *dbh; pdo_sqlite_db_handle *H; int ret; ZEND_PARSE_PARAMETERS_START(3, 4) Z_PARAM_STRING(func_name, func_name_len) Z_PARAM_ZVAL_DEREF(step_callback) Z_PARAM_ZVAL_DEREF(fini_callback) Z_PARAM_OPTIONAL Z_PARAM_LONG(argc) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); dbh = Z_PDO_DBH_P(getThis()); PDO_CONSTRUCT_CHECK; if (!zend_is_callable(step_callback, 0, &cbname)) { php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(cbname)); zend_string_release(cbname); RETURN_FALSE; } zend_string_release(cbname); if (!zend_is_callable(fini_callback, 0, &cbname)) { php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(cbname)); zend_string_release(cbname); RETURN_FALSE; } zend_string_release(cbname); H = (pdo_sqlite_db_handle *)dbh->driver_data; func = (struct pdo_sqlite_func*)ecalloc(1, sizeof(*func)); ret = sqlite3_create_function(H->db, func_name, argc, SQLITE_UTF8, func, NULL, php_sqlite3_func_step_callback, php_sqlite3_func_final_callback); if (ret == SQLITE_OK) { func->funcname = estrdup(func_name); ZVAL_COPY(&func->step, step_callback); ZVAL_COPY(&func->fini, fini_callback); func->argc = argc; func->next = H->funcs; H->funcs = func; RETURN_TRUE; } efree(func); RETURN_FALSE;}
开发者ID:LTD-Beget,项目名称:php-src,代码行数:60,
示例26: sqlite3_create_functionvoid KVStore::createFunctions(){ int ret = sqlite3_create_function(mConn.get(), "escapeStr", 1, SQLITE_ANY, 0, &sqliteEscapeStr, 0, 0); if (ret != SQLITE_OK) { throw ConfigException("Error during creating functions: " + mConn.getErrorMessage()); }}
开发者ID:vyvy,项目名称:vasum,代码行数:7,
示例27: pkg_repo_binary_initintpkg_repo_binary_init(struct pkg_repo *repo){ int retcode = EPKG_OK; sqlite3 *sqlite = PRIV_GET(repo); sqlite3_create_function(sqlite, "file_exists", 2, SQLITE_ANY, NULL, sqlite_file_exists, NULL, NULL); retcode = sql_exec(sqlite, "PRAGMA synchronous=default"); if (retcode != EPKG_OK) return (retcode); retcode = sql_exec(sqlite, "PRAGMA foreign_keys=on"); if (retcode != EPKG_OK) return (retcode); pkgdb_sqlcmd_init(sqlite, NULL, NULL); retcode = pkg_repo_binary_init_prstatements(sqlite); if (retcode != EPKG_OK) return (retcode); repo->priv = sqlite; return (EPKG_OK);}
开发者ID:dpl0,项目名称:pkg,代码行数:26,
注:本文中的sqlite3_create_function函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ sqlite3_data_count函数代码示例 C++ sqlite3_context_db_handle函数代码示例 |