Dear All,
I've just posted this to MySQLdb help forum but maybe
there is a mysql way of getting what I want and you could,
time permitting, help me.
First my setup:
* Python 2.5
* MySQL 5.0.27-standard-log (MYISAM tables)
* MySQLdb.version_info (1, 2, 2, 'gamma', 1)
I have the following statement which I currently cursor.execute:
num_lines = cursor.execute("""insert into AAA (name,desc) select
name,desc from BBB""")
The primary key in AAA is an auto_increment `id`.
The return is the number of lines which were inserted
and cursor.lastrowid (LAST_INSERT_ID()) evaluates to
the *first* `id` which was created in AAA.
So, if after executing the statement above I get:
num_lines = 3
cursor.lastrowid = 5
Is there any guarantee that the `id` for all of my new rows will
be 5,6,7 ? Or could there have been a parallel insert happening
which would make the `id` for my 3 rows be *non-consecutive*?
Is there full-proof way of doing what I want, i.e. knowing *all* of
the inserted ids and not just the first?
Thanks a lot in advance.
Zac
--
Ezequiel Panepucci
Phone: +41 (0)56 310 5267
Cell : +41 (0)79 598 6946
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]