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

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

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

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

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

示例1: get_bd

void get_bd(http_request_t req, socket_t * clientSocket,db_t * db){    char text[20];    strcpy(text,req.uri+4);    int count= db_count(db,text);    char buf[10000];    char tmp[1000];    sqlite3_stmt * stmt = NULL;    strcpy(buf,"<html>"                    "<head>"                    "<title>Page Title</title>"                    "</head>"                    "<body>"                    "<table border=/"3/" align=/"center/">"                    "<tr>"                    "<th>NAME</th>"                    "<th>SURNAME</th>"                    "<th>AGE</th>"                    "</tr>");    for(int i=0;i<count;i++)    {    stmt=db_getrow(db,text,i);    sprintf(tmp,"<tr>"                "<th><a href=/"/db/%s/%i/">%s</a></th>"                "<th><a href=/"/db/%s/%i/">%s</a></th>"                "<th><a href=/"/db/%s/%i/">%i</a></a></th>"                "</tr>",text,i,sqlite3_column_text(stmt, 0),text,i,sqlite3_column_text(stmt, 1),text,i,sqlite3_column_int(stmt, 2));    strcat(buf,tmp);    sqlite3_finalize(stmt);    }    strcat(buf,"</table>");    sprintf(tmp,"<p align=/"center/">Count: %i<br><br><br></p>"                "<p align=/"center/"><a href=/"/db/paste/%s/">Insert new row</a></p>"                "<p align=/"center/"><a href=/"/db/">To Databases</a></p>",count,text);    strcat(buf,tmp);    strcat(buf, "</body>"                "</html>");    socket_write_string(clientSocket,buf);}
开发者ID:vitalik296,项目名称:CoursesRepo,代码行数:42,


示例2: page_usage_report

/*** Try to figure out how every page in the database file is being used.*/static void page_usage_report(const char *zDbName){  int i, j;  int rc;  sqlite3 *db;  sqlite3_stmt *pStmt;  unsigned char *a;  char zQuery[200];  /* Avoid the pathological case */  if( mxPage<1 ){    printf("empty database/n");    return;  }  /* Open the database file */  rc = sqlite3_open(zDbName, &db);  if( rc ){    printf("cannot open database: %s/n", sqlite3_errmsg(db));    sqlite3_close(db);    return;  }  /* Set up global variables zPageUse[] and mxPage to record page  ** usages */  zPageUse = sqlite3_malloc( sizeof(zPageUse[0])*(mxPage+1) );  if( zPageUse==0 ) out_of_memory();  memset(zPageUse, 0, sizeof(zPageUse[0])*(mxPage+1));  /* Discover the usage of each page */  a = getContent(0, 100);  page_usage_freelist(decodeInt32(a+32));  page_usage_ptrmap(a);  free(a);  page_usage_btree(1, 0, 0, "sqlite_master");  sqlite3_exec(db, "PRAGMA writable_schema=ON", 0, 0, 0);  for(j=0; j<2; j++){    sqlite3_snprintf(sizeof(zQuery), zQuery,             "SELECT type, name, rootpage FROM SQLITE_MASTER WHERE rootpage"             " ORDER BY rowid %s", j?"DESC":"");    rc = sqlite3_prepare_v2(db, zQuery, -1, &pStmt, 0);    if( rc==SQLITE_OK ){      while( sqlite3_step(pStmt)==SQLITE_ROW ){        int pgno = sqlite3_column_int(pStmt, 2);        page_usage_btree(pgno, 0, 0, (const char*)sqlite3_column_text(pStmt,1));      }    }else{      printf("ERROR: cannot query database: %s/n", sqlite3_errmsg(db));    }    rc = sqlite3_finalize(pStmt);    if( rc==SQLITE_OK ) break;  }  sqlite3_close(db);  /* Print the report and free memory used */  for(i=1; i<=mxPage; i++){    printf("%5d: %s/n", i, zPageUse[i] ? zPageUse[i] : "???");    sqlite3_free(zPageUse[i]);  }  sqlite3_free(zPageUse);  zPageUse = 0;}
开发者ID:CompassHXM,项目名称:h-store,代码行数:64,


