stargeek
PHP news website logo.
home    PHP scripts    articles    seo tools    links    search    contact    shop    realtors


Pulling Logic Out of PHP and Onto the Database Server







Pulling Logic Out of PHP and Onto the
Database Server

Pulling Logic Out of PHP and Onto the
Database Server
01/07/2003 02:46 PM

Pulling Logic Out of PHP and Onto the Database Server For a lot of us who haven't ever worked with databases other than MySQL, we're not really used to putting our database logic onto the database server. This a really good article, both the author of SourceForge, on implementing server side database logic (in Postgres) and illustrating triggers, advanced SQL, etc. Recommended! As my programming skills have improved over the years, I find myself demanding more precise and guaranteed control over my data. Simply inserting into the database and hoping for the best is not good enough anymore. Using transactions and foreign keys are good first steps in ensuring data integrity, but with some of the more advanced databases, you can go further still and move programming logic into the database itself, stripping it from your PHP code. I recently picked up development of GForge, an open source software development/project management tool. Part of what I wanted to do was create a first-class "Project Manager", similar to MS Project or similar tools which do Gantt charting, and I wanted to do it with PHP using a web interface. In Gantt charting, you have a series of tasks, which can be constrained by prior tasks, as in the example below. Task B is dependent on the completion of Task A, and Task C is dependent on Task B. That sounds easy enough, but what if a user attempts to enter a start date on Task B that is earlier than the end date of Task A? At the time you insert Task B, or update its entry in the database, you could have PHP logic that queries the database and checks the end date of task A. That's a couple lines of PHP. But what if you need to delay Task A by a week? Now you need a recursive function in PHP which will go all the way down the line and delay Task B and then Task C by the proper amount and commit all the changes to the db. Suddenly, you are looking at a lot of queries and recursion in PHP and you've got a performance problem, especially if you have a high-traffic web application. [_Go_]




This is a GrokNews Entry: (what is grok?)





Similar Items

Pulling Logic Out of PHP and Onto the Database Server

Grok Headline matches for Pulling Logic Out of PHP and Onto the Database Server

Moving Logic Into the Database


Moving Logic Into the Database 01/03/2003 09:54 AM
As my programming skills have improved over the years, I find myself demanding more precise and guaranteed control over my data. Simply inserting into the database and hoping for the best is not good enough anymore. Using transactions and foreign keys are good first steps in ensuring data integrity, but with some of the more advanced databases, you can go further still and move programming logic into the database itself, stripping it from your PHP code. - Tim Purdue

I agree absolutely with Tim. In my work, we tend to push all the data intensive work to the RDBMS (Oracle in our case) in the form of stored procedures too. The tight coupling of stored procedures with the database means that stored procedure data processing is sometimes over 10 times faster compared to PHP with oci8.

"btn" By the way ADOdb 2.91 is out. ADOdb is a popular database abstraction library for PHP that runs on many databases including oracle, sybase, mysql, postgresql, mssql, interbase, access, vfp, informix, db2, odbc etc.

Changes:

- For PostgreSQL, we now autodecode blobs if bytea type is used.
- Better support for ODBC and ADO wide character fields. We now allow you to set the ADO code page (see changelog), and halve maxlength if wide char is detected.
- New FetchObj() and FetchObjNext() that does not upper-case field names.
- Misc speedups for postgresql and odbc drivers.

"zeldman.57"

Apple takes pre-orders for Logic, Logic
Express 7.1 (MacCentral)


Apple takes pre-orders for Logic, Logic
Express 7.1 (MacCentral)
04/06/2005 03:47 PM
MacCentral - Apple is now taking pre-orders for the next major update to the company's professional grade music applications, Logic and Logic Express. The update, which brings both applications to version 7.1, will ship on DVD and will cost US$19.95.

News: Apple takes pre-orders for Logic,
Logic Express 7.1


News: Apple takes pre-orders for Logic,
Logic Express 7.1
04/06/2005 03:15 PM
Apple is now taking pre-orders for the next major update to the companies professional grade music applications, Logic and Logic Express. The update, which brings both applications to version 7.1, will ship on DVD and will cost US$19.95.

