Write a C/C++ program that connects to a MySQL server and
checks if the InnoDB plug-in is installed on it. If so, your
program should print the total number of disk writes by MySQL.



Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed..

Answer / Vijay Prakash

Here's an example in C++ using the MySQL Connector library:nn```cppn#include <mysqlx/xdevapi/session.h>nusing namespace mysqlx;nint main() {nSession session = System::Create();nSchema schema = session.getSchema("information_schema");nTable table = schema.getTable("innodb_tablespaces");nRowResult result = table.select("engine").execute();nbool innodbInstalled = false;ndouble diskWrites = 0;nfor (const Row &row : result) {n if (row[0].getString() == "InnoDB") {n innodbInstalled = true;n table = schema.getTable("innodb_file_per_table_stats" + row[1].getString());nResult statsResult = table.select("index_size", "data_size", "os_file_size").execute();ndouble indexSize = statsResult[0][0].getDouble();ndouble dataSize = statsResult[0][1].getDouble();ndouble osFileSize = statsResult[0][2].getDouble();ndiskWrites = osFileSize - (indexSize + dataSize);n }n}nsession.close();nif (innodbInstalled) {n std::cout << "Total number of disk writes by MySQL: " << diskWrites << std::endl;n}nreturn 0;n}n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Engineering AllOther Interview Questions

A polynomials in mamory can be represented by____________

1 Answers  


I need a last 3 years question paper for RRB exam,post of section engineer(computer science)

1 Answers   RRB,


Write a test case plan for a typical banking application which involves functionalities like Balance enquiry, deposit, fund transfer etc. Make your assumptions and mention the same in your answer sheet.

1 Answers  


Write a function that responds to a click anywhere on the page by displaying an alert dialog. Display the event name if the user held Shift during the mouse click. Display the element name that triggered the event if the user held Ctrl during the mouse click. (Answer in Java Language)

2 Answers   Infosys,


how to count 4 column with two "and" condition in oracle? e.g task_type and cust_type and service_type are 3 column and we hv to count where task_type="new"and cust_type="jdp" and resulting column name will be new cust with jdp..and also we hv to count where task_type="new"and service_type="fs" resulting column name will be new cust with fs..

1 Answers  


can i get some win vista notes

1 Answers  


hi friends i am b-tech in computer science having interview of State bank of india clerk day on 30 th april. I want to know the answer of question:"you r B.tech in C.S. why do u want to become a bank clerk?" please help.Its my humble request.

1 Answers   State Bank Of India SBI,


Given two strings, find the sub-string of the first string having minimum length which is having all the characters in second string

1 Answers  


what are the areas of improvement required in yourself to achieve your career goals? Describe what you are doing/plan to do to address the areas of improvement

1 Answers   TATA,


i am astubent of BE3rd year currently in 6th semester branch information technology till now i have 73% near about in each semester the problem with me is that i have got only 58%in 12th class n 55%in 10th class bcoz of my health now i am ok i have got 2 year loss also bcoz i have not giveen the exam in class 12th rite now i am prep for GATE i am working hard pls tell will i get a good job in future in the good company bcoz my inter percent were not gud pls tell me help me pls

1 Answers  


write a program to accept 25 characters and at the end display the largest and smallest among them.

0 Answers  


what is the difference between composite key and primary key in sap abap

1 Answers   Cap Gemini,


Categories
  • Civil Engineering Interview Questions Civil Engineering (5086)
  • Mechanical Engineering Interview Questions Mechanical Engineering (4453)
  • Electrical Engineering Interview Questions Electrical Engineering (16638)
  • Electronics Communications Interview Questions Electronics Communications (3918)
  • Chemical Engineering Interview Questions Chemical Engineering (1095)
  • Aeronautical Engineering Interview Questions Aeronautical Engineering (239)
  • Bio Engineering Interview Questions Bio Engineering (96)
  • Metallurgy Interview Questions Metallurgy (361)
  • Industrial Engineering Interview Questions Industrial Engineering (259)
  • Instrumentation Interview Questions Instrumentation (3014)
  • Automobile Engineering Interview Questions Automobile Engineering (332)
  • Mechatronics Engineering Interview Questions Mechatronics Engineering (97)
  • Marine Engineering Interview Questions Marine Engineering (124)
  • Power Plant Engineering Interview Questions Power Plant Engineering (172)
  • Textile Engineering Interview Questions Textile Engineering (575)
  • Production Engineering Interview Questions Production Engineering (25)
  • Satellite Systems Engineering Interview Questions Satellite Systems Engineering (106)
  • Engineering AllOther Interview Questions Engineering AllOther (1379)