mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +03:00
pgindent run for 9.6
This commit is contained in:
@ -24,12 +24,12 @@ PyObject *PLy_exc_spi_error = NULL;
|
||||
static void PLy_traceback(PyObject *e, PyObject *v, PyObject *tb,
|
||||
char **xmsg, char **tbmsg, int *tb_depth);
|
||||
static void PLy_get_spi_error_data(PyObject *exc, int *sqlerrcode, char **detail,
|
||||
char **hint, char **query, int *position,
|
||||
char **schema_name, char **table_name, char **column_name,
|
||||
char **datatype_name, char **constraint_name);
|
||||
char **hint, char **query, int *position,
|
||||
char **schema_name, char **table_name, char **column_name,
|
||||
char **datatype_name, char **constraint_name);
|
||||
static void PLy_get_error_data(PyObject *exc, int *sqlerrcode, char **detail,
|
||||
char **hint, char **schema_name, char **table_name, char **column_name,
|
||||
char **datatype_name, char **constraint_name);
|
||||
char **hint, char **schema_name, char **table_name, char **column_name,
|
||||
char **datatype_name, char **constraint_name);
|
||||
static char *get_source_line(const char *src, int lineno);
|
||||
|
||||
static void get_string_attr(PyObject *obj, char *attrname, char **str);
|
||||
@ -136,8 +136,8 @@ PLy_elog(int elevel, const char *fmt,...)
|
||||
column_name) : 0,
|
||||
(datatype_name) ? err_generic_string(PG_DIAG_DATATYPE_NAME,
|
||||
datatype_name) : 0,
|
||||
(constraint_name) ? err_generic_string(PG_DIAG_CONSTRAINT_NAME,
|
||||
constraint_name) : 0));
|
||||
(constraint_name) ? err_generic_string(PG_DIAG_CONSTRAINT_NAME,
|
||||
constraint_name) : 0));
|
||||
}
|
||||
PG_CATCH();
|
||||
{
|
||||
@ -544,7 +544,7 @@ PLy_exception_set_with_details(PyObject *excclass, ErrorData *edata)
|
||||
goto failure;
|
||||
|
||||
if (!set_string_attr(error, "sqlstate",
|
||||
unpack_sql_state(edata->sqlerrcode)))
|
||||
unpack_sql_state(edata->sqlerrcode)))
|
||||
goto failure;
|
||||
|
||||
if (!set_string_attr(error, "detail", edata->detail))
|
||||
@ -589,7 +589,7 @@ failure:
|
||||
static void
|
||||
get_string_attr(PyObject *obj, char *attrname, char **str)
|
||||
{
|
||||
PyObject *val;
|
||||
PyObject *val;
|
||||
|
||||
val = PyObject_GetAttrString(obj, attrname);
|
||||
if (val != NULL && val != Py_None)
|
||||
@ -605,8 +605,8 @@ get_string_attr(PyObject *obj, char *attrname, char **str)
|
||||
static bool
|
||||
set_string_attr(PyObject *obj, char *attrname, char *str)
|
||||
{
|
||||
int result;
|
||||
PyObject *val;
|
||||
int result;
|
||||
PyObject *val;
|
||||
|
||||
if (str != NULL)
|
||||
{
|
||||
|
@ -57,13 +57,13 @@ static PyMethodDef PLy_methods[] = {
|
||||
/*
|
||||
* logging methods
|
||||
*/
|
||||
{"debug", (PyCFunction) PLy_debug, METH_VARARGS|METH_KEYWORDS, NULL},
|
||||
{"log", (PyCFunction) PLy_log, METH_VARARGS|METH_KEYWORDS, NULL},
|
||||
{"info", (PyCFunction) PLy_info, METH_VARARGS|METH_KEYWORDS, NULL},
|
||||
{"notice", (PyCFunction) PLy_notice, METH_VARARGS|METH_KEYWORDS, NULL},
|
||||
{"warning", (PyCFunction) PLy_warning, METH_VARARGS|METH_KEYWORDS, NULL},
|
||||
{"error", (PyCFunction) PLy_error, METH_VARARGS|METH_KEYWORDS, NULL},
|
||||
{"fatal", (PyCFunction) PLy_fatal, METH_VARARGS|METH_KEYWORDS, NULL},
|
||||
{"debug", (PyCFunction) PLy_debug, METH_VARARGS | METH_KEYWORDS, NULL},
|
||||
{"log", (PyCFunction) PLy_log, METH_VARARGS | METH_KEYWORDS, NULL},
|
||||
{"info", (PyCFunction) PLy_info, METH_VARARGS | METH_KEYWORDS, NULL},
|
||||
{"notice", (PyCFunction) PLy_notice, METH_VARARGS | METH_KEYWORDS, NULL},
|
||||
{"warning", (PyCFunction) PLy_warning, METH_VARARGS | METH_KEYWORDS, NULL},
|
||||
{"error", (PyCFunction) PLy_error, METH_VARARGS | METH_KEYWORDS, NULL},
|
||||
{"fatal", (PyCFunction) PLy_fatal, METH_VARARGS | METH_KEYWORDS, NULL},
|
||||
|
||||
/*
|
||||
* create a stored plan
|
||||
@ -272,7 +272,7 @@ PLy_generate_spi_exceptions(PyObject *mod, PyObject *base)
|
||||
* don't confuse these with PLy_elog
|
||||
*/
|
||||
static PyObject *PLy_output(volatile int level, PyObject *self,
|
||||
PyObject *args, PyObject *kw);
|
||||
PyObject *args, PyObject *kw);
|
||||
|
||||
static PyObject *
|
||||
PLy_debug(PyObject *self, PyObject *args, PyObject *kw)
|
||||
@ -375,11 +375,11 @@ object_to_string(PyObject *obj)
|
||||
{
|
||||
if (obj)
|
||||
{
|
||||
PyObject *so = PyObject_Str(obj);
|
||||
PyObject *so = PyObject_Str(obj);
|
||||
|
||||
if (so != NULL)
|
||||
{
|
||||
char *str;
|
||||
char *str;
|
||||
|
||||
str = pstrdup(PyString_AsString(so));
|
||||
Py_DECREF(so);
|
||||
@ -394,20 +394,21 @@ object_to_string(PyObject *obj)
|
||||
static PyObject *
|
||||
PLy_output(volatile int level, PyObject *self, PyObject *args, PyObject *kw)
|
||||
{
|
||||
int sqlstate = 0;
|
||||
char *volatile sqlstatestr = NULL;
|
||||
char *volatile message = NULL;
|
||||
char *volatile detail = NULL;
|
||||
char *volatile hint = NULL;
|
||||
char *volatile column = NULL;
|
||||
char *volatile constraint = NULL;
|
||||
char *volatile datatype = NULL;
|
||||
char *volatile table = NULL;
|
||||
char *volatile schema = NULL;
|
||||
int sqlstate = 0;
|
||||
char *volatile sqlstatestr = NULL;
|
||||
char *volatile message = NULL;
|
||||
char *volatile detail = NULL;
|
||||
char *volatile hint = NULL;
|
||||
char *volatile column = NULL;
|
||||
char *volatile constraint = NULL;
|
||||
char *volatile datatype = NULL;
|
||||
char *volatile table = NULL;
|
||||
char *volatile schema = NULL;
|
||||
volatile MemoryContext oldcontext;
|
||||
PyObject *key, *value;
|
||||
PyObject *volatile so;
|
||||
Py_ssize_t pos = 0;
|
||||
PyObject *key,
|
||||
*value;
|
||||
PyObject *volatile so;
|
||||
Py_ssize_t pos = 0;
|
||||
|
||||
if (PyTuple_Size(args) == 1)
|
||||
{
|
||||
@ -437,7 +438,7 @@ PLy_output(volatile int level, PyObject *self, PyObject *args, PyObject *kw)
|
||||
{
|
||||
while (PyDict_Next(kw, &pos, &key, &value))
|
||||
{
|
||||
char *keyword = PyString_AsString(key);
|
||||
char *keyword = PyString_AsString(key);
|
||||
|
||||
if (strcmp(keyword, "message") == 0)
|
||||
{
|
||||
@ -465,9 +466,9 @@ PLy_output(volatile int level, PyObject *self, PyObject *args, PyObject *kw)
|
||||
datatype = object_to_string(value);
|
||||
else if (strcmp(keyword, "constraint") == 0)
|
||||
constraint = object_to_string(value);
|
||||
else
|
||||
PLy_elog(ERROR, "'%s' is an invalid keyword argument for this function",
|
||||
keyword);
|
||||
else
|
||||
PLy_elog(ERROR, "'%s' is an invalid keyword argument for this function",
|
||||
keyword);
|
||||
}
|
||||
}
|
||||
|
||||
@ -480,10 +481,10 @@ PLy_output(volatile int level, PyObject *self, PyObject *args, PyObject *kw)
|
||||
PLy_elog(ERROR, "invalid SQLSTATE code");
|
||||
|
||||
sqlstate = MAKE_SQLSTATE(sqlstatestr[0],
|
||||
sqlstatestr[1],
|
||||
sqlstatestr[2],
|
||||
sqlstatestr[3],
|
||||
sqlstatestr[4]);
|
||||
sqlstatestr[1],
|
||||
sqlstatestr[2],
|
||||
sqlstatestr[3],
|
||||
sqlstatestr[4]);
|
||||
}
|
||||
|
||||
oldcontext = CurrentMemoryContext;
|
||||
@ -524,7 +525,7 @@ PLy_output(volatile int level, PyObject *self, PyObject *args, PyObject *kw)
|
||||
}
|
||||
PG_CATCH();
|
||||
{
|
||||
ErrorData *edata;
|
||||
ErrorData *edata;
|
||||
|
||||
MemoryContextSwitchTo(oldcontext);
|
||||
edata = CopyErrorData();
|
||||
|
@ -554,7 +554,9 @@ PLy_spi_subtransaction_abort(MemoryContext oldcontext, ResourceOwner oldowner)
|
||||
/* Look up the correct exception */
|
||||
entry = hash_search(PLy_spi_exceptions, &(edata->sqlerrcode),
|
||||
HASH_FIND, NULL);
|
||||
/* This could be a custom error code, if that's the case fallback to
|
||||
|
||||
/*
|
||||
* This could be a custom error code, if that's the case fallback to
|
||||
* SPIError
|
||||
*/
|
||||
exc = entry ? entry->exc : PLy_exc_spi_error;
|
||||
@ -583,9 +585,9 @@ PLy_spi_exception_set(PyObject *excclass, ErrorData *edata)
|
||||
if (!spierror)
|
||||
goto failure;
|
||||
|
||||
spidata= Py_BuildValue("(izzzizzzzz)", edata->sqlerrcode, edata->detail, edata->hint,
|
||||
spidata = Py_BuildValue("(izzzizzzzz)", edata->sqlerrcode, edata->detail, edata->hint,
|
||||
edata->internalquery, edata->internalpos,
|
||||
edata->schema_name, edata->table_name, edata->column_name,
|
||||
edata->schema_name, edata->table_name, edata->column_name,
|
||||
edata->datatype_name, edata->constraint_name);
|
||||
if (!spidata)
|
||||
goto failure;
|
||||
|
Reference in New Issue
Block a user