1 Reply Latest reply on Sep 4, 2019 10:52 AM by rareddy

    How to execute a virtual procedure from PHP?

    gadeyne.bram

      Hi,

       

      I'm trying to run a script enclosed within a BEGIN and END block from PHP. I'm using the pg_* functions to do this. I've also tried the odbc_* functions which result in the same error.

       

      pg_query for a normal query e.g. select 1 as a, 2 as b; works fine.

       

      Executing the following results in an error:

       

      BEGIN
      select 1 as a, 2 as b;
      END

       

      TEIID31100 Parsing error: Encountered "2 as b[*]" at line 2, column 21.\nWas expecting: "except" | "fetch" | "from" | "intersect" | "into" | "limit" | "offset" | "option" | "order" | "union" ...\nDETAIL:  org.teiid.jdbc.TeiidSQLException: TEIID31100 Parsing error: Encountered "2 as b[*]" at line 2, column 21.\nWas expecting: "except" | "fetch" | "from" | "intersect" | "into" | "limit" | "offset" | "option" | "order" | "union"

       

      I have a feeling that the pg_* functions actually do some kind of preprocessing and split the query on the semicolon sign. Does anyone know of any options to prevent this?

       

      My current connection string is

       

      $conn = pg_connect("host=servername port=35432 dbname=vdb.1.3.0 user=xxx password=xxx");