Ulf Wendel

2008/03/06
by admin
Comments Off on PHP: Is PDO::FETCH_UNIQUE broken by design?

PHP: Is PDO::FETCH_UNIQUE broken by design?

Unimpressed by the ongoing PDO 2 debate, we have continued working on PDO/mysqlnd for MySQL. It turned out that the current status of PDO makes developing and testing a new driver a challenge. I spent quite a lot of time comparing the different behaviours of the various drivers in the hope I could find out how PDO drivers are supposed to work. The PDO documentation and the specification do not cover each and every detail. PDO really needs some love…

Why do people suggest to improve PDO before kicking-off a PDO 2 project?

The challenge of the day was to find out what PDO::FETCH_UNIQUE is about. All what the first page of the PDO manual tells you is, that is is a predefined (class) constant of the type INT. But luckily, there is more to learn about it on the manual page of PDOStatement->fetchAll():


[…]
array fetchAll ([ int $fetch_style [, int $column_index [, array $ctor_args ]]] )
[…]
To fetch only the unique values of a single column from the result set, bitwise-OR PDO::FETCH_COLUMN with PDO::FETCH_UNIQUE.
[…]

That’s one sentence. And according to Google this is pretty much it what you can find about it on php.net. Hold on, there are some test which give usage examples. However, you never know if a test covers all aspects of a feature. What about the comment-files (ext/pdo/pdo_stmt.c, …) you ask? Well, that’s no good documentation for the end user and you never know if the implementation is wrong as long as there is no description of what the code shall accomplish. Its a valid approach in software development to refine a feature as you go. But in the end you need one document which describes how things are supposed to work. And that document is not the .c file – in particular not, if you want third-parties to contribute.

Continue Reading →

2008/01/17
by admin
Comments Off on Zwangsbespaßung

Zwangsbespaßung

AKA MySQL Company Meeting. Im Land der Zwangsbespaßung.

2008/01/17
by admin
Comments Off on SOLD

SOLD

SOLD

We’re sorry, this item has been sold. Price: 2.300.000 USD.

I used to be enlightened by the LAMP now I’m enlighted by the SUN, scherzte der CEO meines Arbeitgebers vor Kurzem. Und er meinte es ernst. MySQL wurde von SUN aufgekauft. Welche Auswirkungen diese Änderung für mich haben wird ist unklar. Sicherlich werde ich durch den neuen Namen nicht angehalten werden zukünftig Sonnenbäder zu nehmen. Das wäre auch unsinnig, da ich hier den ganzen Tag lang mit Sunblocker auf der Haut rumlaufe. Die Tradition der Trinklieder und der begleitenden Getränke, die Tradition des singenden CEO scheint vorerst verloren. Dabei passte winterliches Lampenlicht doch seit jeher besser zu LAMPen als zur SUN.

Nach dem ersten Schock und dem Verlust des Gefühls für eine besondere Firma zu arbeiten, kommen die Fragen nach den praktischen Änderungen an die Sonne. “Freedom to work from anywhere” (99% Wahrscheinlichkeit: das bleibt) ist und war für viele Angestellte der Entwicklungsabteilung eine Errungenschaft, die schwerer wog als ein höherer Verdienst. Persönliche Freiräume, Flexibilität, für die US-Angestellten “unglaubliche” 25 Tage Urlaub pro Jahr und ein singender CEO sind Lebensumstände, die schwerer wiegen als ein unbegrenzter Kredit bei Pizza-Hut. Es dürfte das Beste für alle Beteiligten sein, Änderungen nur behutsam durchzuführen. Ob und welche Änderungen anstehen, wird die Zukunft zeigen. Vielleicht bringt die Zukunft ja Sozialleistungen und Fortbildungsangebote, die ein Unternehmen mit 400 Angestellten aufgrund seine Größe nicht bieten kann?

