2026/03/19

From Woozle Writes Code
< 2026‎ | 03
Jump to navigation Jump to search
Thursday, March 19, 2026 (#78)
Wednesday Thursday Friday posts:prev <this> next

References

  • 08:36 It turns out that the line of code to set the streams ("pipes", in the docs for proc_open()) opened by Local\Proc to non-blocking mode (using stream_set_blocking()) had somehow been left out. I put it back in, and now I get an actionable error-message from the DB engine!
  • 09:19 ...and now we're back to the broken write-pipe again. There's also "Object has received more Shut() requests than Open() requests!" which might have been a clue except that it happens after the error :-P
  • 09:24 Oh, actually: the error was coming from a line of leftover test-write code. Removed that, and the error goes away and we only have the "Object has received" error.
  • 10:49 Fixed that -- somewhat dubiously, as what works when opening and shuting things no longer matches my mental model -- but now it's basically not doing anything but also not giving error messages.
  • 12:57 Trying to get input-file-size and output-bytes-completed in the same place after finishing the xfer (whether fully or with an error) is proving to be more difficult than it should be.
  • 19:59 We're back to "the output stream dies for no reason, sucks to be you".
  • 20:12 ...and now back to "actionable error message", i.e. 08:36 this morning.

I checked something just now, and the error message actually makes sense. It only happens after it sends all the commented-out stuff at the start of the .sql file. The first real command is DROP TABLE IF EXISTS `actor`;, and the error is "ERROR 1046 (3D000) at line 22: No database selected" -- which seems like something to take at face-value, since there's nothing before that to set which database we're writing.

I guess I need to add some code to send that command too, after ensuring that the DB exists.

  • 20:48 ...which, in turn, leads to a need to be able to queue up multiple commands for execution, with all the usual checking for errors/messages after each. I could just copy/paste a couple of blocks of code, but that seems wasteful/sloppy and difficult to maintain (technical debt). Once I understand how to do a basic operation on different subjects, it should be encapsulated so as to keep the subject separate from the operation. (This is now in progress: IO\Aspect\Connx\Runner\aux\A\Commands clade.)
  • 21:47 Commands now seems to be sending the SQL properly, but once again the SQL data does not seem to be getting sent at all. (I don't think I took out the debug code for that...)