[PDO] Displaying output from prepare()?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gilles Ganault

    #1

    [PDO] Displaying output from prepare()?

    Hello

    I use the prepare/execute combo to generate SQL statements. Is it
    possible to actually see what PDO creates with prepare()?

    =======
    $sql = "INSERT INTO mytable (id, label) VALUES (NULL,?)";
    $insert = $dbh->prepare($sql );

    //Display SQL before running it

    $insert->execute(array( $argv[1]));
    =======

    Thank you.
  • Jerry Stuckle

    #2
    Re: [PDO] Displaying output from prepare()?

    Gilles Ganault wrote:
    Hello
    >
    I use the prepare/execute combo to generate SQL statements. Is it
    possible to actually see what PDO creates with prepare()?
    >
    =======
    $sql = "INSERT INTO mytable (id, label) VALUES (NULL,?)";
    $insert = $dbh->prepare($sql );
    >
    //Display SQL before running it
    >
    $insert->execute(array( $argv[1]));
    =======
    >
    Thank you.
    >
    Unfortunately not.

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Erwin Moller

      #3
      Re: [PDO] Displaying output from prepare()?


      Gilles Ganault schreef:
      Hello
      >
      I use the prepare/execute combo to generate SQL statements. Is it
      possible to actually see what PDO creates with prepare()?
      >
      =======
      $sql = "INSERT INTO mytable (id, label) VALUES (NULL,?)";
      $insert = $dbh->prepare($sql );
      >
      //Display SQL before running it
      >
      $insert->execute(array( $argv[1]));
      =======
      >
      Thank you.
      Hi Gilles,

      As far as I know: No.
      However, if you are on a bughunt, you can probably ask your database
      itself to log anything that is executed against it in a logfile.

      Regards,
      Erwin Moller

      --
      =============== =============
      Erwin Moller
      Now dropping all postings from googlegroups.
      Why? http://improve-usenet.org/
      =============== =============

      Comment

      • =?ISO-8859-1?Q?=22=C1lvaro_G=2E_Vicario=22?=

        #4
        Re: [PDO] Displaying output from prepare()?

        Gilles Ganault escribió:
        I use the prepare/execute combo to generate SQL statements. Is it
        possible to actually see what PDO creates with prepare()?
        I guess you want to see the SQL query with the value of your parameters,
        something like: INSERT INTO mytable (id, label) VALUES (NULL,'Foo Bar')

        I suppose these internals depend on the driver but I'd dare say that
        "INSERT INTO mytable (id, label) VALUES (NULL,?)" is what's actually
        sent to the database server, with the values being sent separately.

        --
        -- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
        -- Mi sitio sobre programación web: http://bits.demogracia.com
        -- Mi web de humor al baño María: http://www.demogracia.com
        --

        Comment

        • Gilles Ganault

          #5
          Re: [PDO] Displaying output from prepare()?

          On Tue, 07 Oct 2008 12:17:14 -0400, Jerry Stuckle
          <jstucklex@attg lobal.netwrote:
          >Unfortunatel y not.
          Too bad. Thanks guys.

          Comment

          • Michael Fesser

            #6
            Re: [PDO] Displaying output from prepare()?

            ..oO(Gilles Ganault)
            >I use the prepare/execute combo to generate SQL statements. Is it
            >possible to actually see what PDO creates with prepare()?
            See <news:em6a35-1r3.ln1@ophelia .g5n.co.uk>.

            Micha

            Comment

            Working...