{"id":11224,"date":"2021-06-07T00:00:20","date_gmt":"2021-06-07T07:00:20","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=11224"},"modified":"2025-06-13T21:48:27","modified_gmt":"2025-06-14T04:48:27","slug":"using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/","title":{"rendered":"Using libcouchbase \/ C SDK to run transactions with Couchbase 7.0"},"content":{"rendered":"<p><span style=\"font-weight: 400;\"><strong>Couchbase Server 7.0 now supports N1QL transactions.<\/strong> <\/span><\/p>\r\n<p><span style=\"font-weight: 400;\">Let&#8217;s try writing a C program that performs a set of transactions on a single node.<\/span><\/p>\r\n<p><span style=\"font-weight: 400;\"><strong>Step 1:<\/strong> We first decide how to call the program. The inputs will be the URL to the Couchbase bucket that we wish to run queries against, and the credentials (username followed by the password).\u00a0<\/span><\/p>\r\n\r\nUsage: \r\n<pre>\r\n.\/n1ql couchbase:\/\/localhost\/test Administrator password\r\n<\/pre><br \/>\r\n\r\n<p><span style=\"font-weight: 400;\">With N1QL transactions, a txid value is returned from the START TRANSACTION command. This is used with all subsequent N1QL queries within the transaction until the final COMMIT or ROLLBACK. So we must declare a transaction ID in the main function that we can pass to the remaining query requests that are part of the transaction.\u00a0<\/span><\/p>\r\n<p><span style=\"font-weight: 400;\"><strong>Step 2:<\/strong> Initialize a pointer that will be used to save the transaction ID from the BEGIN TRANSACTION query. This ID will be used in the entire transaction.<\/span><\/p>\r\n\r\n\r\n<pre>\r\nchar *transaction_id = (char *)malloc(64 * sizeof(char));\r\n<\/pre><br \/>\r\n\r\n\r\n<p><span style=\"font-weight: 400;\"><strong>Step 3:<\/strong> Initialize the cluster\u00a0<\/span><\/p>\r\n<p><span style=\"font-weight: 400;\">A connection to a Couchbase Server cluster is represented by a <\/span><span style=\"font-weight: 400;\">lcb_INSTANCE<\/span><span style=\"font-weight: 400;\"> object.<\/span><\/p>\r\n<p><span style=\"font-weight: 400;\">lcb_INSTANCE *instance;<\/span><\/p>\r\n<p><span style=\"font-weight: 400;\">The set of allowed operations depends on the type of this object, and whether the bucket is associated with it. Here we use the type Cluster. <\/span><span style=\"font-weight: 400;\">The simplest way to create a cluster object is to call <\/span><span style=\"font-weight: 400;\">lcb_create<\/span><span style=\"font-weight: 400;\"> to create a Couchbase handle by passing <\/span><span style=\"font-weight: 400;\">LCB_TYPE_CLUSTER<\/span><span style=\"font-weight: 400;\"> with a connection string, username, and password. Next, we schedule a connection using lcb_connect(), then we check if the bucket exists.\u00a0<\/span><\/p>\r\n\r\n<pre>\r\nlcb_CREATEOPTS *create_options = NULL;\r\nlcb_createopts_create(&create_options, LCB_TYPE_CLUSTER);\r\nlcb_createopts_connstr(create_options, argv[1], strlen(argv[1]));\r\nlcb_createopts_credentials(create_options, argv[2], strlen(argv[2]), argv[3], strlen(argv[3]));\r\ncheck(lcb_create(&instance, create_options), \"create couchbase handle\");\r\nlcb_createopts_destroy(create_options);\r\ncheck(lcb_connect(instance), \"schedule connection\");\r\nlcb_wait(instance, LCB_WAIT_DEFAULT);\r\ncheck(lcb_cntl(instance, LCB_CNTL_GET, LCB_CNTL_BUCKETNAME, &bucket), \"get bucket name\"); \r\n<\/pre><br \/>\r\n\r\n<p><span style=\"font-weight: 400;\"><strong>Step 4:<\/strong> Run the queries in query.h<\/span><\/p>\r\n<p><span style=\"font-weight: 400;\">We have the queries corresponding to our transaction defined in queries.h.\u00a0<\/span><\/p>\r\n\r\n<pre>\r\nBEGIN WORK\r\nINSERT INTO test VALUES(\\\"kkk1\\\", {\\\"a\\\":1})\r\nSELECT d.*, META(d).id FROM test AS d WHERE d.a &gt;= 0\r\nSAVEPOINT s1\r\nUPDATE test AS d SET d.b = 10 WHERE d.a &gt; 0\r\nSELECT d.*, META(d).id FROM test AS d WHERE d.a &gt;= 0\r\nSAVEPOINT s2\r\nUPDATE test AS d SET d.b = 10, d.c = \\\"xyz\\\" WHERE d.a &gt; 0\r\nSELECT d.*, META(d).id FROM test AS d WHERE d.a &gt;= 0\r\nROLLBACK TRAN TO SAVEPOINT s2\r\nSELECT d.*, META(d).id FROM test AS d WHERE d.a &gt;= 0\r\nINSERT INTO test VALUES(\\\"kkk2\\\", {\\\"a\\\":2})\r\nUPDATE test AS d SET d.b = 20, d.c = \\\"xyz\\\" WHERE d.a &gt; 0\r\nCOMMIT WORK\r\n<\/pre><br \/>\r\n\r\n<p><span style=\"font-weight: 400;\">We need to use a JSON parsing library in C to handle the query results to extract the transaction ID. Here we can use the json-c library. In order to get the transaction ID from the BEGIN WORK statement (the first statement), we use the txid callback function. For processing and running the other queries, we call the row callback function. This will return the result rows.\u00a0<\/span><\/p>\r\n\r\n<pre>\r\nfor> (ii = >0>; ii &lt; num_queries; ii++) {>\r\n        >lcb_CMDQUERY> *>cmd>;      >\r\n        >lcb_cmdquery_create>(&cmd);>\r\n        >check>(lcb_cmdquery_statement(cmd, queries[ii].query, strlen(queries[ii].query)), >\"set QUERY statement\">);>\r\n        >printf>(>\"----&gt; \\x1b[1m%s\\x1b[0m\\n\">, queries[ii].query);>\r\n        >if> (ii == >0>) {>\r\n            >lcb_cmdquery_callback>(cmd, txid_callback);>\r\n            >lcb_wait>(instance, LCB_WAIT_DEFAULT);>\r\n            >check>(lcb_query(instance, transaction_id, cmd), >\"schedule QUERY operation\">);>\r\n            >lcb_wait>(instance, LCB_WAIT_DEFAULT);      >\r\n      } >else> {>\r\n            >char> buf>[100];>\r\n            >sprintf>(buf,>\"\\\">%s\\>\"\">,transaction_id);>\r\n            >lcb_cmdquery_callback>(cmd, row_callback);>\r\n\r\n          >\/\/ SET rest option pretty to true and txtimeout to 3s>\r\n            >check>(lcb_cmdquery_option(cmd, >\"pretty\">, strlen(>\"pretty\">), >\"true\">, strlen(>\"true\">)),>\"set QUERY 'pretty' option\">);>\r\n            >check>(lcb_cmdquery_option(cmd, >\"txtimeout\">, strlen(>\"txtimeout\">), >\"\\\">3s>\\>\"\">, strlen(>\"\\\">3s>\\>\"\">)),>\"set QUERY 'txtimeout' option\">);>\r\n            check(lcb_cmdquery_option(cmd, >\"txid\">, >strlen>(>\"txid\">),buf, >strlen>(buf)),>\"set QUERY 'txtimeout' option\">);>\r\n            check(lcb_query(instance, >NULL>, cmd), >\"schedule QUERY operation\">);>\r\n            lcb_wait(instance, LCB_WAIT_DEFAULT);>\r\n      }      >\r\n        lcb_cmdquery_destroy(cmd);>\r\n        lcb_wait(instance, LCB_WAIT_DEFAULT);>\r\n    }>\r\n<\/pre><br \/>\r\n\r\n<p><span style=\"font-weight: 400;\">Prior to running the queries, we set three query parameters: pretty, txtimeout (transaction timeout), and the txid that we got from the first statement. These are request-level parameters.\u00a0<\/span><\/p>\r\n<p><span style=\"font-weight: 400;\">Now let&#8217;s take a deep dive into the callback functions\u00a0<\/span><\/p>\r\n<p><span style=\"font-weight: 400;\">Txid_Callback &#8211;\u00a0<\/span><\/p>\r\n<p><span style=\"font-weight: 400;\">Here we need to parse the JSON response from running the BEGIN WORK statement to extract the txid to pass into the subsequent statements as a query parameter using the JSONC library. For this we use the previously created pointer and set it in the lcb_respquery_cookie method. This sets the operation cookie &#8211; which means when we run lcb_query, there is a cookie argument to it and lcb_respquery_cookie gets this pointer in our callback function. (We created a pointer in the main function and set it in the callback function)<\/span><\/p>\r\n\r\n<pre>\r\n\/* create pointer transaction_id and set it in the callback  *\/\r\n  lcb_respquery_cookie(resp, (void **)&transaction_id);\r\n  check(lcb_respquery_status(resp),\"check response status\");\r\n  lcb_respquery_row(resp, &row, &nrow);\r\n  if (!lcb_respquery_is_final(resp)) {\r\n        parsed_json = json_tokener_parse(row);\r\n        json_object_object_get_ex(parsed_json, \"txid\", &txid_obj);\r\n        temp = json_object_get_string(txid_obj);\r\n        strcpy(transaction_id,temp);\r\n    }\r\n<\/pre><br \/>\r\n\r\n<p><span style=\"font-weight: 400;\">Row callback &#8211; This is used to parse and retrieve the result rows from the query run.\u00a0<\/span><\/p>\r\n\r\n<pre>\r\n    lcb_STATUS rc = lcb_respquery_status(resp);\r\n    lcb_respquery_row(resp, &row, &nrow);\r\n    ln2space(row, nrow);\r\n    fprintf(stderr, \"[\\x1b[%dmQUERY\\x1b[0m] %s, (%d) %.*s\\n\", err2color(rc), lcb_strerror_short(rc), (int)nrow,\r\n            (int)nrow, row);\r\n    if (lcb_respquery_is_final(resp)) {\r\n        fprintf(stderr, \"\\n\");\r\n    }\r\n}\r\n<\/pre><br \/>\r\n\r\n<p><span style=\"font-weight: 400;\">Here we get the query response, get the rows and print it.\u00a0<\/span><\/p>\r\n<p><span style=\"font-weight: 400;\">Using the above example, we can now use N1QL transactions in the C SDK. For the full code see and instructions on how to run it see &#8211; <\/span><a href=\"https:\/\/github.com\/ikandaswamy\/CBSDK_N1QLExamples\"><span style=\"font-weight: 400;\">https:\/\/github.com\/ikandaswamy\/CBSDK_N1QLExamples<\/span><\/a><\/p>\r\n\r\n<p>&nbsp;<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>Couchbase Server 7.0 now supports N1QL transactions. Let&#8217;s try writing a C program that performs a set of transactions on a single node. Step 1: We first decide how to call the program. The inputs will be the URL to [&hellip;]<\/p>\n","protected":false},"author":6882,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[9986,1812,2201,2396],"tags":[],"ppma_author":[9057],"class_list":["post-11224","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-c","category-n1ql-query","category-tools-sdks","category-transactions"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.8 (Yoast SEO v25.8) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using libcouchbase \/ C SDK to run transactions with Couchbase 7.0 - The Couchbase Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using libcouchbase \/ C SDK to run transactions with Couchbase 7.0\" \/>\n<meta property=\"og:description\" content=\"Couchbase Server 7.0 now supports N1QL transactions. Let&#8217;s try writing a C program that performs a set of transactions on a single node. Step 1: We first decide how to call the program. The inputs will be the URL to [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-07T07:00:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T04:48:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1800\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Isha Kandaswamy\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Isha Kandaswamy\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/\"},\"author\":{\"name\":\"Isha Kandaswamy\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/f236f76f209f447fbc8fd46d91eb7e52\"},\"headline\":\"Using libcouchbase \/ C SDK to run transactions with Couchbase 7.0\",\"datePublished\":\"2021-06-07T07:00:20+00:00\",\"dateModified\":\"2025-06-14T04:48:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/\"},\"wordCount\":534,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"articleSection\":[\"C\/C++\",\"SQL++ \/ N1QL Query\",\"Tools &amp; SDKs\",\"Transactions\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/\",\"name\":\"Using libcouchbase \/ C SDK to run transactions with Couchbase 7.0 - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2021-06-07T07:00:20+00:00\",\"dateModified\":\"2025-06-14T04:48:27+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using libcouchbase \/ C SDK to run transactions with Couchbase 7.0\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/f236f76f209f447fbc8fd46d91eb7e52\",\"name\":\"Isha Kandaswamy\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/e8464106b598ad96e4e1446687ce93f6\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/9c28181876ed38a9634b77ddbe73ada95b0f82838c0cce722be73968630d41e1?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/9c28181876ed38a9634b77ddbe73ada95b0f82838c0cce722be73968630d41e1?s=96&d=mm&r=g\",\"caption\":\"Isha Kandaswamy\"},\"description\":\"Isha Kandaswamy is a Senior Software Engineer at Couchbase. Isha is responsible for the development of designing the different features and tools for the N1QL Query Language -SQL for Json. Also, Designing and implementing features and tools for the N1QL query language.\",\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/isha-kandaswamy\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Using libcouchbase \/ C SDK to run transactions with Couchbase 7.0 - The Couchbase Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/","og_locale":"en_US","og_type":"article","og_title":"Using libcouchbase \/ C SDK to run transactions with Couchbase 7.0","og_description":"Couchbase Server 7.0 now supports N1QL transactions. Let&#8217;s try writing a C program that performs a set of transactions on a single node. Step 1: We first decide how to call the program. The inputs will be the URL to [&hellip;]","og_url":"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/","og_site_name":"The Couchbase Blog","article_published_time":"2021-06-07T07:00:20+00:00","article_modified_time":"2025-06-14T04:48:27+00:00","og_image":[{"width":1800,"height":630,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","type":"image\/png"}],"author":"Isha Kandaswamy","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Isha Kandaswamy","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/"},"author":{"name":"Isha Kandaswamy","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/f236f76f209f447fbc8fd46d91eb7e52"},"headline":"Using libcouchbase \/ C SDK to run transactions with Couchbase 7.0","datePublished":"2021-06-07T07:00:20+00:00","dateModified":"2025-06-14T04:48:27+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/"},"wordCount":534,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","articleSection":["C\/C++","SQL++ \/ N1QL Query","Tools &amp; SDKs","Transactions"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/","url":"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/","name":"Using libcouchbase \/ C SDK to run transactions with Couchbase 7.0 - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2021-06-07T07:00:20+00:00","dateModified":"2025-06-14T04:48:27+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Using libcouchbase \/ C SDK to run transactions with Couchbase 7.0"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/f236f76f209f447fbc8fd46d91eb7e52","name":"Isha Kandaswamy","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/e8464106b598ad96e4e1446687ce93f6","url":"https:\/\/secure.gravatar.com\/avatar\/9c28181876ed38a9634b77ddbe73ada95b0f82838c0cce722be73968630d41e1?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9c28181876ed38a9634b77ddbe73ada95b0f82838c0cce722be73968630d41e1?s=96&d=mm&r=g","caption":"Isha Kandaswamy"},"description":"Isha Kandaswamy is a Senior Software Engineer at Couchbase. Isha is responsible for the development of designing the different features and tools for the N1QL Query Language -SQL for Json. Also, Designing and implementing features and tools for the N1QL query language.","url":"https:\/\/www.couchbase.com\/blog\/author\/isha-kandaswamy\/"}]}},"authors":[{"term_id":9057,"user_id":6882,"is_guest":0,"slug":"isha-kandaswamy","display_name":"Isha Kandaswamy","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/9c28181876ed38a9634b77ddbe73ada95b0f82838c0cce722be73968630d41e1?s=96&d=mm&r=g","author_category":"","last_name":"Kandaswamy","first_name":"Isha","job_title":"","user_url":"","description":"Isha Kandaswamy is a Senior Software Engineer at Couchbase. Isha is responsible for the development of designing the different features and tools for the N1QL Query Language -SQL for Json. Also, Designing and implementing features and tools for the N1QL query language."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/11224","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/users\/6882"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=11224"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/11224\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/13873"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=11224"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=11224"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=11224"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=11224"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}