33 * procedural language
44 *
55 * IDENTIFICATION
6- * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.140 2005/05/26 03:18:53 neilc Exp $
6+ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.141 2005/05/26 04:08:31 momjian Exp $
77 *
88 * This software is copyrighted by Jan Wieck - Hamburg.
99 *
@@ -180,7 +180,6 @@ static Datum exec_simple_cast_value(Datum value, Oid valtype,
180180static void exec_init_tuple_store (PLpgSQL_execstate * estate );
181181static bool compatible_tupdesc (TupleDesc td1 , TupleDesc td2 );
182182static void exec_set_found (PLpgSQL_execstate * estate , bool state );
183- static char * unpack_sql_state (int ssval );
184183
185184
186185/* ----------
@@ -748,20 +747,6 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block)
748747 int i ;
749748 int n ;
750749
751-
752- /* setup SQLSTATE and SQLERRM */
753- PLpgSQL_var * var ;
754-
755- var = (PLpgSQL_var * ) (estate -> datums [block -> sqlstate_varno ]);
756- var -> isnull = false;
757- var -> freeval = true;
758- var -> value = DirectFunctionCall1 (textin , CStringGetDatum ("00000" ));
759-
760- var = (PLpgSQL_var * ) (estate -> datums [block -> sqlerrm_varno ]);
761- var -> isnull = false;
762- var -> freeval = true;
763- var -> value = DirectFunctionCall1 (textin , CStringGetDatum ("Successful completion" ));
764-
765750 /*
766751 * First initialize all variables declared in this block
767752 */
@@ -777,7 +762,7 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block)
777762
778763 if (var -> freeval )
779764 {
780- pfree (DatumGetPointer (var -> value ));
765+ pfree (( void * ) (var -> value ));
781766 var -> freeval = false;
782767 }
783768
@@ -870,15 +855,6 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block)
870855 RollbackAndReleaseCurrentSubTransaction ();
871856 MemoryContextSwitchTo (oldcontext );
872857 CurrentResourceOwner = oldowner ;
873-
874- /* set SQLSTATE and SQLERRM variables */
875- var = (PLpgSQL_var * ) (estate -> datums [block -> sqlstate_varno ]);
876- pfree (DatumGetPointer (var -> value ));
877- var -> value = DirectFunctionCall1 (textin , CStringGetDatum (unpack_sql_state (edata -> sqlerrcode )));
878-
879- var = (PLpgSQL_var * ) (estate -> datums [block -> sqlerrm_varno ]);
880- pfree (DatumGetPointer (var -> value ));
881- var -> value = DirectFunctionCall1 (textin , CStringGetDatum (edata -> message ));
882858
883859 /*
884860 * If AtEOSubXact_SPI() popped any SPI context of the subxact,
@@ -943,26 +919,6 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block)
943919 return PLPGSQL_RC_OK ;
944920}
945921
946- /*
947- * unpack MAKE_SQLSTATE code
948- * This code is copied from backend/utils/error/elog.c.
949- */
950- static char *
951- unpack_sql_state (int ssval )
952- {
953- static char tbuf [12 ];
954- int i ;
955-
956- for (i = 0 ; i < 5 ; i ++ )
957- {
958- tbuf [i ] = PGUNSIXBIT (ssval );
959- ssval >>= 6 ;
960- }
961- tbuf [i ] = '\0' ;
962- return tbuf ;
963- }
964-
965-
966922
967923/* ----------
968924 * exec_stmts Iterate over a list of statements
0 commit comments