コード例 #1
0
ファイル: DBHandler.cs プロジェクト: RudolfStander/jportal
        public void GetDistinctList(string tableName, TPCField field)
        {
            string query = "SELECT DISTINCT " + field.name + " FROM " + tableName + " ORDER BY " + field.name;

            cursor.Format(query, 0);
            if (ShowSQL)
            {
                LogDebug = query;
            }
            cursor.Run();
        }
コード例 #2
0
ファイル: DBHandler.cs プロジェクト: RudolfStander/jportal
        public void GetTable(string tableName, TPCField[] allFields, int offsetFields, int noFields, TPCIndexField[] orderFields, int offsetOrderFields, int noOrderFields)
        {
            string query = "SELECT";

#if do_it_with_mssql
            if (Limit.Length > 0)
            {
                query += " " + Limit;
            }
            else
            {
                query += " TOP 1000";
            }
#endif
            string comma = " ";
            fields = new TPCField[noFields];
            for (int i = 0; i < noFields; i++)
            {
                fields[i] = allFields[offsetFields + i];
                query    += comma + fields[i].name;
                comma     = ", ";
            }
            dataTableGrid = new DataTableGrid(tableName);
            dataTableGrid.MakeTableColumns(fields);
            query += comma + UsId + ", " + TmStamp + " FROM " + tableName;
            if (Lookup.Length > 0)
            {
                query += " " + Lookup;
            }
#if do_it_with_oracle
            if (Lookup.Length == 0)
            {
                query += " WHERE ROWNUM <= 1000";
            }
#endif
            if (noOrderFields > 0)
            {
                string orderBy = " ORDER BY";
                comma = " ";
                for (int i = 0; i < noOrderFields; i++)
                {
                    int      no    = orderFields[offsetOrderFields + i].index;
                    TPCField field = fields[no];
                    orderBy += comma + field.name;
                    comma    = ", ";
                }
                query += orderBy;
            }
#if do_it_with_lite3
            if (Limit.Length > 0)
            {
                query += " " + Limit;
            }
            else
            {
                query += " LIMIT 1000";
            }
#endif
            cursor.Format(query, 0);
            if (ShowSQL)
            {
                LogDebug = query;
            }
            cursor.Run();
        }