Hey now, you're rock star! Apple
releases Logic Pro 6 and Logic Express 6


Hey now, you're rock star! Apple
releases Logic Pro 6 and Logic Express 6
01/16/2004 10:58 AM
Apple announced Logic Pro 6 for professional in pro audio while providing Logic Express 6 for amateurs.

Like Pixels? Check out MacDesign

NAMM: Apple introduces Logic Pro 6,
Logic Express 6


NAMM: Apple introduces Logic Pro 6,
Logic Express 6
01/16/2004 10:58 AM
At this week's NAMM show in Anaheim, Calif., Apple announced that it's streamlining its pro audio production software line with Logic Pro 6. It's also introducing Logic Express 6, aimed at students and educators. To find out more about this and a related announcement about new technology coming to new versions of Logic Pro, MacCentral spoke with Apple's vice president of Applications Marketing Rob Schoeben and senior director of pro applications, product marketing, Richard Kerris.

Apple offers Logic, Logic Express 7.1
pre-order


Apple offers Logic, Logic Express 7.1
pre-order
04/06/2005 03:51 PM
Apple is now taking pre-orders for Logic 7.1 and Logic Express 7.1, the next versions of the company's powerful music creation applications...

Apple announces Logic Pro 6, Logic
Express 6


Apple announces Logic Pro 6, Logic
Express 6
01/16/2004 11:33 AM
Apple today announced Logic Pro 6 for professional musicians and Logic Express 6 for students and educators...

Apple Launches Logic Pro 6, Logic Pro
Express


Apple Launches Logic Pro 6, Logic Pro
Express
01/16/2004 11:04 AM
Logic Pro 6 consolidates 12 pre-existing, groundbreaking products into one comprehensive package. (MacNN via MyAppleMenu)

Logic Pro 7, Logic Express 7, and Jam
Packs Released


Logic Pro 7, Logic Express 7, and Jam
Packs Released
10/07/2004 04:11 PM

Apple Announces Logic Pro 6, Logic
Express


Apple Announces Logic Pro 6, Logic
Express
01/16/2004 11:03 AM

SQL Server Database Objects


SQL Server Database Objects 06/23/2004 04:24 AM

PostgreSQL Database Server


PostgreSQL Database Server 11/19/2003 02:44 AM
PostgreSQL 7.4 Now Available For Download

Server/Database Engineer at Six Apart


Server/Database Engineer at Six Apart 01/28/2004 04:35 AM
Six Apart - United States, CA, San Mateo (2004-01-27)

Server CE Database Development with .NET


Server CE Database Development with .NET 12/17/2003 11:55 AM
William Ryan writes "SQL Server CE is Microsoft's preferred database backend for its Compact Framework initiative. Compact Framework is a cool technology, but ...

Copying An SMS Database From One Server
To Another


Copying An SMS Database From One Server
To Another
09/24/2004 05:54 PM

Firebird Database Server


Firebird Database Server 06/13/2004 10:32 AM

Beyond Proprietary Databases: Helen Borrie on the Future of Firebird: Here's an interesting interview with one of the people behind Firebird, an emerging open-source, multi-platform database server.

It's a fork of a mature commercial database called InterBase. InterBase is an enterprise-level database — Firebird is the same, but better. You'll find Firebird behind a number of Web sites, storing records for telecom companies and managing data for point-of-sales systems — just about anywhere you might find Oracle or [Microsoft] SQL Server.

Firebird, you may remember, was the reason that the Mozilla browser project had to change its name to Firefox.

Click here to comment on this entry


Oracle Database 10g Available for Mac OS
X Server


Oracle Database 10g Available for Mac OS
X Server
12/24/2004 12:21 PM
Now certified on Mac OS X Server, Oracle Database 10g is the first database designed for grid computing and it offers a cost-effective way to manage enterprise information. Pairing it with Apple’s powerful server hardware and software, customers get a robust, scalable database platform that’s easy and affordable to deploy and maintain. [Dec 23]

Logic Pro 6, Logic Express 6 Announced


