Confluence Word Tagging? - confluence

Currently setting up a confluence wiki and simple question, is there a way to create a link to specific words?
I would like to have a contents section that would list out all the stored procedures that are mentioned and when clicked will take the user to that specific word or section.
For (bad) example:
Process 1 is using stored procedure x to create tables so that stored procedure y can pick them up.
List of Stored Procedures:
stored procedure x
stored procedure y
I tried to set headings but headings seem to be everything up until a newline (unless I missed something).

Ended up making a custom macro to perform this.
Example:
Process 1 is using stored procedure x to create My.Table to be used with stored procedure y
Returns:
Stored Procedures
stored procedure x
stored procedure y
Tables
My.Table
How it works:
Based on whether text is Italic and then Bold or just italic, depends on where the values are returned.

Related

kdb - how generate HEX colour code as string or symbol

I would like to create a column on an in-memory table that generates a colour HEX code based on a person's name (another column). A quick google didn't give much so wondered if any pointers can be given here.
e.g
update colour: <some code and use username col as input> from table
In kdb+ you can run a function on a column via an update statement but there are slight differences depending on whether the function is vectorised or not. If vectorised:
update colour:{<some code>}[username] from table
update colour:someFunction[username] from table
If not vectorised then an iterator like each ' is required
update colour:{<some code>}'[username] from table
update colour:someFunction'[username] from table
This function will generate hex codes from the first 3 characters of a string.
q)hex:{a:i-16*j:(i:`int$3#x)div 16;"0123456789ABCDEF"raze(j-16*j div 16),'a}
q)hex"Hello"
"48656C"
q)update colour:hex'[username] from table

Postgresql - Return column subset from cursor

I have a legacy stored procedure returning a number (row count) a cursor with many columns; I need to retrieve a subset of the selected columns. I can think of three ways of doing it:
Invoke the existing procedure from the outside, and map columns to my own data structures trimming unneeded columns;
Write a new stored procedure, mostly identical to the existing one but returning different columns;
Write a new stored procedure, invoking the old one internally and filtering columns (the referenced entities and thus the number of rows are exactly the same as the existing procedure).
Number 2 is obviously a no-go.
Number 1 is viable. As far as I know, there is little difference in the computing cost between retrieving one or more columns, in that the engine has to read full rows regardless, before filtering unrequired columns; I do have a feeling it would be heavier on the runtime invoking the procedure from the outside, as objects representing unneeded columns would exist on returning from the DB call.
I would be interested in implementing Number 3, but I would prefer to maintain the same return type as the existing function (count + refcursor) for conformity.
I think I could transfer all the rows in the cursor returned by the existing function into a temporary table as described e.g. in this question, and use it as a source for the output cursor but:
I am not sure of how the output cursor would behave with a temporary table created with a drop-on-commit clause (would the results exist reliably after the procedure has terminated? Would the temporary table be dropped as expected?);
I read that temporary tables are expensive to use, and it feels like overkill for what in the end is a filtering of columns on the same rows from a pre-computed result.
Is there a way to query the existing cursor so that it may be used as a source for the output cursor, while filtering columns?

Entity framework for execute string stored procedure

New to EF... using 6.0. I've have a Stored Proc which has the dynamic build select query inside a string variable that outputs using Execute(#StringQuery). This select has around 20 columns.
After adding this SP in EF, the return type is INT (not sure why). But I think I've to add all the columns manually in Complex types in EDMX. Wanted to know whether there is any better way to handle this as the columns are in huge number.
Please suggest.
Procedure Text:
DECLARE #StringQuery VARCHAR(MAX)
SET #StringQuery = 'SELECT AROUND 20 COLUMNS WITH LOT OF CONDITIONS ADDED'
EXECUTE(#StringQuery)
Open your model
Go to View->Other Windows->Entity Data Model Browser
In browser expand your Model->Function Imports and double click on Stored Proc
In Returns a Collections off choose Complex and press Get Column Information
Click Create New Complex Type
OK, Save

Updating the text of a large number of stored procedures

The question pretty much sums it up. I've got to replace text in a large number for store procedures. Its not so many that doing it manually is impossible, but enough that I'm asking the question. I also prefer automation as it reduces the change of user error when we make the change in production.
I can Identify them like this:
select OBJECT_DEFINITION(object_id), *
from sys.procedures
where OBJECT_DEFINITION(object_id) like '%''MyExampleLiteral''%'
order by name
Is there any way to mass update them all to change 'MyExampleLiteral' to 'MyOtherExampleLiteral'?
I'd even settle for a way to open all the stored procs. Just Finding these store procs in a larger list will take some time.
I thought about generating alter statements using the above select statements, but then I lose line breaks.
Thanks in advance,
This is a Microsoft SQL Server.
There are different tools to use depending on the database in question. For example, Microsoft SQL Server Data Tools integrates with Visual Studio, and allows you to do these types of operations fairly easily. The database is stored in your solution as scripts, which you can then search and replace any keyword you wish. I'm assuming there would be similar tools available for other platforms.
You could do this with dynamic sql. Query the system tables to get all the SPs containing your "MyExampleLiteral":
SELECT [object_id] FROM sys.objects o
WHERE type_desc = 'SQL_STORED_PROCEDURE'
AND is_ms_shipped = 0
AND OBJECT_DEFINITION(o.[object_id]) LIKE '%<search string>%'
Then, write a while loop to go through those object_ids. In the while loop, get the OBJECT_DEFINITION() into a string and replace the "MyExampleLiteral", then replace CREATE PROCEDURE with ALTER PROCEDURE and execute the string using sp_executesql.
Doing something this crazy, make sure you backup the database first.

stored procedure returns data of varying dimensions Entity Framework 4

for the reporting of a survey system I am working on, we developed a stored procedure that returns data with varying number of columns.
we show the operator all the columns from these tables: Users, Questions, Answers.
the user selects the columns from each of the tables that the report should show.
for example:
User: Name, Age, zipcode.
Questions: question2, question 4
Answers: answer2, answer3, answer4.
we then pass the parameters to the stored procedure and the stored procedure returns:
one column for each user property, question or answer.
and a row for each user in the DB.
example:
as you can see, the stored procedure can return anything between 3 rows of 2 columns to 500 rows of 50 columns. Is there a way to use the stored procedure with entity framework? at first I tried with a complex return type, but it appears that that approach will not work in this case.
EF supports only stored procedures with fixed number of columns defined at design time. To execute this procedure you need to use plain old ADO.NET.
EDIT: If you have fixed total nuber of colums (you mentioned 50) you can create single class containing all these columns and use it as result for execution. EF will fill only properties existing in the result set.