if this interests you at all, i found this yesterday on the evolt.org
mailing list. the gentleman who has put this very useful code basically
suggested that i could "base36" my auto_increment IDs. i will leave this
here for those of you who are intersted:

http://www.faqts.com/knowledge_base/view.phtml/aid/17710

i use this in the same table. one of the ID fields is auto_incremented.
when an ID is generated, i calculate the base36 of that number and put it
into my other field which i have to use for my purposes. 

php or mysql should consider putting this code in their language itself,
especially mysql because it can be used for alphanumeric sequences! i
dont know if i am making sense, but my problem is solved. 

hope this helps someone! :)

cheers/erick


--- Carl McNamee <[EMAIL PROTECTED]> wrote:
> Erick,
> 
> We did that very thing here.  Our staff wrote a Unique Record
> Identifier
> (URI) program that was called by the programs that actually put the
> data
> into the database.  The generated URI was then used as the primary key.
> However, I must say up front that this type of thing is fraught with
> problems.  Here are the ones we ran into that I'm aware of.
> 1.  Performance can stink.  If you ask the URI generator for each
> record
> things are slow.   We got around this somewhat by figuring out how many
> records a program was working with and requresting a block of URI's. 
> So now
> you have to modify your programs too!
> 2.  The URI generator must keep track of the URI's it hands out.  So
> you
> need another database table, and its associated overhead, just to keep
> track
> of this.
> 3.  If the system crashes and the URI tables were not updated you could
> start handing out duplicate URI's after the system recovers.  How will
> your
> application handle this?  The database will reject the records assuming
> that
> the URI is your primary key but how do you fix the URI database?
> 
> If anyone responds with a better way it would be great if you'd post it
> to
> the mysql list.
> 
> Carl McNamee
> Systems Administrator
> Billing Concepts
> (210) 949-7282
> 
> -----Original Message-----
> From: Erick Papadakis [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 08, 2002 6:30 AM
> To: mysql
> Subject: mysql primary key question!
> 
> 
> hello, 
> 
> i hope some database guru can help me with this! 
> 
> i need to set up an auto_increment field inside mysql. for various
> reasons, the maximum size is 3. but i don't want this to be ONLY
> integers
> because that limits me until 999 numbers only.  since i have all
> flexibility for these three digits or letters, i want to include
> numbers
> and some characters into it as well. e.g.,
> 
>   m78
>   23a
>   1pt
>   1~8
>   !76
>  
> ...etc can all be valid keys for me. 
> 
> how can i generate such numbers on the fly? if not inside mysql, then
> inside php? AND...be sure that the "key" so generated has not been used
> before as an id field in my data? 
> 
> any ideas would be very welcome! 
> 
> thanks very much in advance/erick
> 



__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to