Logic Pro 6, Logic Express 6 Announced 01/16/2004 11:33 AM
Apple has announced Logic Pro 6 for professionals and Logic Express 6 for students and educators. Logic Pro combines 12 separate audio tools into one comprehensive package for audio professionals. Logic Express provides a more basic set of tools and capabilities. Logic Pro 6 will retail for $999, while Logic Express 6 will retail for $299. Both packages will be available in March.

Logic Pro 6, Logic Express and
Soundtrack 1.2


Logic Pro 6, Logic Express and
Soundtrack 1.2
01/16/2004 01:05 PM
Apple announced updates to their audio applications today: Logic Pro 6 - Logic Pro 6 consolidates 12 pre-existing, groundbreaking products into one...

MySQL Database Server 4.1.1 (Alpha
(4.1.x))


MySQL Database Server 4.1.1 (Alpha
(4.1.x))
12/04/2003 02:29 PM
A fast SQL database server.

MySQL Database Server 4.0.18 (Production
(4.0.x))


MySQL Database Server 4.0.18 (Production
(4.0.x))
02/13/2004 12:09 PM
A fast SQL database server.

Configuring SMS Database Server Memory


Configuring SMS Database Server Memory 09/03/2004 04:25 PM

SQL Server Scripts for Database
Maintenance


SQL Server Scripts for Database
Maintenance
05/19/2004 12:02 AM

MySQL Database Server 4.0.20 (Production
(4.0.x))


MySQL Database Server 4.0.20 (Production
(4.0.x))
05/19/2004 04:27 AM
A fast SQL database server.

MySQL Database Server 5.0.0 (Development
(5.0.x))


MySQL Database Server 5.0.0 (Development
(5.0.x))
12/24/2003 09:21 PM
A fast SQL database server.

Microsoft beefs up SQL Server database


Microsoft beefs up SQL Server database 04/04/2005 04:38 AM
Microsoft last week shared details about the business intelligence features it is adding to the forthcoming SQL Server 2005 database, code-named Yukon.

MySQL Database Server 4.1.4 (Gamma
(4.1.x))


MySQL Database Server 4.1.4 (Gamma
(4.1.x))
08/31/2004 09:34 AM
A fast SQL database server.

MySQL Database Server 4.0.17 (Production
(4.0.x))


MySQL Database Server 4.0.17 (Production
(4.0.x))
12/17/2003 06:09 PM
A fast SQL database server.

MySQL Database Server 4.1.3 (Alpha
(4.1.x))


MySQL Database Server 4.1.3 (Alpha
(4.1.x))
07/02/2004 06:24 PM
A fast SQL database server.

Firebird Database Server Penetration


Firebird Database Server Penetration 03/30/2005 03:30 PM

'Most important ever' MySQL reaches beta: I found this stat in this article about MySQL 5.0, and I'm amazed by it:

[MySQL] accounted for 40 percent of open source database deployments, while Firebird and PostgreSQL accounted for 39 percent and 11 percent of deployments respectively.

Firebird has a 39% share of open-source database deployments? One percent behind MySQL? That's amazing, as I thought it was still a hidden gem.

We've talked about Firebird here and here. Great database platform, by all appearances. I'm moving an enterprise system I built off of SQL Server, and I made the decision to put it on Firebird, so know that you'll be hearing much more about it in the coming months.


MySQL Database Server 4.0.2 (Alpha)
released


MySQL Database Server 4.0.2 (Alpha)
released
07/11/2002 05:29 PM
MySQL is a widely used and fast SQL database server. It is a client/server implementation that consists of a server daemon (mysqld) and many different client programs/libraries.

Casino Hits Database Jackpot With SQL
Server


Casino Hits Database Jackpot With SQL
Server
05/31/2004 10:05 AM
Integrated BI makes SQL Server a winner for the Borgata.

An Overview of SQL Server "Yukon" for
the Database Developer


An Overview of SQL Server "Yukon" for
the Database Developer
10/31/2003 12:37 AM
With the advent of the next version of Microsoft SQL Server code named "Yukon" the world of database development is changing. Developers now have the option of locating their code appropriate to its functionality, accessing data in native formats, like XML, and building complex systems driven by the power of the database server. Also, database development is becoming more integrated than ever with all the tools that developers need presented at their fingertips.

Using The SQL Server Web Assistant To
Publish SMS Database Information


