AF-DesignWe put the customer's needs before the technology
News
Portfolio
Products
Services
Resources
Contact Us
ColdFusion:
 Components
Computer Primer:
 Bit/Byte/Kilobyte
 Download Calculator
Design Primer:
 Color Picker
Images:
 Free use images
JavaScript Primer:
 Forms
 Popup's
 Redirect Select
 UUID Class
PHP
 Graphing Tool
SQL Toolkit:
 Download/Info
 Documentation
 Changelog
 Demo
Just for fun:
 TV width & height

SQL Toolkit

The SQL Toolkit officially supports MySQL, Microsoft SQL Server and PostgreSQL database systems. Support for mSQL and ODBC have not been tested, but are implemented. If you are able to test either of these implementations, please contact me and let me know your findings.

Version 0.5 has been released. Minor bug fixes with XML import functionality are included.

If you would like to be notified of new releases as they come out, put your name on the mailing list.

Download the latest SQL Toolkit

SQL Toolkit sql_0.5.tar.gz (17K) 2003-03-22 view changelog
SQL Toolkit sql_0.4.tar.gz (17K) 2003-03-12
SQL Toolkit sql_0.3.tar.gz (16K) 2003-03-11
SQL Toolkit sql_0.2.tar.gz (13K) 2003-03-10

How you can help...
If you have access to Oracle, mSQL, Informix, MS SQL Server, MySQL, PostgreSQL, Sybase, Frontbase, Ovrimos SQL Server, Interbase or other PHP supported database platforms; please contact me with any testing results you are able to do!
Take a look at the code! See if you see something that could be improved and get back to me.

Example usage

1. Configure a datasource in datasource_config.php

	$datasource_mysql = new datasource(
		'MySQL', 		// MySQL, MSSQL, mSQL, ODBC or PostgreSQL depending on your server type
		'localhost',	// localhost, 127.0.0.1, db.host.com or if ODBC, the datasource name
		'',				// TCP/IP Port number to connect on can be blank
		'sqluser',		// username to access database as
		'mypassword',	// password for username
		'test'			// database to connect to
		);

2. Include the code in you page

	require("sql.php");

3a. Run a "quick" query which will handle all the open and closing of the database connections for you.

	$result = database_quick_query($datasource_mysql, "select * from test");

or

3b. Manage your own connections and run queries

	$connection = database_connect($datasource_pg);
	$result     = database_query($connection, "select * from test");
	database_close($connection);

4. Do something with the results

	database_result_dump($result);
or
	database_data_seek($result, 0);
	for($row; $row<database_num_rows($result); $i++){
		$this_row = database_fetch_assoc($result);
		print "<p>column 1: " . $this_row["your_column_name_1"] . 
			  " column 2: " . $this_row["your_column_name_2"] . "</p>"; 
	}

That's it!

So what is this really?

The PHP SQL Toolkit is an abstraction layer for common database platforms that are supported natively in PHP. Unlike most functionality in PHP, this doesn't get compiled in, rather uses 2 different class types to define a connection and a result set that are database independent. There is a third class which defines connection information about each server known as datasources.

After configuring your datasource_config.php file, you can use almost any SQL99 Core code. Currently there is no support for stored procedures because stored procedure code is highly dependent on the database platform. While support may be added in the future, it is not on the current development plan.

So what is next with SQL Toolkit? Support for all native php database systems API's. Next more functionality in result reporting and information. Lastly better system inter-connectivity with standards compliant export and import functionality for WDDX, XML and some type of RPC methods yet to be determined.

If you're interested in helping with this growing project, contact me and I will add you to the developer/supporter list. I could really use platform testers!


Copyright (C) 2000-2009, Erik Giberti (AF-Design), All rights reserved.

Program as used in this license may refer to entire software packages, code snippets and binary image or visual information.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

AF-Design, 1305 Karen Drive, West Dundee, IL, 60118 / Tel: 888-762-1056 / Fax: 888-845-8898
Copyright © 1998-2009 AF-Design, All rights reserved. Privacy / Contact Us