Die Alternative zum Aufkauf, ein Börsengang, hätte den Sprung ins eiskalte Wasser bedeutet. Ein Inhaberwechsel, eine freundliche oder feindliche Übernahme, eine Zerschlagung, alles wäre jederzeit denkbar gewesen. So ist die Katze aus dem Sack.

Muß ich jetzt Java lernen? Das wäre auf meine alten Tage eine zu große Änderung. Muß ich jetzt (wieder) Solaris machen? Ich kann es mir nicht vorstellen. Aber ls funktioniert doch überall gleich, oder – ich kenn mich da nicht aus! Ist jetzt Schluß mit PHP? Ich weiß nicht was die Zukunft bringen wird, aber MySQL wäre nicht MySQL ohne PHP und PHP wäre nicht PHP ohne MySQL. Wenn 2007 eines gezeigt hat, dann doch, daß viele Manager bei MySQL PHP einen breiteren Raum eingeräumt haben, obwohl es keine Technologie ist, deren Marktwert sich unmittelbar an Umsätzen ableiten lässt. Die Ausganglage könnte kaum besser sein für 2008. MySQL hat bald ein paar Tausend neue Mitarbeiter, die nur darauf warten (PHP-)Aufgaben zugewiesen zu bekommen! Warten wir es ab. Panik ist unangebracht.

Ich warte ja immer noch darauf, daß endlich einer die letzten Hemden von MySQL auf eBay verkauft… Ach halt, Panik ist ja unangebracht.

2008/01/04
by admin
Comments Off on Hopp Schwiiz!

Hopp Schwiiz!

Hopp Schwiiz! ruft die Schweizer Zuckerwirtschaft der Fußball-EM entgegen. Vielleicht nicht sehr originell aber doch ein gutes Motto für das Neue Jahr und die anstehende Europameisterschaft. Nach dem denkbar verhaltenen Start des Jahres in Genf, einer Stadt, die keinerlei Silvesterfeierlichkeiten zu kennen scheint, kann es nur noch turbulenter werden. Rückblickend war das letzte Jahr nach dem ersten Quartal beruflich so schleppend wie Silvesterfeierlichkeiten in Genf. Als unser Gastgeber am 2. Januar erstmal wieder mit einheimischen Arbeitskollegen in Kontakt kam gab es auch die Begründung für die Totenstille. Die Ureinwohner fliehen aus der Stadt in Richtung Chamonix….

Hopp Schwiiz!

So ähnlich sollte dann auch das Motto für 2008 ausfallen: Hopp und auf in die Partyzone. Unterwegs nur nicht von der Sonne blenden lassen.

Allen Lesern und Freunden ein Frohes Neues Jahr!

Genf am 31.12.2007

2007/12/28
by admin
Comments Off on PHP: Compiling mysqlnd with PHP 5.2/5.3/6.0

PHP: Compiling mysqlnd with PHP 5.2/5.3/6.0

A user comment made clear that we need to send out a quick status update on how to install / compile mysqlnd with PHP 5.2, 5.3 and 6.0 .

mysqlnd @ PHP 5.2.x

At the time of writing PHP 5.2 is the latest production version of PHP. The latest code release is 5.2.5. The MySQL native driver for PHP (mysqlnd) is still in (late, late) beta status. As 5.2.x is the stable tree and mysqlnd is beta, mysqlnd is not part of the PHP 5.2.x code tree. To run PHP 5.2.x with mysqlnd you need to patch PHP. For example, you need to copy over zend_ptr_stack.h and zend_ptr_stack.c from the 5.3 tree. If you omit that step you’ll get some error message about the files.

However, we won’t give detailed instructions for patching PHP 5.2.x because meanwhile there is also PHP 5.3 which contains mysqlnd. And using PHP 5.3 is simpler. If you really want to patch PHP 5.2.x, you might find the blog posting PHP: mysqlnd checked in to PHP 6 (HEAD) useful.

