View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0031965 | Lazarus | Database Components | public | 2017-06-04 16:29 | 2017-11-17 23:31 |
Reporter | ertank | Assigned To | Juha Manninen | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | Raspberry Pi 3, x86_64 | OS | Raspbian, Windows | ||
Product Version | 1.8RC1 | ||||
Summary | 0031965: TSQLQuery.Params[0].Value assignment or changing TSQLQuery.Params[0].Value.Type does not work | ||||
Description | Both on Windows 10 64bit and Lazarus 64bit, or Raspberry Pi 3 and Lazarus doesn't work. Database server is PostgreSQL 9.4.10 on Raspberry Pi 3 | ||||
Steps To Reproduce | I have following text in my SQLQuery1.SQL Code: [Select] select * from test where abc = :param All below is at design time. I am using object inspector; -Click Params (new windows pops: Editing SQLQuery1.Params[0]) -Click 0 - param to set parameter "param" (Object Inspector changes into TParam properties) -Click Value and type something. 1- When I hit Enter Value reverts back to "(Null)" 2- When I try to set a Parameter Value Type it simply reverts back to "Null" | ||||
Additional Information | It is not just Object Inspector that cannot assign a parameter value, parameters are not assigned using code, too. For attached project, I have log_statement = 'all' in my postgresql.conf to understand better what's going on. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | r56035, r56146 | ||||
LazTarget | - | ||||
Widgetset | GTK 2 | ||||
Attached Files |
|
related to | 0019324 | resolved | Juha Manninen | propedits.pp - TPropertyEditor with Variants not working, TVariantPropertyEditor commented out |
related to | 0028040 | resolved | Juha Manninen | TLRSObjectWriter is missing implementation of WriteVariant |
related to | 0025068 | assigned | Juha Manninen | Modifying CollectionItem does not mark the edited file as modified. (was:Changing ContentProducer property in OI has no effect) |
related to | 0032705 | resolved | Juha Manninen | TSQLQuery.Params are not updating at design-time |
|
|
|
Just wanted to add that Lazarus 1.6.4 (SVN 55188) works OK. |
|
|
|
Can you try attached "bug31965.lpr" what results do you get? If you get correct results, can you alter "bug31965.lpr" to show bug ? |
|
Bug is at design time. You cannot set a parameter value at design time using Object Inspector. |
|
Does the problem happen only in Raspberry Pi? I understood LacaK could not reproduce. If Lazarus 1.6.4 is OK, you could try bisecting the guilty revision: http://wiki.freepascal.org/How_do_I_create_a_bug_report#Regression_caused_by_a_certain_revision Otherwise please provide test project without PostgreSQL dependency. I guess the bug is not related to it. |
|
I can not reproduce in FPC only (confirmed by reporter, that bug is in design time only) TParam.Value is published *Variant* property ... |
|
I will not install PostgreSQL for this. I hope there is a way to test without it. |
|
I think, that you are not required to install PostgreSQL. IMO problem may be reproducible with any TCustomSQLQuery (descendant) component with any TSQLConnection descendant on any platform (not only RPi). May be this help: TCustomSQLQuery.Params is declared of type TParams (collection of TParam), but object created at runtime is always of type TSQLDBParams (is descendant from TParams i.e.=class(TParams)) and item in this collection is of type TSQLDBParam Btw. you can reproduce it without PostgreSQL: - Open attached project1 (in bug31965_param.zip) - Click in Object inspector on "SQLQuery1: TSQLQuery" "FieldDefs: TSQLDBFieldDefs" changes to "<unknow collection>: TSQLDBFieldDefs" ? - Then click on "Params" property and on "0-param" - Try change Value to any numeric value. You will see, that (Null) is set back ... (Also when you save form, form is damaged, because there is: Params = < item DataType = ftInteger Name = 'param' ParamType = ptInput Value = <--- end> ) |
|
|
|
Ok, I can reproduce... |
|
Please test with r56035. |
|
In r56036 is resolved only problem with: "FieldDefs: TSQLDBFieldDefs" changes to "<unknow collection>: TSQLDBFieldDefs" There are still problems with "0-param".Value: - When I change value of Value or any other property (like Size, Precision, Name etc.) in Object inspector then in toolbox (and main menu) is not enabled Save (Ctrl+S) button ... seems like change is not catched - When I change value of Type property (under Value property) to Unassigned or Null and save form , form becomes corrupted as I wrote above (you cannot open it later) |
|
Did it work at some point? |
|
In Lazarus 1.6.4 (FPC 3.0.2) it does not work, but behaves differently. When I try to change Value error dialog is shown "Could not convert variant of type (Null) ..." and only option is press Esc to cancel change. Later when I save form, form is NOT corrupted (Value property is not present in LFM file of course). When I change value of any other property Save is also not enabled. In Lazarus 1.4.4 (FPC 2.6.4) when I click "0-param" there is no Value property in object inspector at all! When I change value of any other property Save is also not enabled. So conclusion: none of above mentioned versions works correctly, but none cause LFM corruption. It is hard to fix this bug in trunk? (I do not know what is root of problem, streaming NULL variant values or ?) |
|
> It is hard to fix this bug in trunk? I believe it is easy if you know how to do it. :) I don't know it but I will debug it at some point. BTW, nobody maintains the DB stuff very actively. Many bug reports are open since 8+ years. If somebody provides well tested patches, I can apply. |
|
I fixed the TVariantPropertyEditor in r56146. I had applied its initial implementation by Michal Gawrycki a year and a half ago. Didn't even remember. Please test. Now the LFM does not corrupt any more but I am still puzzled of what is going on. In your example app I can add Params in the property editor and set their values. After I save the project I can see they are stored in LFM file. Good. However when I open the project again it only shows the one Param that was there already. The others are ignored. Is the one saved also somewhere else? Changes in FieldDefs are stored OK. It is also shown in the component treeview. Why params are not there? Uhhh... |
|
Yes, I can confirm that LFM is okay. Only small cosmetic problem is with "Save" (as I wrote when I change something in "param" Save button is not enabled ... I must go to owner component and there do any change) There is IMO no problem, when you add params and save LFM and restore, that newly added params are mising ... it is like TSQLQuery works ... Params are built based on SQL text in SQL property ... so sql statement is parsed and params are put in TParams collection. So from my POV root problem is fixed ... may be this is candidate for merging in 1.8.x branch |
|
> So from my POV root problem is fixed ... may be this is candidate for merging in 1.8.x branch Yes, the 2 revisions are already merged. This was a major bug anyway, and partly a regression. I try to figure out the remaining Save-button issue. I guess it is common with many Collection properties. |
|
Fixed. Continuing the Save-button issue in 0025068. |
|
I just checked with Lazarus 1.8.0.RC5 SVN 56257 and problem is still present. - Open new project - Put a TSQLQuery on the form. - Write following in SQL property: "select * from abc where id = :id" - Go to params property and click "0 - id" From this point on all of the following failed for me: 1- Directly type something in Value (it stays as Null) 2- Change DataType to ftString and write something in Value (it stays as Null) 3- Change Value.Type to String (it is not changing to string) Basically, I could not set a value for a parameter at design time. |
|
It works here. There is no 1.8.0.RC5 r56257. That revision came after RC5. Test either with fixes_1_8 branch or with trunk directly from SVN server. |
Date Modified | Username | Field | Change |
---|---|---|---|
2017-06-04 16:29 | ertank | New Issue | |
2017-06-04 16:29 | ertank | File Added: sqlquery_param_problem.rar | |
2017-06-04 16:46 | ertank | Note Added: 0100857 | |
2017-06-12 09:04 | LacaK | File Added: bug31965.lpr | |
2017-06-12 09:05 | LacaK | Note Added: 0101044 | |
2017-06-14 21:08 | ertank | Note Added: 0101130 | |
2017-10-09 17:30 | Juha Manninen | LazTarget | => - |
2017-10-09 17:30 | Juha Manninen | Note Added: 0103286 | |
2017-10-09 17:30 | Juha Manninen | Assigned To | => Juha Manninen |
2017-10-09 17:30 | Juha Manninen | Status | new => feedback |
2017-10-09 17:37 | LacaK | Note Added: 0103287 | |
2017-10-10 01:37 | Juha Manninen | Note Added: 0103317 | |
2017-10-11 10:25 | LacaK | Note Added: 0103350 | |
2017-10-11 10:34 | LacaK | Note Edited: 0103350 | View Revisions |
2017-10-11 10:34 | LacaK | Note Edited: 0103350 | View Revisions |
2017-10-11 10:41 | LacaK | Note Edited: 0103350 | View Revisions |
2017-10-11 10:43 | LacaK | File Added: bug31965_param.zip | |
2017-10-11 10:45 | LacaK | Note Edited: 0103350 | View Revisions |
2017-10-11 10:48 | LacaK | Note Edited: 0103350 | View Revisions |
2017-10-11 18:53 | Juha Manninen | Note Added: 0103361 | |
2017-10-11 18:54 | Juha Manninen | Status | feedback => assigned |
2017-10-12 15:37 | Juha Manninen | Note Added: 0103378 | |
2017-10-12 15:37 | Juha Manninen | Status | assigned => feedback |
2017-10-13 07:45 | LacaK | Note Added: 0103395 | |
2017-10-13 18:14 | Juha Manninen | Note Added: 0103412 | |
2017-10-13 21:02 | LacaK | Note Added: 0103415 | |
2017-10-16 07:14 | LacaK | Note Edited: 0103415 | View Revisions |
2017-10-16 07:17 | LacaK | Note Edited: 0103415 | View Revisions |
2017-10-16 15:49 | Juha Manninen | Note Added: 0103475 | |
2017-10-22 15:26 | Juha Manninen | Relationship added | related to 0019324 |
2017-10-22 18:03 | Juha Manninen | Relationship added | related to 0028040 |
2017-10-22 18:22 | Juha Manninen | Note Added: 0103686 | |
2017-10-23 07:45 | LacaK | Note Added: 0103708 | |
2017-10-23 09:35 | Juha Manninen | Note Added: 0103710 | |
2017-10-23 09:35 | Juha Manninen | Status | feedback => assigned |
2017-10-24 12:55 | Juha Manninen | Relationship added | related to 0025068 |
2017-10-24 12:57 | Juha Manninen | Fixed in Revision | => r56035, r56146 |
2017-10-24 12:57 | Juha Manninen | Note Added: 0103734 | |
2017-10-24 12:57 | Juha Manninen | Status | assigned => resolved |
2017-10-24 12:57 | Juha Manninen | Resolution | open => fixed |
2017-11-17 23:08 | ertank | Note Added: 0104164 | |
2017-11-17 23:09 | ertank | Note Edited: 0104164 | View Revisions |
2017-11-17 23:29 | Juha Manninen | Note Added: 0104165 | |
2017-11-17 23:31 | Juha Manninen | Relationship added | related to 0032705 |