|
maxxx# wrote: Probably - though I seem to rememebr a 32 character limit on field names in Cobol - so could have been the full month name and year
I was just making a Y2K joke
|
|
|
|
|
Sorry - me being dense (or you just being too bloody clever!)
Take a chill pill, Daddy-o
.\\axxx
(That's an 'M')
|
|
|
|
|
|
Cobol is horrific anyways
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Here's a gem I found in some C++ legacy Windows code I am starting to have to maintain:
if (hWnd ? hWnd == pWndAppts->m_hWnd : pWndAppts)
pWndAppts->DeleteSelected();
else if(hWnd ? hWnd == pWndNotes->m_hWnd : pWndNotes)
pWndNotes->DeleteSelected();
pWndNotes and pWndAppts are class pointers (the exact specifics are unimportant). hWnd is, well, an HWND.
Note how nothing checks to be sure pWndNotes or pWndAppts are not NULL (until it is too late).
Someone obviously thought they were very clever.
|
|
|
|
|
Yuck.
Tom Delany wrote: Someone obviously thought they were very clever.
Maybe they were some intern trying to be a show off?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Tom Delany wrote: Note how nothing checks to be sure pWndNotes or pWndAppts are not NULL (until it is too late)
Without knowing the code, their could be the situation that pWndNotes or pWndAppts cannot be NULL if hWnd is not NULL. The converse is not true, hence the extra check.
|
|
|
|
|
That might be possible. I still have not gotten familiar enough with the code myself to say for sure, yet. I still think it would not have killed them to use a few more lines of code and written it a bit less obtusely.
WE ARE DYSLEXIC OF BORG. Refutance is systile. Your a$$ will be laminated.
There are 10 kinds of people in the world: People who know binary and people who don't.
|
|
|
|
|
Tom Delany wrote: I still think it would not have killed them to use a few more lines of code and written it a bit less obtusely.
Probably.
|
|
|
|
|
Ok...well I can't post the screenshot...or tell why, but here it is...
While learning an inherited database schema for a suite of apps that we are taking over, I found a database diagram called Unrelated Tables containing sure enough, 22 unrelated tables.
I had to stop there.
|
|
|
|
|
while not the best practice I have several sets of unreleated tables, simply because there is no real way to relate them to anything, and they have over 400 million rows of data between them, and some other groups that are transactional and only related to each other for application performance reasons. I can search the 400 million+ rows in less than a second(on a 10 character compare no less, no or very few int compares), the old db server could do it in under a second and it was 4 or 5 years old.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I should have been more specific...in all the tables, there are a few records to a few thousand. They do relate to each other, but have no relationships setup.
|
|
|
|
|
thats better than a product we found...dozens if not hundreds of FK's many circuliar, and several per table(read 2 or 3 FK's to table b, which has several back to table a, along with various others..some are circular and involve 3 to 4 tables in a big loop), all on character keys. doing anything in that DB takes forever. importing 20k rows took 24 or so hours(run time), because of all the extra data that had to be created and integrity checks the server had to make.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
These tables might have their merit.
For example for storing data that really does not relate to anything else but is still worth storing in the database.
|
|
|
|
|
|
At least better than using strings which are created by adding several different infos as primary keys.
Especially when a certain combination of these infos can appear multiple times and you need to add new rows in tables, not because they contain new data, but only because the primary key of a different table would be the same as it uses the same combination of infos.
Or using columns with non-atomic values as lists separated by commas (I can tell you, getting all entries from that list is a pain)...
|
|
|
|
|
Sometimes using compound string keys is the only way to maintain data between multiple systems / instances where there is no shared system key (and no reason to force such a situation). That said, you would hope the individual elements which were used to generate the keys are available as individual columns also to give good performance for queries...
AJ
|
|
|
|
|
Hi all,
I had found this master piece in one of my junior's coding.Check this duffer act.
We are having a table tblBookings with primary key nBookingID to save bookings with other fields like nProductID, nCategoryID etc.
Now see what he wrote to access perticular booking:
"Select ...... from tblBookings where nBookingID='...' and nProductID='..' and nCategoryID='..'"
I just could not stop laughing after listing of his answer of my question.. "why the hell you want to write two more conditions while u will get unique booking after checking with primary key itself????"
Check his answer.. "For extra perfection sir!!!!"
Anand Desai
Developer
Atharva Infotech
|
|
|
|
|
Anand Desai wrote: I just could not stop laughing after listing of his answer of my question.. "why the hell you want to write two more conditions while u will get unique booking after checking with primary key itself????"
Check his answer.. "For extra perfection sir!!!!"
Neither of you have heard of optimistic concurrency, dont worry, you will get there
|
|
|
|
|
I used to see quite a lot of that in ABAP/4 report programs.
|
|
|
|
|
While it didn't involve a primary key, I learned something similar about databases many years ago (mid-90s).
Using Oracle 6, I had a query that I wanted to speed up.
I went to one of the DBAs and asked for help.
The where clause involved two fields (I'll call then X and Y).
The DBA said that there was no index for X and Y, but there was an index for X, Y, and Z.
If I added Z to the where clause the query would use the index and therefore be faster.
So I added a test for Z that would always be true, like "AND Z NOT NULL" when I know Z is never null.
And by golly it worked!
|
|
|
|
|
Certainly not relevant to SQL Server - SQL Server can always use the leftmost columns of an index, if that's all that's required.
It does depend on the ordering of columns in the CREATE INDEX or PRIMARY KEY declaration, though; if the ordering is X, Y, Z it can generate a seek on X and Y when you're looking for X and Y, but if it's X, Z, Y it can only generate a seek on X, because the identical Y values are not clumped together (they're separated by different values of Z). Adding AND Z NOT NULL doesn't help much here because Z likely isn't selective, unless the Zs in the table are mostly NULL.
I'm pretty sure modern Oracle can use prefixes as well.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
The priest told you to 'honor the god of index'. ... Thats why the called their product "Oracle"
Asking a specialist is always one of the best ideas.
Greetings from Germany
|
|
|
|
|
It's my personal opinion that posting the mistakes of ones juniors is mean spirited - if you're a supervisor, your job is to teach and encourage, not to ridicule.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Right, so one should always write it up as if the culprit is "the senior design guru".
|
|
|
|