[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: SQL syntax in Lua?
- From: PA <petite.abeille@...>
- Date: Wed, 8 Mar 2006 07:29:13 +0100
Hello,
I would like to, hmmm, use some SQL like syntax in Lua and I was
wondering if anyone had any thoughts on such endeavor?
My current thinking is to chain function calls which mimic SQL
constructs. Something along these lines:
DB:Select( 'name' ):
From( aSource ):
Where( 'name', 'like', '%joe%' ):
Where( 'city', '=', 'NYC' ):
Order( 'name' )()
Or perhaps wrap the above in a function call which would execute in a
custom environment (providing additional substitution magic along the
way):
local aStatement = function()
Select( name )
From( aSource )
Where( name, like, '%joe%' )
Where( city, eq, 'NYC' )
Order( name )
end
DB:run( aStatement )
Any thoughts on such constructs?
Thanks for any insights!
Cheers
--
PA, Onnay Equitursay
http://alt.textdrive.com/