Esempio n. 1
0
        public bool RetrieveValue(string sqlstatement, ref string result)
        {
            short value = ODBCDriver.SQLExecDirect(this.m_StatementHandle, sqlstatement, -3);

            if (!this.IsOK((int)value))
            {
                return(false);
            }
            value = ODBCDriver.SQLFetch(this.m_StatementHandle);
            if (!this.IsOK((int)value))
            {
                ODBCDriver.SQLCloseCursor(this.m_StatementHandle);
                return(false);
            }
            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(1024);
            short num;

            value = ODBCDriver.SQLGetData(this.m_StatementHandle, 1, 1, stringBuilder, 1024, out num);
            if (!this.IsOK((int)value))
            {
                ODBCDriver.SQLCloseCursor(this.m_StatementHandle);
                return(false);
            }
            result = stringBuilder.ToString();
            ODBCDriver.SQLCloseCursor(this.m_StatementHandle);
            return(true);
        }
Esempio n. 2
0
        public bool ColumnExist(string tableName, string columnName)
        {
            short value = ODBCDriver.SQLColumns(this.m_StatementHandle, null, 0, null, 0, tableName, -3, columnName, -3);

            if (this.IsOK((int)value))
            {
                value = ODBCDriver.SQLFetch(this.m_StatementHandle);
                ODBCDriver.SQLCloseCursor(this.m_StatementHandle);
                return(this.IsOK((int)value));
            }
            ODBCDriver.SQLCloseCursor(this.m_StatementHandle);
            return(false);
        }
Esempio n. 3
0
        private bool TableExist(string tableName)
        {
            short value = ODBCDriver.SQLTables(this.m_StatementHandle, null, 0, null, 0, tableName, -3, "TABLE", -3);

            if (this.IsOK((int)value))
            {
                value = ODBCDriver.SQLFetch(this.m_StatementHandle);
                ODBCDriver.SQLCloseCursor(this.m_StatementHandle);
                return(this.IsOK((int)value));
            }
            ODBCDriver.SQLCloseCursor(this.m_StatementHandle);
            return(false);
        }