Oracle stored procs
-
When I started at my current company I was given a c# / oracle project and asked to rewrite it from scratch. I was told the guy who wrote it had been fired and everyone who had attempted to maintain the code had given up. I reakon I could have provided six months of content for the WTF web site from this single project. By far my favorite part was how he returned values from oracle stored procs to the application. Every stored proc returned a var of type VARCHAR2_32_ARRAY, and looked something like this
CURSOR CUR_PARAMETERS IS
SELECT
CAST (
MULTISET (
SELECT
COLUMN_NAME_1 || ':' || COLUMN_NAME_2 || ':' || COLUMN_NAME_3
FROM
SOME_TABLE_NAME
WHERE
SOME_FIELD = SOME_VAL
) AS VARCHAR2_32_ARRAY
)
FROM
DUAL;RESULT_VAR VARCHAR2_32_ARRAY;
BEGINOPEN CUR_PARAMETERS;
FETCH CUR_PARAMETERS INTO RESULT_VAR;
CLOSE CUR_PARAMETERS;RETURN RESULT_VAR;
END;
then in the c# code we had things like this
private void ParseResults ( IDataReader p_reader)
{
while ( p_reader.Read () )
{
string _encoded_record = ( string ) p_reader [ 0 ];
string[] _fields = _encoded_record.Split ( new char[] {':' } );double var1 = Double.Parse( \_fields \[ 0 \] ); etc etc etc
}
}Interesting way of doing things to say the least
System.IO.Path.IsPathRooted() does not behave as I would expect
-
When I started at my current company I was given a c# / oracle project and asked to rewrite it from scratch. I was told the guy who wrote it had been fired and everyone who had attempted to maintain the code had given up. I reakon I could have provided six months of content for the WTF web site from this single project. By far my favorite part was how he returned values from oracle stored procs to the application. Every stored proc returned a var of type VARCHAR2_32_ARRAY, and looked something like this
CURSOR CUR_PARAMETERS IS
SELECT
CAST (
MULTISET (
SELECT
COLUMN_NAME_1 || ':' || COLUMN_NAME_2 || ':' || COLUMN_NAME_3
FROM
SOME_TABLE_NAME
WHERE
SOME_FIELD = SOME_VAL
) AS VARCHAR2_32_ARRAY
)
FROM
DUAL;RESULT_VAR VARCHAR2_32_ARRAY;
BEGINOPEN CUR_PARAMETERS;
FETCH CUR_PARAMETERS INTO RESULT_VAR;
CLOSE CUR_PARAMETERS;RETURN RESULT_VAR;
END;
then in the c# code we had things like this
private void ParseResults ( IDataReader p_reader)
{
while ( p_reader.Read () )
{
string _encoded_record = ( string ) p_reader [ 0 ];
string[] _fields = _encoded_record.Split ( new char[] {':' } );double var1 = Double.Parse( \_fields \[ 0 \] ); etc etc etc
}
}Interesting way of doing things to say the least
System.IO.Path.IsPathRooted() does not behave as I would expect
Old habits die hard. It reminds me of: At a job I had ten years ago, we were just switching from Oracle using PRO*C to Sql Server (6 I think) using ODBC. No one in the company knew anything about ODBC so a "consultant" was brought in and, as the story went, given two days to write us a library of functions we could use. What he did, as the story continued, was copy examples from the floppy that came with an ODBC book. The functions returned the values as CSV strings! Management thought this was a perfectly usable solution. When I started using it after others had been for six months or so I said something that can't be repeated in the Lounge. There was absolutely no way I was going to stand for it, but I didn't have much time to fix it, so I made it only marginally better... my versions of the functions returned the values as arrays of strings. I left the company soon after, but had I stayed I was to be tasked with completely rewriting the library, I wish I had.
--| "Every tool is a hammer." |--