Recent

Author Topic: MySQL writing into BLOB error: ""is invalid float  (Read 11396 times)

syalyshev

  • New Member
  • *
  • Posts: 29
MySQL writing into BLOB error: ""is invalid float
« on: October 13, 2017, 12:33:52 pm »
Could anyone kindly help me.
When attempting to insert string variable into blob field of MySQL table the error message ' ""is invalid float' is obtained. Query formed is like this
Code: Pascal  [Select][+][-]
  1. ...
  2.   SaveQuery.SQL.Add(''''+F_Centre.Text+''',');
  3.   SaveQuery.SQL.Add(''''+BW.Text+''',');
  4.   SaveQuery.SQL.Add(''''+st_co+''',');
  5.   SaveQuery.SQL.Add(''''+st_cx+''')');
  6.  
  7.   SaveQuery.ExecSQL;
  8.   SQLTransaction.Commit;
  9. ...  
  10.  
st_co and st_cx are strings inserted into blobs.
All records in the table are written correctly. Is it possible not to show such a message?

rvk

  • Hero Member
  • *****
  • Posts: 6112
Re: MySQL writing into BLOB error: ""is invalid float
« Reply #1 on: October 13, 2017, 01:18:34 pm »
st_co and st_cx are strings inserted into blobs.
All records in the table are written correctly. Is it possible not to show such a message?
Yes, don't insert text when your database/SQL expects a float value.

It's impossible to see because you didn't include the whole SQL statement but in the fields-selection you are trying to insert is a float and you are trying to put text into that (which results in this message).

Check the order of the fields of your entire SQL-statement or put it here with the complete table description.

syalyshev

  • New Member
  • *
  • Posts: 29
Re: MySQL writing into BLOB error: ""is invalid float
« Reply #2 on: October 13, 2017, 02:34:06 pm »
Thanks a lot for your reply!
Well, the whole SQL Statement (if nesessary) looks like this:
Code: Pascal  [Select][+][-]
  1. ...
  2.   SaveQuery.SQL.Add('INSERT INTO  work_sp');
  3.   SaveQuery.SQL.Add('VALUES (last_insert_id(),'''+ES_Index.Text+''',');                                   {index}
  4.   SaveQuery.SQL.Add(''''+FormatDateTime('yyy.mm.dd/hh:mm:ss',StrToDateTime(Date_Time.Text))+''',');       {date}
  5.   SaveQuery.SQL.Add(''''+customer_es_name.Text+''',');                                                    {cust_es}
  6.   SaveQuery.SQL.Add(''''+ASMI_Operator.Text+''',');                                                       {ASMI_Operator}
  7.   SaveQuery.SQL.Add(''''+operator_phone.Text+''',');                                                      {operator_phone}
  8.   SaveQuery.SQL.Add(''''+srb_doc.Text+''',');                                                             {srb_doc}
  9.   SaveQuery.SQL.Add(''''+Satellite.Text+''',');                                                           {Satellite}
  10.   SaveQuery.SQL.Add(''''+SatLongitude.Text+''',');                                                        {Sat Longitude}
  11.   SaveQuery.SQL.Add(''''+ChooseTP.Text+''',');                                                            {co_tp_name}
  12.   SaveQuery.SQL.Add(''''+Co_Up_pol.Text+''',');                                                           {co_up_pol}
  13.   SaveQuery.SQL.Add(''''+CX_tp.Text+''',');                                                               {cx_tp_name}
  14.   SaveQuery.SQL.Add(''''+Cx_Up_pol.Text+''',');                                                           {cx_up_pol}
  15.   SaveQuery.SQL.Add(''''+Station_Own.Text+''',');                                                         {es_owner}
  16.   SaveQuery.SQL.Add(''''+User_Operator.Text+''',');                                                       {contact_person}
  17.   SaveQuery.SQL.Add(''''+User_Cont_Phone.Text+''',');                                                     {contact_phone}
  18.   SaveQuery.SQL.Add(''''+ES_location.Text+''',');                                                         {es_location}
  19.   SaveQuery.SQL.Add(''''+ES_latitude.Text+''',');                                                         {es_latitude}
  20.   SaveQuery.SQL.Add(''''+ES_longitude.Text+''',');                                                        {es_longitude}
  21.   SaveQuery.SQL.Add(''''+Ant_Diameter.Text+''',');                                                        {es_ant_diam}
  22.   SaveQuery.SQL.Add(''''+Ref_Station.Text+''',');                                                         {ref_station}
  23.   SaveQuery.SQL.Add(''''+F_up.Text+''',');                                                                {frq_isol_up}
  24.   SaveQuery.SQL.Add(''''+F_dn.Text+''',');                                                                {frq_isol_dn}
  25.   SaveQuery.SQL.Add(''''+CO_EIRP_f.Text+''',');                                                           {co_eirp_calculated}
  26.   SaveQuery.SQL.Add(''''+CPI_es_f.Text+''',');                                                            {cpi_es_calculated}
  27.   SaveQuery.SQL.Add(''''+sp+''',');                                                                       {dir_spectrum}
  28.   SaveQuery.SQL.Add(''''+frq+''',');                                                                      {dir_frq}
  29.   SaveQuery.SQL.Add(''''+eirp+''',');                                                                     {dir_frq}
  30.   SaveQuery.SQL.Add(''''+'0'+''',');                                                                      {Comment}
  31.   SaveQuery.SQL.Add(''''+Pot_f.Text+''',');                                                               {Pot}
  32.   SaveQuery.SQL.Add(''''+Pxt_f.Text+''',');                                                               {Pxt}
  33.   SaveQuery.SQL.Add(''''+Por_f.Text+''',');                                                               {Por}
  34.   SaveQuery.SQL.Add(''''+Pxr_f.Text+''',');                                                               {Pxr}
  35.   SaveQuery.SQL.Add(''''+G_CO_Max.Text+''',');                                                            {G_CO_Max}
  36.   SaveQuery.SQL.Add(''''+Got_f.Text+''',');                                                               {Got}
  37.   SaveQuery.SQL.Add(''''+Gor_f.Text+''',');                                                               {Gor}
  38.   SaveQuery.SQL.Add(''''+Gxt_f.Text+''',');                                                               {Gxt}
  39.   SaveQuery.SQL.Add(''''+Gxr_f.Text+''',');                                                               {Gxr}
  40.   SaveQuery.SQL.Add(''''+Gxtx_f.Text+''',');                                                              {Gxtx}
  41.   SaveQuery.SQL.Add(''''+CPIsum_f.Text+''',');                                                            {CPIsum}
  42.   SaveQuery.SQL.Add(''''+CPIsat_f.Text+''',');                                                            {CPIsat}
  43.   SaveQuery.SQL.Add(''''+descr_cust.Text+''',');                                                          {cust_full}
  44.   SaveQuery.SQL.Add(''''+City_Full_f.Text+''',');                                                         {City_Full}
  45.   SaveQuery.SQL.Add(''''+TimeToStr(BegTime.Time)+''',');                                                  {BegTime}
  46.   SaveQuery.SQL.Add(''''+TimeToStr(EndTime.Time)+''',');                                                  {EndTime}
  47.   SaveQuery.SQL.Add(''''+SpentTime.Text+''',');                                                           {SpentTime}
  48.   SaveQuery.SQL.Add(''''+F_Centre.Text+''',');                                                            {central FRQ}
  49.   SaveQuery.SQL.Add(''''+BW.Text+''',');                                                                  {Band Width}
  50.   SaveQuery.SQL.Add(''''+st_co+''',');                                                                    {Spectrum values CO}
  51.   SaveQuery.SQL.Add(''''+st_cx+''')');                                                                    {Spectrum values CX}
  52.  
  53.   SaveQuery.ExecSQL;
  54.   SQLTransaction.Commit;
  55. ...  
Table structure as per attached table_structure.jpg.
I have just changed types of fields st_co and ct_cx from MEDIUMBLOB to MEDIUMTEXT for to confirm that string was expected, not float! The result was the same :(
What was my mistake? The message '""is invalid float' though not having influence on the result of recording to database annoys very much!

rvk

  • Hero Member
  • *****
  • Posts: 6112
Re: MySQL writing into BLOB error: ""is invalid float
« Reply #3 on: October 13, 2017, 02:47:51 pm »
Table structure as per attached table_structure.jpg.
I have just changed types of fields st_co and ct_cx from MEDIUMBLOB to MEDIUMTEXT for to confirm that string was expected, not float! The result was the same :(
What was my mistake? The message '""is invalid float' though not having influence on the result of recording to database annoys very much!
The fields st_co and ct_cx are not your problem.

If you look at the following fields... you can see you pass them as TEXT (with quotes around it). But according to your DB-design these should be DECIMAL(8,2)s. So you need to pass them as values/valid floats (so remove the extra '). And if one of these field.Text is empty string you should convert it to 0 or NULL. A '' can't be stored in a DECIMAL(8,2).

Code: Pascal  [Select][+][-]
  1.   SaveQuery.SQL.Add(''''+Pot_f.Text+''',');                                                               {Pot}
  2.   SaveQuery.SQL.Add(''''+Pxt_f.Text+''',');                                                               {Pxt}
  3.   SaveQuery.SQL.Add(''''+Por_f.Text+''',');                                                               {Por}
  4.   SaveQuery.SQL.Add(''''+Pxr_f.Text+''',');                                                               {Pxr}
  5.   SaveQuery.SQL.Add(''''+G_CO_Max.Text+''',');                                                            {G_CO_Max}
  6.   SaveQuery.SQL.Add(''''+Got_f.Text+''',');                                                               {Got}
  7.   SaveQuery.SQL.Add(''''+Gor_f.Text+''',');                                                               {Gor}
  8.   SaveQuery.SQL.Add(''''+Gxt_f.Text+''',');                                                               {Gxt}
  9.   SaveQuery.SQL.Add(''''+Gxr_f.Text+''',');                                                               {Gxr}
  10.   SaveQuery.SQL.Add(''''+Gxtx_f.Text+''',');                                                              {Gxtx}
  11.   SaveQuery.SQL.Add(''''+CPIsum_f.Text+''',');                                                            {CPIsum}
  12.   SaveQuery.SQL.Add(''''+CPIsat_f.Text+''',');                                                            {CPIsat}
  13.  
  14.   SaveQuery.SQL.Add(''''+F_Centre.Text+''',');                                                            {central FRQ}
  15.   SaveQuery.SQL.Add(''''+BW.Text+''',');                                                                  {Band Width}

syalyshev

  • New Member
  • *
  • Posts: 29
Re: MySQL writing into BLOB error: ""is invalid float
« Reply #4 on: October 13, 2017, 03:19:00 pm »
Thanks again for your reply!
I followed your recommendations and obtained no effect. No change.
One thing puzzles... Until I addded fields: fcenter, band (float!) and spect_co, spect_cx (blob or text!), everything worked, records were written without rough. Adding these fields changed the structure of the table dramatically!

Thanks a lot anyway! Going to think over the issue further!

rvk

  • Hero Member
  • *****
  • Posts: 6112
Re: MySQL writing into BLOB error: ""is invalid float
« Reply #5 on: October 13, 2017, 03:34:47 pm »
What are st_co and st_cx for strings. Are they multiline strings? In that case you can't add them with just the INSERT statement and you need to work with parameters (which is better anyway).

I would change the whole SaveQuery.SQL.Text to use parameters.

Something like this:
Code: Pascal  [Select][+][-]
  1.   SaveQuery.SQL.Add('INSERT INTO work_sp');
  2.   SaveQuery.SQL.Add('VALUES (last_insert_id(),:ES_Index, :fdate, :customer_es_name, :ASMI_Operator, :operator_phone,');
  3.   SaveQuery.SQL.Add(':srb_doc, :Satellite, :SatLongitude, :ChooseTP, :Co_Up_pol, :CX_tp, :Cx_Up_pol, :Station_Own,');
  4.   SaveQuery.SQL.Add(':User_Operator, :User_Cont_Phone, :ES_location, :ES_latitude, :ES_longitude, :Ant_Diameter,');
  5.   SaveQuery.SQL.Add(':Ref_Station, :F_up, :F_dn, :CO_EIRP_f, :CPI_es_f, :sp, :frq, :eirp, 0, :Pot_f, :Pxt_f, :Por_f,');
  6.   SaveQuery.SQL.Add(':Pxr_f, :G_CO_Max, :Got_f, :Gor_f, :Gxt_f, :Gxr_f, :Gxtx_f, :CPIsum_f, :CPIsat_f, :descr_cust');
  7.   SaveQuery.SQL.Add(':City_Full_f, :begtime, :endTime, :SpentTime, :F_Centre, :BW, :st_co, :st_cx);');
After that you can do:
Code: Pascal  [Select][+][-]
  1. SaveQuery.ParamByName('ES_Index').asInteger := IntToStrDef(ES_Index.Text, 0);
  2. SaveQuery.ParamByName('fdate').asDateTime := Date_Time.Value; // depending if Date_Time has a Date property or is just text
  3. SaveQuery.ParamByName('customer_es_name').asString := customer_es_name.Text;
  4. //...
  5. SaveQuery.ParamByName('Pot_f').asFloat := StrToFloat(Pot_f.Text); // or StrToFloatDef if Text can be empty or invalid)
  6. //...
  7. SaveQuery.ParamByName('st_co').asString := st_co;
  8. SaveQuery.ParamByName('st_cx').asString := st_cx;
  9. SaveQuery.ExecSQL

Another option could be:
Code: Pascal  [Select][+][-]
  1. SaveQuery.SQL.Add('SELECT * FROM work_sp');
  2. SaveQuery.Insert;
  3. SaveQuery.FieldByName('ES_Index').asInteger := IntToStrDef(ES_Index.Text, 0);
  4. //... etc
  5. SaveQuery.Post;
« Last Edit: October 13, 2017, 03:36:41 pm by rvk »

syalyshev

  • New Member
  • *
  • Posts: 29
Re: MySQL writing into BLOB error: ""is invalid float
« Reply #6 on: October 13, 2017, 03:41:36 pm »
Many thanks for the idea! I'd never thought of such thing as parameter. I'll try it but not today!
Thanks for your big work for me!

syalyshev

  • New Member
  • *
  • Posts: 29
Re: MySQL writing into BLOB error: ""is invalid float
« Reply #7 on: October 18, 2017, 11:09:54 am »
Followed all your variants. Result was the same :(
Many thanks anyway!
Will think further...

rvk

  • Hero Member
  • *****
  • Posts: 6112
Re: MySQL writing into BLOB error: ""is invalid float
« Reply #8 on: October 18, 2017, 11:19:56 am »
If you used the parameter method you can exactly pinpoint where the error-message is coming from.

If you still get the  ""is invalid float' you are still trying to put an empty string into a float somewhere, which isn't possible.

If you used StrToFloat(Pot_f.Text); and Pot_f.Text is an empty string, you should use StrToFloatDef(Pot_f.Text, 0); so that an empty string (or invalid float) is automatically converted to 0.

syalyshev

  • New Member
  • *
  • Posts: 29
Re: MySQL writing into BLOB error: ""is invalid float
« Reply #9 on: October 23, 2017, 12:36:31 pm »
Trying to use parameter I faced the following error message: "MySQL50Connection: error exequting query: Column count doesn't match value count at row 1." I think that the cause is last_insert_id()... But what to do with that!?

rvk

  • Hero Member
  • *****
  • Posts: 6112
Re: MySQL writing into BLOB error: ""is invalid float
« Reply #10 on: October 23, 2017, 12:39:15 pm »
You've only showed us half your code.
And you also didn't show your complete table definition.
So we can't know where the fault is.

But you need to count the exact fields (and also correct order !!!) and match it with the insert statement.

The insert statement I gave with parameters was just a guess of what the fields are.

In the insert statement the fields you are going to update are not mentioned so ALL fields need to be updated. If you don't want that you can also specify which fields you want to update.
Code: SQL  [Select][+][-]
  1. INSERT INTO work_sp (field1, field2) VALUES (:field1, :field2)
Otherwise you need to give ALL the fields:
Code: SQL  [Select][+][-]
  1. INSERT INTO work_sp VALUES (:field1, :field2, :field3 etc etc etc etc etc etc etc)
And you can't mis one field or give the fields out of order.
« Last Edit: October 23, 2017, 12:41:46 pm by rvk »

syalyshev

  • New Member
  • *
  • Posts: 29
Re: MySQL writing into BLOB error: ""is invalid float
« Reply #11 on: October 23, 2017, 12:57:48 pm »
Dear rvk, thanks a lot again!
The fields count and order are correct! My current code looks like this
Code: Pascal  [Select][+][-]
  1. SaveQuery.SQL.Add('INSERT INTO work_sp');
  2.       SaveQuery.SQL.Add('VALUES (last_insert_id(),:ES_Index, :fdate, :customer_es_name, :ASMI_Operator, :operator_phone,');  {6}
  3.       SaveQuery.SQL.Add(':srb_doc, :Satellite, :SatLongitude, :ChooseTP, :Co_Up_pol, :CX_tp, :Cx_Up_pol, :Station_Own,'); {8}
  4.       SaveQuery.SQL.Add(':User_Operator, :User_Cont_Phone, :ES_location, :ES_latitude, :ES_longitude, :Ant_Diameter,'); {6}
  5.       SaveQuery.SQL.Add(':Ref_Station, :F_up, :F_dn, :CO_EIRP_f, :CPI_es_f, :sp, :frq, :eirp, :comment, :Pot_f, :Pxt_f, :Por_f,'); {12}
  6.       SaveQuery.SQL.Add(':Pxr_f, :G_CO_Max, :Got_f, :Gor_f, :Gxt_f, :Gxr_f, :Gxtx_f, :CPIsum_f, :CPIsat_f, :descr_cust'); {10}
  7.       SaveQuery.SQL.Add(':City_Full_f, :begtime, :endTime, :SpentTime, :F_Centre, :BW, :st_co, :st_cx);'); {8}
  8.  
  9. SaveQuery.ParamByName('ES_Index').asString := ES_Index.Text;
  10. SaveQuery.ParamByName('fdate').asDateTime := StrToDateTime(Date_Time.Text); // depending if Date_Time has a Date property or is just text
  11. SaveQuery.ParamByName('customer_es_name').asString := customer_es_name.Text;
  12. SaveQuery.ParamByName('ASMI_Operator').asString:=ASMI_Operator.Text;
  13. SaveQuery.ParamByName('operator_phone').asString:=operator_phone.Text;                   {5}
  14. SaveQuery.ParamByName('srb_doc').asString:=srb_doc.Text;
  15. SaveQuery.ParamByName('Satellite').asString:=Satellite.Text;
  16. SaveQuery.ParamByName('SatLongitude').asFloat:=StrToFloatDef(SatLongitude.Text,12);
  17. SaveQuery.ParamByName('ChooseTP').asString:=ChooseTP.Text;
  18. SaveQuery.ParamByName('Co_Up_Pol').asString:=Co_Up_pol.Text;
  19. SaveQuery.ParamByName('CX_tp').asString:=CX_tp.Text;
  20. SaveQuery.ParamByName('Cx_Up_pol').asString:=Cx_Up_pol.Text;
  21. SaveQuery.ParamByName('Station_Own').asString:=Station_Own.Text;                         {8}
  22. SaveQuery.ParamByName('User_Operator').asString:=User_Operator.Text;
  23. SaveQuery.ParamByName('User_Cont_Phone').asString:=User_Cont_Phone.Text;
  24. SaveQuery.ParamByName('ES_location').asString:=ES_location.Text;
  25. SaveQuery.ParamByName('ES_Latitude').asFloat:=StrToFloatDef(ES_latitude.Text,12);
  26. SaveQuery.ParamByName('ES_Longitude').asFloat:=StrToFloatDef(ES_longitude.Text,12);
  27. SaveQuery.ParamByName('Ant_Diameter').asFloat:=StrToFloatDef(Ant_Diameter.Text,12);      {6}
  28. SaveQuery.ParamByName('Ref_Station').asString:=Ref_Station.Text;
  29. SaveQuery.ParamByName('F_up').asFloat:=StrToFloatDef(F_up.Text,12);
  30. SaveQuery.ParamByName('F_dn').asFloat:=StrToFloatDef(F_dn.Text,12);
  31. SaveQuery.ParamByName('CO_EIRP_f').asFloat:=StrToFloatDef(CO_EIRP_f.Text,12);
  32. SaveQuery.ParamByName('CPI_es_f').asFloat:=StrToFloatDef(CPI_es_f.Text,12);
  33. SaveQuery.ParamByName('sp').asString:=sp;
  34. SaveQuery.ParamByName('frq').asString:=frq;
  35. SaveQuery.ParamByName('eirp').asString:=eirp;
  36. SaveQuery.ParamByName('comment').asString:=Comment.Text;
  37. SaveQuery.ParamByName('Pot_f').asFloat := StrToFloatDef(Pot_f.Text,12); // or StrToFloatDef if Text can be empty or invalid)
  38. SaveQuery.ParamByName('Pxt_f').asFloat := StrToFloatDef(Pxt_f.Text,12);
  39. SaveQuery.ParamByName('Por_f').asFloat := StrToFloatDef(Por_f.Text,12);                  {12}
  40. SaveQuery.ParamByName('Pxr_f').asFloat := StrToFloatDef(Pxr_f.Text,12);
  41. SaveQuery.ParamByName('G_CO_Max').asFloat := StrToFloatDef(G_CO_Max.Text,12);
  42. SaveQuery.ParamByName('Got_f').asFloat := StrToFloatDef(Got_f.Text,12);
  43. SaveQuery.ParamByName('Gor_f').asFloat := StrToFloatDef(Gor_f.Text,12);
  44. SaveQuery.ParamByName('Gxt_f').asFloat := StrToFloatDef(Gxt_f.Text,12);
  45. SaveQuery.ParamByName('Gxr_f').asFloat := StrToFloatDef(Gxr_f.Text,12);
  46. SaveQuery.ParamByName('Gxtx_f').asFloat := StrToFloatDef(Gxtx_f.Text,12);
  47. SaveQuery.ParamByName('CPIsum_f').asFloat := StrToFloatDef(CPIsum_f.Text,12);
  48. SaveQuery.ParamByName('CPIsat_f').asFloat := StrToFloatDef(CPIsat_f.Text,12);
  49. SaveQuery.ParamByName('descr_cust').asString:=descr_cust.Text;                           {10}
  50. SaveQuery.ParamByName('City_Full_f').asString:=City_Full_f.Text;
  51. SaveQuery.ParamByName('begtime').asTime:=BegTime.Time;
  52. SaveQuery.ParamByName('endTime').asTime:=EndTime.Time;
  53. SaveQuery.ParamByName('SpentTime').asFloat:=StrToFloatDef(SpentTime.Text,12);
  54. SaveQuery.ParamByName('F_Centre').asFloat:=StrToFloatDef(F_Centre.Text,12);
  55. SaveQuery.ParamByName('BW').asFloat:=StrToFloatDef(BW.Text,12);
  56. SaveQuery.ParamByName('st_co').asString := st_co;
  57. SaveQuery.ParamByName('st_cx').asString := st_cx;                                       {8}
  58.  
  59. SaveQuery.ExecSQL;
  60. SQLTransaction.Commit;

rvk

  • Hero Member
  • *****
  • Posts: 6112
Re: MySQL writing into BLOB error: ""is invalid float
« Reply #12 on: October 23, 2017, 01:02:29 pm »
The fields count and order are correct! My current code looks like this
If I lap them over each other it should be ok (see below).

But you STILL haven't given the complete DLL (description) of the table.
Could you extract the DLL for that table work_sp?
It will also give you the all fields in the correct order which you should use.

Otherwise you would need to restructure the INSERT sql to specify the fields you update like I showed in the previous post.
i.e.
Code: SQL  [Select][+][-]
  1. INSERT INTO work_sp (field1, field2) VALUES (:field1, :field2)

Code: [Select]
last_insert_id(),
:ES_Index,                       SaveQuery.ParamByName('ES_Index').asString := ES_Index.Text;
:fdate,                          SaveQuery.ParamByName('fdate').asDateTime := StrToDateTime(Date_Time.Text); // depending if Date_Time has a Date property or is just text
:customer_es_name,               SaveQuery.ParamByName('customer_es_name').asString := customer_es_name.Text;
:ASMI_Operator,                  SaveQuery.ParamByName('ASMI_Operator').asString:=ASMI_Operator.Text;
:operator_phone,');  {6}         SaveQuery.ParamByName('operator_phone').asString:=operator_phone.Text;                   {5}
:srb_doc,                        SaveQuery.ParamByName('srb_doc').asString:=srb_doc.Text;
:Satellite,                      SaveQuery.ParamByName('Satellite').asString:=Satellite.Text;
:SatLongitude,                   SaveQuery.ParamByName('SatLongitude').asFloat:=StrToFloatDef(SatLongitude.Text,12);
:ChooseTP,                       SaveQuery.ParamByName('ChooseTP').asString:=ChooseTP.Text;
:Co_Up_pol,                      SaveQuery.ParamByName('Co_Up_Pol').asString:=Co_Up_pol.Text;
:CX_tp,                          SaveQuery.ParamByName('CX_tp').asString:=CX_tp.Text;
:Cx_Up_pol,                      SaveQuery.ParamByName('Cx_Up_pol').asString:=Cx_Up_pol.Text;
:Station_Own,'); {8}             SaveQuery.ParamByName('Station_Own').asString:=Station_Own.Text;                         {8}
:User_Operator,                  SaveQuery.ParamByName('User_Operator').asString:=User_Operator.Text;
:User_Cont_Phone,                SaveQuery.ParamByName('User_Cont_Phone').asString:=User_Cont_Phone.Text;
:ES_location,                    SaveQuery.ParamByName('ES_location').asString:=ES_location.Text;
:ES_latitude,                    SaveQuery.ParamByName('ES_Latitude').asFloat:=StrToFloatDef(ES_latitude.Text,12);
:ES_longitude,                   SaveQuery.ParamByName('ES_Longitude').asFloat:=StrToFloatDef(ES_longitude.Text,12);
:Ant_Diameter,'); {6}            SaveQuery.ParamByName('Ant_Diameter').asFloat:=StrToFloatDef(Ant_Diameter.Text,12);      {6}
:Ref_Station,                    SaveQuery.ParamByName('Ref_Station').asString:=Ref_Station.Text;
:F_up,                           SaveQuery.ParamByName('F_up').asFloat:=StrToFloatDef(F_up.Text,12);
:F_dn,                           SaveQuery.ParamByName('F_dn').asFloat:=StrToFloatDef(F_dn.Text,12);
:CO_EIRP_f,                      SaveQuery.ParamByName('CO_EIRP_f').asFloat:=StrToFloatDef(CO_EIRP_f.Text,12);
:CPI_es_f,                       SaveQuery.ParamByName('CPI_es_f').asFloat:=StrToFloatDef(CPI_es_f.Text,12);
:sp,                             SaveQuery.ParamByName('sp').asString:=sp;
:frq,                            SaveQuery.ParamByName('frq').asString:=frq;
:eirp,                           SaveQuery.ParamByName('eirp').asString:=eirp;
:comment,                        SaveQuery.ParamByName('comment').asString:=Comment.Text;
:Pot_f,                          SaveQuery.ParamByName('Pot_f').asFloat := StrToFloatDef(Pot_f.Text,12); // or StrToFloatDef if Text can be empty or invalid)
:Pxt_f,                          SaveQuery.ParamByName('Pxt_f').asFloat := StrToFloatDef(Pxt_f.Text,12);
:Por_f,'); {12}                  SaveQuery.ParamByName('Por_f').asFloat := StrToFloatDef(Por_f.Text,12);                  {12}
:Pxr_f,                          SaveQuery.ParamByName('Pxr_f').asFloat := StrToFloatDef(Pxr_f.Text,12);
:G_CO_Max,                       SaveQuery.ParamByName('G_CO_Max').asFloat := StrToFloatDef(G_CO_Max.Text,12);
:Got_f,                          SaveQuery.ParamByName('Got_f').asFloat := StrToFloatDef(Got_f.Text,12);
:Gor_f,                          SaveQuery.ParamByName('Gor_f').asFloat := StrToFloatDef(Gor_f.Text,12);
:Gxt_f,                          SaveQuery.ParamByName('Gxt_f').asFloat := StrToFloatDef(Gxt_f.Text,12);
:Gxr_f,                          SaveQuery.ParamByName('Gxr_f').asFloat := StrToFloatDef(Gxr_f.Text,12);
:Gxtx_f,                         SaveQuery.ParamByName('Gxtx_f').asFloat := StrToFloatDef(Gxtx_f.Text,12);
:CPIsum_f,                       SaveQuery.ParamByName('CPIsum_f').asFloat := StrToFloatDef(CPIsum_f.Text,12);
:CPIsat_f,                       SaveQuery.ParamByName('CPIsat_f').asFloat := StrToFloatDef(CPIsat_f.Text,12);
:descr_cust'); {10}              SaveQuery.ParamByName('descr_cust').asString:=descr_cust.Text;                           {10}
:City_Full_f,                    SaveQuery.ParamByName('City_Full_f').asString:=City_Full_f.Text;
:begtime,                        SaveQuery.ParamByName('begtime').asTime:=BegTime.Time;
:endTime,                        SaveQuery.ParamByName('endTime').asTime:=EndTime.Time;
:SpentTime,                      SaveQuery.ParamByName('SpentTime').asFloat:=StrToFloatDef(SpentTime.Text,12);
:F_Centre,                       SaveQuery.ParamByName('F_Centre').asFloat:=StrToFloatDef(F_Centre.Text,12);
:BW,                             SaveQuery.ParamByName('BW').asFloat:=StrToFloatDef(BW.Text,12);
:st_co,                          SaveQuery.ParamByName('st_co').asString := st_co;
:st_cx                           SaveQuery.ParamByName('st_cx').asString := st_cx;                                       {8}

I take it there is an index_field above ES_Index ?? Where you put the last_insert_id in ??

syalyshev

  • New Member
  • *
  • Posts: 29
Re: MySQL writing into BLOB error: ""is invalid float
« Reply #13 on: October 23, 2017, 04:27:33 pm »
The work_sp table structure looks like this:
+-------------------------------+------------------+-------+-------+-----------------------------------+-------------+
| Field                        | Type           | Null  | Key | Default                         | Extra      |
+------------------------------+-------------------+-------+-------+-----------------------------------+-------------+
| es_id                      | int(11)           | NO   | PRI | NULL                          | auto_increment |
| idx                          | varchar(45)   | NO   | PRI | NULL                          |                |
| date                        | datetime       | YES  |     | NULL                            |                |
| cust_station_name   | varchar(40)    | YES  |     | NULL                            |                |
| operator                  | varchar(20)    | YES  |     | NULL                            |                |
| operator_phone       | varchar(5)     | YES  |     | NULL                            |                |
| srb_doc                  | varchar(30)    | YES  |     | NULL                            |                |
| satellite                   | varchar(15)    | YES  |     | NULL                            |                |
| satellite_longitude    | decimal(6,2)  | YES  |     | NULL                           |                |
| co_tp_name            | varchar(10)    | YES  |     | NULL                            |                |
| co_tp_pol                | varchar(10)   | YES  |     | NULL                            |                |
| cx_tp_name            | varchar(10)    | YES  |     | NULL                            |                |
| cx_tp_pol                | varchar(10)   | YES  |     | NULL                            |                |
| es_owner                | varchar(30)   | YES  |     | NULL                            |                |
| contact_person        | varchar(30)   | YES  |     | NULL                            |                |
| contact_phone         | varchar(35)   | YES  |     | NULL                            |                |
| es_location              | varchar(30)   | YES  |     | NULL                            |                |
| es_latitude               | decimal(10,3) | YES  |     | NULL                            |                |
| es_longitude            | decimal(10,3) | YES  |     | NULL                            |                |
| es_ant_diam            | decimal(6,2)  | YES  |     | NULL                            |                |
| ref_station                | varchar(20)   | YES  |     | NULL                            |                |
| frq_isol_up              | decimal(11,4) | YES  |     | NULL                            |                |
| frq_isol_dn              | decimal(11,4) | YES  |     | NULL                            |                |
| co_eirp_calculated  | decimal(10,2) | YES  |     | NULL                            |                |
| cpi_es_calculated   | decimal(10,2) | YES  |     | NULL                            |                |
| dir_spectrum           | varchar(120)  | YES  |     | spectrum                       |                |
| dir_frq                     | varchar(120)  | YES  |     | frq                                 |                |
| dir_eirp                   | varchar(120)  | YES  |     | eirp                               |                |
| comment                 | varchar(200)  | YES  |     | NULL                            |                |
| Pot                         | decimal(8,2)  | YES  |     | NULL                            |                |
| Pxt                         | decimal(8,2)  | YES  |     | NULL                            |                |
| Por                        | decimal(8,2)  | YES  |     | NULL                            |                |
| Pxr                        | decimal(8,2)  | YES  |     | NULL                            |                |
| G_CO_Max            | decimal(8,2)  | YES  |     | NULL                            |                |
| Got                        | decimal(8,2)  | YES  |     | NULL                            |                |
| Gor                        | decimal(8,2)  | YES  |     | NULL                            |                |
| Gxt                        | decimal(8,2)  | YES  |     | NULL                            |                |
| Gxr                        | decimal(8,2)  | YES  |     | NULL                            |                |
| Gxtx                      | decimal(8,2)  | YES  |     | NULL                            |                |
| CPIsum                 | decimal(8,2)  | YES  |     | NULL                            |                |
| CPIsat                   | decimal(8,2)  | YES  |     | NULL                            |                |
| cust_fullname         | varchar(150)  | YES  |     | NULL                            |                |
| city_full                  | varchar(60)   | YES  |     | NULL                            |                |
| t_strt                      | varchar(20)   | YES  |     | NULL                            |                |
| t_end                    | varchar(20)   | YES  |     | NULL                            |                |
| SpentTime             | varchar(15)   | YES  |     | NULL                            |                |
| fcenter                   | decimal(15,6) | YES  |     | NULL                            |                |
| band                     | decimal(15,6) | YES  |     | NULL                            |                |
| spect_co               | mediumtext    | YES  |     | NULL                            |                |
| spect_cx               | mediumtext    | YES  |     | NULL                            |                |
+---------------------+---------------+------+-----+---------------------------------+----------------+

syalyshev

  • New Member
  • *
  • Posts: 29
Re: MySQL writing into BLOB error: ""is invalid float
« Reply #14 on: October 23, 2017, 04:33:42 pm »
This is index:
| es_id                      | int(11)           | NO   | PRI | NULL                          | auto_increment |
| idx                          | varchar(45)   | NO   | PRI | NULL                          |                           |
last_insert_id() applied to es_id - primary key, auto_increment
idx corresponds to ES_Index.

 

TinyPortal © 2005-2018