Embedding SQLite in a c programm
        
The following program demonstrates how to embed SQLite into a c program.
I compiled the program with MinGW without any problems (Using this makefile)
In order to compile the program, you have to download the SQLite sources (version 3.0.1, the zip file) as well as the following c program (embed_sqlite.c). I don't know how easy or hard it is to compile it with another compiler than MinGW.
The program does the following:

Creates a database (filename: countries.db).
    Creates a table in this database (table name: countries).
    Inserts many countries with their size and population.
    Queries the table for the countries with the most/fewest people/area.

The programm
embed_sqlite.c

#include <string.h>
#include <stdio.h>
#include "sqlite3.h"

sqlite3* db;

int first_row;

int select_callback(void *p_data, int num_fields, char **p_fields, char **p_col_names) {

int i;
  int *p_rn = (int*)p_data;

if (first_row) {
    first_row = 0;

for(i=0; i < num_fields; i++) {
      printf("%20s", p_col_names[i]);
    }
    printf("\n");
    for(i=0; i< num_fields*20; i++) {
      printf("=");
    }
    printf("\n");
  }

(*p_rn)++;

for(i=0; i < num_fields; i++) {
    printf("%20s", p_fields[i]);
  }

printf("\n");
  return 0;
}

void select_stmt(const char* stmt) {
  char *errmsg;
  int   ret;
  int   nrecs = 0;

first_row = 1;

ret = sqlite3_exec(db, stmt, select_callback, &nrecs, &errmsg);

if(ret!=SQLITE_OK) {
    printf("Error in select statement %s [%s].\n", stmt, errmsg);
  }
  else {
    printf("\n   %d records returned.\n", nrecs);
  }
}

void sql_stmt(const char* stmt) {
  char *errmsg;
  int   ret;

ret = sqlite3_exec(db, stmt, 0, 0, &errmsg);

if(ret != SQLITE_OK) {
    printf("Error in statement: %s [%s].\n", stmt, errmsg);
  }
}

