[Gambas-user] Problem with Gambas and MySql

nando nando_f at ...951...
Sat Oct 5 16:33:42 CEST 2013


This isn't really a Gambas issue.
The table is poorly created without a primary key with auto-increment.
If you wanted to delete one row with values 347 200, then which row would it be?
Without the primary key, you're asking MySQL to guess, and it wont.
Whatever your 'row pointer' is in Gambas, MySQL knows nothing of it.
-Nando


---------- Original Message -----------
From: Willy Raets <willy at ...2734...>
To: mailing list for gambas users <gambas-user at lists.sourceforge.net>
Sent: Sat, 05 Oct 2013 14:08:27 +0200
Subject: Re: [Gambas-user] Problem with Gambas and MySql

> On Sat, 2013-10-05 at 10:08 +0200, Fernando Martins wrote:
> > On 10/05/2013 01:25 AM, Willy Raets wrote:
> > > On Fri, 2013-10-04 at 22:53 +0200, Willy Raets wrote:
> > >
> > > Nando, Fernando and Caveat,
> > >
> > > Thanks for your responses.
> > >
> > >> Content in 'ICzakgewicht' can be like this:
> > >> | ID | Gewicht |
> > >> 345 100
> > >> 345 100
> > >> 345 50
> > >> 347 200
> > >> 347 200
> > >> 347 200
> > >> 347 200
> > > @ Fernando and Caveat
> > >
> > > Above you can see that more than one record can be exactly the same.
> > > At any time only one of them needs to be removed.
> > > With Gambas this can be done, looking for the first record meeting the
> > > criteria, delete it, next update and leave the table.
> > >
> > > With SQL DELETE all records that meet the criteria will be deleted
> > > instead of only one.
> > >
> > > That is why this is not an option.
> > >
> > >
> > "duplicate rows are and always were a mistake in SQL", C.J.Date
> > 
> >
http://books.google.nl/books?id=y_eVBB5qdwMC&pg=PA159&lpg=PA159&dq=c+j+date+duplicate+records&source=bl&ots=DjN-LDuU2B&sig=5-vlJ8itEkC7h6aFMt2PxHkT-ug&hl=en&sa=X&ei=1cdPUtjSCcHH0QWvooGQCw&redir_esc=y#v=onepage&q=c%20j%20date%20duplicate%20records&f=false
> > 
> > In my experience, most often there is a design problem with the database 
> > allowing for duplicates. With duplicates, you step out of the set theory 
> > behind relational dbs and enter into trouble. I admit I have done it 
> > myself, but best be avoided.
> > 
> Then adding a primary key should solve that problem.
> 
> -- 
> Kind regards,
> 
> Willy (aka gbWilly)
> 
> http://gambasshowcase.org/
> http://howtogambas.org
> http://gambos.org
> 
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
------- End of Original Message -------





More information about the User mailing list