How to disable Null PK?

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

How to disable Null PK?

Postby john1598360627 » Thu Dec 07, 2023 12:41 am

I'm getting warning's about database tables that are allowing null's in their PK.

When I try to disable allowing nulls for the PK, it just resets back to allowing them when I save.

How do I disable allowing nulls for the PK? Do I need to use an external database editor to do this?

For some context, these are quite old database tables. From Visual Fox Pro. Purely setup to import old data, and not for active use.

nullpk-1.png
nullpk-1.png (166.58 KiB) Viewed 4930 times


nullpk-2.png
nullpk-2.png (131.62 KiB) Viewed 4930 times
john1598360627
 
Posts: 175
Joined: Tue Aug 25, 2020 3:03 pm

Re: How to disable Null PK?

Postby mboegem » Thu Dec 07, 2023 9:10 am

Hi John

I don't have any experience with Visual Fox Pro Databases, but for sure you need an external editor to change database definitions.
From within Servoy you are only able to create/delete tables and columns. Changing column definitions is not possible.

There are definitely Visual Fox Pro guru's around on this forum to guide you on how to do it.
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1752
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: How to disable Null PK?

Postby hilgers » Thu Dec 07, 2023 11:16 am

Hi John,

I'm (still) a FoxPro Developer and my recommendation is Database.NET https://fishcodelib.com/database.htm
This one differs from most other DB-Tools because of using the original VFP OleDB driver which can prevent many problems *IF* the Fox Database has some FoxPro code in stored procedures or record validations
It's astonishing what this tiny portable exe is able to do. The free version does most of the things you might need.
Joachim Hilgers
Hicosoft GmbH
Cologne, Germany
hilgers
 
Posts: 13
Joined: Wed Feb 15, 2012 1:29 pm
Location: Cologne / Germany

Re: How to disable Null PK?

Postby john1598360627 » Fri Dec 08, 2023 1:33 am

hilgers wrote:Hi John,

I'm (still) a FoxPro Developer and my recommendation is Database.NET https://fishcodelib.com/database.htm
This one differs from most other DB-Tools because of using the original VFP OleDB driver which can prevent many problems *IF* the Fox Database has some FoxPro code in stored procedures or record validations
It's astonishing what this tiny portable exe is able to do. The free version does most of the things you might need.

Great! Thank you, I'll check it out!
john1598360627
 
Posts: 175
Joined: Tue Aug 25, 2020 3:03 pm

Re: How to disable Null PK?

Postby omar » Mon Dec 11, 2023 12:37 pm

Hi John, did you fix it? Best is to add the PK in VFP. You may need to recreate the table and import the data again. Even better is to upgrade your databse to PostgreSQL if possible. I can help you with that. I have done it for several VFP databases.
Intrasoft, Founder
Omar van Galen
omar@intrasoft.nl
+31-(0)6-21234586
Servoy Developer
omar
 
Posts: 377
Joined: Sat Feb 12, 2011 4:51 pm
Location: Intrasoft, The Netherlands

Re: How to disable Null PK?

Postby john1598360627 » Sat Feb 24, 2024 2:55 am

omar wrote:Hi John, did you fix it? Best is to add the PK in VFP. You may need to recreate the table and import the data again. Even better is to upgrade your databse to PostgreSQL if possible. I can help you with that. I have done it for several VFP databases.

Hasn't been fixed yet.

The VFP already has pk's, and Servoy can identify the pk too. The issue is that it's 'allowing nulls' for some reason.
john1598360627
 
Posts: 175
Joined: Tue Aug 25, 2020 3:03 pm

Re: How to disable Null PK?

Postby john1598360627 » Sat Feb 24, 2024 2:58 am

When looking into the VFP database with Database .NET, it seems like the PK shouldn't allow nulls. As it has 'NOT NULL'.

Code: Select all
ALTER TABLE `acagecardweb` ADD
   `pk` Integer NOT NULL AUTOINC NEXTVALUE 1 STEP 1


Again though, in Servoy it shows 'Allow Null' to be checked ON... So I have no idea why there is a discrepancy.


Could the SQL in VFP be setup wrong, or that VFP is just too old for Servoy to detect this? It's just strange.
john1598360627
 
Posts: 175
Joined: Tue Aug 25, 2020 3:03 pm

Re: How to disable Null PK?

Postby hilgers » Sun Feb 25, 2024 6:22 pm

you are not alone - Servoy believes all my VFP fields are nullable as well...
Joachim Hilgers
Hicosoft GmbH
Cologne, Germany
hilgers
 
Posts: 13
Joined: Wed Feb 15, 2012 1:29 pm
Location: Cologne / Germany

Re: How to disable Null PK?

Postby john1598360627 » Thu Feb 29, 2024 2:41 am

hilgers wrote:you are not alone - Servoy believes all my VFP fields are nullable as well...

Ah, so I'm not alone. I'll try and get a ticket posted to Servoy about this issue.
john1598360627
 
Posts: 175
Joined: Tue Aug 25, 2020 3:03 pm

Re: How to disable Null PK?

Postby kwpsd » Fri Mar 01, 2024 12:42 am

Created Support Ticket: SVY-18996
Kim W. Premuda
San Diego, CA USA
User avatar
kwpsd
 
Posts: 687
Joined: Sat Jul 28, 2007 6:59 pm
Location: San Diego, CA USA

Re: How to disable Null PK?

Postby rgansevles » Fri Mar 08, 2024 10:42 am

It seems that the driver just does ignores nullability.
When I create a table using another JDBC tool (squirrelsql) outside Servoy I see exactly the same.
I can create a table with non-nullable fields

Code: Select all
create table tst (tst_id integer not null, tst_f integer null, primary key (tst_id))


The metadata still says nullable for all columns.
When I insert nulls, it stores 0.

Code: Select all
insert into tst values (null, null)


Code: Select all
select * from tst -- returns  ( 0, 0 )


So it seems this is an issue with the driver / database and cannot be fixed in Servoy.
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1927
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: How to disable Null PK?

Postby john1598360627 » Tue Apr 09, 2024 1:21 am

Hmmm so if there's no way for Servoy to fix the Warning... is there any way I can filter them out? Any way of unselecting or ignoring the the specific database?


Not really sure how to do that.
warning-filter.png
warning-filter.png (93.57 KiB) Viewed 552 times
john1598360627
 
Posts: 175
Joined: Tue Aug 25, 2020 3:03 pm

Re: How to disable Null PK?

Postby john1598360627 » Wed Apr 10, 2024 12:56 am

OKAY I figured it out.

I had to make a New Configuration + New Working Set. In which it contains all project modules EXCEPT resources, thereby ignoring the database warnings.

Then made the resources it's own Configuration + Working Set too, so I can look at it on it's own.
john1598360627
 
Posts: 175
Joined: Tue Aug 25, 2020 3:03 pm


Return to How To

Who is online

Users browsing this forum: No registered users and 19 guests