void insert_countries() {
  sql_stmt("begin");
  sql_stmt("insert into countries values ('Afghanistan'                   ,  251826,   22664136)");
  sql_stmt("insert into countries values ('Albania'                       ,   11100,    3249136)");
  sql_stmt("insert into countries values ('Algeria'                       ,  919595,   29183032)");
  sql_stmt("insert into countries values ('Andorra'                       ,     175,      67509)");
  sql_stmt("insert into countries values ('Angola'                        ,  481354,   10342899)");
  sql_stmt("insert into countries values ('Argentina'                     , 1073400,   34672997)");
  sql_stmt("insert into countries values ('Armenia'                       ,   11506,    3463574)");
  sql_stmt("insert into countries values ('Australia'                     , 2966155,   18260863)");
  sql_stmt("insert into countries values ('Austria'                       ,   32377,    8013614)");
  sql_stmt("insert into countries values ('Azerbaijan'                    ,   33436,    7676953)");
  sql_stmt("insert into countries values ('Bahrain'                       ,     267,     590042)");
  sql_stmt("insert into countries values ('Bangladesh'                    ,   55598,  123062800)");
  sql_stmt("insert into countries values ('Barbados'                      ,     166,     257030)");
  sql_stmt("insert into countries values ('Belarus'                       ,   80155,   10415973)");
  sql_stmt("insert into countries values ('Belgium'                       ,   11783,   10131863)");
  sql_stmt("insert into countries values ('Belize'                        ,    8866,     219296)");
  sql_stmt("insert into countries values ('Benin'                         ,   43475,    5709529)");
  sql_stmt("insert into countries values ('Bhutan'                        ,   18200,    1822625)");
  sql_stmt("insert into countries values ('Bolivia'                       ,  424165,    7165257)");
  sql_stmt("insert into countries values ('Bosnia-Herzegovina'            ,   19741,    2656240)");
  sql_stmt("insert into countries values ('Botswana'                      ,  231800,    1477630)");
  sql_stmt("insert into countries values ('Brazil'                        , 3286488,  162661214)");
  sql_stmt("insert into countries values ('Brunei'                        ,    2226,     299939)");
  sql_stmt("insert into countries values ('Bulgaria'                      ,   42823,    8612757)");
  sql_stmt("insert into countries values ('Burkina Faso'                  ,  105869,   10623323)");
  sql_stmt("insert into countries values ('Burundi'                       ,   10745,    5943057)");
  sql_stmt("insert into countries values ('Cambodia'                      ,   69898,   10600000)");
  sql_stmt("insert into countries values ('Cameroon'                      ,  183569,   14261557)");
  sql_stmt("insert into countries values ('Canada'                        , 3849674,   29857369)");
  sql_stmt("insert into countries values ('Cape Verde'                    ,    1557,     449066)");
  sql_stmt("insert into countries values ('Central African Republic'      ,  240535,    3274426)");
  sql_stmt("insert into countries values ('Chad'                          ,  495755,    6976845)");
  sql_stmt("insert into countries values ('Chile'                         ,  292135,   14333258)");
  sql_stmt("insert into countries values ('China'                         , 3689631, 1210004956)");
  sql_stmt("insert into countries values ('Colombia'                      ,  440831,   36813161)");
  sql_stmt("insert into countries values ('Comoros'                       ,     863,     569237)");
  sql_stmt("insert into countries values ('Congo(Zaire)'                  ,  905446,   46498539)");
  sql_stmt("insert into countries values ('Congo Republic'                ,  132047,    2527841)");
  sql_stmt("insert into countries values ('Costa Rica'                    ,   19730,    3463083)");
  sql_stmt("insert into countries values ('Croatia'                       ,   21829,    5004112)");
  sql_stmt("insert into countries values ('Cuba'                          ,   42804,   11007446)");
  sql_stmt("insert into countries values ('Cyprus'                        ,    3593,     736636)");
  sql_stmt("insert into countries values ('Czech Republic'                ,   30613,   10321120)");
  sql_stmt("insert into countries values ('Denmark'                       ,   16638,    5210833)");
  sql_stmt("insert into countries values ('Djibouti'                      ,    8958,     427642)");
  sql_stmt("insert into countries values ('Dominica'                      ,     305,      82926)");
  sql_stmt("insert into countries values ('Dominican Republic'            ,   18704,    8088881)");
  sql_stmt("insert into countries values ('Ecuador'                       ,  109484,   11466291)");
  sql_stmt("insert into countries values ('Egypt'                         ,  386662,   65375107)");
  sql_stmt("insert into countries values ('El Salvador'                   ,    8124,    5828987)");
  sql_stmt("insert into countries values ('Equatorial Guinea'             ,   10831,     431282)");
  sql_stmt("insert into countries values ('Eritrea'                       ,   45300,    3909628)");
  sql_stmt("insert into countries values ('Estonia'                       ,   17413,    1459428)");
  sql_stmt("insert into countries values ('Ethiopia'                      ,  483123,   57171682)");
  sql_stmt("insert into countries values ('Fiji'                          ,    7078,     782381)");
  sql_stmt("insert into countries values ('Finland'                       ,  130559,    5100213)");
  sql_stmt("insert into countries values ('France'                        ,  211208,   58317450)");
  sql_stmt("insert into countries values ('Gabon'                         ,  103347,    1172798)");
  sql_stmt("insert into countries values ('Gambia'                        ,    4127,    1020178)");
  sql_stmt("insert into countries values ('Georgia'                       ,   26911,    5219810)");
  sql_stmt("insert into countries values ('Germany'                       ,  137882,   83536115)");
  sql_stmt("insert into countries values ('Ghana'                         ,   92098,   17698271)");
  sql_stmt("insert into countries values ('Greece'                        ,   50962,   10718518)");
  sql_stmt("insert into countries values ('Grenada'                       ,     133,      94961)");
  sql_stmt("insert into countries values ('Guatemala'                     ,   42042,   11177614)");
  sql_stmt("insert into countries values ('Guinea'                        ,   94926,    7411981)");
  sql_stmt("insert into countries values ('Guinea-Bissau'                 ,   13948,    1151330)");
  sql_stmt("insert into countries values ('Guyana'                        ,   83000,     712091)");
  sql_stmt("insert into countries values ('Haiti'                         ,   10714,    6731539)");
  sql_stmt("insert into countries values ('Honduras'                      ,   43277,    5605193)");
  sql_stmt("insert into countries values ('Hungary'                       ,   35920,   10002541)");
  sql_stmt("insert into countries values ('Iceland'                       ,   36769,     268369)");
  sql_stmt("insert into countries values ('India'                         , 1237062,  952107694)");
  sql_stmt("insert into countries values ('Indonesia'                     ,  742410,  206611600)");
  sql_stmt("insert into countries values ('Iran'                          ,  632457,   66094264)");
  sql_stmt("insert into countries values ('Iraq'                          ,  169235,   21422292)");
  sql_stmt("insert into countries values ('Ireland'                       ,   27137,    3562902)");
  sql_stmt("insert into countries values ('Israel'                        ,    8019,    5215022)");
  sql_stmt("insert into countries values ('Italy'                         ,  116234,   57460274)");
  sql_stmt("insert into countries values ('Ivory Coast'                   ,  124518,   14762445)");
  sql_stmt("insert into countries values ('Jamaica'                       ,    4244,    2593918)");
  sql_stmt("insert into countries values ('Japan'                         ,  145870,  125568504)");
  sql_stmt("insert into countries values ('Jordan'                        ,   35135,    4212152)");
  sql_stmt("insert into countries values ('Kazakhstan'                    , 1049156,   16916463)");
  sql_stmt("insert into countries values ('Kenya'                         ,  224961,   28176686)");
  sql_stmt("insert into countries values ('KoreaNorth'                    ,   46540,   23904124)");
  sql_stmt("insert into countries values ('KoreaSouth'                    ,   38230,   45482291)");
  sql_stmt("insert into countries values ('Kuwait'                        ,    6880,    1950047)");
  sql_stmt("insert into countries values ('Kyrgyzstan'                    ,   76641,    4529648)");
  sql_stmt("insert into countries values ('Laos'                          ,   91429,    4905772)");
  sql_stmt("insert into countries values ('Latvia'                        ,   24595,    2468982)");
  sql_stmt("insert into countries values ('Lebanon'                       ,    4015,    3776317)");
  sql_stmt("insert into countries values ('Lesotho'                       ,   11720,    1970781)");
  sql_stmt("insert into countries values ('Liberia'                       ,   38250,    2109789)");
  sql_stmt("insert into countries values ('Libya'                         ,  679362,    5445436)");
  sql_stmt("insert into countries values ('Liechtenstein'                 ,      62,      31011)");
  sql_stmt("insert into countries values ('Lithuania'                     ,   25174,    3718000)");
  sql_stmt("insert into countries values ('Luxembourg'                    ,     998,     406901)");
  sql_stmt("insert into countries values ('Macedonia'                     ,    9928,    2104035)");
  sql_stmt("insert into countries values ('Madagascar'                    ,  226658,   13670507)");
  sql_stmt("insert into countries values ('Malawi'                        ,   45747,    9542844)");
  sql_stmt("insert into countries values ('Malaysia'                      ,  129251,   19962893)");
  sql_stmt("insert into countries values ('Maldives'                      ,     115,     270758)");
  sql_stmt("insert into countries values ('Mali'                          ,  478767,    9653261)");
  sql_stmt("insert into countries values ('Malta'                         ,     122,     372314)");
  sql_stmt("insert into countries values ('Mauritania'                    ,  395956,    2336048)");
  sql_stmt("insert into countries values ('Mauritius'                     ,     788,    1139047)");
  sql_stmt("insert into countries values ('Mexico'                        ,  756066,   95772462)");
  sql_stmt("insert into countries values ('Micronesia'                    ,     271,     125377)");
  sql_stmt("insert into countries values ('Moldova'                       ,   13012,    4463847)");
  sql_stmt("insert into countries values ('Mongolia'                      ,  604829,    2496617)");
  sql_stmt("insert into countries values ('Morocco'                       ,  275114,   29779156)");
  sql_stmt("insert into countries values ('Mozambique'                    ,  308642,   17877927)");
  sql_stmt("insert into countries values ('Myanmar (Burma)'               ,  261228,   49975625)");
  sql_stmt("insert into countries values ('Namibia'                       ,  317818,    1677243)");
  sql_stmt("insert into countries values ('Nepal'                         ,   56827,   22094033)");
  sql_stmt("insert into countries values ('Netherlands'                   ,   16133,   15531940)");
  sql_stmt("insert into countries values ('New Zealand'                   ,  103519,    3547983)");
  sql_stmt("insert into countries values ('Nicaragua'                     ,   50054,    4272352)");
  sql_stmt("insert into countries values ('Niger'                         ,  489191,    9113001)");
  sql_stmt("insert into countries values ('Nigeria'                       ,  356669,  103912489)");
  sql_stmt("insert into countries values ('Norway'                        ,  125050,    4345941)");
  sql_stmt("insert into countries values ('Oman'                          ,   82030,    2186548)");
  sql_stmt("insert into countries values ('Pakistan'                      ,  310432,  129275660)");
  sql_stmt("insert into countries values ('Panama'                        ,   29157,    2655094)");
  sql_stmt("insert into countries values ('Papua New Guinea'              ,  178704,    4394537)");
  sql_stmt("insert into countries values ('Paraguay'                      ,  157048,    5504146)");
  sql_stmt("insert into countries values ('Peru'                          ,  496225,   24523408)");
  sql_stmt("insert into countries values ('Philippines'                   ,  115831,   74480848)");
  sql_stmt("insert into countries values ('Poland'                        ,  120728,   38642565)");
  sql_stmt("insert into countries values ('Portugal'                      ,   35516,    9865114)");
  sql_stmt("insert into countries values ('Qatar'                         ,    4416,     547761)");
  sql_stmt("insert into countries values ('Romania'                       ,   91699,   21657162)");
  sql_stmt("insert into countries values ('Russia'                        , 6592849,  148190419)");
  sql_stmt("insert into countries values ('Rwanda'                        ,   10169,    6853359)");
  sql_stmt("insert into countries values ('St. Kitts and Nevis'           ,     104,      41369)");
  sql_stmt("insert into countries values ('St. Lucia'                     ,     238,     157862)");
  sql_stmt("insert into countries values ('St. Vincent/Grenadines'        ,     150,     118344)");
  sql_stmt("insert into countries values ('S�o Tomé and Principe'         ,     372,     144128)");
  sql_stmt("insert into countries values ('Saudi Arabia '                 ,  830000,   19409058)");
  sql_stmt("insert into countries values ('Senegal'                       ,   75951,    9092749)");
  sql_stmt("insert into countries values ('Seychelles'                    ,     175,      77575)");
  sql_stmt("insert into countries values ('Sierra Leone'                  ,   27925,    4793121)");
  sql_stmt("insert into countries values ('Singapore'                     ,     246,    3396924)");
  sql_stmt("insert into countries values ('Slovakia'                      ,   18933,    5374362)");
  sql_stmt("insert into countries values ('Slovenia'                      ,    7819,    1951433)");
  sql_stmt("insert into countries values ('Solomon Islands'               ,   10954,     412902)");
  sql_stmt("insert into countries values ('Somalia'                       ,  246201,    9369151)");
  sql_stmt("insert into countries values ('South Africa'                  ,  433680,   41743459)");
  sql_stmt("insert into countries values ('Spain'                         ,  194885,   38853397)");
  sql_stmt("insert into countries values ('Sri Lanka'                     ,   24962,   18553074)");
  sql_stmt("insert into countries values ('Sudan'                         ,  967500,   31065229)");
  sql_stmt("insert into countries values ('Suriname'                      ,   63251,     436418)");
  sql_stmt("insert into countries values ('Swaziland'                     ,    6704,     998730)");
  sql_stmt("insert into countries values ('Sweden'                        ,  173732,    8861270)");
  sql_stmt("insert into countries values ('Switzerland'                   ,   15943,    7124745)");
  sql_stmt("insert into countries values ('Syria'                         ,   71498,   15608648)");
  sql_stmt("insert into countries values ('Taiwan'                        ,   13900,   21304000)");
  sql_stmt("insert into countries values ('Tajikistan'                    ,   55251,    5916373)");
  sql_stmt("insert into countries values ('Tanzania'                      ,  364900,   29058470)");
  sql_stmt("insert into countries values ('Thailand'                      ,  198115,   58851357)");
  sql_stmt("insert into countries values ('Togo'                          ,   21925,    4570530)");
  sql_stmt("insert into countries values ('Trinidad and Tobago'           ,    1980,    1272385)");
  sql_stmt("insert into countries values ('Tunisia'                       ,   63170,    9019687)");
  sql_stmt("insert into countries values ('Turkey'                        ,  300948,   62484478)");
  sql_stmt("insert into countries values ('Turkmenistan'                  ,  188456,    4149263)");
  sql_stmt("insert into countries values ('Uganda'                        ,   93104,   20158176)");
  sql_stmt("insert into countries values ('Ukraine'                       ,  233090,   50864009)");
  sql_stmt("insert into countries values ('United Arab Emirates'          ,   32278,    3057337)");
  sql_stmt("insert into countries values ('United Kingdom'                ,   94248,   58489975)");
  sql_stmt("insert into countries values ('United States'                 , 3787425,  265089998)");
  sql_stmt("insert into countries values ('Uruguay'                       ,   68500,    3238952)");
  sql_stmt("insert into countries values ('Uzbekistan'                    ,  172742,   23418381)");
  sql_stmt("insert into countries values ('Venezuela'                     ,  352145,   21983188)");
  sql_stmt("insert into countries values ('Vietnam'                       ,  128066,   73976973)");
  sql_stmt("insert into countries values ('Yemen'                         ,  205356,   13483178)");
  sql_stmt("insert into countries values ('Yugoslavia (Serbia-Montenegro)',   26913,   10611558)");
  sql_stmt("insert into countries values ('Zambia'                        ,  290586,    9159072)");
  sql_stmt("insert into countries values ('Zimbabwe'                      ,  150873,   11271314)");
  sql_stmt("commit");
}

