mirror of
https://github.com/postgres/postgres.git
synced 2025-10-21 02:52:47 +03:00
Initial pgindent run for v12.
This is still using the 2.0 version of pg_bsd_indent. I thought it would be good to commit this separately, so as to document the differences between 2.0 and 2.1 behavior. Discussion: https://postgr.es/m/16296.1558103386@sss.pgh.pa.us
This commit is contained in:
@@ -63,51 +63,51 @@ ecpg_register_prepared_stmt(struct statement *stmt)
|
||||
struct prepared_statement *this;
|
||||
struct connection *con = NULL;
|
||||
struct prepared_statement *prev = NULL;
|
||||
char *real_connection_name;
|
||||
int lineno = stmt->lineno;
|
||||
char *real_connection_name;
|
||||
int lineno = stmt->lineno;
|
||||
|
||||
real_connection_name = ecpg_get_con_name_by_declared_name(stmt->name);
|
||||
if (real_connection_name == NULL)
|
||||
real_connection_name = stmt->connection->name;
|
||||
real_connection_name = ecpg_get_con_name_by_declared_name(stmt->name);
|
||||
if (real_connection_name == NULL)
|
||||
real_connection_name = stmt->connection->name;
|
||||
|
||||
con = ecpg_get_connection(real_connection_name);
|
||||
if (!ecpg_init(con, real_connection_name, stmt->lineno))
|
||||
return false;
|
||||
con = ecpg_get_connection(real_connection_name);
|
||||
if (!ecpg_init(con, real_connection_name, stmt->lineno))
|
||||
return false;
|
||||
|
||||
/* check if we already have prepared this statement */
|
||||
this = ecpg_find_prepared_statement(stmt->name, con, &prev);
|
||||
if (this && !deallocate_one(lineno, ECPG_COMPAT_PGSQL, con, prev, this))
|
||||
return false;
|
||||
/* check if we already have prepared this statement */
|
||||
this = ecpg_find_prepared_statement(stmt->name, con, &prev);
|
||||
if (this && !deallocate_one(lineno, ECPG_COMPAT_PGSQL, con, prev, this))
|
||||
return false;
|
||||
|
||||
/* allocate new statement */
|
||||
this = (struct prepared_statement *) ecpg_alloc(sizeof(struct prepared_statement), lineno);
|
||||
if (!this)
|
||||
return false;
|
||||
/* allocate new statement */
|
||||
this = (struct prepared_statement *) ecpg_alloc(sizeof(struct prepared_statement), lineno);
|
||||
if (!this)
|
||||
return false;
|
||||
|
||||
prep_stmt = (struct statement *) ecpg_alloc(sizeof(struct statement), lineno);
|
||||
if (!stmt)
|
||||
{
|
||||
ecpg_free(this);
|
||||
return false;
|
||||
}
|
||||
memset(prep_stmt, 0, sizeof(struct statement));
|
||||
prep_stmt = (struct statement *) ecpg_alloc(sizeof(struct statement), lineno);
|
||||
if (!stmt)
|
||||
{
|
||||
ecpg_free(this);
|
||||
return false;
|
||||
}
|
||||
memset(prep_stmt, 0, sizeof(struct statement));
|
||||
|
||||
/* create statement */
|
||||
prep_stmt->lineno = lineno;
|
||||
prep_stmt->connection = con;
|
||||
prep_stmt->command = ecpg_strdup(stmt->command, lineno);
|
||||
prep_stmt->inlist = prep_stmt->outlist = NULL;
|
||||
this->name = ecpg_strdup(stmt->name, lineno);
|
||||
this->stmt = prep_stmt;
|
||||
this->prepared = true;
|
||||
/* create statement */
|
||||
prep_stmt->lineno = lineno;
|
||||
prep_stmt->connection = con;
|
||||
prep_stmt->command = ecpg_strdup(stmt->command, lineno);
|
||||
prep_stmt->inlist = prep_stmt->outlist = NULL;
|
||||
this->name = ecpg_strdup(stmt->name, lineno);
|
||||
this->stmt = prep_stmt;
|
||||
this->prepared = true;
|
||||
|
||||
if (con->prep_stmts == NULL)
|
||||
this->next = NULL;
|
||||
else
|
||||
this->next = con->prep_stmts;
|
||||
if (con->prep_stmts == NULL)
|
||||
this->next = NULL;
|
||||
else
|
||||
this->next = con->prep_stmts;
|
||||
|
||||
con->prep_stmts = this;
|
||||
return true;
|
||||
con->prep_stmts = this;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -239,8 +239,8 @@ ECPGprepare(int lineno, const char *connection_name, const bool questionmarks,
|
||||
if (real_connection_name == NULL)
|
||||
{
|
||||
/*
|
||||
* If can't get the connection name by declared name then using connection name
|
||||
* coming from the parameter connection_name
|
||||
* If can't get the connection name by declared name then using
|
||||
* connection name coming from the parameter connection_name
|
||||
*/
|
||||
real_connection_name = connection_name;
|
||||
}
|
||||
@@ -345,8 +345,8 @@ ECPGdeallocate(int lineno, int c, const char *connection_name, const char *name)
|
||||
if (real_connection_name == NULL)
|
||||
{
|
||||
/*
|
||||
* If can't get the connection name by declared name then using connection name
|
||||
* coming from the parameter connection_name
|
||||
* If can't get the connection name by declared name then using
|
||||
* connection name coming from the parameter connection_name
|
||||
*/
|
||||
real_connection_name = connection_name;
|
||||
}
|
||||
@@ -408,8 +408,8 @@ ECPGprepared_statement(const char *connection_name, const char *name, int lineno
|
||||
if (real_connection_name == NULL)
|
||||
{
|
||||
/*
|
||||
* If can't get the connection name by declared name then using connection name
|
||||
* coming from the parameter connection_name
|
||||
* If can't get the connection name by declared name then using
|
||||
* connection name coming from the parameter connection_name
|
||||
*/
|
||||
real_connection_name = connection_name;
|
||||
}
|
||||
@@ -667,11 +667,11 @@ ECPGdeclare(int lineno, const char *connection_name, const char *name)
|
||||
{
|
||||
/*
|
||||
* Going to here means not using AT clause in the DECLARE STATEMENT
|
||||
* ECPG pre-processor allows this case.
|
||||
* However, we don't allocate a node to store the declared name
|
||||
* because the DECLARE STATEMENT without using AT clause will be ignored.
|
||||
* The following statement such as PREPARE, EXECUTE are executed
|
||||
* as usual on the current connection.
|
||||
* ECPG pre-processor allows this case. However, we don't allocate a
|
||||
* node to store the declared name because the DECLARE STATEMENT
|
||||
* without using AT clause will be ignored. The following statement
|
||||
* such as PREPARE, EXECUTE are executed as usual on the current
|
||||
* connection.
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
@@ -682,7 +682,10 @@ ECPGdeclare(int lineno, const char *connection_name, const char *name)
|
||||
|
||||
if (ecpg_find_declared_statement(name))
|
||||
{
|
||||
/* Should not go to here because the pre-compiler has check the duplicate name */
|
||||
/*
|
||||
* Should not go to here because the pre-compiler has check the
|
||||
* duplicate name
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -751,7 +754,7 @@ ecpg_update_declare_statement(const char *declared_name, const char *cursor_name
|
||||
/* Find the declared node by declared name */
|
||||
p = ecpg_find_declared_statement(declared_name);
|
||||
if (p)
|
||||
p->cursor_name = ecpg_strdup(cursor_name,lineno);
|
||||
p->cursor_name = ecpg_strdup(cursor_name, lineno);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -831,7 +834,10 @@ ecpg_release_declared_statement(const char *connection_name)
|
||||
ecpg_free(cur->cursor_name);
|
||||
ecpg_free(cur);
|
||||
|
||||
/* One connection can be used by multiple declared name, so no break here */
|
||||
/*
|
||||
* One connection can be used by multiple declared name, so no
|
||||
* break here
|
||||
*/
|
||||
}
|
||||
else
|
||||
prev = cur;
|
||||
|
Reference in New Issue
Block a user