IMHO mysqlnd should not get checked in to PHP 5.2.x . mysqlnd is just too big for a stable, production branch. mysqlnd should and does aim at PHP 5.3 and PHP 6.0, the two development branches. Therefore we focus on PHP 5.3 and PHP 6.0 and I believe its OK not to push on PHP 5.2.x patch instructions. However, if you think that is wrong: I would not reject a blog comment with detailed patch instructions.

mysqlnd @ PHP 5.3

As of October 2007, mysqlnd is part of the PHP 5.3 branch. This makes compiling PHP with mysqlnd support easy.


cvs -d :pserver:cvsread@cvs.php.net:/repository checkout -r PHP_5_3 php5  
cd php5/
./buildconf --force
./configure --help | grep -i mysql
./configure --with-mysql=mysqlnd --with-mysqli=mysqlnd
make clean; make
sapi/cli/php -m | grep -i mysql

mysqlnd @ PHP 6.0

As of July 2007, mysqlnd is part of the PHP 6.0 branch. This makes compiling PHP with mysqlnd support easy.


cvs -d :pserver:cvsread@cvs.php.net:/repository checkout php6  
cd php6/
./buildconf --force
./configure --help | grep -i mysql
./configure --with-mysql=mysqlnd --with-mysqli=mysqlnd
make clean; make
sapi/cli/php -m | grep -i mysql

2007/12/21
by admin
Comments Off on PHP: ping mysqlnd.team

PHP: ping mysqlnd.team

PING mysqlnd.team (MySQL) - 56(84) bytes of data
64 bytes from mysqlnd.team - icmp_seq=1 ttl=3weeks time=1month


Yes, there are delays. But not for the reason that we are having any problems. We have been borrowed out to other teams recently. A short status report.

PONG from mysqlnd.team

Andrey could not resist and has continued researching on parallel and background query operation. Georg was not too happy about this. Not that Georg does not support the idea, no, but Andrey had some other urgent assignments. Well, Andrey sometimes works in sort of waves: do little for some time, hack like crazy on other days. Again, Miha Nedok from http://www.izklop.com/, our alpha-beta-everything-tester number one, has given Andrey’s code studies a test drive and he did not regret it. However, I haven’t tested anything myself. I cannot share any experiences not to speak of production ready code.

My QA efforts have slowed down. I’m thankful Anthony – AKA tony2001 – never hesitates to inform and remind people about test failures. Anthony Dovgal is just one of many active PHP contributors. Credits to all active PHP contributors. I started sketching first PDO tests for the upcoming PDO mysqlnd driver. Its not an easy task because not all PDO drivers behave consistently. Also there is a frightening low number of general PDO tests. Could be a goal for next year to fix that.

Georg continues to shelter us. He fights hard to protect our little PHP eco-system: PHP hardly generates direct and simple to measure revenues at MySQL. Sure, PHP and MySQL have grown up together and I hope we do right to keep the relationship with PHP folks in good shape, but how do you measure the benefit of, for example, this blog posting, if there is any at all? Balancing Community and commercial interests is difficult. If we do right, it never becomes your problem. One of Georg’s 2008 plans: make mysqlnd popular, make it very simple to install and a fun to use!

Don’t know how many of you have noted Johannes announcing his new job. I can’t resist to announce it again with an even greater delay. I was lucky in 2004 to get to know him when doing some consultancy work together, Andrey was thankful to get a really good sparring made and as usual Georg was the deal closer: we have won Johannes Schlüter to develop the PDO mysqlnd driver for us. Johannes is the Release Master for the PHP 5.3 series.

In the press…

We have two mysqlnd articles in print.

A bit early, but…

Merry Christmas and a Happy New Year!

2007/12/20
by admin
1 Comment

Von Shuttle-PCs und Artikeln