int main() {
  sqlite3_open("./countries.db", &db);

if(db == 0) {
    printf("Could not open database.");
    return 1;
  }

sql_stmt("create table countries (country_name, size_sq_miles, population)");

insert_countries();

printf("\nselecting the countries with the largest population\n\n");
  select_stmt("select * from countries order by population desc limit 5");

printf("\nselecting the countries with the smallest population\n\n");
  select_stmt("select * from countries order by population  asc limit 5");

printf("\nselecting the countries with the largest area\n\n");
  select_stmt("select * from countries order by size_sq_miles desc limit 5");

printf("\nselecting the countries with the smallest area\n\n");
  select_stmt("select * from countries order by size_sq_miles  asc limit 5");

sqlite3_close(db);
  return 0;
}

The makefile
The makefile is very rudimentary as I expect most .c files (except embed_sqlite.c) to be compiled only once.
makefile

CC_OPTS=-Wall

embed_sqlite.exe : embed_sqlite.o \
                   attach.o \
                   auth.o \
                   build.o \
                   btree.o \
                   date.o \
                   delete.o \
                   expr.o \
                   func.o \
                   hash.o \
                   insert.o \
                   legacy.o \
                   main.o \
                   opcodes.o \
                   os_win.o \
                   pager.o \
                   parse.o \
                   pragma.o \
                   printf.o \
                   random.o \
                   select.o \
                   table.o \
                   tokenize.o \
                   trigger.o \
                   update.o \
                   util.o \
                   utf.o \
                   vacuum.o \
                   vdbe.o \
                   vdbeapi.o \
                   vdbemem.o \
                   vdbeaux.o \
                   where.o
    gcc embed_sqlite.o \
  attach.o \
  auth.o \
  build.o \
  btree.o \
  date.o \
  delete.o \
  expr.o \
  func.o \
  hash.o \
  insert.o \
  legacy.o \
  main.o \
  opcodes.o \
  os_win.o \
  pager.o \
  parse.o \
  pragma.o \
  printf.o \
  random.o \
  select.o \
  table.o \
  tokenize.o \
  trigger.o \
  update.o \
  util.o \
  utf.o \
  vacuum.o \
  vdbe.o \
  vdbeapi.o \
  vdbemem.o \
  vdbeaux.o \
  where.o -o $@

