Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-08

SQLdb not detect automatically Required field

12 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

silvioprog

Hi,

I made a very simple example to reproduce the bug. In Delphi, when adding the fields in Query, the Query automatically detects whether the Field is not null. In Lazarus this is not happening.

Sample in attached.

Thx.

Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> LazWebSolutions - <code.google.com/p/lazwebsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * =============================================== -------------- next part -------------- A non-text attachment was scrubbed... Name: sqldb_bug.zip Type: application/zip Size: 3587 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110802/b5319f5d/attachment-0001.zip>

Reply by email

silvioprog
to silvioprog

A best sample in attached.

2011/8/2 silvioprog :

Show quoted text 21 lines
Hi, I made a very simple example to reproduce the bug. In Delphi, when adding the fields in Query, the Query automatically detects whether the Field is not null. In Lazarus this is not happening. Sample in attached. Thx. -- Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> LazWebSolutions - <code.google.com/p/lazwebsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * ===============================================

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sqldb_bug.zip
Type: application/zip
Size: 3724 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110802/edf4d388/attachment.zip>

Reply by email

silvioprog

Hi,

Someone is experiencing this problem?:

http://62.166.198.202/view.php?id=19872

I'm trying to create an OPF, but with this bug still isn't possible to continue implementing my framework.

Thx.

Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> LazWebSolutions - <code.google.com/p/lazwebsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * ===============================================

Reply by email

Graeme Geldenhuys
to silvioprog
silvioprog wrote
I'm trying to create an OPF,

Sorry I can't help with your problem, but I do have a question...

Just curious. Have you tried tiOPF2? This is a OPF with a lot of features and very stable code base - been in production use for many years, by many developers. Not to mention it will save you a boat load of time, instead of implementing a full featured OPF from scratch. Also the GUI bindings work well with Delphi VCL, Lazarus LCL and fpGUI. Just a thought I would mention all this.

If you have tried tiOPF2, but still needed to implement your own OPF. Would you mind sharing why you decided against tiOPF?

Regards, ? - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net

Reply by email

silvioprog
to Graeme Geldenhuys

Hi Graeme,

2011/8/9 Graeme Geldenhuys :

Sorry I can't help with your problem, but I do have a question...

No problem. ;) It seems to be a bug in fcl-db.

Show quoted text 9 lines
Just curious. Have you tried tiOPF2? This is a OPF with a lot of features and very stable code base - been in production use for many years, by many developers. Not to mention it will save you a boat load of time, instead of implementing a full featured OPF from scratch. Also the GUI bindings work well with Delphi VCL, Lazarus LCL and fpGUI. ?Just a thought I would mention all this. If you have tried tiOPF2, but still needed to implement your own OPF. Would you mind sharing why you decided against tiOPF?

My framework will not have many resources. It will be a very simple framework. It will generate only a few simple SQL scripts, such as select, insert, update, and something with join.

One question, tiOPF is compatible with CGI apps?

Thx.

-- Regards, ? - Graeme -
Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> LazWebSolutions - <code.google.com/p/lazwebsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * ===============================================

Reply by email

Graeme Geldenhuys
to silvioprog
silvioprog wrote
No problem. ;) It seems to be a bug in fcl-db.

I read the bug report you listed, but haven't taken a look at the sample project attached to that report. I use SqlDB (which falls under the fcl-db umbrella) extensively, but haven't found any major issues. Those that I have found via the extensive test suite of tiOPF has already been addressed. I'll be extending the tiOPF SqlDB support to cover PostgreSQL, MySQL etc in the test suite too - make they will raise some issues (but I hope not). I also want to try out the open source IBX components for FPC.

My framework will not have many resources. It will be a very simple framework. It will generate only a few simple SQL scripts, such as select, insert, update, and something with join.

Maybe you should give tiOPF2 a try after all. For simple SQL, the tiOPF has what is called Auto-Mapping, and can generate all the SQL for you. My projects are a bit more complex, so I manage the SQL myself (with the help of utility apps).

One question, tiOPF is compatible with CGI apps?

Definitely. We have a large product built with tiOPF. It has a Desktop GUI and a CGI Web interface. About 90% of the code is shared between the different frontends because most of the code is non-gui code. We have a good separation between GUI, Business Objects/Rules and Storage (db persistence), so this made things very easy.

Regards, ? - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net

Reply by email

silvioprog
to Graeme Geldenhuys

2011/8/9 Graeme Geldenhuys :

Show quoted text 8 lines
I read the bug report you listed, but haven't taken a look at the sample project attached to that report. I use SqlDB (which falls under the fcl-db umbrella) extensively, but haven't found any major issues. Those that I have found via the extensive test suite of tiOPF has already been addressed. I'll be extending the tiOPF SqlDB support to cover PostgreSQL, MySQL etc in the test suite too - make they will raise some issues (but I hope not). I also want to try out the open source IBX components for FPC.

