How to create Object field via SQL

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to create Object field via SQL

4D Tech mailing list
How do you create an Object field with SQL code. What do you use for the field type?

Begin SQL
   ALTER TABLE Orders ADD OrderID UUID;
   ALTER TABLE Orders ADD ObjectField ????;
End SQL

Tim

********************************************
Tim Nevels
Innovative Solutions
785-749-3444
[hidden email]
********************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: How to create Object field via SQL

4D Tech mailing list
The SQL engine has no knowledge of, nor compatibility with, object columns. In fact, it completely blows up if you try to access an object field through SQL. It's almost as if the SQL engine is a bolted-on afterthought to 4D that doesn't receive much love at all from the development team.

It's a real pain if you deal with external systems that may need call a SELECT * against a table in your 4D Server and you've happened to add an object field. In this example, I added an object field named 'Extra' to an Invoices table. If I try to SELECT * FROM Invoices WHERE InvoiceID=x, I get the following stream of garbage in a runtime error (it would be so much better if they would just ignore it if they can't deal with it properly):

Error when executing the method "SQLQuery.RunQuery" at line number 281

The functionality is not implemented.

Error code: 1203
The functionality is not implemented.
component: 'SQLS'
task -13, name: 'SQLQuery'

Error code: 1203
The functionality is not implemented.
component: 'SQLS'
task -13, name: 'SQLQuery'

Error code: 1726
Failed to validate SELECT command.
component: 'SQLS'
task 9336, name: 'SQL connection handler'

Error code: 1704
Failed to validate SELECT list.
component: 'SQLS'
task 9336, name: 'SQL connection handler'

Error code: 1716
Failed to validate SELECT item 154.
component: 'SQLS'
task 9336, name: 'SQL connection handler'

Error code: 1717
Failed to validate column 'Extra'.
component: 'SQLS'
task 9336, name: 'SQL connection handler'

Error code: 1203
The functionality is not implemented.
component: 'SQLS'
task 9336, name: 'SQL connection handler'

Jeff

--
Jeffrey Kain
[hidden email]

> On Apr 13, 2017, at 4:14 PM, Tim Nevels via 4D_Tech <[hidden email]> wrote:
>
> How do you create an Object field with SQL code. What do you use for the field type?
>
> Begin SQL
>   ALTER TABLE Orders ADD OrderID UUID;
>   ALTER TABLE Orders ADD ObjectField ????;
> End SQL

**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: How to create Object field via SQL

4D Tech mailing list
Jeff,

Just a note of thanks for drawing attention to this....uh...."feature." I
would have been digging around in my code for some time had I not had your
post in the back of my mind.

-- David
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: How to create Object field via SQL

4D Tech mailing list
This bit me again yesterday too. I tried to do a SELECT * from a simple table. I forgot that I had used an object field.

So annoying.


**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************