embed_sqlite.o : embed_sqlite.c
    gcc $(CC_OPTS) -c embed_sqlite.c

legacy.o : legacy.c
    gcc $(CC_OPTS) -c legacy.c

main.o : main.c
    gcc $(CC_OPTS) -c main.c

attach.o : attach.c
    gcc $(CC_OPTS) -c attach.c

auth.o : auth.c
    gcc $(CC_OPTS) -c auth.c

btree.o : btree.c btree.h
    gcc $(CC_OPTS) -c btree.c

build.o : build.c
    gcc $(CC_OPTS) -c build.c

date.o : date.c
    gcc $(CC_OPTS) -c date.c

delete.o : delete.c
    gcc $(CC_OPTS) -c delete.c

expr.o : expr.c
    gcc $(CC_OPTS) -c expr.c

func.o : func.c
    gcc $(CC_OPTS) -c func.c

hash.o : hash.c hash.h
    gcc $(CC_OPTS) -c hash.c

insert.o : insert.c
    gcc $(CC_OPTS) -c insert.c

opcodes.o : opcodes.c opcodes.h
    gcc $(CC_OPTS) -c opcodes.c

os_win.o : os_win.c os_win.h
    gcc $(CC_OPTS) -c os_win.c

pager.o : pager.c pager.h
    gcc $(CC_OPTS) -c pager.c

