[Freeswitch-users] error loading module 'luasql.mysql'

David Villasmil david.villasmil.work at gmail.com
Fri Jan 29 08:23:45 PST 2010


Where in the wiki?

On Fri, Jan 29, 2010 at 4:30 PM, Michael Collins <msc at freeswitch.org> wrote:
> David,
>
> Are you using Lua and lusql for some exotic call handling scenarios? If so,
> would you mind posting some examples to the wiki and then linking here?
> Also, if you can join the community conference call today that would be
> great!
>
> Thanks,
> MC
>
> On Fri, Jan 29, 2010 at 7:22 AM, David Villasmil
> <david.villasmil.work at gmail.com> wrote:
>>
>> Oh yes, here's an example:
>>
>> function dbConnect()
>>     -- connect to db
>>     require "luasql.mysql"
>>     env = assert(luasql.mysql())
>>     conn = assert(env:connect("freeswitch","user","userpass","localhost"))
>> end
>>
>> function getpin()
>>     session:streamFile(card_greeting_audio_file)
>>
>>     card_pin = session:getDigits(4, "#", 3000);
>>
>>     if card_pin > "" then
>>          freeswitch.consoleLog("info", "CARD INFO: PIN...........:
>> ".. card_pin .."\n");
>>          cur = assert(
>>               conn:execute( "select * from cards_table where pin ="..
>> card_pin ..";" )
>>               )
>>
>>          -- print all rows, the rows will be indexed by field names
>>          row = cur:fetch ({}, "a")
>>          fsLog("ROWS: ".. cur:numrows() )
>>          if cur:numrows() > 0 then pinok=true end
>>          while row do
>>
>>               fsLog("CARD INFO: Batch.........: ".. row.batch        )
>>               fsLog("CARD INFO: Card Name.....: ".. row.card_name    )
>>               fsLog("CARD INFO: Ratetable.....: ".. row.ratetable    )
>>               fsLog("CARD INFO: Initial Bal...: ".. row.init_bal     )
>>               fsLog("CARD INFO: Curr Balance..: ".. row.balance      )
>>
>>               batch, ratetable, init_bal, balance = row.batch,
>> row.ratetable, row.init_bal, row.balance
>>
>>               SetVar("card_pin",card_pin)
>>               SetVar("card_batch", batch)
>>               SetVar("card_ratetable", ratetable)
>>               SetVar("card_init_bal", init_bal)
>>               SetVar("card_balance", balance)
>>
>>            -- reusing the table of results
>>            row = cur:fetch (row, "a")
>>          end
>>     else
>>          pinok=false
>>          session:streamFile(card_invalid_pin_audio_file)
>>     end
>> end
>>
>>
>> On Thu, Jan 28, 2010 at 9:05 PM, Mike van Lammeren
>> <mike at van.lammeren.net> wrote:
>> > And you can make queries against your MySQL database, and get results,
>> > etc.?
>> >
>> > On Thu, Jan 28, 2010 at 2:43 AM, David Villasmil
>> > <david.villasmil.work at gmail.com> wrote:
>> >>
>> >> Hello,
>> >>
>> >> That works fine:
>> >>
>> >> box:~# lua testdb.lua
>> >> box:~#
>> >>
>> >>
>> >> David
>> >>
>> >> On Thu, Jan 28, 2010 at 7:27 AM, Mike van Lammeren
>> >> <mike at van.lammeren.net> wrote:
>> >> > Have you tried running a Lua script that includes the library from
>> >> > outside
>> >> > of FreeSWITCH? What does that do?
>> >> >
>> >> > On Wed, Jan 27, 2010 at 11:47 PM, Adam Wilt <wiltingtree at gmail.com>
>> >> > wrote:
>> >> >>
>> >> >> I tried running ldconfig on the directory containing mysql.so, but
>> >> >> it
>> >> >> did
>> >> >> not help.
>> >> >> So it sounds like there could be a bug in the latter versions?
>> >> >>
>> >> >> On Wed, Jan 27, 2010 at 8:09 PM, David Villasmil
>> >> >> <david.villasmil.work at gmail.com> wrote:
>> >> >>>
>> >> >>> I got the same error, my script was working with no problems before
>> >> >>> an
>> >> >>> update to trunk.
>> >> >>>
>> >> >>> David
>> >> >>>
>> >> >>> On Thu, Jan 28, 2010 at 1:15 AM, Adam Wilt <wiltingtree at gmail.com>
>> >> >>> wrote:
>> >> >>> > Hi, I followed the instructions in the Lua documentation for
>> >> >>> > setting
>> >> >>> > up
>> >> >>> > luasql, but when I try to run my script I get:
>> >> >>> > 2010-01-27 19:08:14.799250 [ERR] mod_lua.cpp:182 error loading
>> >> >>> > module
>> >> >>> > 'luasql.mysql' from file
>> >> >>> > '/usr/local/lib/lua/5.1/luasql/mysql.so':
>> >> >>> >         /usr/local/lib/lua/5.1/luasql/mysql.so: cannot restore
>> >> >>> > segment
>> >> >>> > prot
>> >> >>> > after reloc: Permission denied
>> >> >>> > stack traceback:
>> >> >>> >         [C]: ?
>> >> >>> >         [C]: in function 'require'
>> >> >>> >         /usr/local/freeswitch/scripts/l.lua:2: in main chunk
>> >> >>> > I'm running FreeSWITCH version 1.4 and luasql version 2.1.1.
>> >> >>> > I changed the permissions for mysql.so and for my script to 777,
>> >> >>> > so
>> >> >>> > I'm
>> >> >>> > not
>> >> >>> > sure where the permission problem could be.
>> >> >>> > I'd appreciate any suggestions.
>> >> >>> > Thanks,
>> >> >>> > Adam
>> >> >>> >
>> >> >>> > _______________________________________________
>> >> >>> > FreeSWITCH-users mailing list
>> >> >>> > FreeSWITCH-users at lists.freeswitch.org
>> >> >>> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> >> >>> >
>> >> >>> >
>> >> >>> >
>> >> >>> > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> >> >>> > http://www.freeswitch.org
>> >> >>> >
>> >> >>> >
>> >> >>>
>> >> >>> _______________________________________________
>> >> >>> FreeSWITCH-users mailing list
>> >> >>> FreeSWITCH-users at lists.freeswitch.org
>> >> >>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> >> >>>
>> >> >>>
>> >> >>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> >> >>> http://www.freeswitch.org
>> >> >>
>> >> >>
>> >> >> _______________________________________________
>> >> >> FreeSWITCH-users mailing list
>> >> >> FreeSWITCH-users at lists.freeswitch.org
>> >> >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> >> >>
>> >> >>
>> >> >> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> >> >> http://www.freeswitch.org
>> >> >>
>> >> >
>> >> >
>> >> > _______________________________________________
>> >> > FreeSWITCH-users mailing list
>> >> > FreeSWITCH-users at lists.freeswitch.org
>> >> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> >> >
>> >> > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> >> > http://www.freeswitch.org
>> >> >
>> >> >
>> >>
>> >> _______________________________________________
>> >> FreeSWITCH-users mailing list
>> >> FreeSWITCH-users at lists.freeswitch.org
>> >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> >>
>> >> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> >> http://www.freeswitch.org
>> >
>> >
>> > _______________________________________________
>> > FreeSWITCH-users mailing list
>> > FreeSWITCH-users at lists.freeswitch.org
>> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> > http://www.freeswitch.org
>> >
>> >
>>
>> _______________________________________________
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>
>
> _______________________________________________
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>




More information about the FreeSWITCH-users mailing list