Home Database Mysql Tutorial 在MYSQL中如何使用API_MySQL

在MYSQL中如何使用API_MySQL

Jun 01, 2016 pm 01:56 PM
how app ability language

    5.2 选择API

    本节介绍根据各种类型的应用程序选择A P I的方法,比较C、DBI 和PHP API 的能力,并给出它们相对的优点和缺点,并指出什么时候应选择哪一个。

    首先应该指出,笔者不认为任一种语言优于其他语言。尽管笔者的确有自己的喜好,但还是统统使用它们。您也会有自己的喜好,像我的评论家一样。一个评论家会感觉应该强调C 对MySQL编程的重要性,应将这种重要性上升到更重要的程度,而另一个评论家会认为C编程相当困难,应放弃使用它!您应当权衡本节中讨论的这些因素,得出自己的结论。在对特定任务选择哪个API 时,要考虑以下问题:

    ■ 预期的执行环境。期望使用应用程序的上下文环境。

    ■ 性能。当在API 语言中编写时,如何使应用程序高效地执行。

    ■ 开发的容易性。如何便于API 和它的语言编写应用程序。

    ■ 可移植性。除MySQL以外,应用程序是否还将用于其他数据库系统。

    下面进一步分析每个问题。要注意这些因素的相互影响。例如,您想要一个运行良好的应用程序,但使用一个可快速开发该应用程序的语言也同等重要,即使该应用程序不能非常有效地运行也同样。

    5.2.1执行环境

    当编写应用程序时,通常应考虑使用哪种环境。例如,该应用程序可能是从外壳程序中调用的报告生成器程序,或一个应付账目概要程序,在每月的月底作为cron job 进行运行。从外壳程序或cron 程序中运行的命令通常依赖它们自己,而且很少需要运行环境。另外,可以编写一个应用程序来试图由Web 服务器调用。这样的程序期望能从它的运行环境中抽出非常特殊类型的信息:客户正在使用什么浏览器?在邮件清单订阅请求格式中输入什么参数?客户提供正确的口令访问我们个人信息了吗?每种API 语言都以它在这些不同的环境中适于编写应用程序而变化:

    ■C 是通用目标的语言,从理论上讲任何任务都可使用它。在实际中, C 倾向于用于更频繁的独立程序而不是对Web 的编程。其原因可能是在C 中不像在Perl 或在PHP 中那样容易地实现文本处理和内存管理,并且这些处理和管理在Web 应用程序中大量地使用。

    ■ Perl,像C 一样,适合于编写独立的程序。然而,对于Web 站点的开发,Perl 也是非常有用的,例如通过使用CGI.pm 模块。这使Perl 成为编写连接MySQL和Web 的应用程序的便利的语言。这样的应用程序可以经CGI.pm 模块与Web 接口,并可以使用DBI 与MySQL相互作用。

    ■ PHP 是设计用来编写Web 应用程序的语言,所以这个环境显然是最适合的。而且,数据库访问是PHP 最大的优势之一,所以它是实现与MySQL相关的任务的Web 应用程序最自然的选择。也可以将PHP 作为一个独立的解释程序(例如,从外壳程序中运行脚本),但不能非常频繁地使用它。

    根据以上这些需要考虑的问题,对于独立的应用程序, C 和Perl 是最佳语言。对于We b应用程序, Perl 和PHP 是最合适的。如果需要编写这两种类型的应用程序,但又不会使用这些语言的任何一种,并想用尽可能少的精力来学习,则Perl 可能是您最佳的选择。

    5.2.2 性能

    我们通常喜欢应用程序尽可能快地运行。然而,实际上性能的重要性取决于所使用的程序的频率。对于一个月运行一次晚上定时工作的程序,性能可能不是非常重要的。而对于在Web 站点上一秒钟运行若干次的程序,则每当排除一点无效性都会带来巨大的不同。后一种情况下,在站点的有效性和请求中,性能发挥着重要的作用。一个缓慢的站点是令用户苦恼的,无论站点的内容如何,如果您依靠站点作为一项收入来源,则性能的降低直接影响收入。如果不能一次为多个连接提供服务,访问者只会产生厌烦情绪而去其他的站点。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Unable to save changes to Photos app error in Windows 11 Unable to save changes to Photos app error in Windows 11 Mar 04, 2024 am 09:34 AM

If you encounter the Unable to save changes error while using the Photos app for image editing in Windows 11, this article will provide you with solutions. Unable to save changes. An error occurred while saving. Please try again later. This problem usually occurs due to incorrect permission settings, file corruption, or system failure. So, we’ve done some deep research and compiled some of the most effective troubleshooting steps to help you resolve this issue and ensure you can continue to use the Microsoft Photos app seamlessly on your Windows 11 device. Fix Unable to Save Changes to Photos App Error in Windows 11 Many users have been talking about Microsoft Photos app error on different forums