parse.o : parse.c parse.h
    gcc $(CC_OPTS) -c parse.c

pragma.o : pragma.c
    gcc $(CC_OPTS) -c pragma.c

printf.o : printf.c
    gcc $(CC_OPTS) -c printf.c

random.o : random.c
    gcc $(CC_OPTS) -c random.c

select.o : select.c
    gcc $(CC_OPTS) -c select.c

#shell.o : shell.c
#    gcc $(CC_OPTS) -c shell.c

table.o : table.c
    gcc $(CC_OPTS) -c table.c

tokenize.o : tokenize.c
    gcc $(CC_OPTS) -c tokenize.c

trigger.o : trigger.c
    gcc $(CC_OPTS) -c trigger.c

update.o : update.c
    gcc $(CC_OPTS) -c update.c

util.o : util.c
    gcc $(CC_OPTS) -c util.c

utf.o : utf.c
    gcc $(CC_OPTS) -c utf.c

vacuum.o : vacuum.c
    gcc $(CC_OPTS) -c vacuum.c

vdbe.o : vdbe.c vdbe.h
    gcc $(CC_OPTS) -c vdbe.c

vdbeapi.o : vdbeapi.c
    gcc $(CC_OPTS) -c vdbeapi.c

vdbemem.o : vdbemem.c
    gcc $(CC_OPTS) -c vdbemem.c

