コード例 #1
0
            private bool DoMeta(ushort id, string s0, string s1, string s2, DExecuteResult handler, DRows row, DRowsetHeader rh, DDiscarded discarded)
            {
                ulong index = GetCallIndex();

                //don't make m_csDB locked across calling SendRequest, which may lead to client dead-lock
                //in case a client asynchronously sends lots of requests without use of client side queue.
                lock (m_csDB) {
                    m_mapRowset[index] = new KeyValuePair <DRowsetHeader, DRows>(rh, row);
                }
                if (!SendRequest(id, s0, s1, s2, index, (ar) => {
                    ProcessODBC(handler, ar, id, index);
                }, discarded, null))
                {
                    lock (m_csDB) {
                        m_mapRowset.Remove(index);
                    }
                    return(false);
                }
                return(true);
            }
コード例 #2
0
            private void ProcessODBC(DExecuteResult handler, CAsyncResult ar, ushort reqId, ulong index)
            {
                ulong  fail_ok;
                int    res;
                string errMsg;

                ar.Load(out res).Load(out errMsg).Load(out fail_ok);
                COdbc odbc = (COdbc)ar.AsyncServiceHandler;

                lock (odbc.m_csDB) {
                    odbc.m_lastReqId = reqId;
                    odbc.m_affected  = 0;
                    odbc.m_dbErrCode = res;
                    odbc.m_dbErrMsg  = errMsg;
                    odbc.m_mapRowset.Remove(index);
                }
                if (handler != null)
                {
                    handler(odbc, res, errMsg, 0, fail_ok, null);
                }
            }
コード例 #3
0
ファイル: odbc.cs プロジェクト: qingchen1984/socketpro
            private bool DoMeta(ushort id, string s0, string s1, string s2, DExecuteResult handler, DRows row, DRowsetHeader rh)
            {
                ulong index;

                //don't make m_csDB locked across calling SendRequest, which may lead to client dead-lock
                //in case a client asynchronously sends lots of requests without use of client side queue.
                lock (m_csDB)
                {
                    index = ++m_nCall;
                    m_mapRowset[m_nCall] = new KeyValuePair <DRowsetHeader, DRows>(rh, row);
                }
                if (!SendRequest(id, s0, s1, s2, index, (ar) =>
                {
                    ulong fail_ok;
                    int res;
                    string errMsg;
                    ar.Load(out res).Load(out errMsg).Load(out fail_ok);
                    lock (m_csDB)
                    {
                        m_lastReqId = id;
                        m_affected = 0;
                        m_dbErrCode = res;
                        m_dbErrMsg = errMsg;
                        m_mapRowset.Remove(m_indexRowset);
                    }
                    if (handler != null)
                    {
                        handler(this, res, errMsg, 0, fail_ok, null);
                    }
                }))
                {
                    lock (m_csDB)
                    {
                        m_mapRowset.Remove(index);
                    }
                    return(false);
                }
                return(true);
            }
コード例 #4
0
 public bool PrimaryKeys(string CatalogName, string SchemaName, string TableName, DExecuteResult handler, DRows row, DRowsetHeader rh, DDiscarded discarded)
 {
     return(DoMeta(idSQLPrimaryKeys, CatalogName, SchemaName, TableName, handler, row, rh, discarded));
 }
コード例 #5
0
 public bool ProcedureColumns(string CatalogName, string SchemaName, string ProcName, string ColumnName, DExecuteResult handler, DRows row, DRowsetHeader rh, DDiscarded discarded)
 {
     return(DoMeta(idSQLProcedureColumns, CatalogName, SchemaName, ProcName, ColumnName, handler, row, rh, discarded));
 }
コード例 #6
0
 public bool Columns(string CatalogName, string SchemaName, string TableName, string ColumnName, DExecuteResult handler, DRows row, DRowsetHeader rh)
 {
     return(DoMeta(idSQLColumns, CatalogName, SchemaName, TableName, ColumnName, handler, row, rh, null));
 }
コード例 #7
0
 public bool ColumnPrivileges(string CatalogName, string SchemaName, string TableName, string ColumnName, DExecuteResult handler, DRows row, DRowsetHeader rh, DDiscarded discarded)
 {
     return(DoMeta(idSQLColumnPrivileges, CatalogName, SchemaName, TableName, ColumnName, handler, row, rh, discarded));
 }
