RE: SQL statement PREPARE does not work in ECPG - Mailing list pgsql-hackers

From Matsumura, Ryo
Subject RE: SQL statement PREPARE does not work in ECPG
Date
Msg-id 03040DFF97E6E54E88D3BFEE5F5480F74ABCB772@G01JPEXMBYT04
Whole thread Raw
In response to RE: SQL statement PREPARE does not work in ECPG  ("Matsumura, Ryo" <matsumura.ryo@jp.fujitsu.com>)
Responses Re: SQL statement PREPARE does not work in ECPG  (Michael Meskes <meskes@postgresql.org>)
List pgsql-hackers
Hi Meskes-san

There are two points.

(1)
I attach a new patch. Please review it.

  - Preproc replaces any prepared_name to "$0" and changes it to an input-variable
    for PREARE with typelist and EXECUTE with paramlist.
    $0 is replaced in ecpg_build_params().
    It's enable not to change ECPGdo interface.
  - Host variables can be used in paramlist of EXECUTE.

(2)
I found some bugs (two types). I didn't fix them and only avoid bison error.

Type1. Bugs or intentional unsupported features.
  - EXPLAIN EXECUTE
  - CREATE TABLE AS with using clause

  e.g.
    EXPLAIN EXECUTE st;  /* It has not been supported before.*/

     ExplainableStmt:
     ExecuteStmt
     {
  -     $$ = $1;
  +     $$ = $1.name;    /* only work arround for bison error */
     }

Type2. In multi-bytes encoding environment, a part of character of message is cut off.

  It may be very difficult to fix. I pretend I didn't see it for a while.

  [ecpglib/error.c]
    snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), "%s on line %d", message, line);
    sqlca->sqlerrm.sqlerrml = strlen(sqlca->sqlerrm.sqlerrmc);
    ecpg_log("raising sqlstate %.*s (sqlcode %ld): %s\n",
             (int) sizeof(sqlca->sqlstate), sqlca->sqlstate, sqlca->sqlcode, sqlca->sqlerrm.sqlerrmc);

Regards
Ryo Matsumura

Attachment

pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Typos and wording in jsonpath-exec.c
Next
From: Tomas Vondra
Date:
Subject: Re: accounting for memory used for BufFile during hash joins