Database A little request !

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
thyphoon
Enthusiast
Enthusiast
Posts: 345
Joined: Sat Dec 25, 2004 2:37 pm

Database A little request !

Post by thyphoon »

I think add DatabaseLastInsertRowId() function will be great !

Netmaestro give a good alternative solution for sqlite3

Code: Select all

ImportC "sqlite3.lib"
sqlite3_last_insert_rowid(hDB.l)
EndImport
But it will be better if an integreate function will existe!

Ps:excuse my bad english !
User avatar
Kiffi
Addict
Addict
Posts: 1486
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: Database A little request !

Post by Kiffi »

thyphoon wrote:I think add DatabaseLastInsertRowId() function will be great !
Netmaestro give a good alternative solution for sqlite3
here is another one without using ImportC:

Code: Select all

Procedure DatabaseLastInsertRowId(hDB)
  
  DatabaseQuery(hDB, "Select last_insert_rowid()")
  NextDatabaseRow(hDB)
  ProcedureReturn GetDatabaseLong(hDB, 0)
  
EndProcedure
Greetings ... Kiffi
Hygge
User avatar
thyphoon
Enthusiast
Enthusiast
Posts: 345
Joined: Sat Dec 25, 2004 2:37 pm

Re: Database A little request !

Post by thyphoon »

Kiffi wrote:
thyphoon wrote:I think add DatabaseLastInsertRowId() function will be great !
Netmaestro give a good alternative solution for sqlite3
here is another one without using ImportC:

Code: Select all

Procedure DatabaseLastInsertRowId(hDB)
  
  DatabaseQuery(hDB, "Select last_insert_rowid()")
  NextDatabaseRow(hDB)
  ProcedureReturn GetDatabaseLong(hDB, 0)
  
EndProcedure
Greetings ... Kiffi
Thanks it's great !! :)
Post Reply