Is there anyway for LUA to access and utilize the SQL Database? menu

User Tag List

Results 1 to 5 of 5
  1. #1
    controlsx2's Avatar Member
    Reputation
    16
    Join Date
    Jun 2007
    Posts
    223
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is there anyway for LUA to access and utilize the SQL Database?

    I was looking through the list of ArcEmu LUA commands and i came accross

    Code:
    [edit]  sql scripting
    
     GetColumn  
    
     NextRow  
    
     GetColumnCount  
    
     GetRowCount  
    
     GetByte  
    
     GetUByte  
    
     GetShort  
    
     GetUShort  
    
     GetLong  
    
     GetULong  
    
     GetString
     
     SqlGetString 
     
     GetGUID  
    
     GetFloat  
    
     GetBool
    So i was wondering. Is it possible for a LUA script to access the Database. So i could make a script edit parts of a the database?

    Is there anyway for LUA to access and utilize the SQL Database?
  2. #2
    adrion's Avatar Private
    Reputation
    1
    Join Date
    May 2010
    Posts
    7
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    when you script a npc you need to specify the npc spawn ID the spells IDs.Theoreticaly you are looking on wowhead for these cods but there are actualy in your Databse.So when you do a lua script you actualy take informations from your databse.This i think is the conection beetween LUA and your Databse.

  3. #3
    Breakdawn's Avatar Active Member
    Reputation
    39
    Join Date
    Jun 2009
    Posts
    266
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by adrion View Post
    when you script a npc you need to specify the npc spawn ID the spells IDs.Theoreticaly you are looking on wowhead for these cods but there are actualy in your Databse.So when you do a lua script you actualy take informations from your databse.This i think is the conection beetween LUA and your Databse.
    That's not what he ment - And yes there is a way to do that, Just depends on how epic you are at LUA scripting

  4. #4
    controlsx2's Avatar Member
    Reputation
    16
    Join Date
    Jun 2007
    Posts
    223
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Breakdawn View Post


    That's not what he ment - And yes there is a way to do that, Just depends on how epic you are at LUA scripting
    Any hints? xD

  5. #5
    Dynashock's Avatar Contributor

    Reputation
    176
    Join Date
    Nov 2007
    Posts
    203
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use WorldDBQuery, CharDBQuery, WorldDBQueryTable or CharDBQueryTable.
    The first two return a queryresult object which you can use the methods on you listed in the first post. Thus for instance:
    Code:
    local qResult = WorldDBQuery("SELECT `name` FROM `items` WHERE `quality` = 2") -- performs query and returns it as a QueryResult object
    while (qResult:NextRow()) do -- fetches next row, return true on success, false otherwise (false will break the while loop)
         local field = qResult:GetColumn(0) -- gets the first column of the row and returns it as a field object
         print(field:GetString()) -- fetches the string from the field object and prints it, thus it prints the name of the item
    end
    WorldDBQueryTable and CharDBQueryTable both return a table instead. You can play around with indices of the table to get the values you want.
    Ignorance is bliss.

Similar Threads

  1. Is there anyway you can run two WoW on the same pc?
    By bait in forum World of Warcraft General
    Replies: 5
    Last Post: 10-24-2006, 06:42 PM
All times are GMT -5. The time now is 02:21 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search