Jump to content
MakeWebGames

PDO (PHP Data Objects)


Curt

Recommended Posts

I was introduced to PDO recently and it seems nice from what I have learned about it so far. I am curious about others opinions about it.

I noticed its built in with new PHP versions. Seems like a rather old function but I have never heard mention of it here.

I searched pdo and found nothing so I figured I'll make a thread.

Link to comment
Share on other sites

  • 2 months later...

If these prepared statements are getting stored on the serverside so they can be shared, that would make a difference of course.

Because than you would have better, re-usable and stable SQL code with a little bit of overhead.

But i just `generate` my php/sql code from the database.

So i know all the names, types, relations, constains, so i can use set theory and monads to do this stuff.

Persons::Insert(...,...,...)(); '()' <- Invoking the magic monad, that creates the whole thing. so i can pass it around leazy, and invoke it on a `foreach` itterator.

Like:

foreach(Model::Persons->Top(5000)->Page(2, 50)->OrderBy(Model::Person::FirstName, Model::Person::LastName)->Join(Model::Account)->Where(Model::Person->FirstName->Like("A*")) as $Person) {

[here the magic happens..] => object: Linq2PHPEntities->Invoke() = Record Itterator !

}

 

It's called 'Monads': http://en.wikipedia.org/wiki/Monad_(functional_programming)

So: File("longfile.txt")->Columns(";")->Column(2)->Average() => Not a result, it's a function chain that when invoked will result in a itterator with a list.

The whole things is a expression tree from a chain of functions. The only thing i need objects for is to tell the stupid php language what type, what it is.

So Max(Array(array(1,2,3,4), array(3,4,5,6))) => Array(4,6) so i can bind: WithResult->Column(2) => array(6) or with WithResult->Max() = 6.

That means: Yes, Model::Person->TelephoneNumber->Like("A*") wil make ZEND studio know this is wrong before even TRY to run a test on this.

Because it's not in my numbermonad, so even intelliscence when writing code know's it's a number and not text.

So it's totally type safe and i don't use STRINGS in my expression tree to build SQL.

That means: "Find Reference" gives me ALL the references of a object. He never can find them inside a SQL string.

So you don't know where "firstname,...... from persons....." is used, and your programming enviorment doesn't know.

When using types, you can ofcourse.

 

Happy Hacking: Roger.

 

Ps: Good video and extreemly hot babe:

Or a dull old man from Microsoft Research:

(The genius: Brian Backman) Edited by Lucifer.iix
Had to throw in the chick... could'n resist....
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...