Photos cannot open this file because the format is not supported or the file is corrupted Photos cannot open this file because the format is not supported or the file is corrupted Feb 22, 2024 am 09:49 AM

In Windows, the Photos app is a convenient way to view and manage photos and videos. Through this application, users can easily access their multimedia files without installing additional software. However, sometimes users may encounter some problems, such as encountering a "This file cannot be opened because the format is not supported" error message when using the Photos app, or file corruption when trying to open photos or videos. This situation can be confusing and inconvenient for users, requiring some investigation and fixes to resolve the issues. Users see the following error when they try to open photos or videos on the Photos app. Sorry, Photos cannot open this file because the format is not currently supported, or the file

MS Paint not working properly in Windows 11 MS Paint not working properly in Windows 11 Mar 09, 2024 am 09:52 AM

Microsoft Paint not working in Windows 11/10? Well, this seems to be a common problem and we have some great solutions to fix it. Users have been complaining that when trying to use MSPaint, it doesn't work or open. Scrollbars in the app don't work, paste icons don't show up, crashes, etc. Luckily, we've collected some of the most effective troubleshooting methods to help you resolve issues with Microsoft Paint app. Why doesn't Microsoft Paint work? Some possible reasons why MSPaint is not working on Windows 11/10 PC are as follows: The security identifier is corrupted. hung system

How to connect Apple Vision Pro to PC How to connect Apple Vision Pro to PC Apr 08, 2024 pm 09:01 PM

The Apple Vision Pro headset is not natively compatible with computers, so you must configure it to connect to a Windows computer. Since its launch, Apple Vision Pro has been a hit, and with its cutting-edge features and extensive operability, it's easy to see why. Although you can make some adjustments to it to suit your PC, and its functionality depends heavily on AppleOS, so its functionality will be limited. How do I connect AppleVisionPro to my computer? 1. Verify system requirements You need the latest version of Windows 11 (Custom PCs and Surface devices are not supported) Support 64-bit 2GHZ or faster fast processor High-performance GPU, most

How to solve application startup error 0xc000012d problem How to solve application startup error 0xc000012d problem Jan 02, 2024 pm 12:53 PM

When a friend's computer is missing certain files, the application cannot start normally with error code 0xc000012d. In fact, it can be solved by re-downloading the files and installing them. The application cannot start normally 0xc000012d: 1. First, the user needs to download ".netframework". 2. Then find the download address and download it to your computer. 3. Then double-click on the desktop to start running. 4. After the installation is completed, return to the wrong program location and open the program again.

Fix caa90019 Microsoft Teams error Fix caa90019 Microsoft Teams error Feb 19, 2024 pm 02:30 PM

Many users have been complaining about encountering error code caa90019 every time they try to log in using Microsoft Teams. Even though this is a convenient communication app, this mistake is very common. Fix Microsoft Teams Error: caa90019 In this case, the error message displayed by the system is: "Sorry, we are currently experiencing a problem." We have prepared a list of ultimate solutions that will help you resolve Microsoft Teams error caa90019. Preliminary steps Run as administrator Clear Microsoft Teams application cache Delete settings.json file Clear Microsoft from Credential Manager

Shazam app not working in iPhone: Fix Shazam app not working in iPhone: Fix Jun 08, 2024 pm 12:36 PM

Having issues with the Shazam app on iPhone? Shazam helps you find songs by listening to them. However, if Shazam isn't working properly or doesn't recognize the song, you'll have to troubleshoot it manually. Repairing the Shazam app won't take long. So, without wasting any more time, follow the steps below to resolve issues with Shazam app. Fix 1 – Disable Bold Text Feature Bold text on iPhone may be the reason why Shazam is not working properly. Step 1 – You can only do this from your iPhone settings. So, open it. Step 2 – Next, open the “Display & Brightness” settings there. Step 3 – If you find that “Bold Text” is enabled

High CPU usage of Feature Access Manager service in Windows 11 High CPU usage of Feature Access Manager service in Windows 11 Feb 19, 2024 pm 03:06 PM

Some PC users and gamers may experience abnormally high CPU usage when using Windows 11 or Windows 10, especially when running certain applications or games. This article provides some suggestions to help users alleviate this problem. Some affected PC users noted that when experiencing this issue, they observed Task Manager showing other applications using only 0% to 5% of the CPU, while the Service Host: Capability Access Manager service was seeing usage as high as 80%. % to 100%. What is the Service Host: Feature Access Manager service? The function of the Function Access Manager service is to confirm whether the application has permission to access the camera and microphone and grant the necessary permissions. It facilitates the management of UWP applications

See all articles