~drizzle-replicator/replicator/trunk

« back to all changes in this revision

Viewing changes to replicator/src/java/com/continuent/tungsten/replicator/applier/MySQLDrizzleApplier.java

  • Committer: Marcus Eriksson
  • Date: 2011-01-20 21:27:11 UTC
  • Revision ID: marcuse@marcuse-laptop-20110120212711-ff0854gb8gzwsz1x
work-in-progress - wont build, work or look good

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
import java.io.FileNotFoundException;
28
28
import java.math.BigDecimal;
29
29
import java.math.BigInteger;
 
30
import java.sql.Connection;
30
31
import java.sql.PreparedStatement;
31
32
import java.sql.SQLException;
32
33
import java.sql.SQLWarning;
 
34
import java.sql.Statement;
33
35
import java.sql.Time;
34
36
import java.sql.Types;
35
37
import java.util.List;
80
82
    }
81
83
 
82
84
    @Override
83
 
    protected void applyStatementData(StatementData data)
 
85
    protected void applyStatementData(Connection connection, StatementData data)
84
86
            throws ApplierException
85
87
    {
 
88
        Statement statement = null;
 
89
        try {
 
90
            statement = connection.createStatement();
 
91
        } catch (SQLException e) {
 
92
            throw new ApplierException(e.getMessage(), e);
 
93
        }
 
94
 
86
95
        if (!(statement instanceof DrizzleStatement))
87
96
        {
88
97
            // Check if the right driver is in use
89
98
            if (!alreadyLogged)
90
99
                logger.warn("Using MySQLDrizzleApplier with the wrong driver."
91
100
                        + " Check the driver.");
92
 
            super.applyStatementData(data);
 
101
            super.applyStatementData(connection, data);
93
102
            return;
94
103
        }
95
104
        else if (data.getQueryAsBytes() == null)
96
105
        {
97
106
            // Use the old code path if the new one is not required
98
 
            super.applyStatementData(data);
 
107
            super.applyStatementData(connection, data);
99
108
            return;
100
109
        }
101
110
 
108
117
            Long timestamp = data.getTimestamp();
109
118
            List<ReplOption> options = data.getOptions();
110
119
 
111
 
            applyUseSchema(schema);
112
 
 
113
 
            applySetTimestamp(timestamp);
114
 
 
115
 
            applyOptionsToStatement(options);
 
120
            applyUseSchema(statement, schema);
 
121
 
 
122
            applySetTimestamp(statement, timestamp);
 
123
 
 
124
            applyOptionsToStatement(statement, options);
116
125
 
117
126
            // Using drizzle driver specific method to send bytes directly to
118
127
            // mysql
183
192
    }
184
193
 
185
194
    @Override
186
 
    protected void applyLoadDataLocal(LoadDataFileQuery data, File temporaryFile)
 
195
    protected void applyLoadDataLocal(Connection connection, LoadDataFileQuery data, File temporaryFile)
187
196
            throws ApplierException
188
197
    {
 
198
        Statement statement;
189
199
        try
190
200
        {
 
201
            statement = connection.createStatement();
191
202
            int[] updateCount;
192
203
            String schema = data.getDefaultSchema();
193
204
            Long timestamp = data.getTimestamp();
194
205
            List<ReplOption> options = data.getOptions();
195
206
 
196
 
            applyUseSchema(schema);
197
 
 
198
 
            applySetTimestamp(timestamp);
199
 
 
200
 
            applyOptionsToStatement(options);
 
207
            applyUseSchema(statement, schema);
 
208
 
 
209
            applySetTimestamp(statement, timestamp);
 
210
 
 
211
            applyOptionsToStatement(statement, options);
201
212
 
202
213
            try
203
214
            {