Exemple #1
0
        static int tclvarColumn(sqlite3_vtab_cursor cur, sqlite3_context ctx, int i)
        {
            Tcl_Obj       p1 = null;
            Tcl_Obj       p2 = null;
            string        z1;
            string        z2     = "";
            tclvar_cursor pCur   = (tclvar_cursor)cur;
            Tcl_Interp    interp = ((tclvar_vtab )cur.pVtab).interp;

            TCL.Tcl_ListObjIndex(interp, pCur.pList1, pCur.i1, out p1);
            TCL.Tcl_ListObjIndex(interp, pCur.pList2, pCur.i2, out p2);
            z1 = TCL.Tcl_GetString(p1);
            if (p2 != null)
            {
                z2 = TCL.Tcl_GetString(p2);
            }
            switch (i)
            {
            case 0: {
                sqlite3_result_text(ctx, z1, -1, SQLITE_TRANSIENT);
                break;
            }

            case 1: {
                sqlite3_result_text(ctx, z2, -1, SQLITE_TRANSIENT);
                break;
            }

            case 2: {
                Tcl_Obj pVal = TCL.Tcl_GetVar2Ex(interp, z1, z2 == "" ? null : z2, (TCL.VarFlag)TCL.TCL_GLOBAL_ONLY);
                sqlite3_result_text(ctx, TCL.Tcl_GetString(pVal), -1, SQLITE_TRANSIENT);
                break;
            }
            }
            return(SQLITE_OK);
        }