// copies a single character field to the dataLine void CSVFile::writeChar (char c) { char string[2] = " "; if (c) string[0] = c; insertField (string); }
// copies a floating point field to the dataLine void CSVFile::writeFloat (float aReal, int precision) { char formatStr[32] = "%."; _itoa (precision, formatStr+2, 10); strcat (formatStr, "f"); char tempStr[128]; sprintf (tempStr, formatStr, aReal); insertField (tempStr); }
QgsAttributeActionDialog::QgsAttributeActionDialog( QgsAttributeAction* actions, const QgsFields& fields, QWidget* parent ): QWidget( parent ), mActions( actions ) { setupUi( this ); QHeaderView *header = attributeActionTable->horizontalHeader(); header->setHighlightSections( false ); header->setStretchLastSection( true ); attributeActionTable->setColumnWidth( 0, 100 ); attributeActionTable->setColumnWidth( 1, 230 ); attributeActionTable->setCornerButtonEnabled( false ); connect( attributeActionTable, SIGNAL( itemSelectionChanged() ), this, SLOT( itemSelectionChanged() ) ); connect( actionName, SIGNAL( textChanged( QString ) ), this, SLOT( updateButtons() ) ); connect( actionAction, SIGNAL( textChanged() ), this, SLOT( updateButtons() ) ); connect( moveUpButton, SIGNAL( clicked() ), this, SLOT( moveUp() ) ); connect( moveDownButton, SIGNAL( clicked() ), this, SLOT( moveDown() ) ); connect( removeButton, SIGNAL( clicked() ), this, SLOT( remove() ) ); connect( addDefaultActionsButton, SIGNAL( clicked() ), this, SLOT( addDefaultActions() ) ); connect( browseButton, SIGNAL( clicked() ), this, SLOT( browse() ) ); connect( insertButton, SIGNAL( clicked() ), this, SLOT( insert() ) ); connect( updateButton, SIGNAL( clicked() ), this, SLOT( update() ) ); connect( insertFieldButton, SIGNAL( clicked() ), this, SLOT( insertField() ) ); connect( insertExpressionButton, SIGNAL( clicked() ), this, SLOT( insertExpression() ) ); connect( chooseIconButton, SIGNAL( clicked() ), this, SLOT( chooseIcon() ) ); init(); // Populate the combo box with the field names. Will the field names // change? If so, they need to be passed into the init() call, or // some access to them retained in this class. for ( int idx = 0; idx < fields.count(); ++idx ) fieldComboBox->addItem( fields[idx].name() ); }
void refresh() { mAddressee = mDocument->findByUid(mAddressee.uid()); if(!mAddressee.isEmpty()) { clearFields(); KABC::Field::List::ConstIterator it(mFields.begin()); const KABC::Field::List::ConstIterator endIt(mFields.end()); for(; it != endIt; ++it) { // insert empty fields or not? not doing so saves a bit of memory and CPU // (during geometry calculations), but prevents having equally // wide label columns in all cards, unless CardViewItem/CardView search // globally for the widest label. (anders) // if ( mShowEmptyFields || !(*it)->value( mAddressee ).isEmpty() ) insertField((*it)->label(), (*it)->value(mAddressee)); } setCaption(mAddressee.realName()); } }
QgsVectorLayerProperties::QgsVectorLayerProperties( QgsVectorLayer *lyr, QWidget * parent, Qt::WindowFlags fl ) : QgsOptionsDialogBase( "VectorLayerProperties", parent, fl ) , layer( lyr ) , mMetadataFilled( false ) , mSaveAsMenu( 0 ) , mLoadStyleMenu( 0 ) , mRendererDialog( 0 ) , labelingDialog( 0 ) , labelDialog( 0 ) , actionDialog( 0 ) , diagramPropertiesDialog( 0 ) , mFieldsPropertiesDialog( 0 ) { setupUi( this ); // QgsOptionsDialogBase handles saving/restoring of geometry, splitter and current tab states, // switching vertical tabs between icon/text to icon-only modes (splitter collapsed to left), // and connecting QDialogButtonBox's accepted/rejected signals to dialog's accept/reject slots initOptionsBase( false ); QPushButton* b = new QPushButton( tr( "Style" ) ); QMenu* m = new QMenu( this ); mActionLoadStyle = m->addAction( tr( "Load Style..." ), this, SLOT( loadStyle_clicked() ) ); mActionSaveStyleAs = m->addAction( tr( "Save Style..." ), this, SLOT( saveStyleAs_clicked() ) ); m->addSeparator(); m->addAction( tr( "Save As Default" ), this, SLOT( saveDefaultStyle_clicked() ) ); m->addAction( tr( "Restore Default" ), this, SLOT( loadDefaultStyle_clicked() ) ); b->setMenu( m ); connect( m, SIGNAL( aboutToShow() ), this, SLOT( aboutToShowStyleMenu() ) ); buttonBox->addButton( b, QDialogButtonBox::ResetRole ); connect( lyr->styleManager(), SIGNAL( currentStyleChanged( QString ) ), this, SLOT( syncToLayer() ) ); connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) ); connect( this, SIGNAL( accepted() ), this, SLOT( apply() ) ); connect( this, SIGNAL( rejected() ), this, SLOT( onCancel() ) ); connect( mOptionsStackedWidget, SIGNAL( currentChanged( int ) ), this, SLOT( mOptionsStackedWidget_CurrentChanged( int ) ) ); connect( insertFieldButton, SIGNAL( clicked() ), this, SLOT( insertField() ) ); connect( insertExpressionButton, SIGNAL( clicked() ), this, SLOT( insertExpression() ) ); // connections for Map Tip display connect( htmlRadio, SIGNAL( toggled( bool ) ), htmlMapTip, SLOT( setEnabled( bool ) ) ); connect( htmlRadio, SIGNAL( toggled( bool ) ), insertFieldButton, SLOT( setEnabled( bool ) ) ); connect( htmlRadio, SIGNAL( toggled( bool ) ), fieldComboBox, SLOT( setEnabled( bool ) ) ); connect( htmlRadio, SIGNAL( toggled( bool ) ), insertExpressionButton, SLOT( setEnabled( bool ) ) ); connect( fieldComboRadio, SIGNAL( toggled( bool ) ), displayFieldComboBox, SLOT( setEnabled( bool ) ) ); if ( !layer ) return; QVBoxLayout *layout; if ( layer->hasGeometryType() ) { // Create the Labeling dialog tab layout = new QVBoxLayout( labelingFrame ); layout->setMargin( 0 ); labelingDialog = new QgsLabelingGui( layer, QgisApp::instance()->mapCanvas(), labelingFrame ); labelingDialog->layout()->setContentsMargins( -1, 0, -1, 0 ); layout->addWidget( labelingDialog ); labelingFrame->setLayout( layout ); // Create the Labeling (deprecated) dialog tab layout = new QVBoxLayout( labelOptionsFrame ); layout->setMargin( 0 ); labelDialog = new QgsLabelDialog( layer->label(), labelOptionsFrame ); labelDialog->layout()->setMargin( 0 ); layout->addWidget( labelDialog ); labelOptionsFrame->setLayout( layout ); connect( labelDialog, SIGNAL( labelSourceSet() ), this, SLOT( setLabelCheckBox() ) ); } else { labelingDialog = 0; labelDialog = 0; mOptsPage_Labels->setEnabled( false ); // disable labeling item mOptsPage_LabelsOld->setEnabled( false ); // disable labeling (deprecated) item } // Create the Actions dialog tab QVBoxLayout *actionLayout = new QVBoxLayout( actionOptionsFrame ); actionLayout->setMargin( 0 ); const QgsFields &fields = layer->pendingFields(); actionDialog = new QgsAttributeActionDialog( layer->actions(), fields, actionOptionsFrame ); actionDialog->layout()->setMargin( 0 ); actionLayout->addWidget( actionDialog ); // Create the menu for the save style button to choose the output format mSaveAsMenu = new QMenu( this ); mSaveAsMenu->addAction( tr( "QGIS Layer Style File" ) ); mSaveAsMenu->addAction( tr( "SLD File" ) ); //Only if the provider support loading & saving styles to db add new choices if ( layer->dataProvider()->isSaveAndLoadStyleToDBSupported() ) { //for loading mLoadStyleMenu = new QMenu(); mLoadStyleMenu->addAction( tr( "Load from file" ) ); mLoadStyleMenu->addAction( tr( "Load from database" ) ); //mActionLoadStyle->setContextMenuPolicy( Qt::PreventContextMenu ); mActionLoadStyle->setMenu( mLoadStyleMenu ); QObject::connect( mLoadStyleMenu, SIGNAL( triggered( QAction * ) ), this, SLOT( loadStyleMenuTriggered( QAction * ) ) ); //for saving mSaveAsMenu->addAction( tr( "Save in database (%1)" ).arg( layer->providerType() ) ); }
Tag* VCard::tag() const { Tag *v = new Tag( "vCard" ); v->addAttribute( "xmlns", XMLNS_VCARD_TEMP ); v->addAttribute( "version", "3.0" ); insertField( v, "FN", m_formattedname ); insertField( v, "NICKNAME", m_nickname ); insertField( v, "URL", m_url ); insertField( v, "BDAY", m_bday ); insertField( v, "JABBERID", m_jabberid ); insertField( v, "TITLE", m_title ); insertField( v, "ROLE", m_role ); insertField( v, "NOTE", m_note ); insertField( v, "DESC", m_desc ); insertField( v, "MAILER", m_mailer ); insertField( v, "TZ", m_tz ); insertField( v, "REV", m_rev ); insertField( v, "SORT_STRING", m_sortstring ); insertField( v, "UID", m_uid ); if( m_N ) { Tag *n = new Tag( v, "N" ); insertField( n, "FAMILY", m_name.family ); insertField( n, "GIVEN", m_name.given ); insertField( n, "MIDDLE", m_name.middle ); insertField( n, "PREFIX", m_name.prefix ); insertField( n, "SUFFIX", m_name.suffix ); } if( m_PHOTO ) { Tag *p = new Tag( v, "PHOTO" ); if( !m_photo.extval.empty() ) { new Tag( p, "EXTVAL", m_photo.extval ); } else if( !m_photo.type.empty() && !m_photo.binval.empty() ) { new Tag( p, "TYPE", m_photo.type ); new Tag( p, "BINVAL", Base64::encode64( m_photo.binval ) ); } } if( m_LOGO ) { Tag *l = new Tag( v, "LOGO" ); if( !m_logo.extval.empty() ) { new Tag( l, "EXTVAL", m_logo.extval ); } else if( !m_logo.type.empty() && !m_logo.binval.empty() ) { new Tag( l, "TYPE", m_logo.type ); new Tag( l, "BINVAL", Base64::encode64( m_logo.binval ) ); } } EmailList::const_iterator ite = m_emailList.begin(); for( ; ite != m_emailList.end(); ++ite ) { Tag *e = new Tag( v, "EMAIL" ); insertField( e, "INTERNET", (*ite).internet ); insertField( e, "WORK", (*ite).work ); insertField( e, "HOME", (*ite).home ); insertField( e, "X400", (*ite).x400 ); insertField( e, "PREF", (*ite).pref ); insertField( e, "USERID", (*ite).userid ); } AddressList::const_iterator ita = m_addressList.begin(); for( ; ita != m_addressList.end(); ++ita ) { Tag *a = new Tag( v, "ADR" ); insertField( a, "POSTAL", (*ita).postal ); insertField( a, "PARCEL", (*ita).parcel ); insertField( a, "HOME", (*ita).home ); insertField( a, "WORK", (*ita).work ); insertField( a, "PREF", (*ita).pref ); insertField( a, "DOM", (*ita).dom ); if( !(*ita).dom ) insertField( a, "INTL", (*ita).intl ); insertField( a, "POBOX", (*ita).pobox ); insertField( a, "EXTADD", (*ita).extadd ); insertField( a, "STREET", (*ita).street ); insertField( a, "LOCALITY", (*ita).locality ); insertField( a, "REGION", (*ita).region ); insertField( a, "PCODE", (*ita).pcode ); insertField( a, "CTRY", (*ita).ctry ); } TelephoneList::const_iterator itt = m_telephoneList.begin(); for( ; itt != m_telephoneList.end(); ++itt ) { Tag *t = new Tag( v, "TEL" ); insertField( t, "NUMBER", (*itt).number ); insertField( t, "HOME", (*itt).home ); insertField( t, "WORK", (*itt).work ); insertField( t, "VOICE", (*itt).voice ); insertField( t, "FAX", (*itt).fax ); insertField( t, "PAGER", (*itt).pager ); insertField( t, "MSG", (*itt).msg ); insertField( t, "CELL", (*itt).cell ); insertField( t, "VIDEO", (*itt).video ); insertField( t, "BBS", (*itt).bbs ); insertField( t, "MODEM", (*itt).modem ); insertField( t, "ISDN", (*itt).isdn ); insertField( t, "PCS", (*itt).pcs ); insertField( t, "PREF", (*itt).pref ); } if( !m_geo.latitude.empty() && !m_geo.longitude.empty() ) { Tag *g = new Tag( v, "GEO" ); new Tag( g, "LAT", m_geo.latitude ); new Tag( g, "LON", m_geo.longitude ); } if( !m_org.name.empty() ) { Tag *o = new Tag( v, "ORG" ); new Tag( o, "ORGNAME", m_org.name ); StringList::const_iterator ito = m_org.units.begin(); for( ; ito != m_org.units.end(); ++ito ) new Tag( o, "ORGUNITS", (*ito) ); } if( m_class != ClassNone ) { Tag *c = new Tag( v, "CLASS" ); switch( m_class ) { case ClassPublic: new Tag( c, "PUBLIC" ); break; case ClassPrivate: new Tag( c, "PRIVATE" ); break; case ClassConfidential: new Tag( c, "CONFIDENTIAL" ); break; default: break; } } return v; }
QgsVectorLayerProperties::QgsVectorLayerProperties( QgsVectorLayer *lyr, QWidget * parent, Qt::WFlags fl ) : QDialog( parent, fl ) , layer( lyr ) , mMetadataFilled( false ) , mRendererDialog( 0 ) { setupUi( this ); setupEditTypes(); connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) ); connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) ); connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) ); connect( this, SIGNAL( accepted() ), this, SLOT( apply() ) ); connect( mAddAttributeButton, SIGNAL( clicked() ), this, SLOT( addAttribute() ) ); connect( mDeleteAttributeButton, SIGNAL( clicked() ), this, SLOT( deleteAttribute() ) ); connect( mToggleEditingButton, SIGNAL( clicked() ), this, SLOT( toggleEditing() ) ); connect( this, SIGNAL( toggleEditing( QgsMapLayer* ) ), QgisApp::instance(), SLOT( toggleEditing( QgsMapLayer* ) ) ); connect( layer, SIGNAL( editingStarted() ), this, SLOT( editingToggled() ) ); connect( layer, SIGNAL( editingStopped() ), this, SLOT( editingToggled() ) ); connect( layer, SIGNAL( attributeAdded( int ) ), this, SLOT( attributeAdded( int ) ) ); connect( layer, SIGNAL( attributeDeleted( int ) ), this, SLOT( attributeDeleted( int ) ) ); connect( insertFieldButton, SIGNAL( clicked() ), this, SLOT( insertField() ) ); connect( insertExpressionButton, SIGNAL( clicked() ), this, SLOT( insertExpression() ) ); mAddAttributeButton->setIcon( QgsApplication::getThemeIcon( "/mActionNewAttribute.png" ) ); mDeleteAttributeButton->setIcon( QgsApplication::getThemeIcon( "/mActionDeleteAttribute.png" ) ); mToggleEditingButton->setIcon( QgsApplication::getThemeIcon( "/mActionToggleEditing.png" ) ); mCalculateFieldButton->setIcon( QgsApplication::getThemeIcon( "/mActionCalculateField.png" ) ); connect( btnUseNewSymbology, SIGNAL( clicked() ), this, SLOT( useNewSymbology() ) ); QVBoxLayout *layout; if ( layer->hasGeometryType() ) { // Create the Labeling dialog tab layout = new QVBoxLayout( labelingFrame ); layout->setMargin( 0 ); labelingDialog = new QgsLabelingGui( QgisApp::instance()->palLabeling(), layer, QgisApp::instance()->mapCanvas(), labelingFrame ); layout->addWidget( labelingDialog ); labelingFrame->setLayout( layout ); // Create the Labeling (deprecated) dialog tab layout = new QVBoxLayout( labelOptionsFrame ); layout->setMargin( 0 ); labelDialog = new QgsLabelDialog( layer->label(), labelOptionsFrame ); layout->addWidget( labelDialog ); labelOptionsFrame->setLayout( layout ); connect( labelDialog, SIGNAL( labelSourceSet() ), this, SLOT( setLabelCheckBox() ) ); } else { tabWidget->setTabEnabled( 1, false ); // hide labeling item tabWidget->setTabEnabled( 2, false ); // hide labeling (deprecated) item } // Create the Actions dialog tab QVBoxLayout *actionLayout = new QVBoxLayout( actionOptionsFrame ); actionLayout->setMargin( 0 ); const QgsFieldMap &fields = layer->pendingFields(); actionDialog = new QgsAttributeActionDialog( layer->actions(), fields, actionOptionsFrame ); actionLayout->addWidget( actionDialog ); // Create the menu for the save style button to choose the output format mSaveAsMenu = new QMenu( pbnSaveStyleAs ); mSaveAsMenu->addAction( tr( "QGIS Layer Style File" ) ); mSaveAsMenu->addAction( tr( "SLD File" ) ); QObject::connect( mSaveAsMenu, SIGNAL( triggered( QAction * ) ), this, SLOT( saveStyleAsMenuTriggered( QAction * ) ) ); reset(); if ( layer->dataProvider() )//enable spatial index button group if supported by provider { int capabilities = layer->dataProvider()->capabilities(); if ( !( capabilities&QgsVectorDataProvider::CreateSpatialIndex ) ) { pbnIndex->setEnabled( false ); } if ( capabilities & QgsVectorDataProvider::SetEncoding ) { cboProviderEncoding->addItems( QgsVectorDataProvider::availableEncodings() ); QString enc = layer->dataProvider()->encoding(); int encindex = cboProviderEncoding->findText( enc ); if ( encindex < 0 ) { cboProviderEncoding->insertItem( 0, enc ); encindex = 0; } cboProviderEncoding->setCurrentIndex( encindex ); } else { // currently only encoding can be set in this group, so hide it completely grpProviderOptions->hide(); } } updateButtons(); leSpatialRefSys->setText( layer->crs().authid() + " - " + layer->crs().description() ); leSpatialRefSys->setCursorPosition( 0 ); leEditForm->setText( layer->editForm() ); leEditFormInit->setText( layer->editFormInit() ); connect( sliderTransparency, SIGNAL( valueChanged( int ) ), this, SLOT( sliderTransparency_valueChanged( int ) ) ); //insert existing join info const QList< QgsVectorJoinInfo >& joins = layer->vectorJoins(); for ( int i = 0; i < joins.size(); ++i ) { addJoinToTreeWidget( joins[i] ); } diagramPropertiesDialog = new QgsDiagramProperties( layer, mDiagramFrame ); mDiagramFrame->setLayout( new QVBoxLayout( mDiagramFrame ) ); mDiagramFrame->layout()->addWidget( diagramPropertiesDialog ); //for each overlay plugin create a new tab int position; QList<QgsVectorOverlayPlugin*> overlayPluginList = overlayPlugins(); QList<QgsVectorOverlayPlugin*>::const_iterator it = overlayPluginList.constBegin(); for ( ; it != overlayPluginList.constEnd(); ++it ) { QgsApplyDialog* d = ( *it )->dialog( lyr ); position = tabWidget->insertTab( tabWidget->count(), qobject_cast<QDialog*>( d ), QgsApplication::getThemeIcon( "propertyicons/diagram.png" ), tr( "Overlay" ) ); tabWidget->setCurrentIndex( position ); //ugly, but otherwise the properties dialog is a mess mOverlayDialogs.push_back( d ); } //layer title and abstract if ( layer ) { mLayerTitleLineEdit->setText( layer->title() ); mLayerAbstractTextEdit->setPlainText( layer->abstract() ); } QSettings settings; restoreGeometry( settings.value( "/Windows/VectorLayerProperties/geometry" ).toByteArray() ); int tabIndex = settings.value( "/Windows/VectorLayerProperties/row", 0 ).toInt(); // if the last used tab is not enabled display the first enabled one if ( !tabWidget->isTabEnabled( tabIndex ) ) { tabIndex = 0; for ( int i = 0; i < tabWidget->count(); i++ ) { if ( tabWidget->isTabEnabled( i ) ) { tabIndex = i; break; } } } tabWidget->setCurrentIndex( tabIndex ); setWindowTitle( tr( "Layer Properties - %1" ).arg( layer->name() ) ); } // QgsVectorLayerProperties ctor
/* Desc of nulltest table timestampNull = true | Field | Type | Null | Key | Default | Extra +-------+---------------+------+-----+----------------------+------------------- | id | int(11) | NO | PRI | NULL | | fd1 | int(11) | YES | UNI | NULL | | fd2 | int(11) | YES | | NULL | | fd3 | int(11) | YES | | NULL | | fd4 | int(11) | YES | | NULL | | fd5 | int(11) | YES | | -1 | | fd6 | varchar(16) | YES | | NULL | | fd7 | varbinary(50) | YES | | NULL | | fd8 | timestamp(6) | YES | | NULL | | fd9 | datetime(6) | YES | | NULL | | fd10 | timestamp(6) | YES | | CURRENT_TIMESTAMP(6) | on update CURRENT_TIMESTAMP(6) | fd11 | datetime(6) | YES | | NULL | +-------+---------------+------+-----+----------------------+------------------- CREATE TABLE `nulltest` (`id` INT NOT NULL ,`fd1` INT NULL DEFAULT NULL,`fd2` INT NULL DEFAULT NULL,`fd3` INT NULL DEFAULT NULL,`fd4` INT NULL DEFAULT NULL,`fd5` INT NULL DEFAULT '-1',`fd6` VARCHAR(16) binary NULL DEFAULT '-123456',`fd7` VARBINARY(50) NULL DEFAULT NULL,`fd8` TIMESTAMP(6) NULL DEFAULT NULL,`fd9` DATETIME(2) NULL DEFAULT NULL,`fd10` TIMESTAMP(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),`fd11` DATETIME(6) NULL DEFAULT NULL, UNIQUE key0(`id`), UNIQUE key1(`fd1`)) ENGINE=InnoDB default charset=utf8 */ short createTestTable(database* db, bool timestampNull = true, bool supportDateTimeTimeStamp = true) { try { openDatabase(db, makeUri(PROTOCOL, HOSTNAME, DBNAMEV3, BDFNAME), TYPE_SCHEMA_BDF,TD_OPEN_NORMAL); dbdef* def = db->dbDef(); short tableid = 1; db->dropTable(_T("nulltest")); def->deleteTable(tableid); short fieldnum = 0; insertTable(def, tableid, _T("nulltest"), g_td_charsetIndex); insertField(def, tableid, fieldnum, _T("id"), ft_integer, 4); fielddef* fd = insertField(def, tableid, ++fieldnum, _T("fd1"), ft_integer, 4); fd->setNullable(true); //fd->nullbit = 100; //fd->nullbytes = 30; fd = insertField(def, tableid, ++fieldnum, _T("fd2"), ft_integer, 4); fd->setNullable(true); fd = insertField(def, tableid, ++fieldnum, _T("fd3"), ft_integer, 4); fd->setNullable(true); fd = insertField(def, tableid, ++fieldnum, _T("fd4"), ft_integer, 4); fd->setNullable(true); fd = insertField(def, tableid, ++fieldnum, _T("fd5"), ft_integer, 4); fd->setNullable(timestampNull, false); fd->setDefaultValue(-1LL); fd = insertField(def, tableid, ++fieldnum, _T("fd6"), ft_myvarchar, 49); fd->setNullable(true, false); fd->setDefaultValue(_T("-123456")); //fd->setDefaultValue(_T("漢字")); fd = insertField(def, tableid, ++fieldnum, _T("fd7"), ft_myvarbinary, 51); fd->setNullable(true); fd = insertField(def, tableid, ++fieldnum, _T("fd8"), ft_mytimestamp, 7); fd->setNullable(timestampNull); fd->decimals = 6; fd = insertField(def, tableid, ++fieldnum, _T("fd9"), ft_mydatetime, 6); fd->setNullable(true); fd->decimals = 2; fd = insertField(def, tableid, ++fieldnum, _T("fd10"), ft_mytimestamp, 7); fd->setNullable(true); fd->decimals = 6; if (timestampNull == false && supportDateTimeTimeStamp) { fd->setDefaultValue(DFV_TIMESTAMP_DEFAULT); fd->setTimeStampOnUpdate(true); } fd = insertField(def, tableid, ++fieldnum, _T("fd11"), ft_mydatetime, 8); fd->setNullable(timestampNull); fd->decimals = 6; if (timestampNull == false && supportDateTimeTimeStamp) fd->setTimeStampOnUpdate(true); fd = insertField(def, tableid, ++fieldnum, _T("fd12"), ft_myyear, 1); fd->setNullable(true); keydef* kd = insertKey(def, tableid, 0); kd->segments[0].fieldNum = 0; kd->segments[0].flags.bit8 = 1; // extended key type kd->segments[0].flags.bit1 = 1; // changeable kd->segmentCount = 1; kd = insertKey(def, tableid, 1); kd->segments[0].fieldNum = 1; kd->segments[0].flags.bit8 = 1; // extended key type kd->segments[0].flags.bit1 = 1; // changeable kd->segmentCount = 1; tabledef* td = def->tableDefs(tableid); td->primaryKeyNum = 0; updateTableDef(def, tableid); return 0; } catch (bzs::rtl::exception& e) { _tprintf(_T("Error! %s\n"), (*getMsg(e)).c_str()); } return 1; }
// copies a long int field to the dataLine void CSVFile::writeInt (long integer) { char string[SMALL]; _ltoa (integer, string, 10); insertField (string); }
// copies a int int field to the dataLine void CSVFile::writeInt (short integer) { char string[SMALL]; _itoa (integer, string, 10); insertField (string); }