Joseph L. Casale wrote:
> Each row from the CSV required several tables with relationships to be
> populated. One could
> certainly abstract this out into an api, but that can have impacts on
> performance for large
> batch processing if you are creating parameters for every insert rather than
> reusing them.
>
> In simple cases, the code is trivial but in this example, it looks terrible
> given the number of
> Command instances...
.NET's handling of SQL parameter objects is horribly verbose.
If you had access to the SQLite C API, you could write a helper function
that automatically created all the parameter objects for you. But even
so, you can write a helper function with a list of parameter names:
var attributeCommand = CreateCommandHelperFunction(
connection,
@"INSERT INTO Attribute
(Type, Value, AccountId)
VALUES
(@Type, @Value, @AccountId)",
"@Type", "@Value", "@AccountId"
);
If the returned object is your own wrapper, you can also make the
parameter binding easier; something like this:
attributeCommand.bindParameter(1, type); // or:
attributeCommand.bindParameter("@Value", value);
Regards,
Clemens
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users