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

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

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

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

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

示例1: checkVM

int CppSQLite3Query::fieldIndex(const char* szField){	checkVM();	if (szField)	{		for (int nField = 0; nField < mnCols; nField++)		{			const char* szTemp = sqlite3_column_name(mpVM, nField);			if (strcmp(szField, szTemp) == 0)			{				return nField;			}		}	}	throw CppSQLite3Exception(CPPSQLITE_ERROR, "Invalid field name requested", DONT_DELETE_MSG);}
开发者ID:bblr001,项目名称:MVS,代码行数:18,


示例2: column_tolua

	static int column_tolua(lua_State *L)	{		SQLiteLuaStmt *ptr = (SQLiteLuaStmt *)checkudata(L, 1, &stmtmetakey, "sqlite.stmt");		if (ptr->stmt == NULL)		{			lua_pushnil(L);			lua_pushliteral(L, "closed database");			return 2;		}		int col = sqlite3_column_count(ptr->stmt);		lua_createtable(L, col, 0);		for (int i = 0; i < col; ++i)		{			lua_pushstring(L, sqlite3_column_name(ptr->stmt, i));			lua_rawseti(L, -2, i + 1);		}		return 1;	}
开发者ID:libla,项目名称:luaex-runtime,代码行数:18,


示例3: do_step

/*** This procedure runs in the thread to step the virtual machine.*/static void do_step(Thread *p){  int i;  if( p->pStmt==0 ){    p->zErr = p->zStaticErr = "no virtual machine available";    p->rc = SQLITE_ERROR;    return;  }  p->rc = sqlite3_client_step(p->pStmt);  if( p->rc==SQLITE_ROW ){    p->argc = sqlite3_column_count(p->pStmt);    for(i=0; i<sqlite3_data_count(p->pStmt); i++){      p->argv[i] = (char*)sqlite3_column_text(p->pStmt, i);    }    for(i=0; i<p->argc; i++){      p->colv[i] = sqlite3_column_name(p->pStmt, i);    }  }}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:21,


示例4: checkVM

int CSQLite3Query::fieldIndex(const char* pszField){    checkVM();    if (pszField)    {        for (int iField = 0; iField < m_iCols; iField++)        {            const char* pszTemp = sqlite3_column_name(m_pVM, iField);            if (0 == strcmp(pszField, pszTemp))            {                return iField;            }        }    }    Q_EXCEPTION(Q_ERROR_DATABASE, "invalid field name requested, %s", pszField);}
开发者ID:867344633,项目名称:QService,代码行数:18,


示例5: fetch

static int fetch(lua_State* L, int mode) {	stmt* s = (stmt*)luaL_checkudata(L, 1, MT_STMT);	sqlite3* db = sqlite3_db_handle(s->handle);	int ret;	while((ret = sqlite3_step(s->handle)) == SQLITE_SCHEMA) {}	if(ret == SQLITE_DONE) {		lua_pushnil(L);		return 1;	} else if(ret == SQLITE_ROW) {		int i;		int col_count = sqlite3_column_count(s->handle);		lua_createtable(L, col_count, 0);		for(i = 0; i < col_count; i++) {			if(mode == 0) {				/* fetch, rows */				lua_pushstring(L, sqlite3_column_name(s->handle, i));			} else if(mode == 1) {				/* ifetch, irows */				lua_pushinteger(L, i + 1);			}			switch(sqlite3_column_type(s->handle, i)) {			case SQLITE_INTEGER:				lua_pushinteger(L, sqlite3_column_int(s->handle, i));				break;			case SQLITE_FLOAT:				lua_pushnumber(L, sqlite3_column_double(s->handle, i));				break;			case SQLITE_TEXT:				lua_pushstring(L, (const char*)sqlite3_column_text(s->handle, i));				break;			case SQLITE_BLOB:			case SQLITE_NULL:				lua_pushnil(L);				break;			}			lua_settable(L, -3);		}		return 1;	}	return luaL_error(L, "[%d] %s", ret, sqlite3_errmsg(db));}
开发者ID:h-a,项目名称:lsqlite3lib,代码行数:44,


示例6: l_sqlite3_row_mode