Good. I use only SQLite and PostgreSQL (in all my apps, desktop or web).

[...]

Show quoted text 5 lines
Definitely. We have a large product built with tiOPF. It has a Desktop GUI and a CGI Web interface. About 90% of the code is shared between the different frontends because most of the code is non-gui code. We have a good separation between GUI, Business Objects/Rules and Storage (db persistence), so this made things very easy.

I'm downloading the sources of tiOPF via SVN. I will do some tests. Any questions I ask again (in the list of tiOPF, sure ;) ).

Thx again. ;)

-- Regards, ? - Graeme -
Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> LazWebSolutions - <code.google.com/p/lazwebsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * ===============================================

Reply by email

Michael Van Canneyt
to silvioprog: Someone is experiencing this problem?: http://62.166.198.202/view.php?id=19872 I'm trying…
silvioprog wrote 8 lines
Hi, Someone is experiencing this problem?: http://62.166.198.202/view.php?id=19872 I'm trying to create an OPF, but with this bug still isn't possible to continue implementing my framework.

It is not always possible to detect the required field. Delphi also very often does it wrong. (for instance when you do a join)

That is why sql-db relies on the ProviderOptions property : pfInkey should be set for the keyfield.

This does not exclude that fcl-db should try harder to detect the key field, but you should be aware that it cannot always be detected reliably. (I always specify it manually)

So leave the bug open. But try setting the pfInKey option whenever you can.

Michael.

Reply by email

waldo kitty
to silvioprog: Someone is experiencing this problem?: http://62.166.198.202/view.php?id=19872 I'm trying…
silvioprog wrote 8 lines
Hi, Someone is experiencing this problem?: http://62.166.198.202/view.php?id=19872 I'm trying to create an OPF, but with this bug still isn't possible to continue implementing my framework.

off the top of my head, without reading the bug report, is this a required field that the database knows about that is expected to tell the application about?

even though i've been doing a lot of this type of stuff for 20+ years, i've not run into this particular situation based on the reading of the posts about it... in my past, anything that was required was required by the coder to handle... in other words, they must know the requirements of the database when they wrote their code so that specific situations like this were covered by their code... yes, this meant "hardcoding" items like this... but many things have changed over the years and this may be one of those... but i am trying to assist when and where i can though many, like yourself, may have more experience than i in some cases like this ;)

Reply by email

Graeme Geldenhuys
to waldo kitty
waldo kitty wrote 5 lines
even though i've been doing a lot of this type of stuff for 20+ years, i've not run into this particular situation based on the reading of the posts about it... in my past, anything that was required was required by the coder to handle...

I fully agree with this, and this is how I code my projects too.

Regards, ? - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net

Reply by email

silvioprog
to Michael Van Canneyt: It is not always possible to detect the required field. Delphi also very often does it…

2011/8/9 Michael Van Canneyt :

Show quoted text 14 lines
It is not always possible to detect the required field. Delphi also very often does it wrong. ?(for instance when you do a join) That is why sql-db relies on the ProviderOptions property : pfInkey should be set for the keyfield. This does not exclude that fcl-db should try harder to detect the key field, but you should be aware that it cannot always be detected reliably. (I always specify it manually) So leave the bug open. But try setting the pfInKey option whenever you can. Michael.

Thanks Michael,

After this explanation, I'll prefer inform the Required field manually.

Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> LazWebSolutions - <code.google.com/p/lazwebsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * ===============================================

Reply by email

silvioprog
to waldo kitty: off the top of my head, without reading the bug report, is this a required field that the…

2011/8/9 waldo kitty :

Show quoted text 13 lines
off the top of my head, without reading the bug report, is this a required field that the database knows about that is expected to tell the application about? even though i've been doing a lot of this type of stuff for 20+ years, i've not run into this particular situation based on the reading of the posts about it... in my past, anything that was required was required by the coder to handle... in other words, they must know the requirements of the database when they wrote their code so that specific situations like this were covered by their code... yes, this meant "hardcoding" items like this... but many things have changed over the years and this may be one of those... but i am trying to assist when and where i can though many, like yourself, may have more experience than i in some cases like this ;)

Hi Waldo,

Sorry if I did not understand everything, the translator was not very clear for me. ^^'

Know if the field is Required would be very helpful for me to configure the fields are not null in my views (I use MVC with input in HTML5: http://www.w3schools.com/html5/att_input_required.asp).

But I can put the field not null manually, no problems. ;)

Thx, and sorry if I was not very clear in the translation.

Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> LazWebSolutions - <code.google.com/p/lazwebsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * ===============================================

Reply by email