Posts RSS Comments RSS

La ce-i bun “VCL 4 PHP”

delphi for php
Uite de ce am eu incredere in CodeGear si in Delphi for PHP. Am vazut in prima versiune din Delphi for PHP (D4PHP) integrate componente reprezentate vizual care le pui cu mouseul pe pagina: butoane, combobox-uri, calendare, ba chiar cate un wrapper la Google Maps sau phpBB. Dar daca am putea sa folosim functionalitati din framework-urile noastre preferate, gata de a fi instantiate din doua trei clickuri? Unul din principalele scopuri pentru care e dezvoltata libraria “VCL 4 PHP” (libraria folosita de Delphi for PHP) e de a putea integra rapid si usor cod “third-party” (scris de altii) si a folosi o reprezentare vizuala acestuia, incat sa fie usor de manevrat si inclus in proiect.
Programatorii de la Qadram (cei care au scris libraria) s-au apucat deja de integrat cateva functionalitati din Zend Framework. Ideea e ca acestia le vor folosi doar ca exemple iar cei care folosesc D4PHP vor putea sa “wrap”-eze ce cod vor ei.
Undeva in prima parte a anului curent se anunta lansarea D4PHP v.2 si am auzit ca va demonstra adevarata lui valoare. Asa sa le-ajute Domnu’ (sau the Invisible Pink Unicorn, indiferent).

Delphi for PHP - INSERT with QUERY

If you don’t know very well the VCL for PHP and you try to insert a new record using a Query component, you will likely get this error:
Application raised an exception class ADODB_Exception with message ‘mysql error: [1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘LIMIT 0,10′ at line …
A workaround for this is to disable the LIMIT command at runtime or design-time by setting LimitStart and LimitCount to ‘-1′;
An example how to disable this at runtime:

$query = “INSERT INTO table (field1,field2) VALUES(’” . $value1 . “‘,’” . value2 . “‘)”;

$this->Query1->close();
$this->Query1->LimitStart = ‘-1′;
$this->Query1->LimitCount = ‘-1′;
$this->Query1->SQL = $query;
$this->Query1->open();

I got this solution after studying the ECommerce sample project.

Delphi for PHP - I just got an extra day trial licence :)

Two weeks ago, I bought Delphi for PHP. I waited impatiently for the release in 22 march. The release was delayed about one week, but that wasn’t very important. I contacted the reseller to mail me the serial key and license file for the product, but they don’t have it yet. They suggested to download the trial version and use that until I get the mail I asked for. No problem. I went to the download page and I was shocked. 1 day trial? WTF am I gonna do with that? I hoped it was a mistake, a joke. I’ve downloaded (Downloads (keys where required)) it and installed it. I played with it for a while, but not very much because I had other things to do. Next day evening, I’ve opened it again, I’ve put some stuff on a form (text boxes, buttons etc) and suddenly it stopped responding. I thought it has a bug, or something. I closed it, opened it again and I found out that the license had expired (1 day of trial expired :( ). I searched on google how to extend this at least until I get the license from the reseller I bought Delphi for PHP from. I found nothing. I even searched cracks and keygen’s (naughty me :D;). Nothing yet. I was very impatient to get it work because I saw there some cool samples to play with (Web Services, eCommerce). My final solution was to try desperately something very simple that only a noob will think of: get another trial license from codegear. I went to Delphi for php download page, applied for another licence at Keys Only (If you have a CD) link, and got one. It works (2 hours now :D;). I used the same account I got first one from. Is CodeGear aware of this? (if not, shh, don’t tell them yet). I hope this trick will work for others, not only for me.
So, a short recap:
Go to Delphi for php download page.
If you haven’t already got Delphi for php, get the product from Downloads (keys where required).
After one day of trial expired, go to the same page, get a new license from Keys Only (If you have a CD), and you will get another day of testing.
Maybe tomorrow I’ll be able to get a new extra trial day somehow. A new one each day at least until I’ll get the license I payed for :)!