 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Brian Swan's Blog: SQL Server Driver for PHP Connection Options Encrypt & Failover_Partner
by Chris Cornutt March 11, 2011 @ 08:41:11
Brian Swan has posted two more in his "SQL Server Driver for PHP" series looking at some of the connection options that are available. In these two new articles he looks at the Failover_Partner and Encrypt options.
Database mirroring is primarily a software solution for increasing database availability. [...] When a PHP application connects to the primary server, the Failover_Partner connection option specifies the name of the server to which the application should connect if the primary server is not available.
[...] These two options, Encrypt and TrustServerCertificate, are often used together. The Encrypt option is used to specify whether or not the connection to the server is encrypted (the default is false). The TrustServerCertificate option is used to indicate whether the certificate on the SQL Server instance should be trusted (the default is false).
In both there's code examples showing the connection strings and what kinds of parameters you can pass to them. He also gives a few examples of scenarios when they might be useful.
voice your opinion now!
connect sqlserver driver option failoverpartner encyrpt trustservercertificate
Brian Swan's Blog: SQL Server Driver for PHP Connection Options ReturnDatesAsStrings
by Chris Cornutt February 09, 2011 @ 08:45:28
Brian Swan has a new post to his blog today looking at one of the connection options for the SQL Server driver in PHP - the "ReturnDatesAsStrings" setting that can make handling date and time information simpler for PHP.
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.
He includes some sample code showing how to use the setting (as a part of the settings array passed in to sqlsrv_connect) and the resulting array key from the fetched results on his sample table. This just gives you one more option for handling dates in your SQL Server-based application, especially if you don't need the full DateTIme object's functionality.
voice your opinion now!
sqlserver driver connection option return date string datetime
Brian Swan's Blog: Paging Data with the SQL Server Drivers for PHP Simplified
by Chris Cornutt January 27, 2011 @ 12:54:56
Brian Swan has simplified the pagination using the SQL Server drivers for PHP in his latest post. He shows how to use a cursor to move around in the result set from your query.
An oversimplified definition of a database cursor might be this: A cursor is database functionality that allows you to point to a certain location within a result set and allows you to move forward (and sometimes backward, depending upon the cursor type) through the result set one row at a time. [...] In the paging [scenario], I'll use a static cursor since that cursor type would seem to satisfy the requirements of many web-based applications.
He shows how to execute a simple query with a dynamic cursor by specifying it in the connection call. He then uses the sqlsrv_num_rows to find the number of records returned and a sqlsrv_fetch_array call to pull just the page you need. He also includes some handy code to paginate the results, complete with links.
voice your opinion now!
sqlserver driver pagination numrows tutorial cursor
Brian Swan's Blog: Why Pass Parameters by Reference in the SQLSRV Driver?
by Chris Cornutt November 25, 2010 @ 09:15:22
Brian Swaan has a new post to his blog talking about why you, in your SQL Server-based application, pass the parameters in by reference.
Last week at JumpIn Camp we spent quite a bit of time focusing on the SQL Server Driver for PHP. As developers worked to build SQL Server support into their applications, they had lots of questions about how both the SQLSRV and PDO_SQLSRV drivers work under the hood. One of the questions that came up was "When using the SQLSRV driver to execute parameterized queries, why do I have to pass parameters by reference?"
He includes a simple code example to show this passing by reference - first without it on the call to sqlsrv_prepare (and the warning message it gives) then the more correct version of passing in the past parameter by reference.
The SQL Server Driver for PHP team understands that passing parameters by reference is not ideal. [...] With that said, the team is continuing to investigate solutions that would produce expected behavior without passing parameters by reference.
voice your opinion now!
parameter passbyreference sqlservprepare sqlsrv driver
|
Community Events
Don't see your event here? Let us know!
|