|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Thu Nov 12, 2020 12:33 am Post subject: CE sqlite3 |
|
|
I try to use CE SQL to create table and etc.
Code: | -- Define connection and database
conn = createSQLite3Connection()
conn.DatabaseName = 'e:\\chatDB.sqlite3'
conn.Connected=true
tran = createSQLTransaction()
tran.SQLConnection = conn
tran.Active = true
-- check and create database
tn = conn.getTableNames()
if #tn==0 then
print("empty")
conn.ExecuteDirect([[
CREATE TABLE chatDB (
'userid' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
'username' TEXT NOT NULL,
'password' TEXT NOT NULL,
'email' TEXT NOT NULL,
'telp' TEXT)
]])
tn = conn.getTableNames()
if #tn==0 then error('no table created') end
end
status,errorstring = conn:execute ([[INSERT into sample values (' 1 ', ' Corroder ', '123', 'blabla@mail', '1234567890')]])
print (status,errorstring)
cursor,errorstring = conn:execute ([[SELECT * from chatDB]])
row = cursor:fetch ({}, "a")
while row do
print (string.format ("userid:%s, usernane:%s", row.id, row.name))
end
note = [[
print("Tables : ")
local dbExist = false
local i
for i=1,#tn do
print(tn[i])
if tn[i]=='chatDB' then dbExist = true end
end
]]
tran.Commit()
tran.Active = false
conn.Connected = false
tran.Destroy()
conn.close() |
1. I got error : 'Error:TSQLite3Connection : database is locked'
2. How to connect a database store in a web host (example script)
Any kinds of "enlightenment" would be appreciated.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Thu Nov 12, 2020 2:05 am Post subject: |
|
|
1: it might be a stale lock. did ce crash before and didn't clean up the lock indicator? Or is it open in another database editor?
2: you write a php script that connects to it and does the queries and use getInternet() to query the results. Look at ceshare
or setup an ODBC connection on the client computer and use createODBCConnection(owner)
but really, NEVER let a client issue sql statements directly to an online host
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Thu Nov 12, 2020 5:34 am Post subject: |
|
|
1. database lock, seem because another sql database still open. Fix by close all database and re-open specific database. So, that mean these statement :
Code: | conn.Connected = false
tran.Destroy()
conn.close()
|
I got a note from SQLite3 site:
"If an sqlite3 object is destroyed while a transaction is open, the transaction is automatically rolled back"
Is that mean to close connected database need 'closeDataSets()'?
2. "NEVER let a client issue sql statements directly to an online host", So, I considering to use ODBC and set a local database. I have some references for that and should ask here when facing some problems.
Thanks DB
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|