Skip to content

Commit 33c7ac7

Browse files
authored
1 parent 7a8dfa6 commit 33c7ac7

21 files changed

+200
-191
lines changed

modules/ROOT/pages/_partials/_attributes-local.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ endif::[]
297297
:snippets-pfx--android-kt: {snippets-pfx--android}kotlin/com/couchbase/code_snippets/
298298
:snippets-pfx--android-java: {snippets-pfx--android}java/com/couchbase/code_snippets/
299299
:snippets-pfx: example$code_snippets/
300-
:snippets-content--android-kotlin: {lang-mod-android}:{snippets-pfx--android-kt}Examples.kt
300+
// :snippets-content--android-kotlin: {lang-mod-android}:{snippets-pfx--android-kt}Examples.kt
301+
:snippets-content--android-kotlin: {lang-mod-android}:example$codesnippet_collection.kt
301302
:snippets-content--android-java: {lang-mod-android}:{snippets-pfx--android-java}Examples.java
302303
:snippets-content--c: {lang-mod-c}:{snippets-pfx}main.c
303304
:snippets-content--csharp: {lang-mod-csharp}:{snippets-pfx}Program.cs

modules/ROOT/pages/_partials/_block_tabbed_code_example.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// include::partial$_block_show_snippet.adoc[]
1616
// :param_tags!:
1717
//
18-
:self-tags:
18+
:self-tags: **
1919
ifdef::is-android[:is-tabbed:]
2020
ifdef::param-tags[:self-tags: {param-tags}]
2121

modules/ROOT/pages/_partials/_page-index.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ ifndef::version[:version: version undefined]
178178
:release-notes--xref: {cbl--xref}{release-notes--page}[Release Notes]
179179

180180
:replication--page: replication.adoc
181-
:replication--xref: {cbl--xref}{replication--page}[Remote Sync Gateway]
181+
:replication--pfx: {cbl--xref}{replication--page}
182+
:replication--xref: {replication--pfx}[Remote Sync Gateway]
183+
:replication--xref--auto-purge: {replication--pfx}#anchor-auto-purge-on-revoke[Auto-purge on Channel Access Revocation]
182184

183185
:save-blob--page: save-blob.adoc
184186
:save-blob--xref: {cbl--xref}{save-blob--page}[Save Blob]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Inclusion used in {src-lang}-database.adoc files
2-
`cblite` is a command-line tool for inspecting and querying Couchbase Lite 2.x databases.
2+
`cblite` is a command-line tool for inspecting and querying Couchbase Lite databases.
33

44
You can download and build it from the couchbaselabs https://github.com/couchbaselabs/couchbase-mobile-tools/blob/master/README.cblite.md[GitHub repository].
55
Note that the `cblite` tool is not supported by the https://www.couchbase.com/support-policy[Couchbase Support Policy].

