void wb_dbms::copy(wb_export &e, const char *fileName) { pwr_tStatus sts; char l_fileName[512]; dcli_translate_filename(l_fileName, fileName); if (!m_env) { m_env = new wb_dbms_env(l_fileName); m_env->open(); } createDb(); importVolume(e); close(); open(); try { m_env->txn_begin(0, (wb_dbms_txn **)&m_txn); wb_dbms_info i(this); i.get(m_txn); m_vid = i.vid(); m_cid = i.cid(); strcpy(m_volumeName, i.name()); commit(&sts); } catch (wb_dbms_error &e) { m_txn->abort(); printf("exeption: %s\n", e.what().c_str()); } }
void wb_dbms::copy(wb_export &e, wb_dbms_env *env) { pwr_tStatus sts; m_env = env; m_env->open(); createDb(); importVolume(e); close(); open(); try { m_env->txn_begin(0, (wb_dbms_txn **)&m_txn); wb_dbms_info i(this); i.get(m_txn); m_vid = i.vid(); m_cid = i.cid(); strcpy(m_volumeName, i.name()); commit(&sts); } catch (wb_dbms_error &e) { m_txn->abort(); printf("exeption: %s\n", e.what().c_str()); } }
void QgsNewSpatialiteLayerDialog::checkOk() { bool created = !leLayerName->text().isEmpty() && ( checkBoxPrimaryKey->isChecked() || mAttributeView->topLevelItemCount() > 0 ) && createDb(); mOkButton->setEnabled( created ); }
void Reminder:: clear() { //Don't know why : The SQlite delete query make a bug..... // So I m using an other methode! QFile::remove(KStandardDirs::locateLocal("data", "translatoid/translatoid.db")); createDb(); connection(); m_model->setQuery("SELECT id, source,translated FROM sentence"); }
Reminder::Reminder(QObject *parent) :QObject(parent) { qsrand(QDateTime::currentDateTime ().toTime_t ()); createDb(); connection(); m_model= new QSqlQueryModel; }
void LocalCookieStore::doSetCookies(const Cookies& parsedCookies) { m_db.setDatabaseName(m_dbPath); if (!m_db.open()) { qCritical() << "Could not open cookie database:" << m_dbPath << m_db.lastError().text(); return; } QSqlQuery q(m_db); // Check whether the table already exists q.exec("SELECT name FROM sqlite_master WHERE type='table' AND name='cookies'"); if (!q.next() && !createDb()) { qCritical() << "Could not create cookie database:" << m_dbPath << m_db.lastError().text(); return; } q.prepare("INSERT INTO cookies (creation_utc," "host_key, name, value, path," "expires_utc, secure, httponly, last_access_utc," "has_expires, persistent, priority, encrypted_value) " "VALUES (:creation_utc," ":host_key, :name, :value, :path," ":expires_utc, :secure, :httponly, :last_access_utc," ":has_expires, :persistent, :priority, :encrypted_value)"); qint64 lastTimestamp = 0; Q_FOREACH(const QNetworkCookie &cookie, parsedCookies) { quint64 timestamp = dateTimeToChrome(QDateTime::currentDateTimeUtc()); /* Make sure that every cicle iteration marks a different timestamp */ if (timestamp <= lastTimestamp) timestamp = lastTimestamp + 1; q.bindValue(":creation_utc", timestamp); q.bindValue(":host_key", cookie.domain()); q.bindValue(":name", cookie.name()); q.bindValue(":value", cookie.value()); q.bindValue(":path", cookie.path()); q.bindValue(":expires_utc", dateTimeToChrome(cookie.expirationDate().toUTC())); q.bindValue(":secure", cookie.isSecure()); q.bindValue(":httponly", cookie.isHttpOnly()); q.bindValue(":last_access_utc", timestamp); q.bindValue(":has_expires", cookie.expirationDate().isValid()); q.bindValue(":persistent", true); q.bindValue(":priority", 1); q.bindValue(":encrypted_value", 1); q.exec(); lastTimestamp = timestamp; }
void QgsNewSpatialiteLayerDialog::on_toolButtonNewDatabase_clicked() { QString fileName = QFileDialog::getSaveFileName( this, tr( "New SpatiaLite Database File" ), ".", tr( "SpatiaLite (*.sqlite *.db )" ) ); if ( fileName.isEmpty() ) return; mDatabaseComboBox->insertItem( 0, fileName ); mDatabaseComboBox->setCurrentIndex( 0 ); createDb(); }
int main( int argc , char **argv ) { char command[124] = { 0 }; char *opt = NULL; int ret = 0; char *status = NULL; ret = initEnvironment(); if( ret < 0 ) return -1; createDb(); if( argc > 1 ) { opt = strtok( argv[1] , "-"); if( !strcmp( opt , "t") ) launchServer(); } while( 1 ) { printf("rdb~>"); fgets( command , 124 , stdin ); if( !strcmp("q\n" , command ) ) break; else { status = ( char * )doCommand( command ); if( !status ) printf("An error occurs.\n"); else { printf("%s\n" , status ); zfree( status ); } } } return 0; }
void QgsNewSpatialiteLayerDialog::on_mAddAttributeButton_clicked() { if ( mNameEdit->text().length() > 0 ) { QString myName = mNameEdit->text(); //use userrole to avoid translated type string QString myType = mTypeBox->itemData( mTypeBox->currentIndex(), Qt::UserRole ).toString(); mAttributeView->addTopLevelItem( new QTreeWidgetItem( QStringList() << myName << myType ) ); if ( mAttributeView->topLevelItemCount() > 0 && leLayerName->text().length() > 0 ) { bool created = createDb(); mOkButton->setEnabled( created ); } mNameEdit->clear(); } }
void QgsNewSpatialiteLayerDialog::on_toolButtonNewDatabase_clicked() { QString fileName = QFileDialog::getSaveFileName( this, tr( "New SpatiaLite Database File" ), QDir::homePath(), tr( "SpatiaLite" ) + " (*.sqlite *.db)" ); if ( fileName.isEmpty() ) return; if ( !fileName.toLower().endsWith( ".sqlite" ) && !fileName.toLower().endsWith( ".db" ) ) { fileName += ".sqlite"; } mDatabaseComboBox->insertItem( 0, fileName ); mDatabaseComboBox->setCurrentIndex( 0 ); createDb(); }
void QgsNewSpatialiteLayerDialog::toolButtonNewDatabase_clicked() { QString fileName = QFileDialog::getSaveFileName( this, tr( "New SpatiaLite Database File" ), QDir::homePath(), tr( "SpatiaLite" ) + " (*.sqlite *.db *.sqlite3 *.db3 *.s3db)", nullptr, QFileDialog::DontConfirmOverwrite ); if ( fileName.isEmpty() ) return; if ( !fileName.endsWith( QLatin1String( ".sqlite" ), Qt::CaseInsensitive ) && !fileName.endsWith( QLatin1String( ".db" ), Qt::CaseInsensitive ) ) { fileName += QLatin1String( ".sqlite" ); } mDatabaseComboBox->insertItem( 0, fileName ); mDatabaseComboBox->setCurrentIndex( 0 ); createDb(); }
database::database(QObject *parent) : QObject(parent) { createDb(); // createTable(); }
void wb_dbms::create(pwr_tVid vid, pwr_tCid cid, const char *volumeName, const char *fileName) { m_vid = vid; m_cid = cid; pwr_tStatus sts; strcpy(m_volumeName, volumeName); char l_fileName[512]; dcli_translate_filename(l_fileName, fileName); size_t rbSize = 0; pwr_tTime time; pwr_tOid oid; pwr_mClassDef flags; flags.m = pwr_mClassDef_System | pwr_mClassDef_TopObject; if (!m_env) { m_env = new wb_dbms_env(l_fileName); m_env->open(); } if (m_env->exists()) createDb(); else return; switch (cid) { case pwr_eClass_RootVolume: rbSize = sizeof(pwr_sRootVolume); break; case pwr_eClass_SubVolume: rbSize = sizeof(pwr_sSubVolume); break; case pwr_eClass_SystemVolume: rbSize = sizeof(pwr_sSystemVolume); break; case pwr_eClass_ClassVolume: case pwr_eClass_DetachedClassVolume: rbSize = sizeof(pwr_sClassVolume); break; case pwr_eClass_WorkBenchVolume: rbSize = sizeof(pwr_sWorkBenchVolume); break; case pwr_eClass_DirectoryVolume: rbSize = sizeof(pwr_sDirectoryVolume); break; case pwr_eClass_SharedVolume: rbSize = sizeof(pwr_sSharedVolume); break; case pwr_eClass_CreateVolume: case pwr_eClass_MountVolume: flags.m = pwr_mClassDef_System | pwr_mClassDef_NoAdopt; break; case pwr_eClass_MountObject: flags.m = pwr_mClassDef_System | pwr_mClassDef_TopObject | pwr_mClassDef_NoAdopt; break; case pwr_eClass_VolatileVolume: case pwr_eClass_ExternVolume: flags.m = pwr_mClassDef_System | pwr_mClassDef_TopObject | pwr_mClassDef_DevOnly; break; case pwr_eClass_DynamicVolume: break; default: ; } oid.vid = vid; oid.oix = pwr_cNOix; wb_name n(volumeName); try { m_env->txn_begin(0, (wb_dbms_txn **)&m_txn); importHead(oid, cid, pwr_cNOid, pwr_cNOid, pwr_cNOid, pwr_cNOid, pwr_cNOid, n.name(), n.normName(), flags, time, time, time, rbSize, 0); if ( rbSize) { void *body = calloc( 1, rbSize); importRbody(oid, rbSize, body); free( body); } wb_dbms_info i(this); i.get(m_txn); m_vid = i.vid(); m_cid = i.cid(); strcpy(m_volumeName, i.name()); commit(&sts); } catch (wb_dbms_error &e) { m_txn->abort(); printf("exeption: %s\n", e.what().c_str()); } }
void QgsNewSpatialiteLayerDialog::on_leLayerName_textChanged( QString text ) { Q_UNUSED( text ); bool created = leLayerName->text().length() > 0 && mAttributeView->topLevelItemCount() > 0 && createDb(); mOkButton->setEnabled( created ); }
void QgsNewSpatialiteLayerDialog::on_leLayerName_textChanged( QString text ) { bool created = leLayerName->text().length() > 0 && mAttributeView->topLevelItemCount() > 0 && createDb(); buttonBox->button( QDialogButtonBox::Ok )->setEnabled( created ); buttonBox->button( QDialogButtonBox::Apply )->setEnabled( created ); }
Artwork::Artwork() { createDb(); }