Some questions about ConvertJSONToSQL and PutDataBaseRecord

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Some questions about ConvertJSONToSQL and PutDataBaseRecord

ZhangCheng
In ConvertJSONToSQL and PutDataBaseRecord, we can set the 'Quote Table Identifiers'.

If we set the 'Quote Table Identifiers' true, and we need to use "Schema Name" and "Table Name", it will quote the fully qualified table name such as "SCHEMANAME.tablename".

```
// build the fully qualified table name
final StringBuilder tableNameBuilder = new StringBuilder();
if (catalog != null) {
tableNameBuilder.append(catalog).append(".");
}
if (schemaName != null) {
tableNameBuilder.append(schemaName).append(".");
}
tableNameBuilder.append(tableName);
final String fqTableName = tableNameBuilder.toString();
```

```
final StringBuilder sqlBuilder = new StringBuilder();
sqlBuilder.append("INSERT INTO ");
if (settings.quoteTableName) {
sqlBuilder.append(tableSchema.getQuotedIdentifierString())
.append(tableName)
.append(tableSchema.getQuotedIdentifierString());
} else {
sqlBuilder.append(tableName);
}
```

I want to konw when we need to quote the fully qualified table name , and in Oracle when the table name is lowercase, how can I get the  fully qualified table name like SCHEMANAME."tablename"?
Reply | Threaded
Open this post in threaded view
|

回复:Some questions about ConvertJSONToSQL and PutDataBaseRecord

ZhangCheng
I have solved problems via NIFI-7313 ,it has fixed the problem


------------------ 原始邮件 ------------------
发件人: "users" <[hidden email]>;
发送时间: 2020年7月13日(星期一) 晚上7:39
收件人: "users"<[hidden email]>;
主题: Some questions about ConvertJSONToSQL and PutDataBaseRecord

In ConvertJSONToSQL and PutDataBaseRecord, we can set the 'Quote Table Identifiers'.

If we set the 'Quote Table Identifiers' true, and we need to use "Schema Name" and "Table Name", it will quote the fully qualified table name such as "SCHEMANAME.tablename".

```
// build the fully qualified table name
final StringBuilder tableNameBuilder = new StringBuilder();
if (catalog != null) {
tableNameBuilder.append(catalog).append(".");
}
if (schemaName != null) {
tableNameBuilder.append(schemaName).append(".");
}
tableNameBuilder.append(tableName);
final String fqTableName = tableNameBuilder.toString();
```

```
final StringBuilder sqlBuilder = new StringBuilder();
sqlBuilder.append("INSERT INTO ");
if (settings.quoteTableName) {
sqlBuilder.append(tableSchema.getQuotedIdentifierString())
.append(tableName)
.append(tableSchema.getQuotedIdentifierString());
} else {
sqlBuilder.append(tableName);
}
```

I want to konw when we need to quote the fully qualified table name , and in Oracle when the table name is lowercase, how can I get the  fully qualified table name like SCHEMANAME."tablename"?