@@ -36,7 +36,7 @@ ELSE expires
3636 public StoreCommand GetEffects ( StoredId storedId )
3737 {
3838 _getEffectResultsSql ??= @$ "
39- SELECT id_hash , status, result, exception, effect_id
39+ SELECT position , status, result, exception, effect_id
4040 FROM { tablePrefix } _effects
4141 WHERE id = ?;" ;
4242
@@ -55,7 +55,7 @@ public async Task<IReadOnlyList<StoredEffect>> ReadEffects(MySqlDataReader reade
5555 var functions = new List < StoredEffect > ( ) ;
5656 while ( await reader . ReadAsync ( ) )
5757 {
58- var idHash = reader . GetString ( 0 ) ;
58+ var position = reader . GetInt64 ( 0 ) ;
5959 var status = ( WorkStatus ) reader . GetInt32 ( 1 ) ;
6060 var result = reader . IsDBNull ( 2 ) ? null : ( byte [ ] ) reader . GetValue ( 2 ) ;
6161 var exception = reader . IsDBNull ( 3 ) ? null : reader . GetString ( 3 ) ;
@@ -76,7 +76,7 @@ public async Task<IReadOnlyList<StoredEffect>> ReadEffects(MySqlDataReader reade
7676 public StoreCommand GetEffects ( IEnumerable < StoredId > storedIds )
7777 {
7878 var sql = @$ "
79- SELECT id, id_hash , status, result, exception, effect_id
79+ SELECT id, position , status, result, exception, effect_id
8080 FROM { tablePrefix } _effects
8181 WHERE id IN ({ storedIds . Select ( id => $ "'{ id . AsGuid : N} '") . StringJoin ( ", " ) } );" ;
8282
@@ -93,7 +93,7 @@ public async Task<Dictionary<StoredId, List<StoredEffect>>> ReadEffectsForMultip
9393 while ( await reader . ReadAsync ( ) )
9494 {
9595 var id = reader . GetString ( 0 ) . ToGuid ( ) . ToStoredId ( ) ;
96- var idHash = reader . GetString ( 1 ) ;
96+ var position = reader . GetInt64 ( 1 ) ;
9797 var status = ( WorkStatus ) reader . GetInt32 ( 2 ) ;
9898 var result = reader . IsDBNull ( 3 ) ? null : ( byte [ ] ) reader . GetValue ( 3 ) ;
9999 var exception = reader . IsDBNull ( 4 ) ? null : reader . GetString ( 4 ) ;
@@ -123,7 +123,7 @@ public StoreCommand UpdateEffects(IReadOnlyList<StoredEffectChange> changes)
123123 . Select ( c => new
124124 {
125125 Instance = c . StoredId . AsGuid ,
126- IdHash = c . EffectId . ToStoredEffectId ( ) . Value ,
126+ Position = c . EffectId . ToStoredEffectId ( ) . Value . ToLong ( ) ,
127127 WorkStatus = ( int ) c . StoredEffect ! . WorkStatus ,
128128 Result = c . StoredEffect ! . Result ,
129129 Exception = c . StoredEffect ! . StoredException ,
@@ -133,7 +133,7 @@ public StoreCommand UpdateEffects(IReadOnlyList<StoredEffectChange> changes)
133133
134134 var setSql = $@ "
135135 INSERT INTO { tablePrefix } _effects
136- (id, id_hash , status, result, exception, effect_id)
136+ (id, position , status, result, exception, effect_id)
137137 VALUES
138138 { "(?, ?, ?, ?, ?, ?)" . Replicate ( upserts . Count ) . StringJoin ( ", " ) }
139139 ON DUPLICATE KEY UPDATE
@@ -143,7 +143,7 @@ ON DUPLICATE KEY UPDATE
143143 foreach ( var upsert in upserts )
144144 {
145145 upsertCommand . AddParameter ( upsert . Instance . ToString ( "N" ) ) ;
146- upsertCommand . AddParameter ( upsert . IdHash . ToString ( "N" ) ) ;
146+ upsertCommand . AddParameter ( upsert . Position ) ;
147147 upsertCommand . AddParameter ( upsert . WorkStatus ) ;
148148 upsertCommand . AddParameter ( upsert . Result ?? ( object ) DBNull . Value ) ;
149149 upsertCommand . AddParameter ( JsonHelper . ToJson ( upsert . Exception ) ?? ( object ) DBNull . Value ) ;
@@ -156,12 +156,12 @@ ON DUPLICATE KEY UPDATE
156156 {
157157 var removes = changes
158158 . Where ( c => c . Operation == CrudOperation . Delete )
159- . Select ( c => new { Id = c . StoredId . AsGuid , IdHash = c . EffectId . ToStoredEffectId ( ) . Value } )
160- . GroupBy ( a => a . Id , a => a . IdHash )
159+ . Select ( c => new { Id = c . StoredId . AsGuid , Position = c . EffectId . ToStoredEffectId ( ) . Value . ToLong ( ) } )
160+ . GroupBy ( a => a . Id , a => a . Position )
161161 . ToList ( ) ;
162162 var predicates = removes
163163 . Select ( r =>
164- $ "(id = '{ r . Key : N} ' AND id_hash IN ({ r . Select ( id => $ "' { id : N } ' ") . StringJoin ( ", " ) } ))")
164+ $ "(id = '{ r . Key : N} ' AND position IN ({ r . Select ( id => $ "{ id } ") . StringJoin ( ", " ) } ))")
165165 . StringJoin ( $ " OR { Environment . NewLine } ") ;
166166 var removeSql = @$ "
167167 DELETE FROM { tablePrefix } _effects
0 commit comments