data type mapping

Posts   
 
    
coco
User
Posts: 8
Joined: 28-Dec-2005
# Posted on: 16-Feb-2006 21:33:17   

I have picked up a project with database columns that were originally char fields. I changed the char fields to varchar and stripped out the padded spaces.

I tested the software to see if LLBLGen treated the char and varchar the same and noticed that upon insert the values were getting padded with the spaces like a char field still. So I regenerated the LLBLGen code.

I looked around in the generated code for a difference that would alter the way the values were inserted and I did notice the following comment in the Entity class :


/// Table field type characteristics (type, precision, scale, length): VarChar, 0, 0, 255

The previous code had Char in there. This is only a comment though. The code in the property had not changed.

The EntityFieldFactory class for this field looks like :


case FieldMappingFieldIndex.Screen:
fieldToReturn = new EntityField2("Screen", "FieldMappingEntity", typeof(System.String), TypeDefaultValue.GetDefaultValue(typeof(System.String)), false, (int)fieldIndex, 255, 0, 0, false, false, false);

I didn't notice a difference here either.

I can't figure out why the strings are still getting inserted with the padded strings. Well, I looked at the SQL tracing and noticed the following output :

Generated Sql query: Query: INSERT INTO.....

Parameter: @Screen : AnsiStringFixedLength. Length: 255. Precision: 0. Scale: 0. Direction: Input. Value: Test.

So that tells me why it gets inserted that way, but I need to figure out how to fix this. Where in the generated code it is specified to create a fixed length parameter?

Thanks in advance.

coco
User
Posts: 8
Joined: 28-Dec-2005
# Posted on: 16-Feb-2006 22:38:46   

I solved the problem. The code was generated correctly but the dll was not being updated in the application. I deleted the dll in the application bin and a rebuild put the correct dll.