@@ -29,15 +29,14 @@ public bool WriteQueryCommand(ref CommandListPosition commandListPosition, IDict
29
29
if ( Log . IsDebugEnabled ( ) )
30
30
Log . Debug ( "Session{0} Preparing command payload; CommandText: {1}" , command . Connection . Session . Id , command . CommandText ) ;
31
31
32
- if ( command . CommandType == CommandType . StoredProcedure )
33
- WriteStoredProcedure ( command , cachedProcedures , writer ) ;
34
- else
35
- WriteCommand ( command , writer ) ;
32
+ writer . Write ( ( byte ) CommandKind . Query ) ;
33
+ WriteQueryPayload ( command , cachedProcedures , writer ) ;
36
34
37
35
commandListPosition . CommandIndex ++ ;
38
36
}
39
37
else
40
38
{
39
+ writer . Write ( ( byte ) CommandKind . StatementExecute ) ;
41
40
WritePreparedStatement ( command , preparedStatements . Statements [ commandListPosition . PreparedStatementIndex ] , writer ) ;
42
41
43
42
// advance to next prepared statement or next command
@@ -47,18 +46,24 @@ public bool WriteQueryCommand(ref CommandListPosition commandListPosition, IDict
47
46
commandListPosition . PreparedStatementIndex = 0 ;
48
47
}
49
48
}
50
-
51
49
return true ;
52
50
}
53
51
54
- private void WritePreparedStatement ( IMySqlCommand command , PreparedStatement preparedStatement , ByteBufferWriter writer )
52
+ public static void WriteQueryPayload ( IMySqlCommand command , IDictionary < string , CachedProcedure > cachedProcedures , ByteBufferWriter writer )
53
+ {
54
+ if ( command . CommandType == CommandType . StoredProcedure )
55
+ WriteStoredProcedure ( command , cachedProcedures , writer ) ;
56
+ else
57
+ WriteCommand ( command , writer ) ;
58
+ }
59
+
60
+ private static void WritePreparedStatement ( IMySqlCommand command , PreparedStatement preparedStatement , ByteBufferWriter writer )
55
61
{
56
62
var parameterCollection = command . RawParameters ;
57
63
58
64
if ( Log . IsDebugEnabled ( ) )
59
65
Log . Debug ( "Session{0} Preparing command payload; CommandId: {1}; CommandText: {2}" , command . Connection . Session . Id , preparedStatement . StatementId , command . CommandText ) ;
60
66
61
- writer . Write ( ( byte ) CommandKind . StatementExecute ) ;
62
67
writer . Write ( preparedStatement . StatementId ) ;
63
68
writer . Write ( ( byte ) 0 ) ;
64
69
writer . Write ( 1 ) ;
@@ -119,7 +124,7 @@ private void WritePreparedStatement(IMySqlCommand command, PreparedStatement pre
119
124
}
120
125
}
121
126
122
- private void WriteStoredProcedure ( IMySqlCommand command , IDictionary < string , CachedProcedure > cachedProcedures , ByteBufferWriter writer )
127
+ private static void WriteStoredProcedure ( IMySqlCommand command , IDictionary < string , CachedProcedure > cachedProcedures , ByteBufferWriter writer )
123
128
{
124
129
var parameterCollection = command . RawParameters ;
125
130
var cachedProcedure = cachedProcedures [ command . CommandText ] ;
@@ -182,7 +187,7 @@ private void WriteStoredProcedure(IMySqlCommand command, IDictionary<string, Cac
182
187
preparer . ParseAndBindParameters ( writer ) ;
183
188
}
184
189
185
- private void WriteCommand ( IMySqlCommand command , ByteBufferWriter writer )
190
+ private static void WriteCommand ( IMySqlCommand command , ByteBufferWriter writer )
186
191
{
187
192
var preparer = new StatementPreparer ( command . CommandText , command . RawParameters , command . CreateStatementPreparerOptions ( ) ) ;
188
193
preparer . ParseAndBindParameters ( writer ) ;
0 commit comments