예제 #1
0
I_Field_Ptr CreateEnumField( 
	I_Table_Ptr 			inTable, 
	const String& 			inName,
	I_Type_Enumerated_Ptr 	inpType,
	vuint16					inFlags )
{
	I_PropertyContainer_Ptr props = new PropertyContainer();	

	props->Add( new Prop_EnumType(inpType) );

	// ---------------
	I_Field_Ptr pField;

	switch( inpType->get_MaxIdentCount() )
	{
		case ENUM_8_IDENT_COUNT:
		{
			pField = inTable->CreateField( inName, kTypeEnum8, inFlags, props );
		} break;

		case ENUM_16_IDENT_COUNT:
		{
			pField = inTable->CreateField( inName, kTypeEnum16, inFlags, props );
		} break;

		default:
		{
			FBL_Throw( xFeatureError( ERR_FEATURE_NOT_SUPPORTED, "Not enum8 or enum16" ) );
		}
	}
	

	return pField;
}
예제 #2
0
I_PropertyContainer_Ptr Create_Link_On_Value_Properties(
	I_Field_Ptr		inKey,
	I_Field_Ptr		inPtr,
	EOnDeletion		inOnDeletion,
	EOnUpdate		inOnUpdate )
{
	I_PropertyContainer_Ptr props = new PropertyContainer();
	props->Add( new Prop_Key( inKey ) );
	props->Add( new Prop_Ptr( inPtr ) );
	props->Add( new Prop_OnDeletion( inOnDeletion ) );
	props->Add( new Prop_OnUpdate( inOnUpdate ) );

	return props;
}
예제 #3
0
I_Field_Ptr CreateMoneyField(
	I_Table_Ptr 	inTable, 
	const String& 	inName,
	vuint16			inFlags,
	const String& 	inMethod )
{
	I_PropertyContainer_Ptr props = new PropertyContainer();

	if( inMethod.isEmpty() == false )
		props->Add( new Prop_MethodSql( inMethod ) );

	I_Field_Ptr pField = inTable->CreateField( inName, kTypeMoney, inFlags, props );

	return pField;
}
예제 #4
0
I_Field_Ptr CreatePictureField( 
	I_Table_Ptr 	inTable, 
	const String& 	inName,
	vuint32			inSegmentSize,
	vuint16			inFlags )	
{
	I_PropertyContainer_Ptr props = new PropertyContainer();	
	
	props->Add( new Prop_SegmentSize(inSegmentSize) );

	// ---------------
	I_Field_Ptr pField = inTable->CreateField( inName, kTypePicture, inFlags, props );
		
	return pField;
}
예제 #5
0
I_PropertyContainer_Ptr Create_Link_On_Values_N_Properties(
	ArrayOfFields_Ptr	inKeys,
	ArrayOfFields_Ptr	inPtrs,
	EOnDeletion			inOnDeletion,
	EOnUpdate			inOnUpdate
)
{
	I_PropertyContainer_Ptr props = new PropertyContainer();
	props->Add( new Prop_RDB_Keys( inKeys ) );
	props->Add( new Prop_RDB_Ptrs( inPtrs ) );
	props->Add( new Prop_OnDeletion( inOnDeletion ) );
	props->Add( new Prop_OnUpdate( inOnUpdate ) );

	return props;
}
예제 #6
0
I_Field_Ptr CreateStringField( 
	I_Table_Ptr 	inTable, 
	const String& 	inName,
	vuint32			inMaxLength,
	vuint16			inFlags,
	const String& 	inMethod )	
{
	I_PropertyContainer_Ptr props = new PropertyContainer();	

	props->Add( new Prop_MaxLen(inMaxLength) );

	if( inMethod.isEmpty() == false )
		props->Add( new Prop_MethodSql( inMethod ) );

	// ---------------
	I_Field_Ptr pField = inTable->CreateField( inName, kTypeString, inFlags, props );
		
	return pField;
}
예제 #7
0
I_Field_Ptr CreateTextField( 
	I_Table_Ptr 	inTable, 
	const String& 	inName,
	vuint32			inSegmentSize,
	vuint16			inFlags,
	const String& 	inMethod )	
{
	I_PropertyContainer_Ptr props = new PropertyContainer();	
	
	props->Add( new Prop_SegmentSize(inSegmentSize) );

	if( inMethod.isEmpty() == false )
		props->Add( new Prop_MethodSql( inMethod ) );

	// ---------------
	I_Field_Ptr pField = inTable->CreateField( inName, kTypeText, inFlags, props );
		
	return pField;
}
예제 #8
0
I_Field_Ptr CreateObjectPtr( 
	I_Table_Ptr 	inTable, 
	const String& 	inName,
	I_Table_Ptr 	inTarget,
	EOnDeletion		inOnDeletion,
	vuint16			inFlags,
	const String& 	inLinkName )
{
	I_PropertyContainer_Ptr props = new PropertyContainer();	
	
	props->Add( new Prop_Target(inTarget) );
	props->Add( new Prop_OnDeletion(inOnDeletion) ); 
	
	if( inLinkName.isEmpty() == false )
		props->Add( new Prop_LinkName( inLinkName ) );

	// ---------------
	I_Field_Ptr pField = inTable->CreateField( inName, kTypeObjectPtr, inFlags, props );
		
	return pField;
}
예제 #9
0
I_Field_Ptr CreateDoubleField(
	I_Table_Ptr 	inTable, 
	const String& 	inName,
	vuint16			inFlags,
	const String& 	inMethod,
	vuint16			inPrecision,
	vuint16			inScale )
{
	I_PropertyContainer_Ptr props = new PropertyContainer();

	if( inPrecision )
		props->Add( new Prop_Precision( inPrecision ) );
	if( inScale )
		props->Add( new Prop_Scale( inScale ) );

	if( inMethod.isEmpty() == false )
		props->Add( new Prop_MethodSql( inMethod ) );

	I_Field_Ptr pField = inTable->CreateField( inName, kTypeDouble, inFlags, props );

	return pField;
}
예제 #10
0
FBL_Begin_Namespace


