@ -13,19 +13,20 @@ using namespace marcelb::asynco;
int main ( ) {
int main ( ) {
try {
try {
MySQL mydb ( " tcp://192.168.2.10:3306 " , " dinio " , " H€r5elfInd1aH@nds " , " dinio " , 5 , time_loop_type : : internal ) ;
// MySQL mydb("tcp://192.168.2.10:3306", "dinio", "H€r5elfInd1aH@nds", "dinio", 5, time_loop_type::internal);
// MySQL mydb("tcp://bitelex.ddns.net:3306", "dinio", "H€r5elfInd1aH@nds", "dinio", 10, time_loop_type::external);
MySQL mydb ( " tcp://bitelex.ddns.net:3306 " , " dinio " , " H€r5elfInd1aH@nds " , " dinio " , 5 , time_loop_type : : external ) ;
// MySQL mydb("tcp://bitelex.ddns.net:3306", "dinio", "H€r5elfInd1aH@nds", "dinio", 5);
// MySQL mydb("tcp://bitelex.ddns.net:3306", "dinio", "H€r5elfInd1aH@nds", "dinio", 5);
mydb . set_on_error ( [ ] ( const string & error ) {
mydb . on_error = [ ] ( const string & error ) {
cout < < error < < endl ;
cout < < error < < endl ;
} ) ;
} ;
periodic mysql_tloop ( [ & mydb ] ( ) {
periodic mysql_tloop ( [ & mydb ] ( ) {
cout < < " loop--------------------------- " < < endl ;
mydb . tloop ( ) ;
mydb . tloop ( ) ;
} , MYSQL_PERIODIC_INTERNAL_TIME ) ;
} , MYSQL_PERIODIC_INTERNAL_TIME ) ;
while ( true ) {
sleep ( 5 ) ;
sleep ( 5 ) ;
auto start = high_resolution_clock : : now ( ) ;
auto start = high_resolution_clock : : now ( ) ;
@ -44,8 +45,8 @@ int main() {
cout < < column_name < < endl ;
cout < < column_name < < endl ;
}
}
} catch ( const string er r) {
} catch ( const SQLException erro r) {
cout < < err < < endl ;
cout < < error . what ( ) < < endl ;
}
}
} ) ;
} ) ;
@ -63,8 +64,8 @@ int main() {
cout < < column_name < < endl ;
cout < < column_name < < endl ;
}
}
} catch ( const string er r) {
} catch ( const SQLException erro r) {
cout < < err < < endl ;
cout < < error . what ( ) < < endl ;
}
}
} ) ;
} ) ;
@ -82,8 +83,8 @@ int main() {
cout < < column_name < < endl ;
cout < < column_name < < endl ;
}
}
} catch ( const string er r) {
} catch ( const SQLException erro r) {
cout < < err < < endl ;
cout < < error . what ( ) < < endl ;
}
}
} ) ;
} ) ;
@ -101,8 +102,8 @@ int main() {
cout < < column_name < < endl ;
cout < < column_name < < endl ;
}
}
} catch ( const string er r) {
} catch ( const SQLException erro r) {
cout < < err < < endl ;
cout < < error . what ( ) < < endl ;
}
}
} ) ;
} ) ;
@ -120,8 +121,8 @@ int main() {
cout < < column_name < < endl ;
cout < < column_name < < endl ;
}
}
} catch ( const string er r) {
} catch ( const SQLException erro r) {
cout < < err < < endl ;
cout < < error . what ( ) < < endl ;
}
}
} ) ;
} ) ;
@ -139,8 +140,8 @@ int main() {
cout < < column_name < < endl ;
cout < < column_name < < endl ;
}
}
} catch ( const string er r) {
} catch ( const SQLException erro r) {
cout < < err < < endl ;
cout < < error . what ( ) < < endl ;
}
}
} ) ;
} ) ;
@ -156,8 +157,9 @@ int main() {
auto duration = duration_cast < microseconds > ( end - start ) ;
auto duration = duration_cast < microseconds > ( end - start ) ;
cout < < " -------------Izvršilo se za: " < < ( double ) ( duration . count ( ) / 1000.0 ) < < " ms " < < endl ;
cout < < " -------------Izvršilo se za: " < < ( double ) ( duration . count ( ) / 1000.0 ) < < " ms " < < endl ;
sleep ( 100 ) ;
}
sleep ( 100 ) ;
} catch ( const SQLException error ) {
} catch ( const SQLException error ) {
cout < < error . what ( ) < < endl ;
cout < < error . what ( ) < < endl ;