Using The SQL Server Web Assistant To
Publish SMS Database Information
01/04/2004 09:31 PM

An Overview of SQL Server 2005 for the
Database Developer


An Overview of SQL Server 2005 for the
Database Developer
08/03/2004 12:31 AM
With the release of Microsoft SQL Server 2005 Beta 2, the world of database development is changing. As a database developer, you now have the option to appropriately locate your code in relation to its functionality, to access data in native formats such as XML, and to build complex systems that are driven by the power of the database server. Database development is becoming more integrated than ever before, and all of the tools that you need are available right at your fingertips. This paper discusses some of the new features of SQL Server 2005 that will enable you to build a new class of database application.

Moving Your Access 2002 Database to SQL
Server


Moving Your Access 2002 Database to SQL
Server
12/22/2004 01:48 AM
Microsoft Access developers generally consider a move to SQL Server for performance, security, and stability reasons. This process is known as upsizing, and developers will find a number of key differences while migrating from Access to SQL Server. It is crucial that these differences are noted and appropriate action is taken to ensure a seamless and incident-free migration from Access to SQL Server.

Dell, Oracle offer server-database
bundle


Dell, Oracle offer server-database
bundle
09/21/2004 05:01 PM
Pursuing enterprise departments and smaller businesses, Oracle and Dell Computer are offering a package featuring a Dell PowerEdge server bundled with the Oracle Database10g Standard Edition One database and the Microsoft Windows Server 2003 operating system.

Microsoft Targets New Database
Developers with SQL Server Express


Microsoft Targets New Database
Developers with SQL Server Express
06/29/2004 05:28 PM
SQL Server 2005 Express Edition will replace Microsoft SQL Server Desktop Engine as the software maker's lightweight database offering of choice.

Generate Unique Notification Server
Database Records


Generate Unique Notification Server
Database Records
06/24/2004 04:40 AM

Grok Description matches for Pulling Logic Out of PHP and Onto the Database Server
GrokA matches for Pulling Logic Out of PHP and Onto the Database Server

Pulling Logic Out of PHP and Onto the Database Server

The following phrases have been identified by the grok system as matching this entry:

















Also check out:


Grok

Ipod Porn on the
Rise

Brief Abstract of
Wikipedia's
Mesothelioma Cancer
page

Get first aid
instructions in your
cell phone

IE is crap
JSPWiki gains
podcasting support

Tiki 1.5 -Regulus-
RC1 released

PHPortal version
0.2.7 released!

You pay peanuts, you
get postgresql
consultants?

Getting Intimate
With PHP's Mail()
Function

A first look at
JavaServer Faces,
Part 1

Artificial Link
Popularity

What Do You Call
Yourself?

What To Do With a
Shut Down Request?

Could Google Make it
Under a Subscription
Model?

High Cost, Low
Profit

Build Accessible
Online Forms

PHP Class 'Date
operations' released

Top Two Google
Ranking Factors

Ask Jeeves Goes
Bannerless

Open Source Blog
Free Issue of PHP
Architect

Hibernate 1.2.2
released

Usermanager 0.60
released

When PHPBB Won't
Work

Simple Localization
with PHP

Review HTML and
XHTML, The
Definitive Guide

Less blog, more book
Best RSS Parser Yet
The Free Issue of
PHP Architect is out

Preventing AdWords
Click Through Blues

PHP Class 'crumb'
released

JGraph Valencia
(v1.0.7) released

WebMacro 1.1final
released

upgrade (Upgrade
notices, pro and
con)

ipro (Alternative
photo resource)

weekend2 (5 January
2003)

Read Me! (3bd8)
More RSS Fun
Read Me! (1c93)
Read Me! (51b1)
Read Me! (a9b2)
Measuring
Programming Language
Popularity Again

PHP: Less Popular
than ADA ?????

How to Publish
Recipes Online

BlogBack: More On
User Agents

Advanced JavaScript
functions

Printing in Web
Start

Beautiful lawyer
needs help...

K-Mart
My DVD List
UK's Which?
Webtrader Closing

PHP Class 'innodb'
released

Ugh
winston (Today in
Chinese history)

return (4–5
January 2003)

what is grok?