Quantcast

multiple commands in pdo prepared statement

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

multiple commands in pdo prepared statement

SunWuKung
I just started to move my application from my development environment to my test environment and I came across something unexpected.
My development environment is Windows/Apache/PHP - connected to an external Postgresql DB.
The application runs fine on that.

I moved to Linux/Apache/PHP and Postgresql and suddenly I get an error saying that I can't run multiple commants (Delete From xx Where yy; Insert Into xx;) in a single prepared statement. Its the same code, the same database. I would think that I either can or can not but it seems that PDO behaves differently on Windows then on Linux.

Does anybody have experience with this?
Thanks for the help.
SWK
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Zend_Form with table

Vince42
Hi,

I need to render data tables in my form with the layout

   +-------+-------+-------+
   | Label | Label | Label |
   +-------+-------+-------+
   | Value | Value | Value |
   +-------+-------+-------+

I tested all kinds of methods like rendering with

   - composite decorator
   - standard decorators
   - view script decorator
   - view script

but none of the solutions looks really nice - they are all cluttered
with too many lines of code - and I simply fear that I will be unable to
refactor / build new functionalities in a few weeks of time, when the
focus of development is somewhere else.

The best solution would be theoretically to generate all the form data
as XML and to build the whole form utilizing XSLT - but I neither want
to override all decorators and view facilities in order to produce the
whole site as XML, nor do I think that this is the way that ZF was
designed to work, thus I prefer to stick with what is there.

I also tried to use definition lists and to display them in table layout
using CSS, but that solution is also suboptimal - and eventually the
table environment is there for exactly this purpose, isn't it? :P

As the forms are parameter driven and the data is dynamically generated,
I also cannot specify forms for each purpose. And passing the parameters
to view scripts just shifts the problem from the form to the view script
code.

Stop yawning. :)

As I already spent two months on refactoring my whole form over and over
again, I really would like to hear your professional opinion on how to
implement a parameter and database driven form, which will render a
(theoretically) unlimited amount of form elements, where some of them
represent table data while sticking as much as possible to the design
ideas of ZF.

Thx a lot in advance!

--
Cheers,                        \\|//
Vince                          (o o)
----------------------------ooO-(_)-Ooo-------------------------
 '''   (o)_(o)                                        [ ][0][ ]
 ô¿ô   (=°o°=)   World Domination by Copy and Paste   [ ][ ][0]
  -    (")_(")                                        [0][0][0]

 ()  ascii ribbon campaign - against html e-mail
 /\  www.asciiribbon.org   - against proprietary attachments
                                   Ooo.
---------------------------.ooO----(  )-------------------------
                           (  )    (_/
                            \_)


signature.asc (202 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Zend_Form with table

Fullarton, Daniel
Hi Vince,

I wrote something similar to this for a project a few weeks ago, it wasn't
perfect but it got the job done.

+-------+-------+-------+
| Label | Label | Label |
+-------+-------+-------+
| Value | Value | Value |
+-------+-------+-------+
| Value | Value | Value |
+-------+-------+-------+
|New Row|
+-------+

Was the general layout, I chucked it up on pastebin for someone else.

Here's the element http://pastebin.com/m438d1001 and the decorator
http://pastebin.com/d840e740

I think there may have been a few bugfixes to the element as well but the
usage went something like this.

$form->addElement(new Acer_Form_Element_Flex('teachers',

    array(

        'elements' => array(

            $form->createElement('text', 'name', array('label' => 'Name',
'class' => 'inputbox', 'size' => 35)),
            $form->createElement('text', 'email', array('label' => 'Email',
'class' => 'inputbox', 'size' => 35,
                'validators' => array('EmailAddress')))

         ),

        'validators' => array(new Acer_Validate_Teachers())

   )

));

This results in  a teachers table with two columns, one for name and one for
email with an email address validator on the email column. Clicking on the
new row adds a new teacher row the form.

I don't think the code itself is ideal, it's a little messy in parts. But it
was a blast to write, and loosely based off a tutorial by Matthew Weier
O'Phinney

Thanks,
Daniel.

On 5/05/09 7:52 AM, "Vince42" <[hidden email]> wrote:

> Hi,
>
> I need to render data tables in my form with the layout
>
>    +-------+-------+-------+
>    | Label | Label | Label |
>    +-------+-------+-------+
>    | Value | Value | Value |
>    +-------+-------+-------+
>
> I tested all kinds of methods like rendering with
>
>    - composite decorator
>    - standard decorators
>    - view script decorator
>    - view script
>
> but none of the solutions looks really nice - they are all cluttered
> with too many lines of code - and I simply fear that I will be unable to
> refactor / build new functionalities in a few weeks of time, when the
> focus of development is somewhere else.
>
> The best solution would be theoretically to generate all the form data
> as XML and to build the whole form utilizing XSLT - but I neither want
> to override all decorators and view facilities in order to produce the
> whole site as XML, nor do I think that this is the way that ZF was
> designed to work, thus I prefer to stick with what is there.
>
> I also tried to use definition lists and to display them in table layout
> using CSS, but that solution is also suboptimal - and eventually the
> table environment is there for exactly this purpose, isn't it? :P
>
> As the forms are parameter driven and the data is dynamically generated,
> I also cannot specify forms for each purpose. And passing the parameters
> to view scripts just shifts the problem from the form to the view script
> code.
>
> Stop yawning. :)
>
> As I already spent two months on refactoring my whole form over and over
> again, I really would like to hear your professional opinion on how to
> implement a parameter and database driven form, which will render a
> (theoretically) unlimited amount of form elements, where some of them
> represent table data while sticking as much as possible to the design
> ideas of ZF.
>
> Thx a lot in advance!


------------------------------------------------
Please consider the environment before you print

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Zend_Form with table

Vince42
Hi Daniel,

Fullarton, Daniel schrieb:
> I wrote something similar to this for a project a few weeks ago, it
> wasn't perfect but it got the job done.

> Was the general layout, I chucked it up on pastebin for someone else.
>  Here's the element http://pastebin.com/m438d1001 and the decorator
> http://pastebin.com/d840e740

Thx a lot 4 sharing!

The second link seems to be dead - and although this approach doesn't
solve my problem, as I have to render also links and buttons in the
table itself, I really would like to see the decorator code - maybe it
will give me additional inspiration on how to approach this. :)

Still open and hoping for more input - especially on how to maybe even
realize a nice XML/XSLT based approach for this ...

--
Cheers,                        \\|//
Vince                          (o o)
----------------------------ooO-(_)-Ooo-------------------------
 '''   (o)_(o)                                        [ ][0][ ]
 ô¿ô   (=°o°=)   World Domination by Copy and Paste   [ ][ ][0]
  -    (")_(")                                        [0][0][0]

 ()  ascii ribbon campaign - against html e-mail
 /\  www.asciiribbon.org   - against proprietary attachments
                                   Ooo.
---------------------------.ooO----(  )-------------------------
                           (  )    (_/
                            \_)


signature.asc (202 bytes) Download Attachment
Loading...