Esempio n. 1
0
        private bool IsMatchingColumn(schemaobj_column pSearchObj,
                                      string table_qualifier,
                                      string table_owner,
                                      string table_name)
        {
            if (pSearchObj == null)
            {
                return(true);
            }

            /* match the search pattern */
            if ((pSearchObj.getTableQualifier() != null) && pSearchObj.getTableQualifier().ToUpper().CompareTo(table_qualifier.ToUpper()) != 0)
            {
                return(false);
            }
            if ((pSearchObj.getTableOwner() != null) && pSearchObj.getTableOwner().ToUpper().CompareTo(table_owner.ToUpper()) != 0)
            {
                return(false);
            }
            if ((pSearchObj.getTableName() != null) && pSearchObj.getTableName().ToUpper().CompareTo(table_name.ToUpper()) != 0)
            {
                return(false);
            }

            return(true);
        }
Esempio n. 2
0
        public int ipSchema(Int64 dam_hdbc, Int64 pMemTree, int iType, Int64 pList, object pSearchObj)
        {
            ndam.trace(m_tmHandle, ipc.UL_TM_F_TRACE, "ipSchema called\n");
            switch (iType)
            {
            case ipc.DAMOBJ_TYPE_CATALOG:
            {
                schemaobj_table TableObj = new schemaobj_table(OA_CATALOG_NAME, null, null, null, null, null, null, null);

                ndam.dam_add_schemaobj(pMemTree, iType, pList, pSearchObj, TableObj);
            }
            break;

            case ipc.DAMOBJ_TYPE_SCHEMA:
            {
                schemaobj_table TableObj = new schemaobj_table();

                TableObj.SetObjInfo(null, "SYSTEM", null, null, null, null, null, null);
                ndam.dam_add_schemaobj(pMemTree, iType, pList, pSearchObj, TableObj);

                TableObj.SetObjInfo(null, OA_USER_NAME, null, null, null, null, null, null);
                ndam.dam_add_schemaobj(pMemTree, iType, pList, pSearchObj, TableObj);
            }
            break;

            case ipc.DAMOBJ_TYPE_TABLETYPE:
            {
                schemaobj_table TableObj = new schemaobj_table();

                TableObj.SetObjInfo(null, null, null, "SYSTEM TABLE", null, null, null, null);
                ndam.dam_add_schemaobj(pMemTree, iType, pList, pSearchObj, TableObj);

                TableObj.SetObjInfo(null, null, null, "TABLE", null, null, null, null);
                ndam.dam_add_schemaobj(pMemTree, iType, pList, pSearchObj, TableObj);

                TableObj.SetObjInfo(null, null, null, "VIEW", null, null, null, null);
                ndam.dam_add_schemaobj(pMemTree, iType, pList, pSearchObj, TableObj);
            }

            break;

            case ipc.DAMOBJ_TYPE_TABLE:
            {
                schemaobj_table pSearchTableObj = (schemaobj_table)pSearchObj;

                if (pSearchTableObj != null)
                {
                    ndam.trace(m_tmHandle, ipc.UL_TM_MAJOR_EV, "Dynamic Schema  of table:<" + pSearchTableObj.getTableQualifier() + "." + pSearchTableObj.getTableOwner() + "." + pSearchTableObj.getTableName() + "> is being requested\n");
                }
                else
                {
                    ndam.trace(m_tmHandle, ipc.UL_TM_MAJOR_EV, "Dynamic Schema for all tables is being requested\n");
                }

                //add new table to openaccess
                if (IsMatchingTable(pSearchTableObj, OA_CATALOG_NAME, OA_USER_NAME, "TIMESERIES"))
                {
                    schemaobj_table TableObj = new schemaobj_table();
                    TableObj.SetObjInfo(OA_CATALOG_NAME, OA_USER_NAME, "TIMESERIES", "TABLE", null, null, null, "Timeseries Table");
                    ndam.dam_add_schemaobj(pMemTree, iType, pList, pSearchObj, TableObj);
                }
            }
            break;

            case ipc.DAMOBJ_TYPE_COLUMN:
            {
                schemaobj_column pSearchColumnObj = (schemaobj_column)pSearchObj;

                if (pSearchColumnObj != null)
                {
                    ndam.trace(m_tmHandle, ipc.UL_TM_MAJOR_EV, "Dynamic Schema for column <" + pSearchColumnObj.getColumnName() + "> of table:<" + pSearchColumnObj.getTableQualifier() + "." + pSearchColumnObj.getTableOwner() + "." + pSearchColumnObj.getTableName() + "> is being requested\n");
                }
                else
                {
                    ndam.trace(m_tmHandle, ipc.UL_TM_MAJOR_EV, "Dynamic Schema for all columns of all tables is being requested\n");
                }

                //add columns to the table TIMESERIES
                if (IsMatchingColumn(pSearchColumnObj, OA_CATALOG_NAME, OA_USER_NAME, "TIMESERIES"))
                {
                    schemaobj_column columnObj = new schemaobj_column();

                    ColumnInfo columnInfo = ipConstants.defaultColumnTypeInfo["VARCHAR"];
                    columnObj.SetObjInfo(OA_CATALOG_NAME, OA_USER_NAME, "TIMESERIES", "Information", columnInfo.uDataType, columnInfo.sTypeName, columnInfo.lCharMaxLength, columnInfo.lNumericPrecision, columnInfo.uNumericPrecisionRadix, columnInfo.uNumericScale, columnInfo.uNullable, columnInfo.uScope, columnInfo.sUserData, columnInfo.sOperatorSupport, columnInfo.uPseudoColumn, columnInfo.uColumnType, columnInfo.sRemarks);
                    ndam.dam_add_schemaobj(pMemTree, iType, pList, pSearchObj, columnObj);

                    columnInfo = ipConstants.defaultColumnTypeInfo["VARCHAR"];
                    columnObj.SetObjInfo(OA_CATALOG_NAME, OA_USER_NAME, "TIMESERIES", "Function", columnInfo.uDataType, columnInfo.sTypeName, columnInfo.lCharMaxLength, columnInfo.lNumericPrecision, columnInfo.uNumericPrecisionRadix, columnInfo.uNumericScale, columnInfo.uNullable, columnInfo.uScope, columnInfo.sUserData, columnInfo.sOperatorSupport, columnInfo.uPseudoColumn, columnInfo.uColumnType, columnInfo.sRemarks);
                    ndam.dam_add_schemaobj(pMemTree, iType, pList, pSearchObj, columnObj);

                    columnInfo = ipConstants.defaultColumnTypeInfo["VARCHAR"];
                    columnObj.SetObjInfo(OA_CATALOG_NAME, OA_USER_NAME, "TIMESERIES", "Symbol", columnInfo.uDataType, columnInfo.sTypeName, columnInfo.lCharMaxLength, columnInfo.lNumericPrecision, columnInfo.uNumericPrecisionRadix, columnInfo.uNumericScale, columnInfo.uNullable, columnInfo.uScope, columnInfo.sUserData, columnInfo.sOperatorSupport, columnInfo.uPseudoColumn, columnInfo.uColumnType, columnInfo.sRemarks);
                    ndam.dam_add_schemaobj(pMemTree, iType, pList, pSearchObj, columnObj);

                    columnInfo = ipConstants.defaultColumnTypeInfo["VARCHAR"];
                    columnObj.SetObjInfo(OA_CATALOG_NAME, OA_USER_NAME, "TIMESERIES", "LastRefreshed", columnInfo.uDataType, columnInfo.sTypeName, columnInfo.lCharMaxLength, columnInfo.lNumericPrecision, columnInfo.uNumericPrecisionRadix, columnInfo.uNumericScale, columnInfo.uNullable, columnInfo.uScope, columnInfo.sUserData, columnInfo.sOperatorSupport, columnInfo.uPseudoColumn, columnInfo.uColumnType, columnInfo.sRemarks);
                    ndam.dam_add_schemaobj(pMemTree, iType, pList, pSearchObj, columnObj);

                    columnInfo = ipConstants.defaultColumnTypeInfo["VARCHAR"];
                    columnObj.SetObjInfo(OA_CATALOG_NAME, OA_USER_NAME, "TIMESERIES", "Interval", columnInfo.uDataType, columnInfo.sTypeName, columnInfo.lCharMaxLength, columnInfo.lNumericPrecision, columnInfo.uNumericPrecisionRadix, columnInfo.uNumericScale, columnInfo.uNullable, columnInfo.uScope, columnInfo.sUserData, columnInfo.sOperatorSupport, columnInfo.uPseudoColumn, columnInfo.uColumnType, columnInfo.sRemarks);
                    ndam.dam_add_schemaobj(pMemTree, iType, pList, pSearchObj, columnObj);

                    columnInfo = ipConstants.defaultColumnTypeInfo["VARCHAR"];
                    columnObj.SetObjInfo(OA_CATALOG_NAME, OA_USER_NAME, "TIMESERIES", "OutputSize", columnInfo.uDataType, columnInfo.sTypeName, columnInfo.lCharMaxLength, columnInfo.lNumericPrecision, columnInfo.uNumericPrecisionRadix, columnInfo.uNumericScale, columnInfo.uNullable, columnInfo.uScope, columnInfo.sUserData, columnInfo.sOperatorSupport, columnInfo.uPseudoColumn, columnInfo.uColumnType, columnInfo.sRemarks);
                    ndam.dam_add_schemaobj(pMemTree, iType, pList, pSearchObj, columnObj);

                    columnInfo = ipConstants.defaultColumnTypeInfo["VARCHAR"];
                    columnObj.SetObjInfo(OA_CATALOG_NAME, OA_USER_NAME, "TIMESERIES", "TimeZone", columnInfo.uDataType, columnInfo.sTypeName, columnInfo.lCharMaxLength, columnInfo.lNumericPrecision, columnInfo.uNumericPrecisionRadix, columnInfo.uNumericScale, columnInfo.uNullable, columnInfo.uScope, columnInfo.sUserData, columnInfo.sOperatorSupport, columnInfo.uPseudoColumn, columnInfo.uColumnType, columnInfo.sRemarks);
                    ndam.dam_add_schemaobj(pMemTree, iType, pList, pSearchObj, columnObj);

                    columnInfo = ipConstants.defaultColumnTypeInfo["TIMESTAMP"];
                    columnObj.SetObjInfo(OA_CATALOG_NAME, OA_USER_NAME, "TIMESERIES", "Timestamp_Recorded", columnInfo.uDataType, columnInfo.sTypeName, columnInfo.lCharMaxLength, columnInfo.lNumericPrecision, columnInfo.uNumericPrecisionRadix, columnInfo.uNumericScale, columnInfo.uNullable, columnInfo.uScope, columnInfo.sUserData, columnInfo.sOperatorSupport, columnInfo.uPseudoColumn, columnInfo.uColumnType, columnInfo.sRemarks);
                    ndam.dam_add_schemaobj(pMemTree, iType, pList, pSearchObj, columnObj);

                    columnInfo = ipConstants.defaultColumnTypeInfo["DOUBLE"];
                    columnObj.SetObjInfo(OA_CATALOG_NAME, OA_USER_NAME, "TIMESERIES", "Open", columnInfo.uDataType, columnInfo.sTypeName, columnInfo.lCharMaxLength, columnInfo.lNumericPrecision, columnInfo.uNumericPrecisionRadix, columnInfo.uNumericScale, columnInfo.uNullable, columnInfo.uScope, columnInfo.sUserData, columnInfo.sOperatorSupport, columnInfo.uPseudoColumn, columnInfo.uColumnType, columnInfo.sRemarks);
                    ndam.dam_add_schemaobj(pMemTree, iType, pList, pSearchObj, columnObj);

                    columnInfo = ipConstants.defaultColumnTypeInfo["DOUBLE"];
                    columnObj.SetObjInfo(OA_CATALOG_NAME, OA_USER_NAME, "TIMESERIES", "High", columnInfo.uDataType, columnInfo.sTypeName, columnInfo.lCharMaxLength, columnInfo.lNumericPrecision, columnInfo.uNumericPrecisionRadix, columnInfo.uNumericScale, columnInfo.uNullable, columnInfo.uScope, columnInfo.sUserData, columnInfo.sOperatorSupport, columnInfo.uPseudoColumn, columnInfo.uColumnType, columnInfo.sRemarks);
                    ndam.dam_add_schemaobj(pMemTree, iType, pList, pSearchObj, columnObj);

                    columnInfo = ipConstants.defaultColumnTypeInfo["DOUBLE"];
                    columnObj.SetObjInfo(OA_CATALOG_NAME, OA_USER_NAME, "TIMESERIES", "Low", columnInfo.uDataType, columnInfo.sTypeName, columnInfo.lCharMaxLength, columnInfo.lNumericPrecision, columnInfo.uNumericPrecisionRadix, columnInfo.uNumericScale, columnInfo.uNullable, columnInfo.uScope, columnInfo.sUserData, columnInfo.sOperatorSupport, columnInfo.uPseudoColumn, columnInfo.uColumnType, columnInfo.sRemarks);
                    ndam.dam_add_schemaobj(pMemTree, iType, pList, pSearchObj, columnObj);

                    columnInfo = ipConstants.defaultColumnTypeInfo["DOUBLE"];
                    columnObj.SetObjInfo(OA_CATALOG_NAME, OA_USER_NAME, "TIMESERIES", "Close", columnInfo.uDataType, columnInfo.sTypeName, columnInfo.lCharMaxLength, columnInfo.lNumericPrecision, columnInfo.uNumericPrecisionRadix, columnInfo.uNumericScale, columnInfo.uNullable, columnInfo.uScope, columnInfo.sUserData, columnInfo.sOperatorSupport, columnInfo.uPseudoColumn, columnInfo.uColumnType, columnInfo.sRemarks);
                    ndam.dam_add_schemaobj(pMemTree, iType, pList, pSearchObj, columnObj);

                    columnInfo = ipConstants.defaultColumnTypeInfo["NUMERIC"];
                    columnObj.SetObjInfo(OA_CATALOG_NAME, OA_USER_NAME, "TIMESERIES", "Volume", columnInfo.uDataType, columnInfo.sTypeName, columnInfo.lCharMaxLength, columnInfo.lNumericPrecision, columnInfo.uNumericPrecisionRadix, columnInfo.uNumericScale, columnInfo.uNullable, columnInfo.uScope, columnInfo.sUserData, columnInfo.sOperatorSupport, columnInfo.uPseudoColumn, columnInfo.uColumnType, columnInfo.sRemarks);
                    ndam.dam_add_schemaobj(pMemTree, iType, pList, pSearchObj, columnObj);
                }
            }
            break;

            case ipc.DAMOBJ_TYPE_STAT:
                break;

            case ipc.DAMOBJ_TYPE_FKEY:
                break;

            case ipc.DAMOBJ_TYPE_PKEY:
                break;

            case ipc.DAMOBJ_TYPE_PROC:
                break;

            case ipc.DAMOBJ_TYPE_PROC_COLUMN:
                break;

            default:
                break;
            }
            return(ipc.IP_SUCCESS);
        }