I have done some additional research on
SELECT LAST_INSERT_ID();
When I execute the select not from within Knoda, but from
a mysql command line prompt it returns 11000+ '0's, i.e.
a 0 for every record in the table. The problem is obviously with
the mysql background database, and not with Knoda.
Thanks for your answer.
Egbert
DJ Anubis <[EMAIL PROTECTED]> wrote: Egbert Eissing a écrit :
> Thanks very much, I have insert working now.
> Now there is another problem. Consider the following code snippet:
> query2=db.new_resultquery()
> query2.set_sql("SELECT last_insert_id() from CdDisk")
> query2.enable()
> CdDiskID=query2.show_currentrow()
>
> The last_insert_id() function is is available in mysql to return the
> key value of the last record inserted into a table. I have used this
> many times in other applications. It does not work properly in Knoda,
> as it always returns 0 instead of the correct key value.
> Is this a bug in Knoda, or is something else wrong?
> It is too useful that I would not like to do without it.
> Egbert
I often use the last_inser_id() MySQL function, as it is a standard way
in MySQL, and it also works well i Knoda.
>From MySQL manual: "LAST_INSERT_ID() (with no argument) returns the
first automatically generated value that was set for an AUTO_INCREMENT
column by the most recently executed INSERT statement to affect such a
column. For example, after inserting a row that generates an
AUTO_INCREMENT value, you can get the value like this:
mysql> SELECT LAST_INSERT_ID();
-> 195
"
Your problem could be in your table structure and options used by your
MySQL installation, as well as your previous query. Mainly, MySQL manual
gives a list of reasons for having undefined value for this function.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Hk-classes-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hk-classes-discuss
---------------------------------
For ideas on reducing your carbon footprint visit Yahoo! For Good this month.-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Hk-classes-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hk-classes-discuss