I am trying to create a database from a mariadb-dump run.
I am storing the file in a qrc file.
the command used to generate the sql file is as follows:
"${MARIADB_PATH}/mariadb-dump" --user=${BACKUP_USER} ${BACKUP_USER_PASSWORD} -h
${HOST} -P ${PORT} --max-allowed-packet=1GB --single-transaction
--extended-insert --flush-logs --flush-privileges --all-tablespaces --hex-blob
--dump-date --routines --events --databases ${TEST_DATABASE}
--result-file=$FILE
I have no issues running mariadb < $FILE of the generated sql file.
However, when I try to use QSqlQuery to send the data, it doesn't error out or
report any issues in query::lastError however, it only creates a small subset
of the tables from the database.
I run the following commands
auto db = QSqlDatabase::addDatabase( "QMARIADB", connName );
db->setHostName( <hostname> );
db->setPort( <port> );
db->setUserName( <username> )
db->setPassword( <password> );
if ( !db->open() )
error();
auto file = QFile( ":/init.sql" );
if ( !file.open( QFile::ReadOnly ) )
error();
auto sql = QString::fromUtf8( file.readAll() );
auto query = QSqlQuery( sql, *db );
if ( query.lastError() != QSqlError::NoError ) // no errors reported
error()
No errors are reported, query.lastError() returns QSqlError::NoError
But the command stops at some of the pragma style comments that are generated.
Any thoughts/ideas?
Scott
--
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development