当前位置: 首页 > news >正文

做外贸用什么网站优化系统软件

做外贸用什么网站,优化系统软件,餐饮网站建设方案,东莞专业做网站优化目录 一.数据库基本概念(理解) 1.数据 2.数据库 二.常用的数据的数据库(了解) 1.大型数据库 2.中型数据库 3.小型数据库 三.基于嵌入式的数据库(了解) 四.SQLite基础(了解)…

目录

一.数据库基本概念(理解)

1.数据

2.数据库

二.常用的数据的数据库(了解)

1.大型数据库

2.中型数据库

3.小型数据库

三.基于嵌入式的数据库(了解)

四.SQLite基础(了解)

五.创建数据库(熟练)

1.手工创建

2.代码创建

六.SQLite编程接口

七.代码示例(学生管理系统)

八.水果店铺管理系统


一.数据库基本概念(理解

1.数据

        能够输入计算机并能够计算机程序识别和处理的信息集合。(不只是数字)

2.数据库

        数据库是在数据库管理系统管理和控制之下,存放在存储介质上的数据集合。

二.常用的数据的数据库(了解)

1.大型数据库

        Oracle公司是最早开发关系数据库的厂商之一,其产品支持最广泛的操作系统平台。目前Oracle关系数据库产品的市场占有率名列前茅。 IBM 的DB2是第一个具备网上功能的多媒体关系数据库管理系统,支持包Linux在内的一系列平台。

2.中型数据库

        Server是微软开发的数据库产品,主要支持windows平台。

3.小型数据库

        mySQL是一个小型关系型数据库管理系统,开发者为瑞典MySQL AB公司,2008年被Sun公司收购,开放源码。

        

三.基于嵌入式的数据库(了解)

        基于嵌入式Linux的数据库主要有SQLite, Firebird, Berkeley DB, eXtremeDB

        Firebird是关系型数据库,功能强大,支持存储过程、SQL兼容等

        SQLite关系型数据库,体积小,支持ACID事务

        Berkeley DB中并没有数据库服务器的概念,它的程序库直接链接到应用程序中

        eXtremeDB是内存数据库,运行效率高

四.SQLite基础(了解)

        SQLite的源代码是C,其源代码完全开放。SQLite第一个Alpha版本诞生于2000年5月。 他是一个轻量级的嵌入式数据库。

SQLite有以下特性:

         零配置一无需安装和管理配置;

        储存在单一磁盘文件中的一个完整的数据库;

        数据库文件可以在不同字节顺序的机器间自由共享;

        支持数据库大小至2TB;

        足够小,全部源码大致3万行c代码,250KB;

        比目前流行的大多数数据库对数据的操作要快;

五.创建数据库(熟练)

1.手工创建

        使用SQLite3工具,通过手工输入SQL命令行完成数据库创建. 用户在Linux的命令行界面中输入SQLite3可启动SQLite3工具

       数据库的安装

 sudo dpkg -i  *.deb  //本地安装包安装sudo apt-get install sqlite3  //在线安装

        数据库常用命令

        (1) 系统命令都以“ . ”开头

.exit //退出
.quit //退出
.table //查看表
.schema <table_name> //查看表的结构 
.help //显示所有命令
.database //显示当前打开的数据库文件

打开数据库文件 

在终端下运行sqlite3   <*.db>,出现如下提示符
SQLite  version  3.7.2
Enter “.help” for instructions
Enter SQL statements terminated with a “;”
sqlite>
<*.db> 是要打开的数据库文件。若该文件不存在,则自动创建

         (2)sql执行语句,都以“ ;”结尾

创建一张表

create  table  <table_name>  (f1  type1, f2  type2,…);crerate table stuinfo(id integer ,name char ,age intger,score float);

插入一条记录 

insert  into  <table_name>  values (value1, value2,…);insert into stuinfo values(1001, 'zhangsan', 18, 80);
insert into stuinfo (id, name, score) values(1002, 'lisi', 90);

 查看数据库记录(where后面是条件)

select  *  from  <table_name>  where  <expression>;select * from stuinfo;
select * from stuinfo where score = 80;
select * from stuinfo where score = 80 and name= 'zhangsan';
select * from stuinfo where score = 80 or name='wangwu';
select name,score from stuinfo;  查询指定的字段
select * from stuinfo where score >= 85 and score < 90;

 删除一条记录

sqlite>delete  from  <table_name>  where  <expression>;delete from stuinfo where id=1003 and name='zhangsan';

更新一条记录 

sqlite>update  <table_name>  set  <f1=value1>, <f2=value2>… where<expression>;  update stuinfo set age=20 where id=1003;
update stuinfo set age=30, score = 82 where id=1003;

 删除一张表

drop  table  <table_name>drop table stuinfo;

 增加一列

alter table <table> add column <field> <type> default  …; alter table stuinfo add column sex char;

 删除一列(通过创建新的表来删除)

create table stu as select id, name, score from stuinfo;
drop table stuinfo;
alter table stu rename to stuinfo;

2.代码创建

        在程序运行过程中,当需要进行数据库操作时,应用程序会首先尝试打开数据库,此时如果数据库并不存在,程序则会自动建立数据库,然后再打开数据库

六.SQLite编程接口

        1.打开(创建)sqlite数据库

int   sqlite3_open(char  *path,   sqlite3 **db);path:数据库文件路径(数据库名称)
db:指向sqlite句柄的指针
返回值:成功返回0,失败返回错误码(非零值)

        2.关闭sqlite数据库       

int   sqlite3_close(sqlite3 *db);返回值:成功返回0,失败返回错误码

        3.得到错误信息的描述

const  char  *sqlite3_errmg(sqlite3 *db);         
返回值:返回错误信息

        4.执行SQL语句操作 

Int sqlite3_exec(
sqlite3 *db,
const  char  *sql, 
sqlite3_callback callback, 
void *, char **errmsg
);db:数据库句柄
sql:SQL语句
callback:回调函数
errmsg:错误信息指针的地址
返回值:成功返回0,失败返回错误码/* Callback function */
功能:查询语句执行之后,会回调此函数
查询回调函数:int (*callback)(void* arg,int ncolumns ,char** f_value,char** f_name);参数:arg   接收sqlite3_exec 传递来的参数ncolumns 列数(记录中包含的字段数目)f_value 列的值的地址(包含每个字段值的指针数组)f_name   列的名称(包含每个字段名称的指针数组)
返回值:成功返回0,失败返回-1

        5. 不使用回调函数执行SQL操作查询

不使用回调函数执行SQL语句
int   sqlite3_get_table(sqlite3 *db, const  char  *sql,  char ***resultp,  int*nrow,  int *ncolumn, char **errmsg);db:数据库句柄
sql:SQL语句
resultp:用来指向sql执行结果的指针
nrow:满足条件的记录的数目
ncolumn:每条记录包含的字段数目
errmsg:错误信息指针的地址
返回值:成功返回0,失败返回错误码

七.代码示例(学生管理系统)

        管理学生的信息

八.水果店铺管理系统

        管理水果种类,重量,价格等信息和信息变动记录

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sqlite3.h>
#include <time.h>#define  DATABASE  "fruit.db"
#define TABLES "fruit"
#define  N  128int do_insert(sqlite3 *db,char *buf);
int do_update_weight(sqlite3 *db,char *buf);
int do_update_price(sqlite3 *db);
int do_query(sqlite3 *db);
int callback(void *arg, int f_num, char ** f_value, char ** f_name);int main(int argc, const char *argv[])
{sqlite3 *db;char *errmsg;int n;char sql[128] = {};char buf[128] = {};time_t t;struct tm *tp;if(sqlite3_open(DATABASE, &db) != SQLITE_OK){printf("%s\n", sqlite3_errmsg(db));return -1;}else{printf("open DATABASE success.\n");}sprintf(sql,"create table if not exists '%s' (id integer primary key autoincrement,name char,weight float,price float,time char);",TABLES);if(sqlite3_exec(db, sql,NULL, NULL, &errmsg) != SQLITE_OK){printf("%s\n", errmsg);}else{printf("Create or open table success.\n");}time(&t);tp = localtime(&t);sprintf(buf,"%d-%02d-%02d %02d:%02d:%02d\n",tp->tm_year+1900, tp->tm_mon+1,tp->tm_mday, tp->tm_hour, tp->tm_min, tp->tm_sec);printf("%s",buf);while(1){puts("-----------------------------------------");do_query(db);puts("-----------------------------------------");puts("");printf("********************************************\n");printf("1: insert 插入  2:query 查询 3:trade 交易 4:update 更新 5:quit 退出系统\n");printf("********************************************\n");printf("Please select:");scanf("%d", &n);switch(n){case 1:do_insert(db,buf);break;case 2:do_query(db);break;case 3:do_update_weight(db,buf);break;case 4:do_update_price(db);break;case 5:printf("main exit.\n");sqlite3_close(db);exit(0);break;default :printf("Invalid data n.\n");}}return 0;
}int do_insert(sqlite3 *db,char *buf)
{char name[32] = {};float weight;float price;char sql[N] = {};char *errmsg;printf("Input fruit name:");scanf("%s", name);getchar();printf("Input weight:");scanf("%f", &weight);printf("Input price:");scanf("%f", &price);sprintf(sql, "insert into '%s' (name,weight,price,time)values('%s', '%.3f', '%.3f','%s')",TABLES, name, weight, price,buf);if(sqlite3_exec(db, sql, NULL, NULL, &errmsg) != SQLITE_OK){printf("%s\n", errmsg);}else{printf("Insert done.\n");}return 0;
}int do_update_weight(sqlite3 *db,char *buf)
{int id;char sql[N] = {};char *errmsg;float weight;printf("Input id:");scanf("%d", &id);printf("Input weight:");scanf("%f", &weight);sprintf(sql, "update '%s' set weight='%f',time='%s' where id=%d",TABLES, weight,buf,id);if(sqlite3_exec(db, sql, NULL, NULL, &errmsg) != SQLITE_OK){printf("%s\n", errmsg);}else{printf("Delete done.\n");}return 0;
}int do_update_price(sqlite3 *db)
{float price;int id;char sql[N] = {};char *errmsg;printf("Input id:");scanf("%d", &id);printf("Input alter price:");scanf("%f", &price);sprintf(sql, "update '%s' set price='%f' where id=%d",TABLES , price,id);if(sqlite3_exec(db, sql, NULL, NULL, &errmsg) != SQLITE_OK){printf("%s\n", errmsg);}else{printf("update done.\n");}return 0;
}int callback(void *arg, int f_num, char ** f_value, char ** f_name)
{int i = 0;for(i = 0; i < f_num; i++){//	printf("%-8s %s", f_value[i], f_name[i]);printf("%-8s", f_value[i]);}putchar(10);puts("-----------------------------------------");return 0;
}int do_query(sqlite3 *db)
{char *errmsg;char sql[N] = {};sprintf(sql,"select * from '%s';",TABLES);if(sqlite3_exec(db, sql, callback,NULL , &errmsg) != SQLITE_OK){printf("%s", errmsg);}else{printf("select done.\n");}return 0;
}

http://www.fp688.cn/news/145376.html

相关文章:

  • 网站建设开发全包关键词优化排名seo
  • 网站服务器备案查询网站备案知名网页设计公司
  • 用flash做的经典网站信息流推广主要具有哪两大优势
  • python php 网站开发百度指数查询入口
  • 哪个网站可以免费做初级试题全网营销网络推广
  • 做网站设计需要办理icp免费的网络推广渠道
  • 简单的视频网站能不能用dw做站长之家ip地址查询
  • 网站如何增加百度权重的方法合肥网络推广有限公司
  • 天蝎网站建设公司软文文案范文
  • 中铁建设集团门户网站登录百度app最新版本
  • 怎么做属于自己的免费网站网上推广的平台有哪些
  • 商务网站建设方案seo系统培训哪家好
  • 泉州建站方案推广合作
  • 深圳百度网站建设二级域名分发平台
  • 如何用rp做网站站长之家官网入口
  • 深圳坂田网站建设昆明网站seo优化
  • 北碚免费建站哪家做得好谷歌seo快速排名软件首页
  • 网站建设价格标准信息深圳网站建设
  • 网站做5级分销合法吗济南百度竞价
  • 网站安全 重要性网络公司
  • 重庆平台网站建设工事件营销案例
  • 做网站推广有用吗百度云盘登录
  • 网站建设丶seo优化北京搜索引擎优化管理专员
  • 教做高级料理的网站app下载推广平台
  • 滕州做网站哪家好广州快速排名
  • 企业网站网站设计seo优化培训公司
  • 平台网站建设制作百度关键词seo
  • 深圳网站建设收费seo黑帽培训骗局
  • 成都设计专业的装修公司引擎seo如何优化
  • 设计师搜图网站百度站长号购买