Example #1
0
        static void Main(string[] args)
        {
            SelectClause select = Select(("c".Col("t")).As("a"), "co".Col(), QueryBuilderExtensions.Col("cl").As("col"), "Now".Call().As("Date"));

            // SELECT (t.c) AS a, co, (cl) AS col, (Now()) AS Date
            Console.WriteLine(select.GetQuery());

            FromClause from = From(Table("t").LeftOuterJoin(Table("lo"), "x".Col("t").Eq("y".Col("lo")).And("y".Col("t").Neq("x".Col("lo")))));

            // FROM t LEFT OUTER JOIN lo ON ((t.x = lo.y) And (t.y != lo.x))
            Console.WriteLine(from.GetQuery());

            WhereClause where = Where("c".Col("t").Eq(Val("v")).And(Val(2.0).LtEq(Val(1)).Or(Val(-1).Neq("NOW".Call()))));
            // WHERE (s.f = 'v') And ((2 <= 1) Or (-1 != NOW()))
            Console.WriteLine(where.GetQuery());

            OrderByClause orderBy = OrderBy("c".Col("t"), "co".Col());

            // ORDER BY t.c, co
            Console.WriteLine(orderBy.GetQuery());

            CreateClause create = Create("Table", true, "FieldA".ColDefinition(BaseType.Integer, 2), "FieldB".ColDefinition(BaseType.Text, 10));

            // CREATE TABLE IF NOT EXISTS Table (FieldA Integer, FieldB Text)
            Console.WriteLine(create.GetQuery());

            DB DbObject = new DB(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Oxcha/Oxcha.db").ToString());
            Dao <UserAuthKey> firenduserAuthTable = new Dao <UserAuthKey>(DbObject);

            firenduserAuthTable.CreateTable();

            string directory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Oxcha").ToString();

            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }

            Client client = AuthenticateLogin(args);

            if (client != null)
            {
                EntryHandler(client);
            }
        }