On Wed, Jun 8, 2011 at 6:37 AM, Edward Brekelbaum <nedb...@yahoo.com> wrote:

> Hello,
>   Let me start by saying using SQLite in Tcl is a real pleasure!
>
>
> I am having a problem determining when to use $ and when to use @ (and
> maybe I
> should use :, but I haven't tried it).
>

You should always use $, except when you want to insert a blob when you
might consider using @, though $ will likely work in that case too.

@ should only be used in the rare case when you have a TCL variable that has
both a string representation and a bytearray representation and you want to
use the bytearray representation and insert it as a blob.


>
>
>
> I have three tables: terrain(x,y), detail(id integer primary key
> autoincrement,
> x, y), and units(id ipka, detailId foreign)
> (there are other fields but they are all untyped and not used for anything
> but
> filtering and retrieval).
>
> I started using $ everywhere, but sometimes had problems where I needed a
> layer
> of [subst] before calling eval.
>
> Then, I converted everything to @, but then some queries wouldn't match.  I
> needed to replace = with like, or insert casts.
>
> Right now, I have a mix of @ and $.  I use @ for inserts and matches on
> most
> fields.  I use $ to match detail.id and units.id.  Comparing detail.id and
> units.detailId requires a cast (because I insert into units.detailId with
> @).
> Also, I seem to be unable to match columns to string constants (I guess,
> because
> everything is a blob).
>
>
> It seems to be related to the "impedance mismatch" mentioned on the Tcl
> wiki.
>
>
>
> Is there some document that describes a best known method for dealing with
> all
> this?
>
> Thanks!
> Ned
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to