Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: when tableName is keyword, the insert operation will get afterImage fail #2053

Merged
merged 9 commits into from
Dec 18, 2019
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.seata.config;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.seata.config;

import java.util.concurrent.ExecutorService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.seata.config;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.seata.config;

import java.util.concurrent.CountDownLatch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
*/
package io.seata.rm.datasource.exec;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.StringJoiner;

import io.seata.common.util.CollectionUtils;
import io.seata.common.util.StringUtils;
import io.seata.core.context.RootContext;
Expand All @@ -31,14 +39,6 @@
import io.seata.rm.datasource.sql.struct.TableRecords;
import io.seata.rm.datasource.undo.SQLUndoLog;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.StringJoiner;

/**
* The type Base transactional executor.
*
Expand Down Expand Up @@ -346,7 +346,8 @@ protected TableRecords buildTableRecords(TableMeta tableMeta, String selectSQL,
protected TableRecords buildTableRecords(List<Object> pkValues) throws SQLException {
TableRecords afterImage;
String pk = getTableMeta().getPkName();
StringJoiner pkValuesJoiner = new StringJoiner(" , ", "SELECT * FROM " + getTableMeta().getTableName() + " WHERE " + pk + " in (", ")");
StringJoiner pkValuesJoiner = new StringJoiner(" , ",
"SELECT * FROM " + getFromTableInSQL() + " WHERE " + pk + " in (", ")");
for (Object pkValue : pkValues) {
pkValuesJoiner.add("?");
}
Expand Down