コード例 #8
0
 public bool ForeignKeys(string PKCatalogName, string PKSchemaName, string PKTableName, string FKCatalogName, string FKSchemaName, string FKTableName, DExecuteResult handler, DRows row, DRowsetHeader rh, DDiscarded discarded)
 {
     return(DoMeta(idSQLForeignKeys, PKCatalogName, PKSchemaName, PKTableName, FKCatalogName, FKSchemaName, FKTableName, handler, row, rh, discarded));
 }
コード例 #9
0
            public bool Statistics(string CatalogName, string SchemaName, string TableName, ushort unique, ushort reserved, DExecuteResult handler, DRows row, DRowsetHeader rh, DDiscarded discarded)
            {
                ulong index = GetCallIndex();

                //don't make m_csDB locked across calling SendRequest, which may lead to client dead-lock
                //in case a client asynchronously sends lots of requests without use of client side queue.
                lock (m_csDB) {
                    m_mapRowset[index] = new KeyValuePair <DRowsetHeader, DRows>(rh, row);
                }
                if (!SendRequest(idSQLStatistics, CatalogName, SchemaName, TableName, unique, reserved, index, (ar) => {
                    ProcessODBC(handler, ar, idSQLStatistics, index);
                }, discarded, null))
                {
                    lock (m_csDB) {
                        m_mapRowset.Remove(index);
                    }
                    return(false);
                }
                return(true);
            }
コード例 #10
0
 public bool Statistics(string CatalogName, string SchemaName, string TableName, ushort unique, ushort reserved, DExecuteResult handler, DRows row, DRowsetHeader rh)
 {
     return(Statistics(CatalogName, SchemaName, TableName, unique, reserved, handler, row, rh, null));
 }
コード例 #11
0
 public bool SpecialColumns(short identifierType, string CatalogName, string SchemaName, string TableName, short scope, short nullable, DExecuteResult handler, DRows row, DRowsetHeader rh, DDiscarded discarded)
 {
     return(DoMeta(idSQLSpecialColumns, identifierType, CatalogName, SchemaName, TableName, scope, nullable, handler, row, rh, discarded));
 }
コード例 #12
0
 public bool Procedures(string CatalogName, string SchemaName, string ProcName, DExecuteResult handler, DRows row, DRowsetHeader rh)
 {
     return(DoMeta(idSQLProcedures, CatalogName, SchemaName, ProcName, handler, row, rh, null));
 }
コード例 #13
0
 public bool TablePrivileges(string CatalogName, string SchemaName, string TableName, DExecuteResult handler, DRows row, DRowsetHeader rh)
 {
     return(DoMeta(idSQLTablePrivileges, CatalogName, SchemaName, TableName, handler, row, rh, null));
 }
コード例 #14
0
ファイル: odbc.cs プロジェクト: skyformat99/socketpro
            public bool Statistics(string CatalogName, string SchemaName, string TableName, ushort unique, ushort reserved, DExecuteResult handler, DRows row, DRowsetHeader rh, DDiscarded discarded)
            {
                ulong index = GetCallIndex();

                //don't make m_csDB locked across calling SendRequest, which may lead to client dead-lock
                //in case a client asynchronously sends lots of requests without use of client side queue.
                lock (m_csDB)
                {
                    m_mapRowset[index] = new KeyValuePair <DRowsetHeader, DRows>(rh, row);
                }
                if (!SendRequest(idSQLStatistics, CatalogName, SchemaName, TableName, unique, reserved, index, (ar) =>
                {
                    ulong fail_ok;
                    int res;
                    string errMsg;
                    ar.Load(out res).Load(out errMsg).Load(out fail_ok);
                    lock (m_csDB)
                    {
                        m_lastReqId = idSQLStatistics;
                        m_affected = 0;
                        m_dbErrCode = res;
                        m_dbErrMsg = errMsg;
                        m_mapRowset.Remove(index);
                    }
                    if (handler != null)
                    {
                        handler(this, res, errMsg, 0, fail_ok, null);
                    }
                }, discarded, null))
                {
                    lock (m_csDB)
                    {
                        m_mapRowset.Remove(index);
                    }
                    return(false);
                }
                return(true);
            }
コード例 #15
0
ファイル: odbc.cs プロジェクト: qingchen1984/socketpro
 public virtual bool PrimaryKeys(string CatalogName, string SchemaName, string TableName, DExecuteResult handler, DRows row, DRowsetHeader rh)
 {
     return(DoMeta(idSQLPrimaryKeys, CatalogName, SchemaName, TableName, handler, row, rh));
 }