diff --git a/ext/session/sqlite3session.h b/ext/session/sqlite3session.h index fcde98f842..38164401f4 100644 --- a/ext/session/sqlite3session.h +++ b/ext/session/sqlite3session.h @@ -523,12 +523,84 @@ int sqlite3changeset_invert( ); /* -** CAPI3REF: Combine Two Changeset Objects +** CAPI3REF: Concatenate Two Changeset Objects +** +** This function is used to concatenate two changesets, A and B, into a +** single changeset. The result is a changeset equivalent to applying +** changeset A followed by changeset B. +** +** Rows are identified by the values in their PRIMARY KEY columns. A change +** in changeset A is considered to apply to the same row as a change in +** changeset B if the two rows have the same primary key. +** +** Changes to rows that appear only in changeset A or B are copied into the +** output changeset. Or, if both changeset A and B contain a change that +** applies to a single row, the output depends on the type of each change, +** as follows: +** +** +** +** +**
Change A Change B Output Change +**
INSERT INSERT +** Change A is copied into the output changeset. Change B is discarded. +** This case does not occur if changeset B is recorded immediately after +** changeset A. +**
INSERT UPDATE +** An INSERT change is copied into the output changeset. The values in +** the INSERT change are as if the row was inserted by change A and then +** updated according to change B. +**
INSERT DELETE +** No change at all is copied into the output changeset. +**
UPDATE INSERT +** Change A is copied into the output changeset. Change B is discarded. +** This case does not occur if changeset B is recorded immediately after +** changeset A. +**
UPDATE UPDATE +** A single UPDATE is copied into the output changeset. The accompanying +** values are as if the row was updated once by change A and then again +** by change B. +**
UPDATE DELETE +** A single DELETE is copied into the output changeset. +**
DELETE INSERT +** If one or more of the column values in the row inserted by change +** B differ from those in the row deleted by change A, an UPDATE +** change is added to the output changeset. Otherwise, if the inserted +** row is exactly the same as the deleted row, no change is added to +** the output changeset. +**
DELETE UPDATE +** Change A is copied into the output changeset. Change B is discarded. +** This case does not occur if changeset B is recorded immediately after +** changeset A. +**
DELETE DELETE +** Change A is copied into the output changeset. Change B is discarded. +** This case does not occur if changeset B is recorded immediately after +** changeset A. +**
+** +** If the two changesets contain changes to the same table, then the number +** of columns and the position of the primary key columns for the table must +** be the same in each changeset. If this is not the case, attempting to +** concatenate the two changesets together fails and this function returns +** SQLITE_SCHEMA. If either of the two input changesets appear to be corrupt, +** and the corruption is detected, SQLITE_CORRUPT is returned. Or, if an +** out-of-memory condition occurs during processing, this function returns +** SQLITE_NOMEM. +** +** If none of the above errors occur, SQLITE_OK is returned and *ppOut set +** to point to a buffer containing the output changeset. It is the +** responsibility of the caller to eventually call sqlite3_free() on *ppOut +** to release memory allocated for the buffer. *pnOut is set to the number +** of bytes in the output changeset. If an error does occur, both *ppOut and +** *pnOut are set to zero before returning. */ int sqlite3changeset_concat( - int nLeft, void *pLeft, /* First input changeset */ - int nRight, void *Right, /* Second input changeset */ - int *pnOut, void **ppOut /* OUT: Output changeset */ + int nA, /* Number of bytes in buffer pA */ + void *pA, /* Pointer to buffer containing changeset A */ + int nB, /* Number of bytes in buffer pB */ + void *pB, /* Pointer to buffer containing changeset B */ + int *pnOut, /* OUT: Number of bytes in output changeset */ + void **ppOut /* OUT: Buffer containing output changeset */ ); /* diff --git a/manifest b/manifest index 7b1c552c55..be42cd3f25 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sfurther\stests\sfor\sthe\ssqlite3changeset_concat()\sfunction.\sAlso\sfixes. -D 2011-04-14T18:01:41.789 +C Add\sdocumentation\sfor\ssqlite3changeset_concat()\sto\ssqlite3session.h. +D 2011-04-15T12:04:50.155 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7a4d9524721d40ef9ee26f93f9bd6a51dba106f2 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -107,7 +107,7 @@ F ext/session/session5.test 9dff891440dc3a424daea914b7e08e9f137272ed F ext/session/session_common.tcl fb91560b6dbd086010df8b3a137a452f1ac21a28 F ext/session/sessionfault.test 2544a2e2ecad56e3c07a32c09799871d243c114c F ext/session/sqlite3session.c abf9846341847c5b81040683b143b511ee828f2e -F ext/session/sqlite3session.h e64876b299dcd1f8c9d043d59bfe14a94ee6b2ba +F ext/session/sqlite3session.h 665f5591562e3c71eb3d0da26f1a1efae26f7bcf F ext/session/test_session.c f4d1dca94db71ec2177ee61eab51e718e58476d7 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 @@ -938,7 +938,7 @@ F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 8927b2260b8d84f53776cb29e1d2fa41b6b0de0e -R f3f9539d9ce74ceea388d1aad2d1949b +P 1fc3f15d88c160b45642b46d1d54c591af058ba2 +R 5b10e49a76b6665385d53106c727e888 U dan -Z 58678ea87adc6f0684f4c0fc5f0a6d31 +Z 6bd794c4ce6596f42844ff8d0a6b8d50 diff --git a/manifest.uuid b/manifest.uuid index d6d4737a85..7b35dd9932 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1fc3f15d88c160b45642b46d1d54c591af058ba2 \ No newline at end of file +ada9efa53a6ea55f89d237cfd530f1d180343e19 \ No newline at end of file