Contents tagged with SQL Server Driver for PHP
-
What SQL Server 2012 Means for PHP Developers
Last week, Microsoft held a virtual conference to announce the availability of SQL Server 2012. The conference included a number of events (speakers, videos, training activities, etc.) that focused on the new functionality available in this release. Now that most of the fanfare has died down a bit, I’d like to take a look at what some of that new functionality means for PHP developers. Combined with the release of the Microsoft Driver for SQL Server for PHP, I think the SQL Server 2012 release makes some big improvements in developing PHP/SQL Server applications.
-
Version 3.0 (beta) of the SQL Server Drivers for PHP Released!
A Community Technology Preview (a beta release) of v3.0 of the SQL Server Drivers for PHP was released today (see the announcement on the team blog). You can download it here: Download v3.0 of the SQL Server Drivers for PHP. In this release, there are three new features: buffered queries, support for LocalDB, and support for high availability and disaster recovery. It’s important to note that the latter two features are dependent on the next version of SQL Server (code named “Denali”). A preview of Denali can be downloaded for free here (see notes later in this article about the installation process): Download SQL Server Denali CTP 3. More detail about each new feature is in the sections below. We’re hoping to get feedback from you. If you have feedback, please comment on this post or reach out to me (@brian_swan) and/or Jonathan Guerin (@kop48, the Program Manager for the drivers) on Twitter.
-
Consuming SQL Server Result Sets as XML with PHP
At last month’s SQL Server JumpIn! Camp, one of the SQL Server features that generated some excitement among the participants was SQL Server’s ability to return result sets as XML. I felt a bit foolish for not having investigated this feature, so I’m rectifying that with this post. The SQL Server XML functionality is very rich (just look at the MSDN documentation devoted to it!), but I will provide only an introduction in this post. As you will see, nothing special is required in your PHP code…the magic is all in the SQL queries.
-
PHP Driver for SQL Server – Request for Feature Feedback
Jonathan Guerin, the Program Manager for the SQL Server Driver for PHP, just posted a request for feature feedback on the team blog. I want to make sure that his request gets in front of lots of eyes, so I’m re-posting his request here (below). Jonathan included some links in his post so you can learn more about what the team is considering for the next release of the driver, but he didn’t elaborate on “Buffered Queries”. If it’s not obvious what that feature is, it is simply functionality that allows you to bring an entire result set into memory all at once (which the SQLSRV driver doesn’t currently support – you currently have to use a scrollable cursor if you want to move back and forth within a result set).
-
Using PDO::quote with Parameterized Queries
I spent some time last week investigating a puzzling issue raised in the SQL Server Driver for PHP forums: Need help with PDO::quote() and PDOStatement::bindValue and PDO::execute using new SQLSRVR 2.0 driver. At the heart of the issue was this question: Should you use the PDO::quote method to quote a parameter if you are also using the PDOStatement::bindValue or the PDOStatement::bindParam method to bind the parameter? My answer is no, you shouldn’t. I’ll explain why not, but I wonder if I’m potentially missing some use cases where it does make sense…I’d be very interested to learn those cases if I am.
-
SQL Server Driver for PHP Connection Options: Encrypt
This short post adds to my series on connection options in the SQL Server Driver for PHP. I’ll go into a bit more detail on the Encrypt and TrustServerCertificate options than the driver documentation does. I’ll start with three important points related to these options, then I’ll go into a couple of hypothetical situations that should shed more light on what these options actually do.
-
SQL Server Driver for PHP Connection Options: Failover_Partner
One of the best things about writing this series on connection options for the SQL Server Driver for PHP is that I get to learn about lots of interesting SQL Server features. This time, the Failover_Partner connection option has led me to do a bit of homework on database mirroring. The short story is that as an application developer you don’t really need to understand much about database mirroring…it’s a DBA concern. Of course, if you are both app dev and DBA and have the need for a failover database, then you might want to invest some time in learning more about mirroring than I'll go into (the MSDN documentation starts here). In this post, I'll provide an introduction to mirroring and hopefully give you enough information about the Failover_Partner option for you to send your DBA an intelligent email in case something goes wrong.
-
SQL Server Driver for PHP Connection Options: CharacterSet
In this post, I’ll add to my slowly growing series that elaborates on the connection options for the SQL Server Driver for PHP. This time I’ll focus on the CharacterSet option. This is the option that specifies how data will be encoded when it is sent to and from the server. I’ll take a look at how and when to use the different values for this option, as well as briefly look at what the driver is doing under the hood for each value. This is especially interesting in the case of storing UTF-8 encoded data since SQL Server only supports storing USC-2 encoded data.
-
SQL Server Driver for PHP Connection Options: ReturnDatesAsStrings
This is short post to address a frustration I’ve seen mentioned on Twitter and in forums a lot: By default, the SQL Server Driver for PHP returns datetime columns as PHP DateTime objects, not strings. This can be especially frustrating if you are not aware of the ReturnDatesAsStrings connection option. By simply setting this option to 1 (or true) when you connect to the server, datetime columns will be returned as strings.
-
Paging Data with Different Cursor Types
This post is a follow up to a post I did last week: Paging Data with the SQL Server Drivers for PHP: Simplified. In that post, I showed how to leverage scrollable cursors to simplify code for paging data. However, my investigation used only one type of scrollable cursor: a static cursor. In this post, I’ll investigate the behavioral differences of paging data with a static cursor and the other two scrollable cursor types: keyset and dynamic cursors. I did write a high-level comparison of the different cursor types last year, but what I really want to focus on in this post are the practical differences between the different cursor types in the paging scenario.