Mitten in der geruhsamen Adventszeit platzen die Rechner. Knack, und es rüht sich nichts mehr. Alle Lämpchen aus, Kiste tot. Aus dem Netzteil fallen mir kleine schwarze Plastikteile entgegen. Da hat sich irgendwas zerlegt. Und das einen Tag bevor ich einen neuen Firmen-PC bekommen. Eigentlich doch gut abgestimmt zumal ich Minuten vor dem Rechnertod noch die Homeverzeichnisse gesichert hatte. Fast. Denn ich rede hier nicht von einem PC sondern von zwei, eigentlich drei, naja vier Kisten an denen ich rumschrauben mußte. Tier Linux, wenn Du nicht noch einfacher zu bedienen wird, gibt es beim nächsten mal ein Schlachtfest und ich werde Vegetarier…

Einst…

In 2003/2004 habe ich drei Rechner angeschafft:

  • Compaq Notebook (warum gibt es keine echten Compaq mehr *seuftz*)
  • Shuttle SB75G2, P4 2.8Ghz, 1.5GB RAM, 2x160GB Platte
  • Shuttle SN95G5, Athlon 3000+, 1GB RAM, 2x160GB Platte

Das Compaq Evo N620c – Sam, bau mir das noch einmal mit aktueller Hardware und verbesserter Kühlung…

Der SN95G5 liegt grob zerteilt in der Fleischtheke. Er hatte einen schlechten Start und verbriet nach wenigen Monaten eine CPU – warum auch immer. Danach fielen wechselweise On-Board Ethernet und PCI-WLAN aus. Die Geräte wurden nicht mehr erkannt. Er starb vor einigen Tag. Schade: er war schnell genug und stets leiser als meine Notebooks.

Dem SB75G2 steht ein zweites Leben als Erstaustattung einen Fünftklässlers bevor. Er war nie richtig leise zu kriegen, trotz Lüfterumbauten. Dafür tat er bis zum Schluß. Mit neuer Grafikkarte ausgestattet darf er noch mal zeigen was er kann.

… heute

Drei Jahre später:

  • Crapovo Notebook – kein Kommentar
  • Shuttle SG33G5, Core2Duo E6750, 4GB, 2x250GB
  • Shuttle SN68G2, AND X2 5000+, 2GB, 2x160GB

Diesmal habe ich den schicken G5 und der altmodische G2 steht bei der Freundin. Wieder ist der Intel deutlich lauter, wenngleich leiser als der Vorgänger. Diesmal ist der G2 ein Fehlkauf. Die Onboard-Grafik des G2 hat nur einen Sub-D VGA Ausgang. Mist, Mist, Mist. Ich dachte ich spare 50 Euro für den mit HDMI ausgestatteten SN68PTG5 ein. Mir war nicht klar, daß kein HDMI auch kein DVI bedeutet. Dumme Idee. Die Signalqualität ist unter aller Sau. Naja, 30 Euro kostet eine passende Office-Grafikkarte. Aber für weitere 20 Euro hätte es ein hübscheres Gehäuse, ein etwas besseres Mainbord etc. gegeben.

Merkt man den Unterschied Athlon 3000+ / P4 2.8 vs. AM2 / Core2Duo? Ja. Drei Jahre sind und waren schon immer ein sinnvoller Zeitrahmen.

Artikel: Going native with mysqlnd

Aufmacher, Dezember Ausgabe vom php|architect – http://www.phparch.com/c/magazine/issue/63 .

2007/12/12
by admin
1 Comment

Von Festplatten und Artikeln

Wo ist der Spaß geblieben am ewigen diskutieren über die perfekte Hardware? Heutzutage will ich einfach nur irgendeine brauchbare Festplatte. Brauchbar bedeutet: 2,5”, PATA (UDMA-100), niedrige Betriebstemperatur, damit der Lüfter im betagten Compaq Evo N620C nicht andauernd läuft. Hätte ich nur nie angefangen eine passende Platte zu suchen, um bequem Windows und Linux parallel fahren zu können. Die Platten sind in der Reihenfolge ihrer Anschaffung aufgeführt – von Originalausstattung über Ostern 2007 bis heute.

  1. Hitachi HTS54106, 60 GB, 5.400 rpm – 44°C ohne Last, 52°C mit Last, 47°C 5 Minuten nach der Last
  2. Hitachi HTS72108, 80 GB, 7.200 rpm – 43°C ohne Last, 52°C mit Last, 48°C 5 Minuten nach der Last
  3. Samsung HM121HC, 120 GB, 5.400 rpm – 47°C ohne Last, 55°C mit Last, 55°C Minuten nach der Last.

