SQLSRV 驱动程序与用于 PHP 和 MS SQL Server 的 PDO 驱动程序

SQLSRV driver vs. PDO driver for PHP with MS SQL Server(SQLSRV 驱动程序与用于 PHP 和 MS SQL Server 的 PDO 驱动程序)
本文介绍了SQLSRV 驱动程序与用于 PHP 和 MS SQL Server 的 PDO 驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

限时送ChatGPT账号..

在 SQLSRV 驱动程序与 PDO 驱动程序之间进行选择时,我应该考虑哪些因素(对于带有 MS SQL 服务器的 PHP)?

What considerations should I take into account when choosing between SQLSRV driver vs. PDO driver (for PHP with MS SQL server)?

我看到了之前的 Stackoverflow 帖子(在 Windows 上使用 PHP 时,哪个更好(1)SQL Server 的本机驱动程序或(2)PDO 驱动程序? )但答案似乎有点缺乏并且没有没有提到 这篇文章.

I saw this previous Stackoverflow post ( When using PHP on Windows, what is better (1) the native driver for SQL Server or (2) the PDO driver? ) but the answer seems a bit lacking and doesn't mention all the benefits of using the SQLSRV driver as mentioned in this article.

我正在寻找一个全面的和最新的(例如,SQLSRV 驱动程序是否仍然只适用于 Windows?)答案,程序员可以将其称为资源.

I'm looking for a comprehensive and up-to-date (eg. is it still the case that SQLSRV driver is only available for Windows?) answer that programmers can refer to as a resource.

推荐答案

PDO 允许您编写合理的 DB 中立的代码.

PDO allows you to write you code to be reasonably DB-neutral.

如果你想要真正的数据库中立,你会想要使用一个完整的数据库抽象层,比如 NotORM-- 使用普通 PDO,您仍然需要注意 SQL 语法差异,但至少您的基本 PHP 代码将与 DB 无关.

If you want truly DB-neutral, you'd want to use a full DB abstraction layer like NotORM -- with plain PDO, you'd still need to be careful about SQL syntax difference, but at least your basic PHP code would be DB-neutral.

DB 中立现在似乎并不重要——如果你使用 SQL Server,那么你可能被告知这是必需的,没有别的——但是你无法预测事情会如何改变未来,所以如果选择是在 DB 中立驱动程序和 DB 特定驱动程序之间,并且您没有任何其他理由偏爱,那么选择中性驱动程序......它会让生活变得很多如果您的公司被接管并且新老板想使用 Oracle 作为数据库,则更容易!

Being DB-neutral may not seem important now -- if you're using SQL Server, then you've probably been told that's what is required and nothing else -- but you can't predict how things will change in the future, so if the choice is between a DB-neutral driver and a DB-specific driver, and you don't have any other reason for a preference, then go with the neutral one.... it'll make life a lot easier if your company gets taken over and the new boss wants to use Oracle as the DB!

此外,因为它是 DB 中立的,所以 PDO 在 PHP 社区中更标准且更广为人知.与使用 MSSQL 驱动程序相比,您将从在线站点(如本站点)获得更多有关 PDO 的帮助.

Also, because it's DB neutral, PDO is more standard and more well-known in the PHP community. You'll get a lot more help with PDO from sites online (like this one) than with the MSSQL driver.

这篇关于SQLSRV 驱动程序与用于 PHP 和 MS SQL Server 的 PDO 驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)