I don't know exactly how to do it in C but in .NET it's pretty
straightforward..

[SQLiteFunction(Name = "FormatCurrency", Arguments = -1, FuncType =
FunctionType.Scalar)]
public class SQLiteCurrency : SQLiteFunction 
{
        public override object Invoke(object[] args)
        {
                try
                {
                        return Convert.ToDecimal(args[0]).ToString("C");
                }
                catch(InvalidCastException)
                {
                        return null;
                }
        }
}

Best regards,

Sam 


-------------------------------------------
We're Hiring! Seeking a passionate developer to join our team building
products. Position is in the Washington D.C. metro area. If interested
contact [EMAIL PROTECTED]
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mitchell
Vincent
Sent: Friday, April 06, 2007 11:54 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Re: Currency Formatting within SQLite

It sounds so easy when you say it like that! :-)

Thanks Mr, Neff! I'll get to reading!

On 4/6/07, Samuel R. Neff <[EMAIL PROTECTED]> wrote:
>
> > Yes, I know about creating a function but I'm wondering if I can hook
> > into the already-existing Windows API function for it.
>
> You don't need to write a totally custom function, just something that
> bridges the two API's.  Create a function that implements the expected
> SQLite call spec and then call out to Windows to get the results.
>
> HTH,
>
> Sam


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to