{"id":13528954,"url":"https://github.com/mysql/mysql-connector-cpp","last_synced_at":"2025-05-14T12:10:56.210Z","repository":{"id":3567551,"uuid":"50173071","full_name":"mysql/mysql-connector-cpp","owner":"mysql","description":"MySQL Connector/C++ is a MySQL database connector for C++. It lets you develop C++ and C applications that connect to MySQL Server.","archived":false,"fork":false,"pushed_at":"2025-01-21T12:45:57.000Z","size":21821,"stargazers_count":662,"open_issues_count":0,"forks_count":255,"subscribers_count":47,"default_branch":"trunk","last_synced_at":"2025-04-13T19:50:03.132Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mysql.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-01-22T09:59:10.000Z","updated_at":"2025-04-11T09:33:03.000Z","dependencies_parsed_at":"2023-02-10T09:01:36.137Z","dependency_job_id":"35a65922-9ee9-4c82-903f-7c79be4e3b51","html_url":"https://github.com/mysql/mysql-connector-cpp","commit_stats":{"total_commits":3108,"total_committers":51,"mean_commits":60.94117647058823,"dds":0.766087516087516,"last_synced_commit":"ac218f0d2d5b7957a8a2efee148bc8d7a1c623a5"},"previous_names":[],"tags_count":47,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mysql%2Fmysql-connector-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mysql%2Fmysql-connector-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mysql%2Fmysql-connector-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mysql%2Fmysql-connector-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mysql","download_url":"https://codeload.github.com/mysql/mysql-connector-cpp/tar.gz/refs/heads/trunk","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254140760,"owners_count":22021219,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T07:00:29.642Z","updated_at":"2025-05-14T12:10:56.133Z","avatar_url":"https://github.com/mysql.png","language":"C++","readme":"# MySQL Connector/C++\n\nThis is a release of MySQL Connector/C++, [the C++ interface](https://dev.mysql.com/doc/dev/connector-cpp/8.0/) for communicating with MySQL servers.\n\nFor detailed information please visit the official [MySQL Connector/C++ documentation](https://dev.mysql.com/doc/dev/connector-cpp/8.0/).\n\n## Licensing\n\nPlease refer to files README and LICENSE, available in this repository, and [Legal Notices in documentation](https://dev.mysql.com/doc/connector-cpp/8.0/en/preface.html) for further details. \n\n## Download \u0026 Install\n\nMySQL Connector/C++ can be installed from pre-compiled packages that can be downloaded from the [MySQL downloads page](https://dev.mysql.com/downloads/connector/cpp/).\nThe process of installing of Connector/C++ from a binary distribution is described in [MySQL online manuals](https://dev.mysql.com/doc/connector-cpp/8.0/en/connector-cpp-installation-binary.html)\n\n### Building from sources\n\nMySQL Connector/C++ can be installed from the source. Please check [MySQL online manuals](https://dev.mysql.com/doc/connector-cpp/8.0/en/connector-cpp-installation-source.html)\n\n### GitHub Repository\n\nThis repository contains the MySQL Connector/C++ source code as per latest released version. You should expect to see the same contents here and within the latest released Connector/C++ package.\n\n## Sample Code\n\n```\n#include \u003ciostream\u003e\n#include \u003cmysqlx/xdevapi.h\u003e\n\nusing ::std::cout;\nusing ::std::endl;\nusing namespace ::mysqlx;\n\n\nint main(int argc, const char* argv[])\ntry {\n\n  const char   *url = (argc \u003e 1 ? argv[1] : \"mysqlx://root@127.0.0.1\");\n\n  cout \u003c\u003c \"Creating session on \" \u003c\u003c url\n       \u003c\u003c \" ...\" \u003c\u003c endl;\n\n  Session sess(url);\n\n  cout \u003c\u003c\"Session accepted, creating collection...\" \u003c\u003cendl;\n\n  Schema sch= sess.getSchema(\"test\");\n  Collection coll= sch.createCollection(\"c1\", true);\n\n  cout \u003c\u003c\"Inserting documents...\" \u003c\u003cendl;\n\n  coll.remove(\"true\").execute();\n\n  {\n    DbDoc doc(R\"({ \"name\": \"foo\", \"age\": 1 })\");\n\n    Result add =\n      coll.add(doc)\n          .add(R\"({ \"name\": \"bar\", \"age\": 2, \"toys\": [ \"car\", \"ball\" ] })\")\n          .add(R\"({ \"name\": \"bar\", \"age\": 2, \"toys\": [ \"car\", \"ball\" ] })\")\n          .add(R\"({\n                 \"name\": \"baz\",\n                  \"age\": 3,\n                 \"date\": { \"day\": 20, \"month\": \"Apr\" }\n              })\")\n          .add(R\"({ \"_id\": \"myuuid-1\", \"name\": \"foo\", \"age\": 7 })\")\n          .execute();\n\n    std::list\u003cstring\u003e ids = add.getGeneratedIds();\n    for (string id : ids)\n      cout \u003c\u003c\"- added doc with id: \" \u003c\u003c id \u003c\u003cendl;\n  }\n\n  cout \u003c\u003c\"Fetching documents...\" \u003c\u003cendl;\n\n  DocResult docs = coll.find(\"age \u003e 1 and name like 'ba%'\").execute();\n\n  int i = 0;\n  for (DbDoc doc : docs)\n  {\n    cout \u003c\u003c\"doc#\" \u003c\u003ci++ \u003c\u003c\": \" \u003c\u003cdoc \u003c\u003cendl;\n\n    for (Field fld : doc)\n    {\n      cout \u003c\u003c \" field `\" \u003c\u003c fld \u003c\u003c \"`: \" \u003c\u003cdoc[fld] \u003c\u003c endl;\n    }\n\n    string name = doc[\"name\"];\n    cout \u003c\u003c \" name: \" \u003c\u003c name \u003c\u003c endl;\n\n    if (doc.hasField(\"date\") \u0026\u0026 Value::DOCUMENT == doc.fieldType(\"date\"))\n    {\n      cout \u003c\u003c \"- date field\" \u003c\u003c endl;\n      DbDoc date = doc[\"date\"];\n      for (Field fld : date)\n      {\n        cout \u003c\u003c \"  date `\" \u003c\u003c fld \u003c\u003c \"`: \" \u003c\u003c date[fld] \u003c\u003c endl;\n      }\n      string month = doc[\"date\"][\"month\"];\n      int day = date[\"day\"];\n      cout \u003c\u003c \"  month: \" \u003c\u003c month \u003c\u003c endl;\n      cout \u003c\u003c \"  day: \" \u003c\u003c day \u003c\u003c endl;\n    }\n\n    if (doc.hasField(\"toys\") \u0026\u0026 Value::ARRAY == doc.fieldType(\"toys\"))\n    {\n      cout \u003c\u003c \"- toys:\" \u003c\u003c endl;\n      for (auto toy : doc[\"toys\"])\n      {\n        cout \u003c\u003c \"  \" \u003c\u003c toy \u003c\u003c endl;\n      }\n    }\n\n    cout \u003c\u003c endl;\n  }\n  cout \u003c\u003c\"Done!\" \u003c\u003cendl;\n}\ncatch (const mysqlx::Error \u0026err)\n{\n  cout \u003c\u003c\"ERROR: \" \u003c\u003cerr \u003c\u003cendl;\n  return 1;\n}\ncatch (std::exception \u0026ex)\n{\n  cout \u003c\u003c\"STD EXCEPTION: \" \u003c\u003cex.what() \u003c\u003cendl;\n  return 1;\n}\ncatch (const char *ex)\n{\n  cout \u003c\u003c\"EXCEPTION: \" \u003c\u003cex \u003c\u003cendl;\n  return 1;\n}\n\n```\n\n## Documentation\n\n* [MySQL](http://www.mysql.com/)\n* [Connector/C++ API Reference](https://dev.mysql.com/doc/dev/connector-cpp/8.0/)\n\n## Questions/Bug Reports\n\n* [Discussion Forum](https://forums.mysql.com/list.php?167)\n* [Slack](https://mysqlcommunity.slack.com)\n* [Bugs](https://bugs.mysql.com)\n\n","funding_links":[],"categories":["Connectors","\u003ca name=\"C%2B%2B\"\u003e\u003c/a\u003eC++","C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmysql%2Fmysql-connector-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmysql%2Fmysql-connector-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmysql%2Fmysql-connector-cpp/lists"}