modules/ROOT/pages/_partials/commons/common-blob.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ When a document is synchronized, the Couchbase Lite replicator adds an `_attachm
2222

2323
== Blob Objects
2424

25-
2625
The blob as an object appears in a document as dictionary property -- see, for example _avatar_ in <<ex-blobobj>> and <<img-blob>>.
2726

2827
Alternatively, you can save the blob to a database without associating it with any documents.
@@ -120,3 +119,4 @@ You could retrieved the blob using the Sync Gateway REST API at http://localhost
120119
image::ROOT:attach-replicated.png[]
121120

122121

122+
// include::{root-partials}block-related-content-data.adoc[]

modules/ROOT/pages/_partials/commons/common-database.adoc

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// BEGIN -- page-inclusion -- common-database.adoc
22
// Applies to all platforms with some platform-specific differences
33

4+
45
include::{root-partials}_set-platform.adoc[]
56

67
:param-related: {blob--xref} | {document--xref} | {indexing--xref}
@@ -30,27 +31,26 @@ endif::[]
3031
[#open-db]
3132
== Create or Open Database
3233

33-
You can create a new database and-or open and existing database, using the {url-api-class-database} class.
34+
You can create a new database and-or open an existing database, using the {url-api-class-database} class.
3435
Just pass in a database name and optionally a {url-api-class-databasecfg} -- see <<ex-dbopen>>.
3536

3637
Things to watch for include:
3738

38-
* Opening/Creating a database is an asynchronous process
3939
* If the named database does not exist in the specified, or default, location then a new one is created
4040
* The database is created in a default location unless you specify a directory for it -- see: {url-api-class-databasecfg} and {url-api-method-databasecfg-setdir}
4141
+
4242
--
4343
TIP: Best Practice is to always specify the path to the database explicitly.
4444
4545
Typically, the default location for {param-title} is
46-
ifndef::is-csharp[]
47-
the application sandbox.
48-
endif::[]
46+
ifndef::is-csharp[the application sandbox]
47+
ifdef::is-c[or current working directory]
48+
.
4949
ifdef::is-csharp[]
5050
a platform-dependant location:
5151

5252
include::{module-partials}database-finding-file.adoc[tags=list-only]
53-
endif::[]
53+
endif::is-csharp[]
5454

5555
See also <<lbl-find-db-loc>>.
5656
--
@@ -60,41 +60,26 @@ See also <<lbl-find-db-loc>>.
6060
:param-tags: new-database
6161
include::{root-partials}_block_tabbed_code_example.adoc[]
6262
:param-tags!:
63-
<.> Here we are specifying the database directory path.
63+
// <.> Here we are specifying the database directory path.
6464

6565
== Close Database
6666

6767
You are advised to incorporate the closing of all open databases into your application workflow.
6868

69-
Closing a database is a simple, just use {url-api-method-database-close} -- see: <<ex-dbclose>>. +
70-
However, there are a number of things to be aware of:
69+
Closing a database is a simple, just use {url-api-method-database-close} -- see: <<ex-dbclose>>.
70+
This also closes
71+
ifndef::is-c[{fn-2-8}]
72+
active replications, listeners and-or live queries connected to the database.
7173

72-
* Closing a database is a *synchronous* operation, it is effective immediately
73-
* You cannot close a database that is not open. +
74-
Remember that opening (or creating) a database is asynchronous.
75-
So issuing a close immediately after initiating an open/create, may result in an error if that process has not completed.
74+
NOTE: Closing a database soon after starting a replication involving it can cause an exception as the asynchronous `replicator (start)` may not yet be `connected`.
7675

77-
* Closing a database
78-
ifndef::is-c[{fn-2-8}]
79-
also closes any active replications, listeners and-or live queries attached to the database. +
80-
Closing a database immediately after kicking-off a replication could cause the sync to generate an exception. +
81-
For example: +
82-
`IllegalStateException: Attempt to perform an operation on a closed database`
8376
ifndef::is-c[]
8477
.Safely Closing a Database pre 2.8
85-
[TIP]
86-
--
87-
. Stop any active live queries -- by removing the query's change listener
88-
. Remove any active replication change listeners
89-
. Stop any active replications -- this is an asynchronous operation
90-
. Wait for all active replications to fully stop -- for this you can monitor the replication status -- see: {xref-cbl-pg-replication--monitor-status}.
91-
. Finally, close the database
92-
93-
--
78+
TIP: Before closing, check that any attached listeners (query/replication/change) indicate they are at least at `connected` status before closing -- see for example: {xref-cbl-pg-replication--monitor-status}.
9479
endif::is-c[]
9580

96-
[#ex-dbclose]
9781
.Close a Database
82+
[#ex-dbclose]
9883
:param-tags: close-database
9984
include::{root-partials}_block_tabbed_code_example.adoc[]
10085
:param-tags!:

modules/ROOT/pages/_partials/commons/common-indexing.adoc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ include::{root-partials}_block-caveats.adoc[tag=index-partial-value]
3737
//end::overview[]
3838

3939

40-
.Creating a new index
41-
====
40+
== Creating a new index
4241

43-
This example creates a new index for the `type` and `name` properties, shown in this data model:
42+
<<ex-create-index>> creates a new index for the `type` and `name` properties, shown in this data model:
4443

44+
.Data Model
45+
====
4546
[source,json]
4647
----
4748
{
@@ -50,6 +51,7 @@ This example creates a new index for the `type` and `name` properties, shown in
5051
"name": "Apple Droid"
5152
}
5253
----
54+
====
5355

5456
The code to create the index will look something like this:
5557

modules/ROOT/pages/_partials/commons/common-querybuilder-n1ql.adoc

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ Then run the query using the`.execute()` method -- see {query-resultsets--xref}
3737

3838
.Running a N1QL Query
3939
[#ex-samplerun]
40-
:param-tags: query-syntax-n1ql-params
40+
:param-tags: query-syntax-n1ql
4141
include::partial$_block_tabbed_code_example.adoc[]
4242
:param-tags!:
43+
<.> Here we are accessing th current database using the shorthand notation *`_`* -- see the <<lbl-from>> clause for more on data source selection and <<lbl-query-params>> for more on parameterized queries.
4344

4445

4546
== Query Format
@@ -147,8 +148,6 @@ This behavior is inline with that of Couchbase Server N1QL -- see example in <<t
147148
|===
148149

149150

150-
151-
152151
=== Example
153152

154153
.SELECT properties
@@ -299,7 +298,7 @@ where = WHERE expression <.>
299298
<.> WHERE evalates `expression` to a BOOLEAN value.
300299
You can chain any number of Expressions in order to implement sophisticated filtering capabilities.
301300

302-
See also -- <<lbl-operators>> for more on building expressions
301+
See also -- <<lbl-operators>> for more on building expressions and <<lbl-query-params>> for more on parameterized queries.
303302

304303
=== Examples
305304

@@ -2010,5 +2009,20 @@ TOSTRING
20102009
|===
20112010
endif::is-c[]
20122011

2012+
[#lbl-query-params]
2013+
== Query Parameters
2014+
2015+
You can provide runtime parameters to yur N1QL query to make it more flexible.
2016+
2017+
To specify substitutable parameters within your query string prefix the name with *`$`*, `$type` -- see: <<ex-sample-params>>.
2018+
2019+
.Running a N1QL Query
2020+
[#ex-sample-params]
2021+
:param-tags: query-syntax-n1ql-params
2022+
include::partial$_block_tabbed_code_example.adoc[]
2023+
:param-tags!:
2024+
2025+
<.> Define a parameter placeholder `$type`
2026+
<.> Set the value of the `$type` parameter
20132027

20142028
// END --- inclusion -- common-querybuilder-n1ql.adoc

modules/ROOT/pages/_partials/database-encryption.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Couchbase Lite does not persist the key.
1919
It is the application's responsibility to manage the key and store it in a platform specific secure store such as Apple's https://developer.apple.com/documentation/security/keychain_services[Keychain] or Android's https://developer.android.com/training/articles/keystore[Keystore].
2020

2121
An encrypted database can only be opened with the same language SDK that was used to encrypt it in the first place.
22-
So a database encrypted using the Swift SDK, and then exported, is readable only by the Swift SDK.
22+
So a database encrypted using the {param-title} SDK, and then exported, is readable only by the {param-title} SDK.
2323

2424
==== Upgrading from 1.x when Encryption is Enabled
2525

modules/ROOT/pages/_partials/nav-skeleton.adoc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,18 @@ ifndef::is-c[** {querybuilder--xref}]
1616
** {query-troubleshooting--xref}
1717
* {fts--xref}
1818
* {indexing--xref}
19+
ifndef::is-c[]
1920
* {landing-replications--xref}
20-
ifndef::is-c[ ** {dbreplica--xref}]
21+
** {dbreplica--xref}]
2122
** {replication--xref}
22-
ifndef::is-c[]
2323
** {p2psync-websocket--xref}
2424
*** {p2psync-websocket-using-passive--xref}
2525
*** {p2psync-websocket-using-active--xref}
2626
*** {p2psync-custom--xref}
2727
endif::is-c[]
28+
ifdef::is-c[]
29+
* {replication--pfx}[Sync]
30+
endif::is-c[]
2831
* {conflict--xref}
2932
* {url-api-references}[API{nbsp}References]
3033
ifndef::is-c[* {dep-upgrade--xref}]

0 commit comments

Comments
 (0)