/* * mode: 0 = direct, 1 = integer, 2 = alphanumeric */static int l_sqlite3_row_mode(lua_State * L, int mode){    /* Old code / Just a reminder / To be removed:    ** checkargs(L, 1, 2, CHECK_PTR, CHECK_NILTABLE, 0);    */    sqlite3_stmt * stmt	= checkstmt_stmt(L, 1);    int num_columns	= sqlite3_data_count(stmt);	/* Maybe wrong state, so don't use sqlite3_column_count */    int index;    /* XXX Should really be cleaned up... Fixme! */    if (mode == 0)        lua_checkstack(L, num_columns);    else if (!lua_istable(L, -1))        lua_newtable(L);    for (index=0; index<num_columns; index++)        switch(mode)        {        case 0:	/* direct mode */            push_column(L, stmt, index);            break;        case 1:	/* integer mode */            push_column(L, stmt, index);            lua_rawseti(L, -2, index+1);            break;        case 2:	/* alphanumeric mode */            lua_pushstring(L, sqlite3_column_name(stmt, index));            push_column(L, stmt, index);            lua_rawset(L, -3);            break;        default:            report_error(L, "libluasqlite3: Internal error in sqlite3_row_mode");        }    if (mode)        return 1;    else        return num_columns;}
开发者ID:kkabdol,项目名称:GameCode4,代码行数:47,


示例7: chirp_sqlite3_row_jsonify

int chirp_sqlite3_row_jsonify(sqlite3_stmt *stmt, buffer_t *B){	int rc;	int i, first;	CATCHUNIX(buffer_putliteral(B, "{"));	for (i = 0, first = 1; i < sqlite3_column_count(stmt); i++, first = 0) {		if (!first)			CATCHUNIX(buffer_putliteral(B, ","));		CATCHUNIX(buffer_putfstring(B, "/"%s/":", sqlite3_column_name(stmt, i)));		chirp_sqlite3_column_jsonify(stmt, i, B);	}	CATCHUNIX(buffer_putliteral(B, "}"));	rc = 0;	goto out;out:	return rc;}
开发者ID:LydiaBrothers,项目名称:cctools,代码行数:19,


示例8: fetch_results

int fetch_results(sqlite3_stmt *stmt, mxArray **results){    struct structlist result_list;    structlist_init(&result_list);    int i, num_columns = sqlite3_column_count(stmt);    mxArray *row = mxCreateStructMatrix(1, 1, 0, NULL);    for (i = 0; i < num_columns; i++) {        const char *name = sqlite3_column_name(stmt, i);        mxAddField(row, name);    }    int res;    while (res = fetch_row(stmt, num_columns, &row),           res == SQLITE_ROW) {        structlist_add(&result_list, row);    }    *results = structlist_collapse(&result_list);    return res;}
开发者ID:rmartinjak,项目名称:mex-sqlite3,代码行数:19,


示例9: sqlite3_column_count

