Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Goddammit, MySQL!
Goddammit, MySQL!
#1
MySQL said: [Image: dot.gif]
Code:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the
right syntax to use near

'IF 1=1 THEN
-- do nothing
END IF;' at line 1

Whatinhell's wrong with that and every other attempt at using an IF/THEN I've tried?

<sigh>  Fuller explanation for those who care:  My modified script for importing the incremental scrape looks to see if there's an existing thread record before creating one.  Only the IF statement that controls that decision, apparently by virtue of its very existence, causes a syntax error.  The script in the error message above is the entire script I'm running now as a result of trimming my problem code down to its barest bones in the process of trying to figure out how I could screw up an IF/THEN.  (And no, it's not the contents of the block.  I've had various valid lines of code in there; nothing makes a difference.

The original code, btw, is

Code:
IF @mybb_tid IS NULL THEN
 -- create new thread here
END IF;

with a line setting @mybb_tid with a select right above it.
-- Bob

I have been Roland, Beowulf, Achilles, Gilgamesh, Clark Kent, Mary Sue, DJ Croft, Skysaber.  I have been 
called a hundred names and will be called a thousand more before the sun grows dim and cold....
Reply
RE: Goddammit, MySQL!
#2
Oh, you have got to be kidding me.

Code:
CASE WHEN (condition) THEN
BEGIN
    -- stuff
END

instead of IF/THEN?  Whose brilliant idea was that?
-- Bob

I have been Roland, Beowulf, Achilles, Gilgamesh, Clark Kent, Mary Sue, DJ Croft, Skysaber.  I have been 
called a hundred names and will be called a thousand more before the sun grows dim and cold....
Reply
RE: Goddammit, MySQL!
#3
No, as it turns out, that's not right, either, dammit. Phpmyadmin really should tell the user when it's timed out when you try to run a script in the SQL window.

I found what it is, actually -- outside of a stored procedure MySQL doesn't allow conditionals (or control structures like WHILE which have conditionals in them). Which is a pain. I may have to manually segregate the new threads from the updates and do the latter by hand. Which is slow and annoying.
-- Bob

I have been Roland, Beowulf, Achilles, Gilgamesh, Clark Kent, Mary Sue, DJ Croft, Skysaber.  I have been 
called a hundred names and will be called a thousand more before the sun grows dim and cold....
Reply
RE: Goddammit, MySQL!
#4
Yes, I've hit this at work.  In order to use some of the functionality limited to stored procedures in MySQL, I've had to create procedures to run once, and then drop them.  Not a day that goes by that I don't dream of Postgres.

Hey, I've also noticed that some of my old posts don't have the correct sig.  Looks an encoding problem.  My old sig was '-- ∇×V ' and it got replaced with '-- ∇×V '.  Think you can run:?
Code:
UPDATE my_bb_posts
SET content = REPLACE(content, '-- ∇×V', '-- ∇×V')
WHERE author = 'Labster' AND content LIKE '%-- ∇×V%'

Not that I looked up the names of the tables or columns.
"Kitto daijoubu da yo." - Sakura Kinomoto
Reply
RE: Goddammit, MySQL!
#5
Sure, no big. All 789 messages were updated.

Quote:Not a day that goes by that I don't dream of Postgres.
Heh. I never thought I would long for a Microsoft product until I was forced to use Oracle SQL and its development suite during the 14 months I worked for CGI. I swear, SSMS has spoiled me.
-- Bob

I have been Roland, Beowulf, Achilles, Gilgamesh, Clark Kent, Mary Sue, DJ Croft, Skysaber.  I have been 
called a hundred names and will be called a thousand more before the sun grows dim and cold....
Reply
RE: Goddammit, MySQL!
#6
Oh and the creation of one-off procs isn't really practical here. My T-SQL script writes a MySQL script which creates the entire thread in one go, which I cut'n'paste into phpmyadmin. Adding the code to make it a proc, save it, run it, and then drop it afterward -- well, if I were doing it at the start for the entire message base it might have been worth the time. But for what I have left? It'll be more time efficient to do the existing threads by hand.
-- Bob

I have been Roland, Beowulf, Achilles, Gilgamesh, Clark Kent, Mary Sue, DJ Croft, Skysaber.  I have been 
called a hundred names and will be called a thousand more before the sun grows dim and cold....
Reply
RE: Goddammit, MySQL!
#7
Hey Brent, you might want to comment Bob's issues here in your Tapatalk-scrape script documentation. It won't help Bob, but it may help the next person to use the script.
--
Rob Kelk

Sticks and stones can break your bones,
But words can break your heart.
- unknown
Reply
RE: Goddammit, MySQL!
#8
Okay, I spent a few minutes running queries on the new boards' DB at lunchtime, and I now know exactly which threads I have to take care of by hand --and there's only about 35. I also worked out exactly what I'm going to do. It won't be the quickest, but I should be able to take care of it all after dinner tonight.
-- Bob

I have been Roland, Beowulf, Achilles, Gilgamesh, Clark Kent, Mary Sue, DJ Croft, Skysaber.  I have been 
called a hundred names and will be called a thousand more before the sun grows dim and cold....
Reply
RE: Goddammit, MySQL!
#9
And the second scrape has been loaded into the forums. I suppose I could do one more, or Brent could, to get the last few posts.

But not tonight.
-- Bob

I have been Roland, Beowulf, Achilles, Gilgamesh, Clark Kent, Mary Sue, DJ Croft, Skysaber.  I have been 
called a hundred names and will be called a thousand more before the sun grows dim and cold....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)