You may get the incorrect value back buy doing this:
So I'm thinking "how do I get something like VFP's old NextKey generation"
akin to this:

* this was pseudo-code, off the top of my head trying to remember my coding
from 17+ years ago
FUNCTION GetNextKey(tcTable as String) as Integer
<snip>

In the same insert statement you append ; select last_insert_id() ; and it
returns YOUR value no matter what type of data column the key is.  If you
do some super fancy secondary select someone else may have gotten an insert
in as well and your code returns their key, not yours.



On Thu, Mar 10, 2016 at 9:49 AM, <
[email protected]> wrote:

> On 2016-03-09 19:55, Stephen Russell wrote:
>
>> why not this?
>>
>> INSERT INTO table_name (col1, col2,...) VALUES ('val1',
>> 'val2'...);SELECT LAST_INSERT_ID();
>>
>> Sometimes you have to use the tool as intended.
>>
>
>
> Well that's basically what I'm doing, but it's in a framework so re-use is
> key.  You don't put this after each task-specific SQL; that's why I had
> that subroutine.  (Am I showing my age there?  Does anybody say
> 'subroutine' anymore???  Reminds me of learning FORTRAN in the LATE 80s at
> Penn State!)
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/cajidmylgr8apaqfyx0xh15kcusgkjxwxba8eygncfa5q5he...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to