Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Designer> SQL Server fixed binary column
 

Pages: 1
Designer
SQL Server fixed binary column
Page:1/1 

  Print all messages in this thread  
Poster Message
simmotech
User



Location:

Joined on:
01-Feb-2006 15:43:00
Posted:
1006 posts
# Posted on: 25-Apr-2019 11:07:08.  
LLBLGen v4.2

I am trying to define a fixed-length binary column for SQL server.

In the Designer:-
The Field is byte[] with Max Length 20.
The Field mapping is 'binary' with Max Length 20.

But the generated code doesn't include the Length!
What am I missing?
  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37476 posts
# Posted on: 25-Apr-2019 11:41:45.  
'Generated code doesn't include the length', you mean: it doesn't define a byte[20] array? That's correct, it validates the value when it's set. We don't use defined member variables so there's no
private byte[] _foo = new byte[20];
possible, hence we do it when the value is set and validate the length. You do that and it doesn't validate/report an error and accepts a longer array?


Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
simmotech
User



Location:

Joined on:
01-Feb-2006 15:43:00
Posted:
1006 posts
# Posted on: 25-Apr-2019 11:48:59.  
No, I mean the SQL Creation script doesn't contain the length:

Code:
[Hash] [binary] NOT NULL


Should be
Code:
[Hash] [binary] (20) NOT NULL




  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37476 posts
# Posted on: 25-Apr-2019 12:34:01.  
Looks like a bug indeed. Also present in 5.5.3. Looking into it.

Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37476 posts
# Posted on: 25-Apr-2019 12:44:27.  
To fix it in 4.2, open Template Viewer and select the 'DDL SQL' framework.
Then select SQL Server -> then select SQL Server specific template bindings. Open the FieldCreationInclude template (it's almost at the bottom).

In the switch statement in the CreateFieldDefinitionString() method, add:
Code:

            case SqlDbTypes.Binary:
                toReturn.AppendFormat("({0})", field.TypeDefinition.Length);
                break;


to make sure it appends a length.
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
simmotech
User



Location:

Joined on:
01-Feb-2006 15:43:00
Posted:
1006 posts
# Posted on: 25-Apr-2019 14:42:53.  
Found it and all working now. Thanks!

  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.