[Gambas-user] Gambas2 components?

Gareth Bult gareth at ...1689...
Thu Jan 15 00:26:40 CET 2009


Mmm,

I wouldn't know "how" to do what GridEditor does without autoinc fields and last_id .. if other DB's make this difficult or don't provide the functionality, that sort of reinforces my suggestion that one should choose MySQL.

Just turning it around for a second, is there any reason why one should *not* use MySQL?

As a 10yr+ MySQL user, my views may be biased, however to the best of my knowledge;
a. MySQL is faster than the competition, certainly the likes of Postgres (by a lot!)
b. MySQL does not crash - so it's reliability is not question
c. Current versions support all the stuff (triggers, stored proc's etc) that people used to insist was their excuse for Postgres
d. MySQL does loads of back end replication stuff other DB's don't do
e. MySQL runs on more Platforms than any other DB
f. It has bindings for every language I can think of, and then some
g. It has loads of nice GUI tools and designers (commercial and free)
.. etc .. etc .. etc ...

yes I do have the T-shirt, but no they're not paying me.

Bottom line, I have no reason why GridEditor should not support other DB's , just so long as they can actually do the job .. so as soon as people with the relevant expertise provide Gambas with autoinc / lastid support, I'll see if I can use it in place of a raw SELECT statement .. how's that ?   :-)

Gareth.


----- Original Message -----
From: "Rob" <sourceforge-raindog2 at ...94...>
To: gambas-user at lists.sourceforge.net
Sent: Wednesday, 14 January, 2009 7:42:27 PM GMT +00:00 GMT Britain, Ireland, Portugal
Subject: Re: [Gambas-user] Gambas2 components?

On Wednesday 14 January 2009 10:29, Gareth Bult wrote:
> This function would be required regardless of the underlying DB .. so
> what't the PG equivalent ?

By looking at the sqlite docs, I'm guessing last_insert_rowid() is their 
equivalent, but I only have MySQL installed so I can't test it.

But some DB engines don't even have auto-incrementing fields, let alone a 
function to return the last inserted ID.  Google tells me 

CURRVAL(pg_get_serial_sequence('my_tbl_name','id_col_name'))

is the Postgres equivalent, but if it uses sequences, I think that's 
different than what we know as autoincrement fields.  With Firebird, you 
can approximate the functionality with generators, like this:

-- before inserting any rows into table
CREATE GENERATOR generator_id;

-- then, as part of each insert statement
INSERT INTO tablename (keycolumn, ...) VALUES 
(gen_id(generator_id, 1), ...);

-- after all that, here's the LAST_INSERT_ID() equivalent
SELECT gen_id(generator_id, 0);

I have no idea whether this is safe to use with multiple connections (like 
MySQL's is) or anything like that.  I also don't think there's any 
standard ODBC mechanism to do this.

Rob

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Gambas-user mailing list
Gambas-user at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

-- 
Managing Director, Encryptec Limited
Tel: 0845 5082719, Mob: 0785 3305393
Email: gareth at ...1689... 
Statements made are at all times subject to Encryptec's Terms and Conditions of Business, which are available upon request.




More information about the User mailing list