{"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\/es\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/","title":{"rendered":"Uso de libcouchbase \/ C SDK para ejecutar transacciones con Couchbase 7.0"},"content":{"rendered":"<p><span style=\"font-weight: 400;\"><strong>Couchbase Server 7.0 ahora soporta transacciones N1QL.<\/strong> <\/span><\/p>\r\n<p><span style=\"font-weight: 400;\">Intentemos escribir un programa en C que realice un conjunto de transacciones en un \u00fanico nodo.<\/span><\/p>\r\n<p><span style=\"font-weight: 400;\"><strong>Primer paso:<\/strong> Primero decidimos c\u00f3mo llamar al programa. Las entradas ser\u00e1n la URL del bucket de Couchbase contra el que deseamos ejecutar consultas, y las credenciales (nombre de usuario seguido de la contrase\u00f1a).\u00a0<\/span><\/p>\r\n\r\nUso: \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;\">Con las transacciones N1QL, se devuelve un valor txid desde el comando START TRANSACTION. Este es usado con todas las subsecuentes consultas N1QL dentro de la transacci\u00f3n hasta el final COMMIT o ROLLBACK. As\u00ed que debemos declarar un ID de transacci\u00f3n en la funci\u00f3n principal que podamos pasar a las solicitudes de consulta restantes que forman parte de la transacci\u00f3n.\u00a0<\/span><\/p>\r\n<p><span style=\"font-weight: 400;\"><strong>Segundo paso:<\/strong> Inicializa un puntero que se utilizar\u00e1 para guardar el ID de transacci\u00f3n de la consulta BEGIN TRANSACTION. Este ID se utilizar\u00e1 en toda la transacci\u00f3n.<\/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>Paso 3:<\/strong> Inicializar el cl\u00faster\u00a0<\/span><\/p>\r\n<p><span style=\"font-weight: 400;\">Una conexi\u00f3n a un cluster de Couchbase Server est\u00e1 representada por un <\/span><span style=\"font-weight: 400;\">lcb_INSTANCE<\/span><span style=\"font-weight: 400;\"> objeto.<\/span><\/p>\r\n<p><span style=\"font-weight: 400;\">lcb_INSTANCE *instance;<\/span><\/p>\r\n<p><span style=\"font-weight: 400;\">El conjunto de operaciones permitidas depende del tipo de este objeto y de si el cubo est\u00e1 asociado a \u00e9l. Aqu\u00ed utilizamos el tipo Cluster. <\/span><span style=\"font-weight: 400;\">La forma m\u00e1s sencilla de crear un objeto cluster es llamar a <\/span><span style=\"font-weight: 400;\">lcb_create<\/span><span style=\"font-weight: 400;\"> para crear un manejador Couchbase pasando <\/span><span style=\"font-weight: 400;\">LCB_TIPO_CLUSTER<\/span><span style=\"font-weight: 400;\"> con una cadena de conexi\u00f3n, un nombre de usuario y una contrase\u00f1a. A continuaci\u00f3n, programamos una conexi\u00f3n utilizando lcb_connect(), y luego comprobamos si el bucket existe.\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>Paso 4:<\/strong> Ejecuta las consultas en query.h<\/span><\/p>\r\n<p><span style=\"font-weight: 400;\">Tenemos las consultas correspondientes a nuestra transacci\u00f3n definidas en 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;\">Necesitamos utilizar una librer\u00eda de an\u00e1lisis JSON en C para manejar los resultados de la consulta y extraer el ID de la transacci\u00f3n. Aqu\u00ed podemos usar la librer\u00eda json-c. Para obtener el ID de transacci\u00f3n de la sentencia BEGIN WORK (la primera sentencia), utilizamos la funci\u00f3n callback txid. Para procesar y ejecutar las otras consultas, llamamos a la funci\u00f3n row callback. Esto devolver\u00e1 las filas de resultados.\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;\">Antes de ejecutar las consultas, establecemos tres par\u00e1metros de consulta: pretty, txtimeout (tiempo de espera de la transacci\u00f3n) y el txid que obtuvimos de la primera sentencia. Estos son par\u00e1metros a nivel de petici\u00f3n.\u00a0<\/span><\/p>\r\n<p><span style=\"font-weight: 400;\">Ahora vamos a profundizar en las funciones callback\u00a0<\/span><\/p>\r\n<p><span style=\"font-weight: 400;\">Txid_Callback -\u00a0<\/span><\/p>\r\n<p><span style=\"font-weight: 400;\">Aqu\u00ed tenemos que analizar la respuesta JSON de la ejecuci\u00f3n de la sentencia BEGIN WORK para extraer el txid y pasarlo a las sentencias posteriores como par\u00e1metro de consulta utilizando la librer\u00eda JSONC. Para ello utilizamos el puntero creado anteriormente y lo establecemos en el m\u00e9todo lcb_respquery_cookie. Esto establece la cookie de la operaci\u00f3n - lo que significa que cuando ejecutamos lcb_query, hay un argumento cookie para ello y lcb_respquery_cookie obtiene este puntero en nuestra funci\u00f3n callback. (Creamos un puntero en la funci\u00f3n principal y lo establecemos en la funci\u00f3n callback)<\/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 - Se utiliza para analizar y recuperar las filas de resultados de la ejecuci\u00f3n de la consulta.\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;\">Aqu\u00ed obtenemos la respuesta de la consulta, obtenemos las filas y la imprimimos.\u00a0<\/span><\/p>\r\n<p><span style=\"font-weight: 400;\">Usando el ejemplo anterior, ahora podemos usar transacciones N1QL en el SDK de C. Para el c\u00f3digo completo ver e instrucciones sobre c\u00f3mo ejecutarlo ver -. <\/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>","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>","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 v26.5 (Yoast SEO v26.5) - 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\/es\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/\" \/>\n<meta property=\"og:locale\" content=\"es_MX\" \/>\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\/es\/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 minutos\" \/>\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\":\"es\",\"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\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@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\":\"es\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@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\":\"es\",\"@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\/es\/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\/es\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/","og_locale":"es_MX","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\/es\/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 minutos"},"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":"es","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":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/using-libcouchbase-c-sdk-to-run-transactions-with-couchbase-7-0\/"]}]},{"@type":"ImageObject","inLanguage":"es","@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":"El blog de Couchbase","description":"Couchbase, la base de datos NoSQL","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":"es"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"El blog de Couchbase","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"es","@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":"es","@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 es Ingeniero de Software Senior en Couchbase. Isha es responsable del desarrollo del dise\u00f1o de las diferentes caracter\u00edsticas y herramientas para el lenguaje de consulta N1QL -SQL para Json. Adem\u00e1s, dise\u00f1a e implementa caracter\u00edsticas y herramientas para el lenguaje de consulta N1QL.","url":"https:\/\/www.couchbase.com\/blog\/es\/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 es Ingeniero de Software Senior en Couchbase. Isha es responsable del desarrollo del dise\u00f1o de las diferentes caracter\u00edsticas y herramientas para el lenguaje de consulta N1QL -SQL para Json. Adem\u00e1s, dise\u00f1a e implementa caracter\u00edsticas y herramientas para el lenguaje de consulta N1QL."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/11224","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/users\/6882"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/comments?post=11224"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/11224\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media\/13873"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media?parent=11224"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/categories?post=11224"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/tags?post=11224"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/ppma_author?post=11224"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}