示例3: sqlite3_column_int

 int query::rows::get(int idx, int) const {   return sqlite3_column_int(stmt_, idx); }
开发者ID:authurlan,项目名称:sqlite3pp,代码行数:4,


示例4: SQLite3StatementGetInt32WithColumn

inline int32_t SQLite3StatementGetInt32WithColumn(SQLite3StatementRef statement, CFIndex index) {  return (int32_t)sqlite3_column_int(statement->stmt, (int)index);}
开发者ID:neostoic,项目名称:CoreSQLite3,代码行数:3,


示例5: parse_from_db

void parse_from_db(list_t* list,db_t* db){    sqlite3_stmt * stmt=NULL;    lanser * lan=Freelanser_new();    for(int i=0; i<db_count(db,"database"); i++)    {        lanser * lan=Freelanser_new();        stmt=db_getrow(db,"database",i);        Freelanser_set(lan,sqlite3_column_text(stmt, 0),sqlite3_column_text(stmt, 1),sqlite3_column_double(stmt, 2),sqlite3_column_text(stmt, 4),sqlite3_column_int(stmt, 3));        list_push(list,lan,get_size());        free(lan);    }    Freelanser_free(lan);}
开发者ID:vitalik296,项目名称:CoursesRepo,代码行数:16,


示例6: init_db

