albers14 Posted July 26, 2014 Posted July 26, 2014 Hey guys, I am wondering how I retrieve the row id in a SQLite table? My script looks like this function createDB() executeSQLQuery("CREATE TABLE IF NOT EXISTS spawncar(id INT, x TEXT, y TEXT, z TEXT, xr TEXT, yr TEXT, zr TEXT, r INT, g INT, b INT, r2 INT, g2 INT, b2 INT, nitro TEXT, lockType TEXT, lockedTo TEXT)") createMarkers() end addEventHandler("onResourceStart", resourceRoot, createDB) function createMarkers() SQLmarker = executeSQLQuery("SELECT * FROM spawncar") markers = {} for i,v in ipairs(SQLmarker) do local marker = createMarker(v.x,v.y,v.z-1, "cylinder", 2, 255,0,0,150) setElementData(marker,"row",v.rowid) -- At here I wanted to retrieve the data about the rowid and assign the ID to the marker, but how can I do that? setElementData(marker, "carspawner",true) setElementData(marker, "carid", v.id) setElementData(marker, "x",v.x) setElementData(marker, "y",v.y) setElementData(marker, "z",v.z) setElementData(marker, "xr",v.xr) setElementData(marker, "yr",v.yr) setElementData(marker, "zr",v.zr) setElementData(marker, "r",v.r) setElementData(marker, "g",v.g) setElementData(marker, "b",v.b) setElementData(marker, "r2",v.r2) setElementData(marker, "g2",v.g2) setElementData(marker, "b2",v.b2) setElementData(marker, "nitro",v.nitro) setElementData(marker, "lock",v.lockType) setElementData(marker, "lockedTo",v.lockedTo) end end
albers14 Posted July 31, 2014 Author Posted July 31, 2014 Please guys? Else any ideas to set a specific ID of the awl row?
Addlibs Posted July 31, 2014 Posted July 31, 2014 SQLmarker = executeSQLQuery("SELECT rowid, * FROM spawncar") --Select the rowid, and all other columns for i,v in ipairs(SQLmarker) do v["rowid"] v.rowid -- Both work, choose any. end
albers14 Posted August 1, 2014 Author Posted August 1, 2014 SQLmarker = executeSQLQuery("SELECT rowid, * FROM spawncar") --Select the rowid, and all other columns for i,v in ipairs(SQLmarker) do v["rowid"] v.rowid -- Both work, choose any. end If this is the case then I fucking love you (no homo) lol gonna post with a edit tomorrow
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now