Convert from ADOdb Library to PDO

May 30th, 2008 § 0

In the past I used the ADOdb Database Abstraction Library for PHP for a lot of my PHP projects. However, PDO (PHP Data Objects) is now a better fit as it performs better for me and doesn’t require the inclusion of any libraries.

I wanted to make the switch not only for future projects, but also to go back into some of my existing projects that I maintain and covert from ADOdb to PDO. However, I didn’t want to alter thousands of calls to ADOdb methods.

The solution I came up with was to do some more work on my PDO Singleton Class. By adding in the ADOdb methods Execute(), qstr(), GetOne(), and an iterator for the adodb recordsets returned by Execute(), I was able to easily transition to PDO in projects with thousands of lines of code by including this class and creating a new instance of sdb() instead of NewADOConnection() and Connect().

$DB =& new sdb(”mysql:host=localhost;dbname=testdb”, ‘username’, ‘password’);

This is the equivalent of the following ADOdb code: (except it is a singleton)

$DB = NewADOConnection(’mysql’);
$DB->Connect(”localhost”, “username”, “password”, “testdb”);

You can now treat that $DB object just as you would with ADOdb to create a connection to the mysql database ‘testdb’. Note: I have not refactored the error or transaction functions as they were not used in the specific projects I needed this conversion in… but they would be very simple to add.

» Read the rest of this entry «

Groovy Http POST/GET Class

November 2nd, 2007 § 0

I was working on a project in and needed to do POST as well as read the response headers.

I was unable to find a suitable class or method for this in either Groovy or Java, so I wrote this class. It opens a socket to the requested host, and writes to the socket using getOutputStream() and PrintWriter(). It reads the response from the server using DataInputStream() and getInputStream().

» Read the rest of this entry «

PHP5 PDO Singleton Class

May 23rd, 2007 § 2

I use Zend Studio for Eclipse as my PHP IDE. The framework I am developing uses PHP PDO for the database abstraction, and rather than passing around a reference to my PDO instance I wanted to create a singleton.

At the same time, I wanted to take advantage of the helpful code completion and suggestion features of the Zend IDE. So I created a class that creates a PDO singleton object in a way that Zend Studio for Eclipse can still do code assistance.

PHP5 PDO Singleton Usage Example

$dbObj =& new sdb("mysql:host=localhost;dbname=testdb", 'username', 'password');

This create a connection to the mysql database ‘testdb’ and a new PDO instance. $dbOjb can be passed around by reference but using the sdb:: singleton is recommended as Zend will do code assist on this.

SOAP Plugin for Smarty

April 21st, 2007 § 0

This plugin for Smarty enables in-template access to SOAP services.

It requires the NuSOAP PHP class in your PHP include folder (ie: includes_path/nusoap/nusoap.php) or edit the path in the soap smarty plugin.

You may need to download the NuSOAP php class and place it in your PHP include path.

The smarty soap plugin function is shown after the fold.

Example SOAP Plugin Usage in Smarty Templates:

{soap assign=soapResponse
 endpoint=http://site.com/resource.soap
 call=resource..search
 var=(string)Test
 debug=true|false}

» Read the rest of this entry «

JSON Plugin for Smarty

April 20th, 2007 § 4

JSON Plugin for Smarty

This is a simple plugin for Smarty to retrieve and parse JSON data into an object in Smarty. Requires the PECL JSON.php class or PHP 5.2.0.

Instructions:

  1. If your PHP version is < 5.2.0 and save it to your include path if it is not already there. If your PHP version is >= 5.2.0, this class is not needed, we will use the native function.
  2. Download the JSON Smarty Plugin PHP Function File (shown after the fold) as function.json.php in your smarty\plugins\ directory.

JSON Plugin Usage in Smarty Templates Files:

{json
 url=http://site.com/data.json
 resource=result}

The $result variable now contains the parsed JSON data.

» Read the rest of this entry «

купить диплом техникума купить аттестат за 11 класс купить диплом техникума купить диплом университета купить диплом http://diplomy-originaly.com купить диплом фармацевта где купить диплом купить диплом нового образца купить диплом колледжа купить диплом о среднем образовании http://diplomsagroups.com купить диплом фармацевта купить диплом фармацевта https://gosznac-diploma.com/ купить диплом специалиста купить диплом фармацевта купить диплом с регистрацией купить диплом с занесением в реестр купить диплом в москве где купить диплом купить диплом техникума с занесением в реестр купить диплом о высшем образовании https://russian-diplom.com купить диплом с занесением в реестр реально купить диплом специалиста http://rudiplomirovanie.com купить диплом с занесен ем в реестр купить диплом института http://aurus-diploms.com купить диплом с реестром цена купить аттестат за 11 класс https://premiums-diploms.com купить диплом с занесением в реестр реально купить диплом автомеханика http://russdiplomiki.com купить диплом с реестром купить диплом автомеханика https://diplomansy.com купить диплом без реестра купить диплом о среднем образовании https://diploms-asx.com купить диплом с занесением в реестр цена купить диплом в москве https://diploms-asx.com купить диплом с занесением в реестр купить диплом фармацевта https://eonline-diploms.com купить настоящий диплом реестр купить диплом института купить диплом института купить диплом с реестром купить дипломы о высшем http://diplomrussian.com купить диплом с проводкой купить диплом университета купить диплом института купить диплом с занесением в реестр купить диплом о среднем специальном купить диплом в москве купить диплом техникума с занесением в реестр купить диплом института https://russiany-diploman.com/ купить диплом с занесением в реестр цена купить диплом кандидата наук купить диплом университета купить диплом техникума с занесением в реестр купить диплом врача https://rudiplomisty24.com/ купить диплом с реестром цена москва купить диплом фармацевта https://land-diplom.com/ купить диплом пту с занесением в реестр купить свидетельство о браке купить аттестат купить диплом с занесением в реестр купить аттестат за 11 класс https://diplomsy-landsy24.ru/ купить диплом высшем образовании занесением реестр купить диплом врача купить аттестат за 9 класс куплю диплом техникума реестр купить диплом института купить диплом о высшем образовании купить диплом с реестром цена купить диплом фармацевта купить диплом фармацевта купить медицинский диплом с занесением в реестр купить диплом о высшем образовании купить свидетельство о браке купить диплом с реестром цена купить диплом о высшем образовании http://aurus-diploms.com/kupit-diplom-farmacevta.html купить диплом с занесен ем в реестр купить диплом о среднем специальном купить диплом вуза с реестром купить диплом колледжа с занесением в реестр купить диплом автомеханика http://diploms-service.com/diplomy-po-gorodam/ufa купить диплом с реестром купить диплом о среднем образовании https://diploms-asx.com/ купить диплом техникума с занесением в реестр купить аттестат за 9 классhttps://russdiplomiki.com/kupit-diplom-v-ekaterinburge.html купить диплом врача с занесением в реестр купить диплом кандидата наук купить диплом училища где купить диплом с реестром купить свидетельство о браке купить диплом специалиста купить диплом с занесен ем в реестр купить диплом о высшем образовании https://ukrdiplom.com куплю диплом техникума реестр купить диплом врача купить диплом для иностранцев купить диплом с реестром цена москва купить аттестат за 11 классаттестат купить купить диплом медсестры с занесением в реестр купить диплом ссср https://diploms-goznak.com купить диплом с занесением в реестр цена