c++ sql
C++
#include <iostream>
#include <sqlite3.h>
int main(int argc, char** argv)
{
sqlite3* DB;
int exit = 0;
exit = sqlite3_open("example.db", &DB);
if (exit) {
std::cerr << "Error open DB " << sqlite3_errmsg(DB) << std::endl;
return (-1);
}
else
std::cout << "Opened Database Successfully!" << std::endl;
sqlite3_close(DB);
return (0);
}
#include <iostream>
#include <sqlite3.h>
int main(int argc, char** argv)
{
sqlite3* DB;
std::string sql = "CREATE TABLE PERSON("
"ID INT PRIMARY KEY NOT NULL, "
"NAME TEXT NOT NULL, "
"SURNAME TEXT NOT NULL, "
"AGE INT NOT NULL, "
"ADDRESS CHAR(50), "
"SALARY REAL );";
int exit = 0;
exit = sqlite3_open("example.db", &DB);
char* messaggeError;
exit = sqlite3_exec(DB, sql.c_str(), NULL, 0, &messaggeError);
if (exit != SQLITE_OK) {
std::cerr << "Error Create Table" << std::endl;
sqlite3_free(messaggeError);
}
else
std::cout << "Table created Successfully" << std::endl;
sqlite3_close(DB);
return (0);
}
Also in C++:
- Title
- Convert binary tree to a doubly linked list
- Category
- C++
- Title
- cpp pi from acos
- Category
- C++
- Title
- zeros of array c++
- Category
- C++
- Title
- new in c++
- Category
- C++
- Title
- c++ files
- Category
- C++
- Title
- how to cout in c++
- Category
- C++
- Title
- c++ try
- Category
- C++
- Title
- eigenvalue of matrix c++ using Eigen
- Category
- C++
- Title
- c++ ros subscriber
- Category
- C++
- Title
- shortest path with bfs in c++
- Category
- C++
- Title
- select elements from array C++
- Category
- C++
- Title
- primeros numeros primos
- Category
- C++
- Title
- how to load from files C++
- Category
- C++
- Title
- two sum problem in c++
- Category
- C++
- Title
- c++ remove item from list
- Category
- C++
- Title
- what is iterator in c++?
- Category
- C++
- Title
- c++ how to return an empty vector
- Category
- C++
- Title
- factorion
- Category
- C++
- Title
- c++ std::copy to cout
- Category
- C++
- Title
- memset
- Category
- C++
- Title
- rosrun actionlib_msgs genaction.py
- Category
- C++
- Title
- c++ char define
- Category
- C++
- Title
- counting valleys hackerrank solution in c++
- Category
- C++
- Title
- maximum subarray sum equal with K in c++
- Category
- C++
- Title
- how to print a string to console in c++
- Category
- C++
- Title
- nearest integer rounding in c++
- Category
- C++
- Title
- heap in cpp stl
- Category
- C++
- Title
- C++ remove element from set
- Category
- C++
- Title
- C++ Syntax
- Category
- C++
- Title
- how to iterate trough a vector in c++
- Category
- C++
- Title
- iterar un map c++
- Category
- C++
- Title
- rgb(100,100,100,0.5) validation c++
- Category
- C++
- Title
- switch c++
- Category
- C++
- Title
- iterative inorder traversal
- Category
- C++
- Title
- vertical traversal of binary tree
- Category
- C++
- Title
- iterate const vector
- Category
- C++
- Title
- tuple c++
- Category
- C++
- Title
- vector pop back
- Category
- C++
- Title
- arrow operator c++
- Category
- C++
- Title
- c++ reading string
- Category
- C++
- Title
- substr in c++
- Category
- C++
- Title
- input a string in c++
- Category
- C++
- Title
- how to get a letter from the user c++ string
- Category
- C++
- Title
- erase in set
- Category
- C++
- Title
- range of long long in c++
- Category
- C++
- Title
- append string to another string c++
- Category
- C++
- Title
- checking an int in c++
- Category
- C++
- Title
- char **
- Category
- C++
- Title
- restting a queue stl
- Category
- C++
- Title
- Runtime Error: Runtime ErrorAbort signal from abort(3) (SIGABRT)
- Category
- C++
- Title
- how to iterate over unordered_map c++
- Category
- C++
- Title
- C++ w3schools
- Category
- C++
- Title
- RLE Encoding/Compression c++
- Category
- C++
- Title
- can you use a return to print a string when referencing an integer c++
- Category
- C++
- Title
- never gonna give you up lyrics
- Category
- C++
- Title
- run cmd command c++
- Category
- C++
- Title
- function template
- Category
- C++
- Title
- how to convert string into number
- Category
- C++
- Title
- min and max heap in cpp
- Category
- C++
- Title
- euler's totient function c++
- Category
- C++
- Title
- print matrix c++
- Category
- C++
- Title
- FInd the element which appears more than n/2 times C++
- Category
- C++
- Title
- initialize array c++
- Category
- C++
- Title
- pop from between string c++
- Category
- C++
- Title
- peak in c++
- Category
- C++
- Title
- how to sort in descending order c++
- Category
- C++
- Title
- coping 2d vector in cpp
- Category
- C++
- Title
- do while loop c++
- Category
- C++
- Title
- change int to string cpp
- Category
- C++
- Title
- bfs in C++
- Category
- C++
- Title
- how to delete an element in vector pair in cpp
- Category
- C++
- Title
- c++ functions
- Category
- C++
- Title
- map.erase in c++
- Category
- C++
- Title
- c++ give options
- Category
- C++
- Title
- printf c++
- Category
- C++
- Title
- fast input output in c++
- Category
- C++
- Title
- cs1955 unity vector3
- Category
- C++
- Title
- c++ for loop syntax
- Category
- C++
- Title
- check if key exists in map c++
- Category
- C++
- Title
- how to append two vectors in c++
- Category
- C++
- Title
- iterate 2d array c++
- Category
- C++
- Title
- c++ short if
- Category
- C++
- Title
- c++ calculator program using switch case
- Category
- C++
- Title
- how to make a 2d vector in c++
- Category
- C++
- Title
- c++ sort vector of objects by property
- Category
- C++
- Title
- how to extract substring from string in c++
- Category
- C++
- Title
- list conda environments
- Category
- C++
- Title
- how to format decimal palces in c++
- Category
- C++
- Title
- qt make widget ignore mouse events
- Category
- C++
- Title
- set in c++
- Category
- C++
- Title
- new c++
- Category
- C++
- Title
- c++ declare char
- Category
- C++
- Title
- reference function in c++
- Category
- C++
- Title
- binary search in set c++
- Category
- C++
- Title
- while loops
- Category
- C++
- Title
- templates of templates c++
- Category
- C++
- Title
- runtime error in c++
- Category
- C++
- Title
- c++ stream string into fiel
- Category
- C++
- Title
- case label in c++
- Category
- C++
- Title
- convert entire string to lowercase c++
- Category
- C++