예제 #1
0
        public void Connect()
        {
            Yaz.ZOOM_connection_connect(ZConnection, _host, _port);
            var errorCode = Yaz.ZOOM_connection_errcode(ZConnection);

            CheckErrorCodeAndThrow(errorCode);
            _connected = true;
        }
예제 #2
0
        public Connection(string host, int port)
        {
            _host = host;
            _port = port;

            _options = new ConnectionOptionsCollection();
            _options["mediumSetElementSetName"] = "F";
            ZConnection = Yaz.ZOOM_connection_create(_options.ZoomOptions);
            Yaz.ZOOM_connection_option_setl(ZConnection, "mediumSetElementSetName", "F", 1);

            var errorCode = Yaz.ZOOM_connection_errcode(ZConnection);

            CheckErrorCodeAndThrow(errorCode);
        }
예제 #3
0
        public ScanSet Scan(IQuery query)
        {
            EnsureConnected();
            var yazScanSet = Yaz.ZOOM_connection_scan(ZConnection, query.QueryString);

            var errorCode = Yaz.ZOOM_connection_errcode(ZConnection);

            if (errorCode != Yaz.ZoomErrorNone)
            {
                Yaz.ZOOM_scanset_destroy(yazScanSet);
            }
            CheckErrorCodeAndThrow(errorCode);

            var scanSet = new ScanSet(yazScanSet, this);

            return(scanSet);
        }
예제 #4
0
        public ResultSet Search(IQuery query)
        {
            EnsureConnected();
            var       yazQuery = Yaz.ZOOM_query_create();
            ResultSet resultSet;

            try
            {
                // branching out to right YAZ-C call
                if (query is CQLQuery)
                {
                    Yaz.ZOOM_query_cql(yazQuery, query.QueryString);
                }
                else if (query is PrefixQuery)
                {
                    Yaz.ZOOM_query_prefix(yazQuery, query.QueryString);
                }
                else
                {
                    throw new NotImplementedException();
                }
                var yazResultSet = Yaz.ZOOM_connection_search(ZConnection, yazQuery);
                Yaz.ZOOM_resultset_option_set(yazResultSet, "elementSetName", "F");
                // error checking C-style
                var errorCode = Yaz.ZOOM_connection_errcode(ZConnection);

                if (errorCode != Yaz.ZoomErrorNone)
                {
                    Yaz.ZOOM_resultset_destroy(yazResultSet);
                }

                CheckErrorCodeAndThrow(errorCode);
                resultSet = new ResultSet(yazResultSet, this);
            }
            finally
            {
                Yaz.ZOOM_query_destroy(yazQuery);
            }
            return(resultSet);
        }