Difference between revisions of "User:Dt192"

From Mudlet
Jump to navigation Jump to search
Line 53: Line 53:
  
 
db:add(mydb.mySheet, unpack(myData))
 
db:add(mydb.mySheet, unpack(myData))
 +
local conn = db.__conn.mydb;
 +
---------------------------------------------------------------------------------------
  
res = db.__conn.mydb:execute("SELECT last_insert_rowid()"):fetch()
+
res = conn:execute("SELECT last_insert_rowid()")
 +
display(res:fetch())
 +
 
 +
----------------------------------------------------------------------------------------
 +
 
 +
results = conn:execute([[SELECT city,name FROM mySheet WHERE city = 'Hallifax']])
 +
 
 +
local city,name = results:fetch()
 +
while city do
 +
  print(city,name)
 +
  city,name = results:fetch()
 +
end
  
display(res)
 
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 15:57, 30 January 2024

Sandbox List of orphaned pages

**Orphaned Pages**
https://wiki.mudlet.org/w/Area_51/Mapping_script
https://wiki.mudlet.org/w/Artists_performance_package
https://wiki.mudlet.org/w/Bounty_Process
https://wiki.mudlet.org/w/Chrome_OS
https://wiki.mudlet.org/w/Comparison_of_MUD_clients
https://wiki.mudlet.org/w/Connection_Window
https://wiki.mudlet.org/w/Dependency_Versions
https://wiki.mudlet.org/w/Fonts
https://wiki.mudlet.org/w/HowTo:OpenInWindowsCmd
https://wiki.mudlet.org/w/Mobile_Plan
https://wiki.mudlet.org/w/Mudlet_Packaging_System_Info_Template
https://wiki.mudlet.org/w/Mudlet_Sponsorship_Plan
https://wiki.mudlet.org/w/ProfileBackup
https://wiki.mudlet.org/w/Tutorials
https://wiki.mudlet.org/w/Updating_PPA
https://wiki.mudlet.org/w/VyzorDocumentation
https://wiki.mudlet.org/w/VyzorWalkthrough

**Links from the main website**
https://wiki.mudlet.org/w/Known_Issues

**Can't be deleted**
https://wiki.mudlet.org/w/Manual:Lua_Functions/Test

**To Delete**
...

So i don't forget again. This is how you sent raw sql to the db and fetch the result

mydb = db:create("mydb",
{
  mySheet = {
    name = "", id = 0, city = "",
    _index = { "name" },
    _unique = { "id" },
    _violations = "FAIL"
  }
})

myData = {
  {name="Ixokai", city="Magnagora", id=1},
  {name="Vadi", city="New Celest", id=2},
  {name="Heiko", city="Hallifax", id=3},
  {name="Keneanung", city="Hashan", id=4},
  {name="Carmain", city="Mhaldor", id=5},
  {name="Ixokai", city="Hallifax", id=6},
}

db:add(mydb.mySheet, unpack(myData))
local conn = db.__conn.mydb;
---------------------------------------------------------------------------------------

res = conn:execute("SELECT last_insert_rowid()")
display(res:fetch())

----------------------------------------------------------------------------------------

results = conn:execute([[SELECT city,name FROM mySheet WHERE city = 'Hallifax']])

local city,name = results:fetch()
while city do
  print(city,name)
  city,name = results:fetch()
end