/* init_db -- *   Prepare the database. Register the compress/uncompress functions and the *   stopword tokenizer. *	 db_flag specifies the mode in which to open the database. 3 options are *   available: *   	1. DB_READONLY: Open in READONLY mode. An error if db does not exist. *  	2. DB_READWRITE: Open in read-write mode. An error if db does not exist. *  	3. DB_CREATE: Open in read-write mode. It will try to create the db if *			it does not exist already. *  RETURN VALUES: *		The function will return NULL in case the db does not exist *		and DB_CREATE *  	was not specified. And in case DB_CREATE was specified and yet NULL is *  	returned, then there was some other error. *  	In normal cases the function should return a handle to the db. */sqlite3 *init_db(mandb_access_mode db_flag, const char *manconf){	sqlite3 *db = NULL;	sqlite3_stmt *stmt;	struct stat sb;	int rc;	int create_db_flag = 0;	char *dbpath = get_dbpath(manconf);	if (dbpath == NULL)		errx(EXIT_FAILURE, "_mandb entry not found in man.conf");	if (!(stat(dbpath, &sb) == 0 && S_ISREG(sb.st_mode))) {		/* Database does not exist, check if DB_CREATE was specified,		 * and set flag to create the database schema		 */		if (db_flag != (MANDB_CREATE)) {			warnx("Missing apropos database. "			      "Please run makemandb to create it.");			return NULL;		}		create_db_flag = 1;	} else {		/*		 * Database exists. Check if we have the permissions		 * to read/write the files		 */		int access_mode = R_OK;		switch (db_flag) {		case MANDB_CREATE:		case MANDB_WRITE:			access_mode |= W_OK;			break;		default:			break;		}		if ((access(dbpath, access_mode)) != 0) {			warnx("Unable to access the database, please check"			    " permissions for `%s'", dbpath);			return NULL;		}	}	sqlite3_initialize();	rc = sqlite3_open_v2(dbpath, &db, db_flag, NULL);	if (rc != SQLITE_OK) {		warnx("%s", sqlite3_errmsg(db));		goto error;	}	if (create_db_flag && create_db(db) < 0) {		warnx("%s", "Unable to create database schema");		goto error;	}	rc = sqlite3_prepare_v2(db, "PRAGMA user_version", -1, &stmt, NULL);	if (rc != SQLITE_OK) {		warnx("Unable to query schema version: %s",		    sqlite3_errmsg(db));		goto error;	}	if (sqlite3_step(stmt) != SQLITE_ROW) {		sqlite3_finalize(stmt);		warnx("Unable to query schema version: %s",		    sqlite3_errmsg(db));		goto error;	}	if (sqlite3_column_int(stmt, 0) != APROPOS_SCHEMA_VERSION) {		sqlite3_finalize(stmt);		warnx("Incorrect schema version found. "		      "Please run makemandb -f.");		goto error;	}	sqlite3_finalize(stmt);	sqlite3_extended_result_codes(db, 1);	/* Register the zip and unzip functions for FTS compression */	rc = sqlite3_create_function(db, "zip", 1, SQLITE_ANY, NULL, zip,	    NULL, NULL);	if (rc != SQLITE_OK) {		warnx("Unable to register function: compress: %s",//.........这里部分代码省略.........
开发者ID:ycui1984,项目名称:netbsd-src,代码行数:101,


示例7: changed_callback

//.........这里部分代码省略.........    case 5: // colorlabels      gtk_list_store_append(GTK_LIST_STORE(model), &iter);      gtk_list_store_set (GTK_LIST_STORE(model), &iter,                          DT_LIB_COLLECT_COL_TEXT,_("red"),                          DT_LIB_COLLECT_COL_ID, 0,                          DT_LIB_COLLECT_COL_TOOLTIP, _("red"),                          -1);      gtk_list_store_append(GTK_LIST_STORE(model), &iter);      gtk_list_store_set (GTK_LIST_STORE(model), &iter,                          DT_LIB_COLLECT_COL_TEXT,_("yellow"),                          DT_LIB_COLLECT_COL_ID, 1,                          DT_LIB_COLLECT_COL_TOOLTIP, _("yellow"),                          -1);      gtk_list_store_append(GTK_LIST_STORE(model), &iter);      gtk_list_store_set (GTK_LIST_STORE(model), &iter,                          DT_LIB_COLLECT_COL_TEXT,_("green"),                          DT_LIB_COLLECT_COL_ID, 2,                          DT_LIB_COLLECT_COL_TOOLTIP, _("green"),                          -1);      gtk_list_store_append(GTK_LIST_STORE(model), &iter);      gtk_list_store_set (GTK_LIST_STORE(model), &iter,                          DT_LIB_COLLECT_COL_TEXT,_("blue"),                          DT_LIB_COLLECT_COL_ID, 3,                          DT_LIB_COLLECT_COL_TOOLTIP, _("blue"),                          -1);      gtk_list_store_append(GTK_LIST_STORE(model), &iter);      gtk_list_store_set (GTK_LIST_STORE(model), &iter,                          DT_LIB_COLLECT_COL_TEXT,_("purple"),                          DT_LIB_COLLECT_COL_ID, 4,                          DT_LIB_COLLECT_COL_TOOLTIP, _("purple"),                          -1);      goto entry_key_press_exit;      break;      // TODO: Add empty string for metadata?      // TODO: Autogenerate this code?    case 6: // title      snprintf(query, 1024, "select distinct value, 1 from meta_data where key = %d and value like '%%%s%%' order by value",               DT_METADATA_XMP_DC_TITLE, escaped_text);      break;    case 7: // description      snprintf(query, 1024, "select distinct value, 1 from meta_data where key = %d and value like '%%%s%%' order by value",               DT_METADATA_XMP_DC_DESCRIPTION, escaped_text);      break;    case 8: // creator      snprintf(query, 1024, "select distinct value, 1 from meta_data where key = %d and value like '%%%s%%' order by value",               DT_METADATA_XMP_DC_CREATOR, escaped_text);      break;    case 9: // publisher      snprintf(query, 1024, "select distinct value, 1 from meta_data where key = %d and value like '%%%s%%' order by value",               DT_METADATA_XMP_DC_PUBLISHER, escaped_text);      break;    case 10: // rights      snprintf(query, 1024, "select distinct value, 1 from meta_data where key = %d and value like '%%%s%%'order by value ",               DT_METADATA_XMP_DC_RIGHTS, escaped_text);      break;    case 11: // lens      snprintf(query, 1024, "select distinct lens, 1 from images where lens like '%%%s%%' order by lens", escaped_text);      break;    case 12: // iso      snprintf(query, 1024, "select distinct cast(iso as integer) as iso, 1 from images where iso like '%%%s%%' order by iso", escaped_text);      break;    case 13: // aperature      snprintf(query, 1024, "select distinct round(aperture,1) as aperture, 1 from images where aperture like '%%%s%%' order by aperture", escaped_text);      break;    case 14: // filename      snprintf(query, 1024, "select distinct filename, 1 from images where filename like '%%%s%%' order by filename", escaped_text);      break;    default: // case 3: // day      snprintf(query, 1024, "SELECT DISTINCT datetime_taken, 1 FROM images WHERE datetime_taken LIKE '%%%s%%' ORDER BY datetime_taken DESC", escaped_text);      break;  }  g_free(escaped_text);  DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), query, -1, &stmt, NULL);  while(sqlite3_step(stmt) == SQLITE_ROW)  {    gtk_list_store_append(GTK_LIST_STORE(model), &iter);    const char *folder = (const char*)sqlite3_column_text(stmt, 0);    if(property == 0) // film roll    {      folder = dt_image_film_roll_name(folder);    }    gchar *value =  (gchar *)sqlite3_column_text(stmt, 0);    gchar *escaped_text = g_markup_escape_text(value, strlen(value));    gtk_list_store_set (GTK_LIST_STORE(model), &iter,                        DT_LIB_COLLECT_COL_TEXT, folder,                        DT_LIB_COLLECT_COL_ID, sqlite3_column_int(stmt, 1),                        DT_LIB_COLLECT_COL_TOOLTIP, escaped_text,                        DT_LIB_COLLECT_COL_PATH, value,                        -1);  }  sqlite3_finalize(stmt);entry_key_press_exit:  gtk_tree_view_set_tooltip_column(GTK_TREE_VIEW(view), DT_LIB_COLLECT_COL_TOOLTIP);  gtk_tree_view_set_model(GTK_TREE_VIEW(view), model);  g_object_unref(model);  return FALSE;}
开发者ID:chubinou,项目名称:darktable,代码行数:101,


示例8: delete_button_clicked

static void delete_button_clicked(GtkButton *button, gpointer user_data){  dt_lib_module_t *self = (dt_lib_module_t *)user_data;  dt_lib_tagging_t *d = (dt_lib_tagging_t *)self->data;  int res = GTK_RESPONSE_YES;  guint tagid;  GtkTreeIter iter;  GtkTreeModel *model = NULL;  GtkTreeView *view = d->related;  GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));  if(!gtk_tree_selection_get_selected(selection, &model, &iter)) return;  gtk_tree_model_get(model, &iter, DT_LIB_TAGGING_COL_ID, &tagid, -1);  // First check how many images are affected by the remove  int count = dt_tag_remove(tagid, FALSE);  if(count > 0 && dt_conf_get_bool("plugins/lighttable/tagging/ask_before_delete_tag"))  {    GtkWidget *dialog;    GtkWidget *win = dt_ui_main_window(darktable.gui->ui);    gchar *tagname = dt_tag_get_name(tagid);    dialog = gtk_message_dialog_new(        GTK_WINDOW(win), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,        ngettext("do you really want to delete the tag `%s'?/n%d image is assigned this tag!",                 "do you really want to delete the tag `%s'?/n%d images are assigned this tag!", count),        tagname, count);    gtk_window_set_title(GTK_WINDOW(dialog), _("delete tag?"));    res = gtk_dialog_run(GTK_DIALOG(dialog));    gtk_widget_destroy(dialog);    free(tagname);  }  if(res != GTK_RESPONSE_YES) return;  GList *tagged_images = NULL;  sqlite3_stmt *stmt;  DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "select imgid from tagged_images where tagid=?1",                              -1, &stmt, NULL);  DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, tagid);  while(sqlite3_step(stmt) == SQLITE_ROW)  {    tagged_images = g_list_append(tagged_images, GINT_TO_POINTER(sqlite3_column_int(stmt, 0)));  }  sqlite3_finalize(stmt);  dt_tag_remove(tagid, TRUE);  GList *list_iter;  if((list_iter = g_list_first(tagged_images)) != NULL)  {    do    {      dt_image_synch_xmp(GPOINTER_TO_INT(list_iter->data));    } while((list_iter = g_list_next(list_iter)) != NULL);  }  g_list_free(g_list_first(tagged_images));  update(self, 0);  update(self, 1);  dt_control_signal_raise(darktable.signals, DT_SIGNAL_TAG_CHANGED);}
开发者ID:marek-vanco,项目名称:darktable,代码行数:62,


示例9: dump_arrays

// Dump array attributes of an objectvoid dump_arrays(sqlite3* db, long long oid){	int rv;	unsigned long count;	sqlite3_stmt* sqlcnt = NULL;	sqlite3_stmt* sqlid = NULL;	std::string commandcnt = "select count(id) from attribute_array where object_id=?;";	std::string commandid = "select id from attribute_array where object_id=?;";	rv = sqlite3_prepare_v2(db, commandcnt.c_str(), -1, &sqlcnt, NULL);	if (rv != SQLITE_OK)	{		fprintf(stderr, "can't count the object table: %d(%s)/n",			rv, sqlite3_errmsg(db));		sqlite3_finalize(sqlcnt);		return;	}	rv = sqlite3_bind_int64(sqlcnt, 1, oid);	if (rv != SQLITE_OK)	{		fprintf(stderr, "can't bind the object id: %d(%s)/n",			rv, sqlite3_errmsg(db));		sqlite3_finalize(sqlcnt);		return;	}	while ((rv = sqlite3_step(sqlcnt)) == SQLITE_BUSY)	{		sched_yield();	}	if (rv != SQLITE_ROW)	{		fprintf(stderr, "can't count the object table: %d(%s)/n",			rv, sqlite3_errmsg(db));		sqlite3_finalize(sqlcnt);		return;	}	count = sqlite3_column_int(sqlcnt, 0);	sqlite3_finalize(sqlcnt);	if (count == 0)		return;	printf("%lu array attributes for object %lld/n", count, oid);	rv = sqlite3_prepare_v2(db, commandid.c_str(), -1, &sqlid, NULL);	if (rv != SQLITE_OK)	{		fprintf(stderr, "can't count the object table: %d(%s)/n",			rv, sqlite3_errmsg(db));		sqlite3_finalize(sqlid);		return;	}	rv = sqlite3_bind_int64(sqlid, 1, oid);	if (rv != SQLITE_OK)	{		fprintf(stderr, "can't bind the object id: %d(%s)/n",			rv, sqlite3_errmsg(db));		sqlite3_finalize(sqlid);		return;	}	while (count-- > 0) {		while ((rv = sqlite3_step(sqlid)) == SQLITE_BUSY)		{			sched_yield();		}		if (rv != SQLITE_ROW)		{			if (rv != SQLITE_DONE)			{				fprintf(stderr,					"can't get next object id: %d(%s)/n",					rv, sqlite3_errmsg(db));			}			sqlite3_finalize(sqlid);			return;		}		long long id = sqlite3_column_int64(sqlid, 0);		uint64_t type;		std::vector<Attribute> value;		if (!getArray(db, oid, id, type, value))		{			return;		}		dumpULong(type);		if ((uint64_t)((uint32_t)type) != type)		{			printf("overflow attribute type/n");		}		else		{			dumpCKA((unsigned long) type, 48);			printf("/n");		}		dumpULong((uint64_t) value.size());		printf("(length %lu)/n", (unsigned long) value.size());		dumpArray(value);	}}
开发者ID:jelu,项目名称:SoftHSMv2,代码行数:98,


示例10: SC_DA_LoadDownloadAreaMapData

/**---------------------------------------------------------------------------- * SC_DA_GetDlMapAreaData * ダウンロ
C++ sqlite3_column_int64函数代码示例
C++ sqlite3_column_double函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。