如何从自定义sqlite扩展函数调用内置sqlite函数?

如何从自定义sqlite扩展函数调用内置sqlite函数?,sqlite,Sqlite,我试图在自定义sqlite扩展函数中调用time'now'。时间是一个标准的sqlite函数。我在下面包含了一个示例扩展函数 #include <sqlite3ext.h> #include <stdio.h> #include <string.h> SQLITE_EXTENSION_INIT1 /* ** The gettime() SQL function returns the current time. */ static void timeFun

我试图在自定义sqlite扩展函数中调用time'now'。时间是一个标准的sqlite函数。我在下面包含了一个示例扩展函数

#include <sqlite3ext.h>
#include <stdio.h>
#include <string.h>

SQLITE_EXTENSION_INIT1

/*
** The gettime() SQL function returns the current time.
*/
static void timeFunc(sqlite3_context *context,int argc,sqlite3_value **argv){

  sqlite3_result_text(context, time("now"),strlen(time("now")),SQLITE_TRANSIENT);
}
/* 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.sdaffsd
*/
int sqlite3_extension_init(sqlite3 *db,char **pzErrMsg,const sqlite3_api_routines *pApi){
  SQLITE_EXTENSION_INIT2(pApi)
  sqlite3_create_function(db, "gettime", 1, SQLITE_UTF8, 0, timeFunc, NULL, NULL);
  return 0;
}

您必须执行SQL查询选择time'now'。

我宁愿直接调用time函数,而不是执行SQL查询。SQL函数需要SQL。