Appgini 5.71 and Mysql8

Please report bugs and any annoyances here. Kindly include all possible details: steps to reproduce, expected result, actual result, screenshots, ... etc.
Post Reply
Nicolas
Veteran Member
Posts: 43
Joined: 2015-12-08 08:08
Location: Barcelona
Contact:

Appgini 5.71 and Mysql8

Post by Nicolas » 2022-07-28 09:59

Hi Forum !! good day

Today our production site had an upgrade to Mysql V 8.0 and we have now a problem saving new records or saving existing records wich may have been modified... Does any one have an idea of what may have to be changed on the app code so to avoid this ????

I've tried to identify on the console the failure and I see this error message

Uncaught ReferenceError: $j is not defined
at invoices_view-1.php:79:5
and on the php file this is the code

show_notification({"message":"Data too long for column 'InvDiasPdte' at row 486<pre class=\"ltr\">Query:\nupdate `invoices` set `InvDiasPdte` = datediff(`FechaPago`,`FFactura`)<\/pre><i class=\"text-right\">La informaci\u00f3n anterior es mostrada porque actualmente se encuentra logeado como super administrador. Otros usuarios no ver\u00e1n esta informaci\u00f3n.<\/i>","class":"danger","dismiss_seconds":7200,"dismiss_days":0,"id":0});

on clients db I can save new records and modified ones...
Any hint???

Thank you

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Appgini 5.71 and Mysql8

Post by jsetzer » 2022-07-28 10:46

(1) What is the type and length of column InvDiasPdtem?

(2) what is the value of colum FechaPago of saved record?

(3) what is the value of column FFactura of saved record?

Calculating the date difference between those two values gives a result, too large for the target field.

