Kaydet (Commit) f883a6b4 authored tarafından Julien Nabet's avatar Julien Nabet Kaydeden (comit) Lionel Elie Mamane

Cleaning in table.cxx of firebird

- Replace nNullabble by nNullable
- Replace wrong var name sNewTableName by sNewColName

Change-Id: Ib10de7057c0d131f8504e8387721a05bd9e4434f
Reviewed-on: https://gerrit.libreoffice.org/38251Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarLionel Elie Mamane <lionel@mamane.lu>
üst c855400e
...@@ -127,6 +127,7 @@ void SAL_CALL Table::alterColumnByName(const OUString& rColName, ...@@ -127,6 +127,7 @@ void SAL_CALL Table::alterColumnByName(const OUString& rColName,
const bool bScaleChanged = xColumn->getPropertyValue("Scale") != rDescriptor->getPropertyValue("Scale"); const bool bScaleChanged = xColumn->getPropertyValue("Scale") != rDescriptor->getPropertyValue("Scale");
const bool bIsNullableChanged = xColumn->getPropertyValue("IsNullable") != rDescriptor->getPropertyValue("IsNullable"); const bool bIsNullableChanged = xColumn->getPropertyValue("IsNullable") != rDescriptor->getPropertyValue("IsNullable");
const bool bIsAutoIncrementChanged = xColumn->getPropertyValue("IsAutoIncrement") != rDescriptor->getPropertyValue("IsAutoIncrement"); const bool bIsAutoIncrementChanged = xColumn->getPropertyValue("IsAutoIncrement") != rDescriptor->getPropertyValue("IsAutoIncrement");
// TODO: remainder -- these are all "optional" so have to detect presence and change. // TODO: remainder -- these are all "optional" so have to detect presence and change.
bool bDefaultChanged = xColumn->getPropertyValue("DefaultValue") bool bDefaultChanged = xColumn->getPropertyValue("DefaultValue")
...@@ -146,22 +147,22 @@ void SAL_CALL Table::alterColumnByName(const OUString& rColName, ...@@ -146,22 +147,22 @@ void SAL_CALL Table::alterColumnByName(const OUString& rColName,
if (bIsNullableChanged) if (bIsNullableChanged)
{ {
sal_Int32 nNullabble = 0; sal_Int32 nNullable = 0;
rDescriptor->getPropertyValue("IsNullable") >>= nNullabble; rDescriptor->getPropertyValue("IsNullable") >>= nNullable;
if (nNullabble != ColumnValue::NULLABLE_UNKNOWN) if (nNullable != ColumnValue::NULLABLE_UNKNOWN)
{ {
OUString sSql; OUString sSql;
// Dirty hack: can't change null directly in sql, we have to fiddle // Dirty hack: can't change null directly in sql, we have to fiddle
// the system tables manually. // the system tables manually.
if (nNullabble == ColumnValue::NULLABLE) if (nNullable == ColumnValue::NULLABLE)
{ {
sSql = "UPDATE RDB$RELATION_FIELDS SET RDB$NULL_FLAG = NULL " sSql = "UPDATE RDB$RELATION_FIELDS SET RDB$NULL_FLAG = NULL "
"WHERE RDB$FIELD_NAME = '" + rColName + "' " "WHERE RDB$FIELD_NAME = '" + rColName + "' "
"AND RDB$RELATION_NAME = '" + getName() + "'"; "AND RDB$RELATION_NAME = '" + getName() + "'";
} }
else if (nNullabble == ColumnValue::NO_NULLS) else if (nNullable == ColumnValue::NO_NULLS)
{ {
// And if we are making NOT NULL then we have to make sure we have // And if we are making NOT NULL then we have to make sure we have
// no nulls left in the column. // no nulls left in the column.
...@@ -208,10 +209,10 @@ void SAL_CALL Table::alterColumnByName(const OUString& rColName, ...@@ -208,10 +209,10 @@ void SAL_CALL Table::alterColumnByName(const OUString& rColName,
// TODO: quote identifiers as needed. // TODO: quote identifiers as needed.
if (bNameChanged) if (bNameChanged)
{ {
OUString sNewTableName; OUString sNewColName;
rDescriptor->getPropertyValue("Name") >>= sNewTableName; rDescriptor->getPropertyValue("Name") >>= sNewColName;
OUString sSql(getAlterTableColumn(rColName) OUString sSql(getAlterTableColumn(rColName)
+ " TO \"" + sNewTableName + "\""); + " TO \"" + sNewColName + "\"");
getConnection()->createStatement()->execute(sSql); getConnection()->createStatement()->execute(sSql);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment