Fossil SCM
Minor performance improvement in sync_log_entry().
Commit
c0fd8338f616a72afc961fab54e3fe7a937db8f14d489e4fe91c42f383b120e4
Parent
1ec46849ff5e065…
1 file changed
+16
-12
+16
-12
| --- src/sync.c | ||
| +++ src/sync.c | ||
| @@ -111,27 +111,31 @@ | ||
| 111 | 111 | void sync_log_entry( |
| 112 | 112 | int syncFlags, /* Indicates whether a PUSH or PULL or both */ |
| 113 | 113 | const char *zRemote, /* Server with which we push or pull */ |
| 114 | 114 | const char *zType /* Type of sync. NULL for normal */ |
| 115 | 115 | ){ |
| 116 | + Stmt s; | |
| 117 | + db_prepare(&s, | |
| 118 | + "INSERT INTO repository.synclog(sfrom,sto,stime,stype)" | |
| 119 | + " VALUES(:sfrom,:sto,julianday(),:stype)" | |
| 120 | + " ON CONFLICT DO UPDATE SET stime=julianday()" | |
| 121 | + ); | |
| 116 | 122 | schema_synclog(); |
| 117 | 123 | if( syncFlags & (SYNC_PULL|SYNC_CLONE) ){ |
| 118 | - db_multi_exec( | |
| 119 | - "INSERT INTO repository.synclog(sfrom,sto,stime,stype)" | |
| 120 | - " VALUES(%Q,'this',julianday(),%Q)" | |
| 121 | - " ON CONFLICT DO UPDATE SET stime=julianday()", | |
| 122 | - zRemote, zType | |
| 123 | - ); | |
| 124 | + db_bind_text(&s, ":sfrom", zRemote); | |
| 125 | + db_bind_text(&s, ":sto", "this"); | |
| 126 | + db_bind_text(&s, ":stype", zType); | |
| 127 | + db_step(&s); | |
| 128 | + db_reset(&s); | |
| 124 | 129 | } |
| 125 | 130 | if( syncFlags & (SYNC_PUSH) ){ |
| 126 | - db_multi_exec( | |
| 127 | - "INSERT INTO repository.synclog(sfrom,sto,stime,stype)" | |
| 128 | - " VALUES('this',%Q,julianday(),%Q)" | |
| 129 | - " ON CONFLICT DO UPDATE SET stime=julianday()", | |
| 130 | - zRemote, zType | |
| 131 | - ); | |
| 131 | + db_bind_text(&s, ":sfrom", "this"); | |
| 132 | + db_bind_text(&s, ":sto", zRemote); | |
| 133 | + db_bind_text(&s, ":stype", zType); | |
| 134 | + db_step(&s); | |
| 132 | 135 | } |
| 136 | + db_finalize(&s); | |
| 133 | 137 | } |
| 134 | 138 | |
| 135 | 139 | |
| 136 | 140 | /* |
| 137 | 141 | ** If the repository is configured for autosyncing, then do an |
| 138 | 142 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -111,27 +111,31 @@ | |
| 111 | void sync_log_entry( |
| 112 | int syncFlags, /* Indicates whether a PUSH or PULL or both */ |
| 113 | const char *zRemote, /* Server with which we push or pull */ |
| 114 | const char *zType /* Type of sync. NULL for normal */ |
| 115 | ){ |
| 116 | schema_synclog(); |
| 117 | if( syncFlags & (SYNC_PULL|SYNC_CLONE) ){ |
| 118 | db_multi_exec( |
| 119 | "INSERT INTO repository.synclog(sfrom,sto,stime,stype)" |
| 120 | " VALUES(%Q,'this',julianday(),%Q)" |
| 121 | " ON CONFLICT DO UPDATE SET stime=julianday()", |
| 122 | zRemote, zType |
| 123 | ); |
| 124 | } |
| 125 | if( syncFlags & (SYNC_PUSH) ){ |
| 126 | db_multi_exec( |
| 127 | "INSERT INTO repository.synclog(sfrom,sto,stime,stype)" |
| 128 | " VALUES('this',%Q,julianday(),%Q)" |
| 129 | " ON CONFLICT DO UPDATE SET stime=julianday()", |
| 130 | zRemote, zType |
| 131 | ); |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | |
| 136 | /* |
| 137 | ** If the repository is configured for autosyncing, then do an |
| 138 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -111,27 +111,31 @@ | |
| 111 | void sync_log_entry( |
| 112 | int syncFlags, /* Indicates whether a PUSH or PULL or both */ |
| 113 | const char *zRemote, /* Server with which we push or pull */ |
| 114 | const char *zType /* Type of sync. NULL for normal */ |
| 115 | ){ |
| 116 | Stmt s; |
| 117 | db_prepare(&s, |
| 118 | "INSERT INTO repository.synclog(sfrom,sto,stime,stype)" |
| 119 | " VALUES(:sfrom,:sto,julianday(),:stype)" |
| 120 | " ON CONFLICT DO UPDATE SET stime=julianday()" |
| 121 | ); |
| 122 | schema_synclog(); |
| 123 | if( syncFlags & (SYNC_PULL|SYNC_CLONE) ){ |
| 124 | db_bind_text(&s, ":sfrom", zRemote); |
| 125 | db_bind_text(&s, ":sto", "this"); |
| 126 | db_bind_text(&s, ":stype", zType); |
| 127 | db_step(&s); |
| 128 | db_reset(&s); |
| 129 | } |
| 130 | if( syncFlags & (SYNC_PUSH) ){ |
| 131 | db_bind_text(&s, ":sfrom", "this"); |
| 132 | db_bind_text(&s, ":sto", zRemote); |
| 133 | db_bind_text(&s, ":stype", zType); |
| 134 | db_step(&s); |
| 135 | } |
| 136 | db_finalize(&s); |
| 137 | } |
| 138 | |
| 139 | |
| 140 | /* |
| 141 | ** If the repository is configured for autosyncing, then do an |
| 142 |