bonnie++ sieht die Samsung um den Faktor 1.5 vor den beiden Hitachi-Modellen, die sich in den Burst-Raten fast nicht unterscheiden. Dafür ist die Samsung aber auch der allererste Online-Einkauf der vor der Rückgabe steht. chip.de listet das jüngst eingestellte Vorgängermodell HM120JC noch als besonders kühl. Pustekuchen. Warum sind Temperaturangaben aus der Praxis nur so schwer im Internet zu finden, wenn man nicht wie einst tagelang Daten vergleichen will? Die 80er bleibt im Notebook. Die 120er, hmm – per USB wird der Speed verloren gehen…

Zum Thema Artikel: im Entwickler-Magazin 1.2008 ist ein mysqlnd-Artikel von mir. Mir selbst gefällt der Text wesentlich besser als ein zweiter mysqlnd-Artikel, der bald im englischen php|architect erscheinen wird. Der Artikel im Entwickler-Magazin geht etwas mehr in die Tiefe. Diejenigen, die eher etwas suchen, was in die Breite geht, sind mit dem php|architect-Artikel besser bedient. Wie immer kann ich die Texte nicht zusätzlich zum Download anbieten. Allerdings juckt es mich schon lange mal Dojo auszuprobieren und von Blog und unbezahlten Zeitschritenartikeln auf andere Medien auszuweichen… Vielleicht kriege ich ja Weihnachten endlich mal die Kurve.

2007/11/19
by admin
12 Comments

PHP: parallel, background, asynchronous fetch

Given the very low number of issues reported to us, we can assume that the core features of mysqlnd have matured. Therefore, we spend some time discussing parallel, background and asynchronous fetch ideas for mysqlnd. All have been on our brainstorming list from the beginning but it was just too early to even discuss them before these days. None of the ideas is new in any way as a recent discussion on the PHP Internals list on parallel database queries has shown. However, people seem to expect different things from it and are not sure how to implement it. We trapped into this ourself when Andrey wrote a background fetch proof-of-concept patch recently. Back one step: what is this about, what do you want, please comment!

Continue Reading →

2007/11/09
by admin
Comments Off on PHP: a quick status update

PHP: a quick status update

We’ve not been blogging about mysqlnd for a while. Reason is that all of us are assigned to other more pressing tasks. What we managed to do is to write two print magazine articles on mysqlnd. One will be published in the english php|architect and one will be published in the german Entwickler-Magazin. Both magazines should have the articles in their next issues.

The very first internal PDO/mysqlnd code has undergone an internal review. We are still evaluating how to integrate mysqlnd with PDO. So far PDO/mysqlnd is nothing but an internal proof-of-concept study. I don’t even try to test or use it. I spend some time writing tests for PDO/MySQL and PDO in general. Again, my tests are not ready for publishing.

Originally, I had planned to blog about Persistent Connections early this week. As I was at it, I considered benchmarking MySQL Proxy (transparent, w/wo profiling, Keep-Alive) as well. Well, don’t plan to do such things if the main developers (Proxy – Jan, mysqlnd – Andrey) are on vacation and won’t be able to fix the annoyances you might encounter. The fact that you read these lines instead of a cool Persistent Connections article tells you that there are still some bugs… – bugs which all the new tests (blame myself) didn’t catch. Luckily, Andrey is back from vacation and he’s truly amazingly good at fixing bugs. And Jan is no difference from that. I’m optimistic that I can send out my blog posting early next week. Together which benchmark results that took one week to produce…