Jump to content

few questions about sql


Extinction

Recommended Posts

Posted (edited)

1. What does dbPoll exactly do?

2. What does dbFree exactly do?

3. How would I put data from sql into a client side script, what functions would i need?

And are there any explained examples?

 

Edited by Extinction
Posted

1 . dbPoll is used to keep a result from a dbExec

2 . dbFree is used when you don't need to keep a result from a dbExec

3 . You'll need to triggerServerEvent.

Posted
local sqlConnect = dbConnect("sqlite", "test.db")
local querryH = dbQuerry(sqlConnect, "SELECT * FROM accounts")
if querryH == statementHere then
	neededData = dbPoll(querryH, -1)
else
	dbFree(querryH)
end

Thats all.

Posted (edited)

So if I did something like this, would it work -

function checkAccounts(username)
local sqlConnect = dbConnect("sqlite", "test.db")
local querryH = dbQuery(sqlConnect, "SELECT * FROM accounts WHERE username = ?", username)
if querryH == "Extinction" then
	neededData = dbPoll(querryH, -1)
    outputChatBox("Username was found, listing all current usernames: ", source)
    outputChatBox(querryH) --- To list all the usernames in DB?
else
    outputChatBox("Username was not found", source)
	dbFree(querryH)
end

checkAccounts()


 

Edited by Extinction

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...