Changeset: 85c4eab66ab2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/85c4eab66ab2
Modified Files:
clients/mapiclient/dump.c
Branch: default
Log Message:
Change variable name.
diffs (truncated from 1729 to 300 lines):
diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -182,27 +182,27 @@ sescape(const char *s)
}
static int
-comment_on(stream *toConsole, const char *object,
+comment_on(stream *sqlf, const char *object,
const char *ident1, const char *ident2, const char *ident3,
const char *remark)
{
if (remark) {
- if (mnstr_printf(toConsole, "COMMENT ON %s ", object) < 0 ||
- dquoted_print(toConsole, ident1, NULL) < 0)
+ if (mnstr_printf(sqlf, "COMMENT ON %s ", object) < 0 ||
+ dquoted_print(sqlf, ident1, NULL) < 0)
return -1;
if (ident2) {
- if (mnstr_printf(toConsole, ".") < 0 ||
- dquoted_print(toConsole, ident2, NULL) < 0)
+ if (mnstr_printf(sqlf, ".") < 0 ||
+ dquoted_print(sqlf, ident2, NULL) < 0)
return -1;
if (ident3) {
- if (mnstr_printf(toConsole, ".") < 0 ||
- dquoted_print(toConsole, ident3, NULL) < 0)
+ if (mnstr_printf(sqlf, ".") < 0 ||
+ dquoted_print(sqlf, ident3, NULL) < 0)
return -1;
}
}
- if (mnstr_write(toConsole, " IS ", 1, 4) < 0 ||
- squoted_print(toConsole, remark, '\'', false) < 0 ||
- mnstr_write(toConsole, ";\n", 1, 2) < 0)
+ if (mnstr_write(sqlf, " IS ", 1, 4) < 0 ||
+ squoted_print(sqlf, remark, '\'', false) < 0 ||
+ mnstr_write(sqlf, ";\n", 1, 2) < 0)
return -1;
}
return 0;
@@ -453,7 +453,7 @@ bailout:
}
static int
-dump_foreign_keys(Mapi mid, const char *schema, const char *tname, const char
*tid, stream *toConsole)
+dump_foreign_keys(Mapi mid, const char *schema, const char *tname, const char
*tid, stream *sqlf)
{
MapiHdl hdl = NULL;
int cnt, i;
@@ -663,31 +663,31 @@ dump_foreign_keys(Mapi mid, const char *
}
}
if (tname == NULL && tid == NULL) {
- mnstr_printf(toConsole, "ALTER TABLE ");
- dquoted_print(toConsole, c_fsname, ".");
- dquoted_print(toConsole, c_ftname, " ADD ");
+ mnstr_printf(sqlf, "ALTER TABLE ");
+ dquoted_print(sqlf, c_fsname, ".");
+ dquoted_print(sqlf, c_ftname, " ADD ");
} else {
- mnstr_printf(toConsole, ",\n\t");
+ mnstr_printf(sqlf, ",\n\t");
}
if (c_fkname) {
- mnstr_printf(toConsole, "CONSTRAINT ");
- dquoted_print(toConsole, c_fkname, " ");
+ mnstr_printf(sqlf, "CONSTRAINT ");
+ dquoted_print(sqlf, c_fkname, " ");
}
- mnstr_printf(toConsole, "FOREIGN KEY (");
+ mnstr_printf(sqlf, "FOREIGN KEY (");
for (i = 0; i < nkeys; i++) {
if (i > 0)
- mnstr_printf(toConsole, ", ");
- dquoted_print(toConsole, fkeys[i], NULL);
+ mnstr_printf(sqlf, ", ");
+ dquoted_print(sqlf, fkeys[i], NULL);
}
- mnstr_printf(toConsole, ") REFERENCES ");
- dquoted_print(toConsole, c_psname, ".");
- dquoted_print(toConsole, c_ptname, " (");
+ mnstr_printf(sqlf, ") REFERENCES ");
+ dquoted_print(sqlf, c_psname, ".");
+ dquoted_print(sqlf, c_ptname, " (");
for (i = 0; i < nkeys; i++) {
if (i > 0)
- mnstr_printf(toConsole, ", ");
- dquoted_print(toConsole, pkeys[i], NULL);
+ mnstr_printf(sqlf, ", ");
+ dquoted_print(sqlf, pkeys[i], NULL);
}
- mnstr_printf(toConsole, ")");
+ mnstr_printf(sqlf, ")");
if (c_faction) {
int action = atoi(c_faction);
int on_update;
@@ -696,12 +696,12 @@ dump_foreign_keys(Mapi mid, const char *
if ((on_delete = action & 255) != 0 &&
on_delete < NR_ACTIONS &&
on_delete != 2 /* RESTRICT -- default */)
- mnstr_printf(toConsole, " ON DELETE %s",
+ mnstr_printf(sqlf, " ON DELETE %s",
actions[on_delete]);
if ((on_update = (action >> 8) & 255) != 0 &&
on_update < NR_ACTIONS &&
on_update != 2 /* RESTRICT -- default */)
- mnstr_printf(toConsole, " ON UPDATE %s",
+ mnstr_printf(sqlf, " ON UPDATE %s",
actions[on_update]);
}
free(c_psname);
@@ -720,9 +720,9 @@ dump_foreign_keys(Mapi mid, const char *
free(pkeys);
if (tname == NULL && tid == NULL)
- mnstr_printf(toConsole, ";\n");
+ mnstr_printf(sqlf, ";\n");
- if (mnstr_errnr(toConsole) != MNSTR_NO__ERROR)
+ if (mnstr_errnr(sqlf) != MNSTR_NO__ERROR)
goto bailout;
}
if (mapi_error(mid))
@@ -737,12 +737,12 @@ bailout:
mapi_explain_result(hdl, stderr);
else if (mapi_error(mid))
mapi_explain_query(hdl, stderr);
- else if (mnstr_errnr(toConsole) == MNSTR_NO__ERROR)
+ else if (mnstr_errnr(sqlf) == MNSTR_NO__ERROR)
fprintf(stderr, "malloc failure\n");
mapi_close_handle(hdl);
} else if (mapi_error(mid))
mapi_explain(mid, stderr);
- else if (mnstr_errnr(toConsole) == MNSTR_NO__ERROR)
+ else if (mnstr_errnr(sqlf) == MNSTR_NO__ERROR)
fprintf(stderr, "malloc failure\n");
return 1;
@@ -765,7 +765,7 @@ toUpper(const char *s)
static int dump_column_definition(
Mapi mid,
- stream *toConsole,
+ stream *sqlf,
const char *schema,
const char *tname,
const char *tid,
@@ -785,105 +785,105 @@ static const char *geomsubtypes[] = {
};
static int
-dump_type(Mapi mid, stream *toConsole, const char *c_type, const char
*c_type_digits, const char *c_type_scale, bool hashge)
+dump_type(Mapi mid, stream *sqlf, const char *c_type, const char
*c_type_digits, const char *c_type_scale, bool hashge)
{
int space = 0;
if (strcmp(c_type, "boolean") == 0) {
- space = mnstr_printf(toConsole, "BOOLEAN");
+ space = mnstr_printf(sqlf, "BOOLEAN");
} else if (strcmp(c_type, "int") == 0) {
- space = mnstr_printf(toConsole, "INTEGER");
+ space = mnstr_printf(sqlf, "INTEGER");
} else if (strcmp(c_type, "smallint") == 0) {
- space = mnstr_printf(toConsole, "SMALLINT");
+ space = mnstr_printf(sqlf, "SMALLINT");
} else if (strcmp(c_type, "tinyint") == 0) {
- space = mnstr_printf(toConsole, "TINYINT");
+ space = mnstr_printf(sqlf, "TINYINT");
} else if (strcmp(c_type, "bigint") == 0) {
- space = mnstr_printf(toConsole, "BIGINT");
+ space = mnstr_printf(sqlf, "BIGINT");
} else if (strcmp(c_type, "hugeint") == 0) {
- space = mnstr_printf(toConsole, "HUGEINT");
+ space = mnstr_printf(sqlf, "HUGEINT");
} else if (strcmp(c_type, "date") == 0) {
- space = mnstr_printf(toConsole, "DATE");
+ space = mnstr_printf(sqlf, "DATE");
} else if (strcmp(c_type, "month_interval") == 0) {
if (strcmp(c_type_digits, "1") == 0)
- space = mnstr_printf(toConsole, "INTERVAL YEAR");
+ space = mnstr_printf(sqlf, "INTERVAL YEAR");
else if (strcmp(c_type_digits, "2") == 0)
- space = mnstr_printf(toConsole, "INTERVAL YEAR TO
MONTH");
+ space = mnstr_printf(sqlf, "INTERVAL YEAR TO MONTH");
else if (strcmp(c_type_digits, "3") == 0)
- space = mnstr_printf(toConsole, "INTERVAL MONTH");
+ space = mnstr_printf(sqlf, "INTERVAL MONTH");
else
fprintf(stderr, "Internal error: unrecognized month
interval %s\n", c_type_digits);
} else if (strcmp(c_type, "day_interval") == 0 || strcmp(c_type,
"sec_interval") == 0) {
if (strcmp(c_type_digits, "4") == 0)
- space = mnstr_printf(toConsole, "INTERVAL DAY");
+ space = mnstr_printf(sqlf, "INTERVAL DAY");
else if (strcmp(c_type_digits, "5") == 0)
- space = mnstr_printf(toConsole, "INTERVAL DAY TO HOUR");
+ space = mnstr_printf(sqlf, "INTERVAL DAY TO HOUR");
else if (strcmp(c_type_digits, "6") == 0)
- space = mnstr_printf(toConsole, "INTERVAL DAY TO
MINUTE");
+ space = mnstr_printf(sqlf, "INTERVAL DAY TO MINUTE");
else if (strcmp(c_type_digits, "7") == 0)
- space = mnstr_printf(toConsole, "INTERVAL DAY TO
SECOND");
+ space = mnstr_printf(sqlf, "INTERVAL DAY TO SECOND");
else if (strcmp(c_type_digits, "8") == 0)
- space = mnstr_printf(toConsole, "INTERVAL HOUR");
+ space = mnstr_printf(sqlf, "INTERVAL HOUR");
else if (strcmp(c_type_digits, "9") == 0)
- space = mnstr_printf(toConsole, "INTERVAL HOUR TO
MINUTE");
+ space = mnstr_printf(sqlf, "INTERVAL HOUR TO MINUTE");
else if (strcmp(c_type_digits, "10") == 0)
- space = mnstr_printf(toConsole, "INTERVAL HOUR TO
SECOND");
+ space = mnstr_printf(sqlf, "INTERVAL HOUR TO SECOND");
else if (strcmp(c_type_digits, "11") == 0)
- space = mnstr_printf(toConsole, "INTERVAL MINUTE");
+ space = mnstr_printf(sqlf, "INTERVAL MINUTE");
else if (strcmp(c_type_digits, "12") == 0)
- space = mnstr_printf(toConsole, "INTERVAL MINUTE TO
SECOND");
+ space = mnstr_printf(sqlf, "INTERVAL MINUTE TO SECOND");
else if (strcmp(c_type_digits, "13") == 0)
- space = mnstr_printf(toConsole, "INTERVAL SECOND");
+ space = mnstr_printf(sqlf, "INTERVAL SECOND");
else
fprintf(stderr, "Internal error: unrecognized second
interval %s\n", c_type_digits);
} else if (strcmp(c_type, "clob") == 0 ||
(strcmp(c_type, "varchar") == 0 &&
strcmp(c_type_digits, "0") == 0)) {
- space = mnstr_printf(toConsole, "CHARACTER LARGE OBJECT");
+ space = mnstr_printf(sqlf, "CHARACTER LARGE OBJECT");
if (strcmp(c_type_digits, "0") != 0)
- space += mnstr_printf(toConsole, "(%s)", c_type_digits);
+ space += mnstr_printf(sqlf, "(%s)", c_type_digits);
} else if (strcmp(c_type, "blob") == 0) {
- space = mnstr_printf(toConsole, "BINARY LARGE OBJECT");
+ space = mnstr_printf(sqlf, "BINARY LARGE OBJECT");
if (strcmp(c_type_digits, "0") != 0)
- space += mnstr_printf(toConsole, "(%s)", c_type_digits);
+ space += mnstr_printf(sqlf, "(%s)", c_type_digits);
} else if (strcmp(c_type, "timestamp") == 0 ||
strcmp(c_type, "timestamptz") == 0) {
- space = mnstr_printf(toConsole, "TIMESTAMP");
+ space = mnstr_printf(sqlf, "TIMESTAMP");
if (strcmp(c_type_digits, "7") != 0)
- space += mnstr_printf(toConsole, "(%d)",
atoi(c_type_digits) - 1);
+ space += mnstr_printf(sqlf, "(%d)", atoi(c_type_digits)
- 1);
if (strcmp(c_type, "timestamptz") == 0)
- space += mnstr_printf(toConsole, " WITH TIME ZONE");
+ space += mnstr_printf(sqlf, " WITH TIME ZONE");
} else if (strcmp(c_type, "time") == 0 ||
strcmp(c_type, "timetz") == 0) {
- space = mnstr_printf(toConsole, "TIME");
+ space = mnstr_printf(sqlf, "TIME");
if (strcmp(c_type_digits, "1") != 0)
- space += mnstr_printf(toConsole, "(%d)",
atoi(c_type_digits) - 1);
+ space += mnstr_printf(sqlf, "(%d)", atoi(c_type_digits)
- 1);
if (strcmp(c_type, "timetz") == 0)
- space += mnstr_printf(toConsole, " WITH TIME ZONE");
+ space += mnstr_printf(sqlf, " WITH TIME ZONE");
} else if (strcmp(c_type, "real") == 0) {
if (strcmp(c_type_digits, "24") == 0 &&
strcmp(c_type_scale, "0") == 0)
- space = mnstr_printf(toConsole, "REAL");
+ space = mnstr_printf(sqlf, "REAL");
else if (strcmp(c_type_scale, "0") == 0)
- space = mnstr_printf(toConsole, "FLOAT(%s)",
c_type_digits);
+ space = mnstr_printf(sqlf, "FLOAT(%s)", c_type_digits);
else
- space = mnstr_printf(toConsole, "FLOAT(%s,%s)",
+ space = mnstr_printf(sqlf, "FLOAT(%s,%s)",
c_type_digits, c_type_scale);
} else if (strcmp(c_type, "double") == 0) {
if (strcmp(c_type_digits, "53") == 0 &&
strcmp(c_type_scale, "0") == 0)
- space = mnstr_printf(toConsole, "DOUBLE");
+ space = mnstr_printf(sqlf, "DOUBLE");
else if (strcmp(c_type_scale, "0") == 0)
- space = mnstr_printf(toConsole, "FLOAT(%s)",
c_type_digits);
+ space = mnstr_printf(sqlf, "FLOAT(%s)", c_type_digits);
else
- space = mnstr_printf(toConsole, "FLOAT(%s,%s)",
+ space = mnstr_printf(sqlf, "FLOAT(%s,%s)",
c_type_digits, c_type_scale);
} else if (strcmp(c_type, "decimal") == 0 &&
strcmp(c_type_digits, "1") == 0 &&
strcmp(c_type_scale, "0") == 0) {
- space = mnstr_printf(toConsole, "DECIMAL");
+ space = mnstr_printf(sqlf, "DECIMAL");
} else if (strcmp(c_type, "table") == 0) {
- mnstr_printf(toConsole, "TABLE ");
- dump_column_definition(mid, toConsole, NULL, NULL,
c_type_digits, 1, hashge);
+ mnstr_printf(sqlf, "TABLE ");
+ dump_column_definition(mid, sqlf, NULL, NULL, c_type_digits, 1,
hashge);
} else if (strcmp(c_type, "geometry") == 0 &&
strcmp(c_type_digits, "0") != 0) {
const char *geom = NULL;
@@ -893,17 +893,17 @@ dump_type(Mapi mid, stream *toConsole, c
(sub >> 2) < (int) (sizeof(geomsubtypes) /
sizeof(geomsubtypes[0])))
geom = geomsubtypes[sub >> 2];
if (geom) {
- mnstr_printf(toConsole, "GEOMETRY(%s", geom);
+ mnstr_printf(sqlf, "GEOMETRY(%s", geom);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]