Column 'change_by' cannot be null

8 years 8 months ago #7 by moose999
Apologies if that came over as a criticism, you must certainly protect against SQL injection and PHP cross site scripting, and I should have submitted the code using the Attachments feature provided to prevent this. Thanks for un-blocking me!

Thanks for the updated file, I am afraid I am still getting an error. I will try the extension on another site before asking you to spend more time, as it could easily be a mistake my end.

The error [with some removal] is:
Column 'change_by' cannot be null =UPDATE jos_content SET `checked_out` = 685 , `checked_out_time` = '2015-07-09 17:38:49' WHERE `id` = '18'

Cheers,
Justin

Please Log in or Create an account to join the conversation.

8 years 8 months ago #8 by geoffc
No problem with criticism and no offence taken.
Re that error, it might be that that it is the 'old' trigger that is being invoked still. I specifically checked that situation, and the error is generated when the article is initially being checked out.

Look at the generated trigger and around lines 25 the code should be similar to:
IF ( cexists ) THEN 
           SELECT IFNULL(modified_by, 0) INTO changedby FROM ..(trimmed) ........;
           SELECT CAST(changedby AS UNSIGNED) INTO chkint; 
           IF ( chkint ) THEN 
           SELECT chkint INTO changedby; 
          ELSE 
              SELECT superid INTO changedby;
          END IF;

If it is anything else then it is the 'old' generated code.

Regards
Geoff

Please Log in or Create an account to join the conversation.

8 years 8 months ago #9 by geoffc
I have double checked the code I attached earlier and its working fine at my end. I must check whether you removed the existing triggers and recreated them after you installed the file? If you omitted this last step then it would explain why you saw the error again.

I also have had a good look at that code again and have decided that some of the work can be taken out of the trigger code and done before the trigger is created. I have modified the helper file even more and attach the latest version. All three trigger types are modified, so as before, replace the same file, and remove all existing triggers and recreate and rerun your tests.

Seems like the problem introduced itself in the 1.0.2 update, since 1.0.1 did not exhibit the problem. I need to do some more tests, but all being well I will release an update after I have made a few more minor tweaks.

Regards
Geoff
Attachments:

Please Log in or Create an account to join the conversation.

8 years 8 months ago #10 by moose999
That all works now!

Many thanks for all your help, and for a great free component.

Cheers!!
Justin
The following user(s) said Thank You: geoffc

Please Log in or Create an account to join the conversation.

8 years 8 months ago #11 by geoffc
Thank you for letting me know. I will mark this topic as resolved.

I will release an updated version (1.1.0) in a few days incorporating the fix and a few other changes. I have modified the generated trigger code and simplified it, by doing some of the work in the trigger generation rather than when the trigger runs, also speeding up trigger in the process. This will also require the triggers to be regenerated after it is installed/updated to get the benefit.

I have also added the ability to download the change records to a file.

Regards
Geoff

Please Log in or Create an account to join the conversation.

Time to create page: 0.223 seconds
Go To Top

Joomla! Debug Console

Session

Profile Information

Memory Usage

Database Queries