SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
[SA 9.0.162 Pro] - $OBJECT()$ anomaly

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
[SA 9.0.162 Pro] - $OBJECT()$ anomaly
Author Message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post [SA 9.0.162 Pro] - $OBJECT()$ anomaly Reply with quote
According to help:
Quote:

Qualified name – this option causes the code snippet to
insert the selected items into the code in place of the
$OBJECT(…)$ macro-variable. The selected items are
named as specified in the "Always Fully Qualify Object
Names" option in "SQL Assistance" group of options for your
database type. See the Qualify Object Names topic in
CHAPTER 8 for more details about object name qualification

yet regardless of the settings Always Fully Qualify Object Names set to With schema name
Code:

$OBJECT(ins_qualname)$

gives
Code:

database.scheme.object

and
Code:

$OBJECT$

gives
Code:

scheme.object

and


Last edited by gemisigo on Wed Oct 12, 2016 4:59 am; edited 1 time in total
Thu Sep 29, 2016 1:01 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7839

Post Reply with quote
I think logically the manual is incorrect. As the name suggest "Qualified name" returns qualified object name independent of the other settings. Isn't that what "Qualified name" is for?
Fri Sep 30, 2016 10:02 pm View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post Reply with quote
No. Well, yes, but that's not the point here. It should return qualified name but the mentioned setting could take four states: Only for objects in other schema or databas, With schema name, With schema name (functions only), and With database and schema names. I think $OBJECT()$ macro should consider the current state, and only qualify objects with database + schema names if this setting says so. Meanwhile I've no combinations of this setting and $OBJECT()$ macro options that would only yield the object name without the schema name, since even the simple $OBJECT()$ will produce schema.object. I have to use
Code:

$$SELECT PARSENAME('$OBJECT()$', 1)$$

to fetch the object name and that's a bit cumbersome to do every time. This behavior change was introduced somewhere in 7.x (see post here). Prior to that $OBJECT()$ only inserted the object name.
Also, the option for $OBJECT()$ named ins_object is not inserted when it's object name selected for insertion. I has to be entered manually (though right now I cannot check if it even works).

Could you check these, please?
Sat Oct 01, 2016 3:57 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post Reply with quote
This is still an issue in [SA 9.0.162 Pro]. I'd recommend renaming the options so that they'd tell what they'd actually do, and adding another option that adds option ins_object from the dialog.

I've created a test environment (a database and a table)
Code:

CREATE TABLE test_table(i INT NOT NULL IDENTITY(1,1) PRIMARY KEY, column1 int, column2 varchar(128), column3 decimal(8,2));


and a snippet:
Code:

ins_nothing: [$OBJECT(ins_nothing)$]
object: [$OBJECT$]
ins_object: [$OBJECT(ins_object)$]
ins_qualname: [$OBJECT(ins_qualname)$]
ins_db: [$OBJECT(ins_db)$]
ins_schema: [$OBJECT(ins_schema)$]
ins_column: [$OBJECT(ins_column)$]


Provided, that running it resulted in:
Code:

ins_nothing: []
object: [dbo.test_table]
ins_object: [test_table]
ins_qualname: [test_dbx.dbo.test_table]
ins_db: [test_dbx]
ins_schema: [dbo]
ins_column: [i, column1, column2, column3]


I got to the conclusion that the $OBJECT$ macro
- without any options will insert the schema qualified name of the object
- ins_object inserts object name only (even if column was selected) which was the default behavior for $OBJECT$ without insert options that broke somewhere in 7.x
- ins_qualname will database and schema qualify the object regardless of the setting Always Fully Qualify Object Names set to With schema name and not to With database and schema names
- ins_db, ins_schema work as expected
- ins_column returns every column of a selected object (table, view, table function, etc.), picking a single/multiple column returns only the one(s) that has been selected
- having ins_column automatically filters out some objects that couldn't produce their own columns (eg. stored procedures are removed from the popup list).

What is confusing is that ins_qualname behavior has been changed and goes against the help (regarding the Always Fully Qualify Object Names setting), and ins_object option cannot added using the $OBJECT$ macro dialog, at has to be entered manually. Also, there's no option to retrieve schema.object in case column(s) are selected, you have to put those two together manually as well.
Wed Oct 12, 2016 4:54 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7839

Post Reply with quote
Let me follow up on this a bit later. I've found a bunch of related tickets in our system for the $OBJECT$ changes and still trying to make sense of what has changed and when, and related issues.
Wed Oct 12, 2016 9:50 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post Reply with quote
Sure, take your time. All(?) the issues related can be worked around by adding/removing $OBJECT$ options manually here and there, so this one is not imperative.
Wed Oct 12, 2016 9:54 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post Reply with quote
Has there been any progress on this matter? It is still qualifying with full database name in [SA 9.0.185 Pro].
Mon Nov 21, 2016 9:23 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.