List:General Discussion« Previous MessageNext Message »
From:Steve Edberg Date:April 26 1999 5:08pm
Subject:Re: rowid
View as plain text  
At 9:05 AM -0700 4/26/99, Derick H Siddoway wrote:
>A possible workaround is to include a column in your tables that
>indicates whether the row has been "deleted" or not.  Then, rather
>than actually deleting the row, you update this column.  Your
>autoincrements should then work, and all you have to do is remember
>to put "AND deleted = 'N'" in your queries.
>
>Yeah, the tables would get bigger than they otherwise would.  But
>this would give you a unique row id.


This is sort of how dBase did things...it had a 'deleted' column, and
wouldn't actually delete records until you did a 'pack' of the table.

You don't include very much info, but I assume you were thinking of using
an auto-incrementing field, and ordering on that? Perhaps, instead, you
could use a column made of unixtime + microtime (like PHPs microtime
function) which returns a unixtime value with microseconds. This might be
enough by itself, or you could sort on an autoincrement field AND this time
column.

Also, in the very near future, apparently MySQL will have the option to
have strictly increasing auto_increment fields that never reuse an
ID...that feature might actually already be in the latest CVS version...


-steve e


>
>From:	luke%quiknet.com@Internet on 04/25/99 12:39 PM
>To:	mysql%lists.mysql.com@Internet
>cc:	 (bcc: Derick H Siddoway/TC/TRS/American Express)
>Subject:	rowid
>
>	I've been reading through the archives about rowid and work-arounds.
>Most
>of the work-arounds focus on unique identifiers. The code I am currently
>working on requires that I have a loop which starts with the first row and
>continues down the table until it has finished. The problem with a unique
>identifier is that the table gets deletions regularly which makes it near
>impossible to loop because of the inconsistant numbers. Any ideas would be
>greatly appreciated.
>
>
>
>
>Luke Hewitt
>Tech Support Geek
>QuikNet, Inc.
>
>luke@stripped
>916.782.9700 ext 113
>M-Th 1pm-9pm, Sun 10am-6pm


+--------------- my people are the people of the dessert, ---------------+
| Steve Edberg                                       Computer Consultant |
| sbedberg@stripped                   University of California, Davis |
| (530)753-7605                                            (530)754-9127 |
+---------------- said t e lawrence, picking up his fork ----------------+
Thread
rowidLuke Hewitt25 Apr
  • RE: Error: Before start of result setFilip Hanik31 Mar
Re: rowidFred Lindberg25 Apr
Re: rowidDerick H Siddoway26 Apr
Re: rowidSteve Edberg26 Apr