@@ -62,8 +62,8 @@ static bool do_edit(const char *filename_arg, PQExpBuffer query_buf,
62
62
static bool do_connect (char * dbname , char * user , char * host , char * port );
63
63
static bool do_shell (const char * command );
64
64
static bool do_watch (PQExpBuffer query_buf , long sleep );
65
- static bool lookup_function_oid (PGconn * conn , const char * desc , Oid * foid );
66
- static bool get_create_function_cmd (PGconn * conn , Oid oid , PQExpBuffer buf );
65
+ static bool lookup_function_oid (const char * desc , Oid * foid );
66
+ static bool get_create_function_cmd (Oid oid , PQExpBuffer buf );
67
67
static int strip_lineno_from_funcdesc (char * func );
68
68
static void minimal_error_message (PGresult * res );
69
69
@@ -611,12 +611,12 @@ exec_command(const char *cmd,
611
611
"AS $function$\n"
612
612
"\n$function$\n" );
613
613
}
614
- else if (!lookup_function_oid (pset . db , func , & foid ))
614
+ else if (!lookup_function_oid (func , & foid ))
615
615
{
616
616
/* error already reported */
617
617
status = PSQL_CMD_ERROR ;
618
618
}
619
- else if (!get_create_function_cmd (pset . db , foid , query_buf ))
619
+ else if (!get_create_function_cmd (foid , query_buf ))
620
620
{
621
621
/* error already reported */
622
622
status = PSQL_CMD_ERROR ;
@@ -1215,12 +1215,12 @@ exec_command(const char *cmd,
1215
1215
psql_error ("function name is required\n" );
1216
1216
status = PSQL_CMD_ERROR ;
1217
1217
}
1218
- else if (!lookup_function_oid (pset . db , func , & foid ))
1218
+ else if (!lookup_function_oid (func , & foid ))
1219
1219
{
1220
1220
/* error already reported */
1221
1221
status = PSQL_CMD_ERROR ;
1222
1222
}
1223
- else if (!get_create_function_cmd (pset . db , foid , func_buf ))
1223
+ else if (!get_create_function_cmd (foid , func_buf ))
1224
1224
{
1225
1225
/* error already reported */
1226
1226
status = PSQL_CMD_ERROR ;
@@ -2934,19 +2934,19 @@ do_watch(PQExpBuffer query_buf, long sleep)
2934
2934
* unfortunately it can be hard to tell the difference.
2935
2935
*/
2936
2936
static bool
2937
- lookup_function_oid (PGconn * conn , const char * desc , Oid * foid )
2937
+ lookup_function_oid (const char * desc , Oid * foid )
2938
2938
{
2939
2939
bool result = true;
2940
2940
PQExpBuffer query ;
2941
2941
PGresult * res ;
2942
2942
2943
2943
query = createPQExpBuffer ();
2944
2944
appendPQExpBufferStr (query , "SELECT " );
2945
- appendStringLiteralConn (query , desc , conn );
2945
+ appendStringLiteralConn (query , desc , pset . db );
2946
2946
appendPQExpBuffer (query , "::pg_catalog.%s::pg_catalog.oid" ,
2947
2947
strchr (desc , '(' ) ? "regprocedure" : "regproc" );
2948
2948
2949
- res = PQexec ( conn , query -> data );
2949
+ res = PSQLexec ( query -> data );
2950
2950
if (PQresultStatus (res ) == PGRES_TUPLES_OK && PQntuples (res ) == 1 )
2951
2951
* foid = atooid (PQgetvalue (res , 0 , 0 ));
2952
2952
else
@@ -2966,7 +2966,7 @@ lookup_function_oid(PGconn *conn, const char *desc, Oid *foid)
2966
2966
* function with the given OID. If successful, the result is stored in buf.
2967
2967
*/
2968
2968
static bool
2969
- get_create_function_cmd (PGconn * conn , Oid oid , PQExpBuffer buf )
2969
+ get_create_function_cmd (Oid oid , PQExpBuffer buf )
2970
2970
{
2971
2971
bool result = true;
2972
2972
PQExpBuffer query ;
@@ -2975,7 +2975,7 @@ get_create_function_cmd(PGconn *conn, Oid oid, PQExpBuffer buf)
2975
2975
query = createPQExpBuffer ();
2976
2976
printfPQExpBuffer (query , "SELECT pg_catalog.pg_get_functiondef(%u)" , oid );
2977
2977
2978
- res = PQexec ( conn , query -> data );
2978
+ res = PSQLexec ( query -> data );
2979
2979
if (PQresultStatus (res ) == PGRES_TUPLES_OK && PQntuples (res ) == 1 )
2980
2980
{
2981
2981
resetPQExpBuffer (buf );
0 commit comments