User:Dt192

From Mudlet
Jump to navigation Jump to search

Sandbox

**List of 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

luasql manual

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;
---------------------------------------------------------------------------------------

display(conn:getlastautoid())

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

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

results:close()

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

results = conn:execute[[
  SELECT * FROM mySheet WHERE name = 'Ixokai'
]]

local res = results:fetch({}, "a")
while res do
  print(res.id, res.city, res.name)
  res = results:fetch(res, "a")
end

results:close()

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

function rows(conn, query)
  local cursor = assert(conn:execute(query))
  local res = {}
  return function ()
    return cursor:fetch(res, "a")
  end
end

local query = [[
  select * from mySheet WHERE id > 1 AND id < 5
]]

for row in rows(conn, query) do
  print(row.name, row.city, row.id)
end

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

function urows(conn, query)
  local cursor = assert(conn:execute(query))
  return function ()
    return cursor:fetch()
  end
end

local query = [[
  select name,city,id from mySheet WHERE id > 1 AND id < 5
]]

for name,city,id in urows(conn, query) do
  print(name, city, id)
end

Command line arguments

Switch Short Action
--help -h displays this message.
--version -v displays version information.
--quiet -q no splash screen on startup.
--profile=<profile> -p additional profile to open, may be repeated.
--only=<predefined> -o make Mudlet only show the specific predefined game, may be repeated.

There are other inherited options that arise from the Qt Libraries which are less likely to be useful for normal use of this application:

--dograb ignore any implicit or explicit -nograb. --dograb wins over --nograb even when --nograb is last on the command line.
--nograb the application should never grab the mouse or the keyboard.
--reverse sets the application's layout direction to right to left.
--style=style sets the application GUI style. Possible values depend on your system configuration. If Qt was compiled with additional styles or has additional styles as plugins these will be available to the -style command line option. You can also set the style for all Qt applications by setting the QT_STYLE_OVERRIDE environment variable.
--style style is the same as listed above.
--stylesheet=stylesheet sets the application styleSheet. The value must be a path to a file that contains the Style Sheet. Note: Relative URLs in the Style Sheet file are relative to the Style Sheet file's path.
--stylesheet stylesheet is the same as listed above.
--widgetcount prints debug message at the end about number of widgets left undestroyed and maximum number of widgets existing at the same time.
--qmljsdebugger=1234[,block] activates the QML/JS debugger with a specified port. The number is the port value and block is optional and will make the application wait until a debugger connects to it.