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

Real SQL Programming

目录

SQL in Real Programs

Options

Stored Procedures

Advantages of Stored Procedures

Parameters in PSM


SQL in Real Programs

  • We have seen only how SQL is used at the generic query interface --- an environment where we sit at a terminal and ask queries of a database.

  • Reality is almost always different:

conventional programs interacting with SQL.

(我们只是看见了SQL是如何在常规的查询接口中的使用,也就是直接通过终端 对数据库进行交互,但实际上通常是常规程序与SQL语言的交互)

Options

  • Code in a specialized language is stored in the database itself (e.g.PSM, PL/SQL).
  • SQL statements are embedded in a host language (e.g., C).
  • Connection tools are used to allow a conventional language to access a database (e.g., CLI, JDBC, PHP/DB).

(常规程序与SQL语言的交互模式: 数据库储存代码、SQL内嵌、连接工具)

Stored Procedures

  • PSM, or “persistent stored modules, ” allows us to store procedures as database schema elements.(持久储存模块允许我们将储存模式作为数据库模式元素)

  • PSM = a mixture of conventional statements (if, while, etc.) and SQL.

  • Lets us do things we cannot do in SQL alone.

数据库中的储存过程和函数的区别在于,函数可以直接通过函数名的引用得到函数值,但是储存过程不行

Advantages of Stored Procedures

  • Share Application Logic(共享应用逻辑)
  • Shield Database Schema Details(屏蔽数据库细节)
  • Provide Security Mechanisms(提供安全机制 )
  • Improve Performance(提升性能)
  • Reduce Network Traffic(减少网络流量)

Parameters in PSM

Unlike the usual name-type pairs in languages like C, PSM uses mode- name-type triples, where the mode can be:

  • IN = procedure uses value, does not change value.(传入参数,只能调用不能修改)

  • OUT = procedure changes, does not use.(传出参数,可以在储存过程被修改)

  • INOUT = both

想得到储存过程的返回值,虽然不能直接通过调用储存过程名字,但是可以调用OUT参数

http://www.xdnf.cn/news/9979.html

相关文章:

  • 安装一个包 myPhysicsLab
  • Numpy知识点
  • Cesium 8 ,在 Cesium 上实现雷达动画和车辆动画效果,并控制显示和隐藏
  • 提示词优化技巧
  • 【Java】线程池的实现原理是怎样的?CPU密集型任务与IO密集型任务的区别?
  • Java基础面试题--jdk和jre的区别
  • openbmc kvm vnc client connection
  • 四、若依从数据库
  • 【JavaWeb】基本概念、web服务器、Tomcat、HTTP协议
  • 数据结构数组总结
  • 大模型调用数据库表实践:基于自然语言的SQL生成与数据查询系统
  • 石油炼化厂融合定位系统人员管控解决方案
  • 阿里云服务器ECS详细购买流程【新手购买手册】
  • 小白的进阶之路系列之六----人工智能从初步到精通pytorch数据集与数据加载器
  • 学习STC51单片机20(芯片为STC89C52RCRC)
  • Webug4.0靶场通关笔记03- 第3关SQL注入之时间盲注(手注法+脚本法 两种方法)
  • 字体查看器
  • C学习-头文件
  • iVX 如何用 VL 中间语言构建程范式闭环?
  • [SC]SystemC语法小结(一)
  • Linux部署python项目为服务,开启自启动
  • 上传图片转成3D VR效果 / 用photo-sphere-viewer实现图片VR效果 / VR效果在项目中落地实践
  • WebBuilder赋能中山欣锠鞋业数字化转型实践
  • Web 系统验证码与登录安全防护全攻略(附实现方案)
  • The CTeX fontset “fandol“ is unavailable in the current mode.
  • 复合机器人:纠偏算法如何重塑工业精度与效率?
  • AET3156AP电源方案 禾纳代理商
  • 1.什么是node.js、npm、vue
  • vue3 各种数据处理
  • Spring 核心知识点补充