001 /** 002 * Copyright (c) 2003 Daffodil Software Ltd all rights reserved, 003 * Modifications Copyright (c) 2008 Regiscope Digital Imaging Co, LLC, All rights reserved. 004 * This program is free software; you can redistribute it and/or modify 005 * it under the terms of version 2 of the GNU General Public License as 006 * published by the Free Software Foundation. 007 * There are special exceptions to the terms and conditions of the GPL 008 * as it is applied to this software. See the GNU General Public License for more details. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU General Public License for more details. 014 * 015 * You should have received a copy of the GNU General Public License 016 * along with this program; if not, write to the Free Software 017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 018 */ 019 020 package org.dbreplicator.replication.xml; 021 022 import java.sql.*; 023 024 /** 025 * This class is used in handling the case of tracing the records at the time of 026 * shadow table search for the records with same pk or with same common_id. 027 * Tracer keeps track of this trace. 028 */ 029 030 public class Tracer 031 { 032 033 public String type; 034 public boolean recordFound; 035 public ResultSet rs; 036 public Object[] oldRow; 037 public Object[] primaryKeyValues; 038 public Tracer() 039 { 040 } 041 042 /** 043 * set original record from shadow table only once during call for getLastReocrd in operationUpdate or OperationDelete 044 * @param rs 045 * @throws SQLException 046 */ 047 public void setOldRow(ResultSet rs) throws SQLException 048 { 049 if (oldRow != null) 050 { 051 return; 052 } 053 int count = rs.getMetaData().getColumnCount(); 054 oldRow = new Object[count - 5]; 055 for (int i = 5, j = 0; i <= count - 1; i++) 056 { 057 oldRow[j++] = rs.getObject(i); 058 } 059 060 } 061 062 }

