Transfer and TQL

I love working with Transfer and Mark Mandel has done an amazing feat of giving it some really good documentation. But I remember when I was getting started I was looking for a rough guide to the TQL language for Transfer and how to implement it. So based on all the information at www.transfer-orm.com/transfer/documentation/ here's a quick start to TQL.Please note: I am presuming you already know how to set up Transfer and have basic knowledge of how it works.For this example here is our Transfer.xml configuration file: First we need to create our (S)TQL statement. TQL is Transfers own scripting language written in Java and ColdFusion. The main difference over SQL is that you are referencing classes and properties from your Transfer.xml file (see above). So to run a "SELECT * FROM" the post_table our TQL would look like: SELECT * FROM post.PostYou can see here that in the query instead of using the table name after FROM we are using the Transfer Class post.Post. Next we use the TQL and create the query. Note at this point you are not running the statement against the database, you are just creating a TQL.query object.Once we have the object returned we just need to pass it on to one of Transfers generated methods such as .readByQuery() or .ListByQuery()That's it. Nothing really new hear and like I said you can get all of this from the documentation. There are some limits still to TQL, one of the is using TOP/LIMIT (see this thread). In my next post i'll go into passing values to the TQL statement and look at other methods that can effect how the TQL script is resolved by TransferQuick reference points:
comments powered by Disqus