vdbeaux.o : vdbeaux.c
    gcc $(CC_OPTS) -c vdbeaux.c

where.o : where.c
    gcc $(CC_OPTS) -c where.c

Embedding SQLite in a c programm的更多相关文章

  1. Introduction of SQLite

    SQLite is a lightweight, server-less database, it's great for embedding into client application. It ...

  2. 【开源】分享2011-2015年全国城市历史天气数据库【Sqlite+C#访问程序】

    由于个人研究需要,需要采集天气历史数据,前一篇文章:C#+HtmlAgilityPack+XPath带你采集数据(以采集天气数据为例子),介绍了基本的采集思路和核心代码,经过1个星期的采集,历史数据库 ...

  3. UWP开发之ORM实践:如何使用Entity Framework Core做SQLite数据持久层?

    选择SQLite的理由 在做UWP开发的时候我们首选的本地数据库一般都是Sqlite,我以前也不知道为啥?后来仔细研究了一下也是有原因的: 1,微软做的UWP应用大部分也是用Sqlite.或者说是微软 ...

  4. 深入解析Sqlite的完美替代者,android数据库新王者——Realm

    写在前面: 又到一年一度七夕虐狗节,看着大家忍受着各种朋友圈和QQ空间还有现实生活中的轮番轰炸,我实在不忍心再在这里给大家补刀,所以我觉得今天不虐狗,继续给大家分享有用的. 如果你比较关心androi ...

  5. VS15 preview 5打开文件夹自动生成slnx.VC.db SQLite库疑惑?求解答

    用VS15 preview 5打开文件夹(详情查看博客http://www.cnblogs.com/zsy/p/5962242.html中配置),文件夹下多一个slnx.VC.db文件,如下图: 本文 ...

  6. Android之SQLite数据存储

    一.SQLite保存数据介绍 将数据库保存在数据库对于重复或者结构化数据(比如契约信息)而言是理想之选.SQL数据库的主要原则之一是架构:数据库如何组织正式声明.架构体现于用于创建数据库的SQL语句. ...

  7. 【教程】SQLite数据库修复

    SQLite 大家都知道,就不多说了. 有时候数据量大了,或者存储过程中出现异常,数据库就可能会出问题. 这是以前公司产品出现过的问题,导致软件都打不开了,我花了不少时间才解决的,趁现在有空贡献出来. ...

  8. SQLite学习笔记(十)&&加密

    随着移动互联网的发展,手机使用越来越广泛,sqlite作为手机端存储的一种解决方案,使用也非常普遍.但是sqlite本身安全特性却比较弱,比如不支持用户权限,只要能获取到数据库文件就能进行访问:另外也 ...

  9. mono for android中使用dapper或petapoco对sqlite进行数据操作

    在mono for android中使用dapper或petapoco,很简单,新建android 类库项目,直接把原来的文件复制过来,对Connection连接报错部分进行注释和修改就可以运行了.( ...

随机推荐

  1. Throw是一个语句,用来做抛出例外的功能

    当我们自己定义一个例外类的时候必须使其继承excepiton或者RuntimeException. Throw是一个语句,用来做抛出例外的功能. 而throws是表示如果下级方法中如果有例外抛出,那么 ...

  2. android4.4上全屏界面实现禁止状态栏下拉

    附上我改动的方法:PhoneWindowManager.java里面的改动 --- a/frameworks/base/policy/src/com/android/internal/policy/i ...

  3. MyBatis 3.2.6插入时候获取自增主键方法

    MyBatis 3.2.6插入时候获取自增主键方法有二 以MySQL5.5为例: 方法1: <insert id="insert" parameterType="P ...

  4. Eclipse导入MyEclipseproject(web项目显示为java项目解决的方法)

    在直接Import MyEclipse的项目文件导入到Eclipse之后,须要在项目所放的workspace内改动引入项目文件夹下的.project文件,改动例如以下: 1.在eclipse中新建一个 ...

  5. C++随机数生成方法(转载,赶紧搜藏)

    一.C++中不能使用random()函数 =============================================================================== ...

  6. 【BZOJ3622】已经没有什么好害怕的了 容斥+DP

    [BZOJ3622]已经没有什么好害怕的了 Description Input Output Sample Input 4 2 5 35 15 45 40 20 10 30 Sample Output ...

  7. Maven 构建Spring-Boot工程报错

    Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.5.6.RELEASE:repackage ...

  8. 零基础在Linux服务器上部署javaweb项目

    本教程使用的工具下载链接:http://pan.baidu.com/s/1sl1qz2P 密码:43pj 一.安装JDK 1.首先要查看服务器的系统版本,是32位还是64位 #getconf LONG ...

  9. 【Python算法】哈希存储、哈希表、散列表原理

    哈希表的定义: 哈希存储的基本思想是以关键字Key为自变量,通过一定的函数关系(散列函数或哈希函数),计算出对应的函数值(哈希地址),以这个值作为数据元素的地址,并将数据元素存入到相应地址的存储单元中 ...

  10. 依赖注入框架Google Guice 对象图

    GettingStarted · google/guice Wiki https://github.com/google/guice/wiki/GettingStarted sameb edited ...