数据库系统概论:第八章 数据库编程

8.1 嵌入式SQL

8.1.1 嵌入式SQL的处理过程

(宿)主语言:被嵌入的程序设计语言,如C++、JAVA
在这里插入图片描述

8.1.2 嵌入式SQL语句与主语言之间的通信

  1. SQL通信区
    向主语言传递SQL语句的执行状态信息,使主语言能够据此信息控制程序流程
  2. 主变量
    SQL语句中使用的主语言程序变量,分为输入主变量和输出主变量。
    一个主变量可以附带一个任选的指示变量,指示所指主变量的值或者条件,主要指示主变量是否为空值
  3. 游标
    解决集合性的SQL语言和过程性的高级语言的不同的处理方式。实际上是一个指针,遍历所要操作的记录
  4. 建立和关闭数据库连接

8.2 过程化SQL

8.2.1 过程化SQL的块结构

对SQL的扩展,增加了过程化语句功能,基本结构是块,可以相互嵌套,每个块完成一个逻辑操作。

8.2.3 流程控制

  1. 条件控制语句:IF语句、IF-THEN语句、嵌套的IF语句
  2. 循环控制语句:LOOP语句、WHILE-LOOP语句、FOR-LOOP语句
  3. 错误处理

8.3 存储过程

持久性存储模块:将命名块,即过程和函数,编译后保存在数据库中,可被反复调用,不用每次执行时都进行编译

8.3.1 存储过程优点

优点:

  1. 运行效率高
  2. 降低了客户机和服务器之间的通信量
  3. 方便实施企业规则

8.3.2 函数

与存储过程类似

8.4 ODBC编程

优点:使用ODBC编写的应用程序可移植性好,能同时访问不同的数据库,共享多个数据资源

8.4.1 ODBC概述

ODBC是微软开放服务体系中有关数据库的一个组成部分,它建立了一组规范,并提供了一组访问数据库的API

8.4.2 ODBC工作原理概述

在这里插入图片描述

  1. 用户应用程序:调用的是标准的ODBC函数和SQL语句
  2. ODBC驱动程序管理器:微软提供,管理应用程序和驱动程序之间的通信
  3. 数据库驱动程序
  4. ODBC数据源管理
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
数据库系统概念(杨冬青)习题答案Chapter 1 provides a general overview of the nature and purpose of database systems. The most important concept in this chapter is that database systems allow data to be treated at a high level of abstraction. Thus, database systems differsignificantly from the file systemsand general purpose programming environments with which students are already familiar. Another important aspect of the chapter is to provide motivation for the use of database systems as opposed to application programs built on top of file systems. Thus, the chapter motivates what the student will be studying in the rest of the course. The idea of abstraction in database systems deserves emphasis throughout, not just in discussion of Section 1.3. The overview of the structure of databases is, of necessity, rather brief, and is meant only to give the student a rough idea of some of the concepts. The student may not initially be able to fully appreciate the concepts described here, but should be able to do so by the end of the course. The specifics of the E-R, relational, and object-oriented models are covered in later chapters. These models can be used in Chapter 1 to reinforce the concept of abstraction, with syntactic details deferred to later in the course. If students have already had a course in operating systems, it is worthwhile to point out how the OS and DBMS are related. It is useful also to differentiate between concurrency as it is taught in operating systems courses (with an orientation towardsfiles, processes,and physical resources)and database concurrency control (with an orientation towards granularity finer than the file level, recoverable transactions, and resources accessed associatively rather than physically). If students are familiar with a particular operating system, that OS’s approach to concurrent file access may be used for illustration.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值