lcCouchQueryBuilder Reference

Stack

preOpenStack

Summary

Used to execute code before the stack opens

Name

lcCouchQueryBuilder

Card

Stack

couchSetSSLVerification

Summary

Set SSL verification to false if a self signed certificate is used

Name

lcCouchQueryBuilder

Parameters

  • pBool Boolean true or false (default true)

Card

Stack

couchInit

Summary

Sets the header to connect to CouchDB

Name

lcCouchQueryBuilder

Parameters

  • pPassword String The CouchDB password
  • pUrl String Full url to the database (example: http://localhost:5984/mydb)
  • pUsername String The CouchDB username

Returns

Array Connection information

Card

Stack

Example

put "testuser" into tUsername
put "mypass" into tPassword
put "http://localhost:5984/mydb" into tURL

put couchInit(tURL, tUsername, tPassword) into tResult

couchGetDocument

Summary

Used to get a CouchDB Document

Name

lcCouchQueryBuilder

Parameters

  • pDocID String The id of the document

Returns

Array An array containing the document

Card

Stack

Example

put couchInit(tURL, tUsername, tPassword) into tResult
put couchGetDocument("id_of_document") into tDoc

couchCreateDocument

Summary

Used to create a new CouchDB document

Name

lcCouchQueryBuilder

Parameters

  • pDocArray Array Array containing the document content
  • pDocName String The name of the document (optional, by default a uuid is created)

Returns

Array Array with url response

Card

Stack

Example

put empty into tDoc
put "James" into tDoc["firstname"]
put "Hauser" into tDoc["lastname"]
put couchInit(tURL, tUsername, tPassword) into tResult
put couchCreateDocument(tDoc) into tResult

couchUpdateDocument

Summary

Used to update a CouchDB document

Name

lcCouchQueryBuilder

Parameters

  • pDocArray String An array containing the document
  • pDocID String The id of the document
  • pDocRev String The revision id of the document

Returns

Array Array with url response

Card

Stack

Example

put empty into tDoc
put "James" into tDoc["firstname"]
put "Hauser" into tDoc["lastname"]
put couchInit(tURL, tUsername, tPassword) into tResult
put couchGetDocument("id_of_document") into tDoc
put couchUpdateDocument(tDoc["_id"], tDoc["_rev"], tDoc) into tResult

couchDeleteDocument

Summary

Used to delete a document

Name

lcCouchQueryBuilder

Parameters

  • pDocID String The id of the document
  • pDocRev String The revision id of the document

Returns

Array Array with url response

Card

Stack

Example

put couchInit(tURL, tUsername, tPassword) into tResult
put couchGetDocument("id_of_document") into tDoc
put couchDeleteDocument(tDoc["_id"], tDoc["_rev"]) into tResult

couchAddAttachment

Summary

Used to upload an attachment to a document

Name

lcCouchQueryBuilder

Parameters

  • pContent String The content to upload (in binary or text form)
  • pStatusObjectID String The long ID of the stack or card
  • pDocID String The id of the document
  • pDocRev String The revision id of the document
  • pFileName String The name of the file to upload
  • pContentType String The content type

Returns

Array Array with the url response

Card

Stack

Example

put url ("binfile:test.jpg") into tContent

put couchInit(tURL, tUsername, tPassword) into tResult
put couchGetDocument("id_of_document") into tDoc
put couchAddAttachment(tDoc["_id"], tDoc["_rev"], "test.jpg", "image/jpg", tContent, the long id of me) into tResult

couchRemoveAttachment

Summary

Used to delete an attachment attached to the document

Name

lcCouchQueryBuilder

Parameters

  • pFileName String The name of the file to delete
  • pDocID String The id of the document
  • pDocRev String The revision id of the document

Returns

Array Array with the url response

Card

Stack

Example

put couchInit(tURL, tUsername, tPassword) into tResult
put couchGetDocument("id_of_document") into tDoc
put couchRemoveAttachment(tDoc["_id"], tDoc["_rev"], "test.jpg") into tResult

couchQueryView

Summary

Used to query a design document

Name

lcCouchQueryBuilder

Parameters

  • pDesignName The design name (optional, default: the same name as the db name)
  • pView String The the name of the view
  • pParams Array An array with parameters

Returns

Array Array with the response values

Card

Stack

Example

put empty into tParams
put 0 into tParams["skip"]
put 10 into tParams["limit"]
put couchInit(tURL, tUsername, tPassword) into tResult
put couchQueryView("users", tParams) into tUsers

Reference

Query Options

couchQueryAllDocs

Summary

Used to query all documents in a database

Name

lcCouchQueryBuilder

Parameters

  • pParams Array An array with parameters

Returns

Array Array with the response values

Card

Stack

Example

put empty into tParams
put 0 into tParams["skip"]
put 10 into tParams["limit"]
put couchInit(tURL, tUsername, tPassword) into tResult
put couchQueryAllDocs(tParams) into tRecords

Reference

Query Options

couchFetchAttachmentMeta

Summary

Used to fetch the metadata of the attachments of a document

Name

lcCouchQueryBuilder

Parameters

  • pDocArr An array with the document content

Returns

Array Array with the metadata of the attachments

Card

Stack

Example

put couchInit(tURL, tUsername, tPassword) into tResult
put couchGetDocument("id_of_document") into tDoc
put couchFetchAttachmentMeta tDoc into tMetaData

createParamsFromArray

Summary

Used to create url parameters from an array

Name

lcCouchQueryBuilder

Parameters

  • pArr Array Array with url parameters

Returns

String String with url parameters

Card

Stack

Example

put empty into tParams
put 10 into tParams["limit"]
put 0 into tParams["skip"]
put createParamsFromArray(tParams) into tUrlParamString

couchReset

Summary

Used to reset the CouchDB connection

Name

lcCouchQueryBuilder

Card

Stack

Leave A Reply