void Session::_MapResultColumnsToObject(ObjectBase *oPtr, sqlite3_stmt *statement){	int cols = sqlite3_column_count(statement);		TCHAR *column_name;	CString *pCString;	for(int x = 0; x < cols; ++x)	{#ifdef UNICODE		column_name = (TCHAR*)sqlite3_column_name16(statement, x);#else		column_name = sqlite3_column_name(statement, x);#endif				if(!oPtr->GetMap().count(column_name))		{			return;		}		VarInfo p(oPtr->GetMap().find(column_name)->second);		switch(p.type)		{		case VarInfo::STRING:			pCString = reinterpret_cast<CString*>(p.dataPtr);#ifdef UNICODE			pCString->Format(_T("%s"),(TCHAR*)sqlite3_column_text16(statement, x));#else			pCString->Format(_T("%s"),(TCHAR*)sqlite3_column_text(statement, x));#endif			break;		case VarInfo::INT:			*((int*)p.dataPtr) = sqlite3_column_int(statement, x);			break;		case VarInfo::INT64:			*((__int64*)p.dataPtr) = sqlite3_column_int64(statement, x);			break;		case VarInfo::DOUBLE:			*((double*)p.dataPtr) = sqlite3_column_double(statement, x);			break;		}	}	oPtr->m_is_null = false;		}
开发者ID:breakingthings,项目名称:mfct,代码行数:43,


示例10: es_sqlite_step

static intes_sqlite_step(duk_context *ctx){    es_sqlite_t *es = es_resource_get(ctx, 0, &es_resource_sqlite);    if(es->es_stmt == NULL) {        duk_push_null(ctx);        return 1;    }    const int cols = sqlite3_data_count(es->es_stmt);    duk_push_object(ctx);    for(int i = 0; i < cols; i++) {        int64_t i64;        switch(sqlite3_column_type(es->es_stmt, i)) {        case SQLITE_INTEGER:            i64 = sqlite3_column_int64(es->es_stmt, i);            if(i64 >= INT32_MIN && i64 <= INT32_MAX)                duk_push_int(ctx, i64);            else if(i64 >= 0 && i64 <= UINT32_MAX)                duk_push_uint(ctx, i64);            else                duk_push_number(ctx, i64);            break;        case SQLITE_TEXT:            duk_push_string(ctx, (const char *)sqlite3_column_text(es->es_stmt, i));            break;        case SQLITE_FLOAT:            duk_push_number(ctx, sqlite3_column_double(es->es_stmt, i));            break;        default:            continue;        }        duk_put_prop_string(ctx, -2, sqlite3_column_name(es->es_stmt, i));    }    es_sqlite_stmt_step(ctx, es);    return 1;}
开发者ID:bguerreiro,项目名称:movian,代码行数:43,


示例11: sqlite3_step

bool SqlFile::GetNextBed(BED &bed, bool forceSorted) {    int rc = sqlite3_step(_stmt);    int ncol;    std::string sql_exec;    _status = BED_INVALID;    switch( rc ) {    case SQLITE_DONE:        I_chrom++;        if (I_chrom == _chrom_table.end()) {            _status = BED_BLANK;            return false;        }        prepareNextChrom(I_chrom->first);        return GetNextBed(bed, forceSorted);        break;    case SQLITE_ROW:        bed.chrom = _prev_chrom;        bed.start = (CHRPOS)sqlite3_column_int(_stmt, 0);        bed.end = (CHRPOS)sqlite3_column_int(_stmt, 1);        bed.fields.clear();        ncol = 2;        while (1) {            const char *_name = sqlite3_column_name(_stmt, ncol);            if (_name == NULL) break;            if (std::string("name").compare(_name) == 0)                 bed.name = std::string((char*)sqlite3_column_text(_stmt, ncol));            else if (std::string("score").compare(_name) == 0)                 bed.score = std::string((char*)sqlite3_column_text(_stmt, ncol));            else if (std::string("strand").compare(_name) == 0)                 bed.strand = std::string(sqlite3_column_int(_stmt, ncol)>0 ? "+" : "-");            else                 bed.fields.push_back(std::string((char*)sqlite3_column_text(_stmt, ncol)));            ncol++;        }        _prev_start = bed.start;        _status = BED_VALID;        return true;    default:        std::cerr << "Error: " << rc << ": " << sqlite3_errmsg(_db) << "/n";        break;    }    return false;}
开发者ID:bbcf,项目名称:bedtools,代码行数:43,


示例12: column_types

static int column_types(lua_State* L, int mode) {	stmt* s = (stmt*)luaL_checkudata(L, 1, MT_STMT);	int col_count = sqlite3_column_count(s->handle);	int i;	lua_createtable(L, col_count, 0);	for(i=0;i<col_count;i++) {		if(mode == 0) {			/* column_types */			lua_pushstring(L, sqlite3_column_name(s->handle, i));		} else {			/* icolumn_types */			lua_pushinteger(L, i + 1);		}		lua_pushinteger(L, sqlite3_column_type(s->handle, i));		lua_settable(L, -3);	}	return 1;}
开发者ID:h-a,项目名称:lsqlite3lib,代码行数:19,


示例13: RowPtr

RowPtr SQLiteCursorBackend::fetch_row(){    if (SQLITE_DONE == last_code_ || SQLITE_OK == last_code_)        return RowPtr();    if (SQLITE_ROW != last_code_)        throw DBError(WIDEN(sqlite3_errmsg(conn_)));    int col_count = sqlite3_column_count(stmt_);    RowPtr row(new Row(col_count));    for (int i = 0; i < col_count; ++i) {        String name = str_to_upper(WIDEN(sqlite3_column_name(stmt_, i)));        int type = sqlite3_column_type(stmt_, i);        (*row)[i].first = name;        if (SQLITE_NULL != type)            (*row)[i].second = Value(                    WIDEN((const char *)sqlite3_column_text(stmt_, i)));    }    last_code_ = sqlite3_step(stmt_);    return row;}
开发者ID:OganovA,项目名称:yb-orm,代码行数:19,


示例14: checkVM

int CppSQLite3Query::fieldIndex(const CString& szField){	checkVM();	if (szField)	{		for (int nField = 0; nField < mnCols; nField++)		{			const char* szTemp = sqlite3_column_name(mpVM, nField);            if (szField.CompareNoCase(szTemp) == 0)			{				return nField;			}		}	}    throw CppSQLite3Exception(CPPSQLITE_ERROR, "Invalid field name requested");}
开发者ID:JackChen007,项目名称:WizQTClient,代码行数:19,


示例15: create_cursor

/* static int create_cursor(lua_State *L, int conn, sqlite3_stmt *sql_vm,   int numcols, const char **row, const char **col_info)*/static int create_cursor(lua_State *L, int o, conn_data *conn,			 sqlite3_stmt *sql_vm, int numcols){  int i;  cur_data *cur = (cur_data*)lua_newuserdata(L, sizeof(cur_data));  luasql_setmeta (L, LUASQL_CURSOR_SQLITE);  /* increment cursor count for the connection creating this cursor */  conn->cur_counter++;  /* fill in structure */  cur->closed = 0;  cur->conn = LUA_NOREF;  cur->numcols = numcols;  cur->colnames = LUA_NOREF;  cur->coltypes = LUA_NOREF;  cur->sql_vm = sql_vm;  cur->conn_data = conn;  lua_pushvalue(L, o);  cur->conn = luaL_ref(L, LUA_REGISTRYINDEX);  /* create table with column names */  lua_newtable(L);  for (i = 0; i < numcols;)    {      lua_pushstring(L, sqlite3_column_name(sql_vm, i));      lua_rawseti(L, -2, ++i);    }  cur->colnames = luaL_ref(L, LUA_REGISTRYINDEX);  /* create table with column types */  lua_newtable(L);  for (i = 0; i < numcols;)    {      lua_pushstring(L, sqlite3_column_decltype(sql_vm, i));      lua_rawseti(L, -2, ++i);    }  cur->coltypes = luaL_ref(L, LUA_REGISTRYINDEX);  return 1;}
开发者ID:0w,项目名称:moai-dev,代码行数:44,


示例16: mLibraryGetEntries

size_t mLibraryGetEntries(struct mLibrary* library, struct mLibraryListing* out, size_t numEntries, size_t offset, const struct mLibraryEntry* constraints) {	mLibraryListingClear(out); // TODO: Free memory	sqlite3_clear_bindings(library->select);	sqlite3_reset(library->select);	_bindConstraints(library->select, constraints);	int countIndex = sqlite3_bind_parameter_index(library->select, ":count");	int offsetIndex = sqlite3_bind_parameter_index(library->select, ":offset");	sqlite3_bind_int64(library->select, countIndex, numEntries ? numEntries : -1);	sqlite3_bind_int64(library->select, offsetIndex, offset);	size_t entryIndex;	for (entryIndex = 0; (!numEntries || entryIndex < numEntries) && sqlite3_step(library->select) == SQLITE_ROW; ++entryIndex) {		struct mLibraryEntry* entry = mLibraryListingAppend(out);		memset(entry, 0, sizeof(*entry));		int nCols = sqlite3_column_count(library->select);		int i;		for (i = 0; i < nCols; ++i) {			const char* colName = sqlite3_column_name(library->select, i);			if (strcmp(colName, "crc32") == 0) {				entry->crc32 = sqlite3_column_int(library->select, i);				struct NoIntroGame game;				if (NoIntroDBLookupGameByCRC(library->gameDB, entry->crc32, &game)) {					entry->title = strdup(game.name);				}			} else if (strcmp(colName, "platform") == 0) {				entry->platform = sqlite3_column_int(library->select, i);			} else if (strcmp(colName, "size") == 0) {				entry->filesize = sqlite3_column_int64(library->select, i);			} else if (strcmp(colName, "internalCode") == 0 && sqlite3_column_type(library->select, i) == SQLITE_TEXT) {				strncpy(entry->internalCode, (const char*) sqlite3_column_text(library->select, i), sizeof(entry->internalCode) - 1);			} else if (strcmp(colName, "internalTitle") == 0 && sqlite3_column_type(library->select, i) == SQLITE_TEXT) {				strncpy(entry->internalTitle, (const char*) sqlite3_column_text(library->select, i), sizeof(entry->internalTitle) - 1);			} else if (strcmp(colName, "filename") == 0) {				entry->filename = strdup((const char*) sqlite3_column_text(library->select, i));			} else if (strcmp(colName, "base") == 0) {				entry->base =  strdup((const char*) sqlite3_column_text(library->select, i));			}		}	}	return mLibraryListingSize(out);}
开发者ID:vitamin-caig,项目名称:zxtune,代码行数:42,


示例17: checkVM

int CppSQLite3Query::fieldIndex(const char* szField){	checkVM();	if (szField)	{		for (int nField = 0; nField < mnCols; nField++)		{			const char* szTemp = sqlite3_column_name(mpVM, nField);			if (strcmp(szField, szTemp) == 0)			{				return nField;			}		}	}	IwError(("Invalid field name requested"));	return 0;}
开发者ID:dongfangx,项目名称:sqlite,代码行数:20,


示例18: sqlite3_column_name

// Return the index of the specified (potentially aliased) column nameint Statement::getColumnIndex(const char* apName) const{    // Build the map of column index by name on first call    if (mColumnNames.empty())    {        for (int i = 0; i < mColumnCount; ++i)        {            const char* pName = sqlite3_column_name(mStmtPtr, i);            mColumnNames[pName] = i;        }    }    const TColumnNames::const_iterator iIndex = mColumnNames.find(apName);    if (iIndex == mColumnNames.end())    {        throw SQLite::Exception("Unknown column name.");    }    return (*iIndex).second;}
开发者ID:bakercp,项目名称:ofxSQLiteCpp,代码行数:21,


示例19: sqlite3_column_name_type_c_

void FTNCALL sqlite3_column_name_type_c_(       sqlite3_stmt **stmt,       int  *colidx,       char *name,	   int   len_name,       char *type,       int   len_type      ){   int   rc   ;   char *pstr ;   pstr = sqlite3_column_name(*stmt, *colidx ) ;   strncpy( name, pstr, len_name ) ;   name[len_name-1] = '/0' ;   pstr = sqlite3_column_decltype(*stmt, *colidx ) ;   strncpy( type, pstr, len_type ) ;   type[len_type-1] = '/0' ;   return ;}
开发者ID:ajarbancina,项目名称:swat-eclipse,代码行数:20,


示例20: g_strdup_printf

RowSet *SQLiteSelect(const char* str){	size_t i, row;	int ret;	char *buf = g_strdup_printf("Select %s;", str);	RowSet *rs = NULL;    sqlite3_stmt *pStmt;    ret = sqlite3_prepare(connection, buf, -1, &pStmt, NULL);	g_free(buf);	if (ret == SQLITE_OK)	{		size_t numCols = (size_t)sqlite3_column_count(pStmt);		size_t numRows = 0;		while((ret = sqlite3_step(pStmt)) == SQLITE_ROW)			numRows++;		if (sqlite3_reset(pStmt) != SQLITE_OK)			outputerrf("SQL error: %s in sqlite3_reset()", sqlite3_errmsg(connection));		rs = MallocRowset(numRows + 1, numCols);	/* first row is headings */		for (i = 0; i < numCols; i++)			SetRowsetData(rs, 0, i, sqlite3_column_name(pStmt, (int)i));		row = 0;		while((ret = sqlite3_step(pStmt)) == SQLITE_ROW)		{			row++;			for (i = 0; i < numCols; i++)				SetRowsetData(rs, row, i, (const char*)sqlite3_column_text(pStmt, (int)i));		}		if (ret == SQLITE_DONE)			ret = SQLITE_OK;	}	if (ret != SQLITE_OK)		outputerrf("SQL error: %s/nfrom '%s'", sqlite3_errmsg(connection), str);	if (sqlite3_finalize(pStmt) != SQLITE_OK)		outputerrf("SQL error: %s in sqlite3_finalize()", sqlite3_errmsg(connection));	return rs;}
开发者ID:DavidePastore,项目名称:libgnubg-android,代码行数:41,


示例21: storage_step

int storage_step(storage_stmt_t *stmt, hash_t **row){	int i, ret, ncols = sqlite3_column_count(stmt);	void *data;	ret = sqlite3_step(stmt);		if (ret != SQLITE_ROW) {		errno = EINVAL;		return ret;	}		if (!row || ret == SQLITE_DONE)		return ret;		*row = hash_init();		for (i = 0; i < ncols; i++) {			switch (sqlite3_column_type(stmt, i)) {			case SQLITE_INTEGER:				data = xintdup(sqlite3_column_int(stmt, i));				break;							case SQLITE_NULL:				data = NULL;				break;			case SQLITE_BLOB:			case SQLITE_TEXT:				data = xstrdup((char *)sqlite3_column_text(stmt, i));				break;							default:				FAIL("b
C++ sqlite3_column_text函数代码示例
C++ sqlite3_column_int64函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。