In _before_insert you should var_dump(...) both values from $data variable, then exit;
You could also var_dump the result of sqlValue("select datediff(..., ...)" to see the evaluated result of your date diff sql function. This could give a hint. Maybe those two date/datetime values being used in your diff function (or at least one of them) contains unexpected values.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

Nicolas
Veteran Member
Posts: 43
Joined: 2015-12-08 08:08
Location: Barcelona
Contact:

Re: Appgini 5.71 and Mysql8

Post by Nicolas » 2022-07-28 13:51

Hi, thanks for the answer,
I'll check the questions and provide the answer.
The issue was that before it was working... so, maybe now Mysql8 is not permitting errors that where aloowed before.
thanks

Nicolas
Veteran Member
Posts: 43
Joined: 2015-12-08 08:08
Location: Barcelona
Contact:

Re: Appgini 5.71 and Mysql8

Post by Nicolas » 2022-07-29 05:13

Hi Js, ... GREAT NEWS

Your hint worked out in terms of being able to save the record... the field InvDiasPdte was a varchar with 3 digits length... so, I've extended to 7 and now it saves the invoice...

But if you could then see another issue that was happening aswel is the following
When saving a new record on two different tables (i've just tested on these two, called customer courses and invoices) the screen goes to white and empty.... refreshing the browser page, then it goes back to the table view and the record is stored and showed there.

It does not happen when modifiying an existing record, you modify anything, and when saving... you get the green bar stating the saved record, and then all normal....

I guess now is a different issue and it has started since the server was upgraded to MySql8
Many thanks for the support
Nicolas

AhmedBR
AppGini Super Hero
AppGini Super Hero
Posts: 327
Joined: 2013-09-19 10:23

Re: Appgini 5.71 and Mysql8

Post by AhmedBR » 2022-07-29 12:58

I had similar issues with white pages, and if you try to see source there is nothing.
Look into these two locations:

Check all the code at the beginning of the file _global.php before the function login_ok
Check the init function in the tables in question.

almost 99% of my cases where issues in the above mentioned locations that usually occurs after upgrades.

Hope this helps and off course let us wait for jsetzer´s more informed opinion.

Have a nice day
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper

Nicolas
Veteran Member
Posts: 43
Joined: 2015-12-08 08:08
Location: Barcelona
Contact:

Re: Appgini 5.71 and Mysql8

Post by Nicolas » 2022-07-29 15:00

I've right clicked on the browser window to get an idea of what can it be and I¡ve got this info. in the lower part it gives a message about a default value for a field, but can't guess what would the default value for this field, as it seems to be a user control or so....

<div class="notifcation-placeholder" id="notifcation-placeholder-88508952"></div>
<script>
$j(function(){
if(window.show_notification != undefined) return;

window.show_notification = function(options){
/* wait till all dependencies ready */
if(window.notifications_ready == undefined){
var op = options;
setTimeout(function(){ /* */ show_notification(op); }, 20);
return;
}

var dismiss_class = '';
var dismiss_icon = '';
var cookie_name = 'hide_notification_' + options.id;
var notif_id = 'notifcation-' + Math.ceil(Math.random() * 1000000);

/* apply provided notficiation id if unique in page */
if(options.id != undefined){
if(!$j('#' + options.id).length) notif_id = options.id;
}

/* notifcation should be hidden? */
if(Cookies.get(cookie_name) != undefined) return;

/* notification should be dismissable? */
if(options.dismiss_seconds > 0 || options.dismiss_days > 0){
dismiss_class = ' alert-dismissible';
dismiss_icon = '<button type="button" class="close" data-dismiss="alert">&times;</button>';
}

/* remove old dismissed notficiations */
$j('.alert-dismissible.invisible').remove();

/* append notification to notifications container */
$j(
'<div class="alert alert-' + options['class'] + dismiss_class + '" id="' + notif_id + '">' +
dismiss_icon +
options.message +
'</div>'
).appendTo('#notifcation-placeholder-88508952');

var this_notif = $j('#' + notif_id);

/* dismiss after x seconds if requested */
if(options.dismiss_seconds > 0){
setTimeout(function(){ /* */ this_notif.addClass('invisible'); }, options.dismiss_seconds * 1000);
}

/* dismiss for x days if requested and user dismisses it */
if(options.dismiss_days > 0){
var ex_days = options.dismiss_days;
this_notif.on('closed.bs.alert', function(){
/* set a cookie not to show this alert for ex_days */
Cookies.set(cookie_name, '1', { expires: ex_days });
});
}
}

/* cookies library already loaded? */
if(undefined != window.Cookies){
window.notifications_ready = true;
return;
}

/* load cookies library */
$j.ajax({
url: 'PREPEND_PATHresources/jscookie/js.cookie.js',
dataType: 'script',
cache: true,
success: function(){ /* */ window.notifications_ready = true; }
});
})
</script>

<script>
$j(function(){
show_notification({"message":"Field 'recID' doesn't have a default value<pre class=\"ltr\">Query:\nINSERT INTO `membership_userrecords` SET memberID='nico', dateUpdated='1659106534', groupID='5', tableName='invoices', pkValue='2983', dateAdded='1659106534'<\/pre><i class=\"text-right\">La informaci\u00f3n anterior es mostrada porque actualmente se encuentra logeado como super administrador. Otros usuarios no ver\u00e1n esta informaci\u00f3n.<\/i>","class":"danger","dismiss_seconds":7200,"dismiss_days":0,"id":0});
})
</script>

Nicolas
Veteran Member
Posts: 43
Joined: 2015-12-08 08:08
Location: Barcelona
Contact:

Re: Appgini 5.71 and Mysql8

Post by Nicolas » 2022-07-29 15:32

Hi there,
I've finally got the problem with the server version upgrade from MySQL 7xx to 8.0....
I had one error in one field size, which apparently the previous version was more permissive with them
and the s-econd errror, which caused the blank screen after saving a new record was due to a missing characteristic on a field on the field recID. it lost the AutoIncrement definition, therefore when the app tried to save a new record, there was no definion of a value....
I was able to understand it and redefined the Auto Increment capability for this field and now not single problem saving new records.

I tell to the community just for anyone that may have the upgrade on MySQL ....
Regards to everyone
Nicolas

Post Reply