/**********************************************************************************************/
I_Field_Ptr CreateNumericField( 
	I_Table_Ptr 	inTable, 
	const String& 	inName,
	VALUE_TYPE		inType,
	vuint16			inFlags,
	const String& 	inMethod )
{
	I_PropertyContainer_Ptr props;	
	
	//if( inMethod != NULL && *inMethod != 0 )
	if( inMethod.isEmpty() == false )
	{
		props = new PropertyContainer();
		props->Add( new Prop_MethodSql( inMethod ) );
	}
	
	I_Field_Ptr pField = inTable->CreateField( inName, inType, inFlags, props );

	return pField;
}
예제 #11
0
I_PropertyContainer_Ptr Create_Binary_Link_Properties(
	I_Table_Ptr		inLeftTable,
	I_Table_Ptr		inRightTable,
	LinkType		inLeftType,
	LinkType		inRightType,
	EOnDeletion		inOnDelete,
	EStorageType	inStorageType,
	ELinkStorageKind inStorageKind )
{
	I_PropertyContainer_Ptr props = new PropertyContainer();
	props->Add( new Prop_LeftTable( inLeftTable ) );
	props->Add( new Prop_RightTable( inRightTable ) );
	props->Add( new PropertyLong( "LeftType", inLeftType ) );
	props->Add( new PropertyLong( "RightType", inRightType ) );
	props->Add( new Prop_OnDeletion( inOnDelete ) );
	props->Add( new PropertyLong( "StorageType", static_cast<vint32>(inStorageType)) );
	props->Add( new PropertyLong( "StorageKind", static_cast<vint32>(inStorageKind)) );

	return props;
}
예제 #12
0
void CloneFieldsLight( 
	I_Table_Ptr 		inpTableSource, 
	I_Table_Ptr 		inpTableTarget )
{
	// Light because of 
	// 1. inpTableSource assumed to be a cursor (no ObjectPtrs, RecID, OID).
	// 2. inpTableTarget will be just a "data-snapshot" of inpTableSource
	//    (most of the flags and some properties like method-text are ignored)
	// 

	vuint16 fldCount = inpTableSource->get_FieldCount();
	for( vuint16 i = 1; i <= fldCount; ++i )
	{
		I_Field_Ptr pSourceFld = inpTableSource->get_Field(i);

		// Flags
		vuint16 fldFlags = fNone;
		if( pSourceFld->get_Nullable() )
			fldFlags |= fNullable;

		// At least for now we will ignore any flag except nullable
		// because of who need to get indexed (especially indexBywords -
		// btw here is a problem - asking for that we create some default tmp
		// index) result.
		// But note that there are some fields for which some flags are always ON!
		// ( indexed for boolean for example)
/*
		if( pSourceFld->get_Indexed() )
			fldFlags |= fIndexed;
		if( pSourceFld->get_Unique() )
			fldFlags |= fIndexUnique;
		if( pSourceFld->get_IndexStyle() )
			fldFlags |= fIndexByWords;
		
*/
		// No sense to keep identity, because cursor's field keeps some particular values
		// and we have to store exactly that values
		//
		//if( pSourceFld->get_Identity() )
		//	fldFlags |= fIdentity;
		
		// Remove any method property. Because it could be the methods
		// which are based on fields which are not available in target table.
		// "SELECT f1+1 FROM t2"
		// So every field will be snapshot of original one.
		//
		//if( pSourceFld->get_IsMethod() )
		//	fldFlags |= fMethod;

		vuint32 fldType = pSourceFld->get_Type();
		// Could not be objectPtr, RecID, OID in the target table because it is impossible 
		// to have those field types in the cursor.
		FBL_CHECK( fldType != kTypeObjectPtr && fldType != kTypeRecID && fldType != kTypeOID );

		// Type and properties
		I_PropertyContainer_Ptr properties;
		// Properties
		properties = pSourceFld->get_Properties();
		if( pSourceFld->get_IsMethod() )
		{
			properties->Remove( "METHOD_TEXT" );
			properties->Remove( "METHOD_TREE" );
		}

		// In case of client-cursor field in vclient environment (no properties at all)
		// register max length property manually.
		if( properties == nullptr )
		{
			properties = new PropertyContainer();	
			properties->Add( new Prop_MaxLen( pSourceFld->get_MaxLength() ) );
		}
		

		// Create target field
		I_Field_Ptr pTargetFld = inpTableTarget->CreateField( 
			pSourceFld->get_Name(), 
			fldType, 
			fldFlags,														
			properties );
	}	
}