Re: [IBPP-DISCUSS] Bind Parameters by name
IBPP is a C++ client class library for FirebirdSQL
Status: Inactive
Brought to you by:
epocman
|
From: Lucas S. <luc...@gm...> - 2015-10-05 23:51:37
|
Good idea! But first, I'll do the part that I'm supposed to do, after
that,we can talk more about your idea!
To do this work properly, I'll need to know if the statement is an (update
or )insert, update or delete, because the structure will be different in
DDLs (I can't replace parameters in DDLs)
For now, I'm simply looking for the first valid word [INSERT, UPDATE,
DELETE, WITH, EXECUTE P(ROCEDURE)]...
But I don't think that this solution is good enough/elegant. If you have an
sugestion, I'll be glad
Thanks!
On Sun, Oct 4, 2015 at 8:20 AM, Olivier Mascia <om...@in...> wrote:
> > Le 3 oct. 2015 à 23:15, Lucas Schatz <luc...@gm...> a écrit :
> >
> > Hi, is there interest to add support to add parameters by name, instead
> of
> > just "?"
> > I'm doing this by myself, but I want to know if IBPP team has interest in
> > the patch.
> >
> > It will work like this example:
> >
> > statement->Prepare("INSERT INTO TEST_TABLE (ID, COLUMN2, COL3, ABC)
> > VALUES (:IDVALUE, :COL2, ?, :ABC)");
> > st2->Set("IDVALUE", 1);
> > st2->Set("COL2", "AAAA");
> > st2->Set(3, 12.34); # Regular use
> > st2->Set("abc", 12344.0); # Case insensitive
>
> Hello, yes, why not, thanks in advance.
>
> Though it was never programmed / finalized, another idea along the same
> lines was this:
>
> statement->Prepare("INSERT INTO TEST_TABLE (ID, COLUMN2, COL3, ABC) VALUES
> (?, "data", ?, ?)");
> st2->Set("ID", 1);
> st2->Set(3, 12.34); # Regular use
> st2->Set("abc", 12344.0); # Case insensitive
>
> It allows to re-use the column names from the INTO part of the statement
> to match them to the '?' instead of assigning yet other pseudo variable
> names. I intentionally added a constant data in the VALUES part, because
> this is something which happen and must be accounted for. It too implies to
> parse correctly the statement, which is something that the current IBPP
> implementation doesn't have to do (merely count the '?' to optimize some
> resources allocation, which is not a proper parse.
>
> --
> Meilleures salutations, Vriendelijke groeten, Best Regards,
>
> Olivier Mascia (from mobile device)
> tipgroup.com/om
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> ibpp-discuss mailing list
> Post to ibp...@li...
> Settings https://lists.sourceforge.net/lists/listinfo/ibpp-discuss
> http://www.ibpp.org
|