check to see if the guard SQL returns a single column containing 0 or 1
        We return true if 1, else False
329878
def proc_check_guard(self, instance, sql):
        
        self.open_db_connections(instance, self.PROC_GUARD_DB_KEY)
        cursor = self.get_cursor(instance, self.PROC_GUARD_DB_KEY)

        should_run = False
        try:
            cursor.execute(sql, ())
            result = cursor.fetchone()
            should_run = result[0] == 1
        except Exception as e:
            self.log.error("Failed to run proc_only_if sql {} : {}".format(sql, e))

        self.close_cursor(cursor)
        self.close_db_connections(instance, self.PROC_GUARD_DB_KEY)
        return should_run
485851
public static boolean isComment(String sql)
    {
        Matcher commentMatcher = PAT_SINGLE_LINE_COMMENT.matcher(sql);
        return commentMatcher.matches();
    }
981735
def contains(bank, key):
    '''
    
    '''
    _init_client()
    query = "SELECT COUNT(data) FROM {0} WHERE bank='{1}' " \
        "AND etcd_key='{2}'".format(_table_name, bank, key)
    cur, _ = run_query(client, query)
    r = cur.fetchone()
    cur.close()
    return r[0] == 1
1256146
def column_exists(cr, table, column):
    
    cr.execute(
        'SELECT count(attname) FROM pg_attribute '
        'WHERE attrelid = '
        '( SELECT oid FROM pg_class WHERE relname = %s ) '
        'AND attname = %s',
        (table, column))
    return cr.fetchone()[0] == 1
135951
def check_is_column(func):
    
    @wraps(func)
    def wrapper(**kwargs):
        table_name = kwargs['table_name']
        col_name = kwargs['col_name']
        if not orca.is_table(table_name):
            abort(404)
        if col_name not in orca.get_table(table_name).columns:
            abort(404)

        return func(**kwargs)
    return wrapper
265734
@SuppressFBWarnings("NP_BOOLEAN_RETURN_NULL")
    public static Boolean getBoolean(final ResultSet rs, final int columnIndex) throws SQLException
    {
        final boolean res = rs.getBoolean(columnIndex);
        if (rs.wasNull()) {
            return null;
        } else {
            return res;
        }
    }
698843
function _query($sql,$inputarr=false)
	{
		$rez = sqlite_query($sql,$this->_connectionID);
		if (!$rez) {
			$this->_errorNo = sqlite_last_error($this->_connectionID);
		}
		// If no data was returned, we don't need to create a real recordset
		// Note: this code is untested, as I don't have a sqlite2 setup available
		elseif (sqlite_num_fields($rez) == 0) {
			$rez = true;
		}

		return $rez;
	}
1263006
def _check_one_size(self):
        '''
        
        '''
        block_one = self.end[0] == self.start[0]+1 or self.end[1] == self.start[1]+1
        if block_one:
            self.flag_change(self.flags, 'error', self.start, self.worksheet,
                             message=self.FLAGS['1-size'])
        return block_one
1213899
private function checkRecordExists($table, $column, $value) {
		
		if (!$value) {
			return FALSE;
		}
		
		// build the query
		$query = 'SELECT COUNT(1) FROM `' . $table . '` WHERE ' . $column . ' = ?';
		
		// search the record into the db
		return (bool)Database::load($query, (array) $value, 'count');
		
	}
1056766
function(table, result) {
            if (result && result.rows && result.rows.length > 0)
                return result.rows[0][table.id];
            return -1;
        }
134943
protected boolean isInCondition(String sql){
		Connection conn = null;
		Statement stmt = null;
		ResultSet rs = null;
		try{
			conn = dataSource.getConnection();
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql);
			rs.next();
			long result = rs.getInt(1);
			log.debug("Result from the condition checking SQL is " + result + " : " + sql);
			return result > 0;
		} catch (SQLException sqle) {
			throw new RuntimeException("Unable to check condition (" + sqle.getMessage() + ") for: " + sql, sqle);
		}finally{
			ConnectionUtility.closeConnection(conn, stmt, rs);
		}
	}
314170
function _query($sql,$inputarr=false)
		{
            // <G. Giunta 2003/03/03/> Reset error messages before executing
            $this->_errorMsg = false;
		    $this->_errorCode = false;

			$curs = ora_open($this->_connectionID);

		 	if ($curs === false) return false;
			$this->_curs = $curs;
			if (!ora_parse($curs,$sql)) return false;
			if (ora_exec($curs)) return $curs;
            // <G. Giunta 2004/03/03> before we close the cursor, we have to store the error message
            // that we can obtain ONLY from the cursor (and not from the connection)
            $this->_errorCode = @ora_errorcode($curs);
            $this->_errorMsg = @ora_error($curs);
            // </G. Giunta 2004/03/03>
		 	@ora_close($curs);
			return false;
		}
178889
public boolean getBoolean(String columnName, boolean defaultValue) {
        int defaultValueAsInt = (defaultValue) ? SQLITE_TRUE : SQLITE_FALSE;

        return getInteger(columnName, defaultValueAsInt) == SQLITE_TRUE;
    }
431995
function Compare(left, right, columns, order)
{
	//Compare all
	for(var i = 0; i < columns.length; i++)
	{
		//Check if que difference is numeric
		var numeric = !isNaN(+left[columns[i]] - +right[columns[i]]);

		//Get the values
		var a = (numeric === true) ? +left[columns[i]] : left[columns[i]].toLowerCase();
		var b = (numeric === true) ? +right[columns[i]] : right[columns[i]].toLowerCase();

		//Check the values
		if(a < b)
		{
			//Check the order
			return (order[i] === 'ASC') ? -1 : 1;
		}
		else if(a > b)
		{
			//Check the order
			return (order[i] === 'ASC') ? 1 : -1;
		}
	}

	//Default, return 0
	return 0;
}
892327
public function check()
    {
        $pdoResult = extension_loaded('PDO');
        $pdoMySqlResult = extension_loaded('pdo_mysql');

        $result = ($pdoResult === true && $pdoMySqlResult === true);

        if ($pdoResult === true) {
            $this->pdoVersion = phpversion('PDO');
        }

        if ($pdoMySqlResult === true) {
            $this->pdoMySqlVersion = phpversion('pdo_mysql');
        }

        return $result;
    }
1277800
public function column_check( $id = false, $column = false )
	{
		$sql = "SELECT COLUMN_CHECK($column) FROM `{$this->table}` WHERE id = :id";
		$params = [ ':id' => $id ];

		return $this->select_one( $sql, $params );
	}
637852
def isIn(row, col_name, arg, dm, df, con=None):
    
    #grade = df.apply(func, args=(validation_name, arg, dm), axis=1)
    cell_value = row[col_name]
    cell_value = str(cell_value)
    if not cell_value:
        return None
    elif cell_value == 'None':
        return None
    elif cell_value == 'nan':
        return None
    elif not con:
        return None
    # if it's in another table
    cell_values = [v.strip(" ") for v in cell_value.split(":")]
    if "." in arg:
        table_name, table_col_name = arg.split(".")
        if table_name not in con.tables:
            return None
            #return "Must contain a value from {} table. Missing {} table.".format(table_name, table_name)
        if table_col_name not in con.tables[table_name].df.columns:
            return '{} table is missing "{}" column, which is required for validating "{}" column'.format(table_name, table_col_name, col_name)
        possible_values = con.tables[table_name].df[table_col_name].unique()
        for value in cell_values:
            if value not in possible_values:
                trunc_possible_values = [val.replace(' ', '') for val in possible_values if val]
                trunc_cell_value = cell_value.replace(' ', '')
                if trunc_cell_value not in trunc_possible_values:
                    if trunc_cell_value != value:
                        return 'This value (long): "{}" is not found in: {} column in {} table.  Also (short): {} is not in {}'.format(value, table_col_name, table_name, trunc_cell_value, arg)
                    else:
                        return 'This value: "{}" is not found in: {} column in {} table'.format(value, table_col_name, table_name)
                    break
    # if it's in the present table:
    else:
        possible_values = df[arg].unique()
        for value in cell_values:
            if value not in possible_values:
                return 'This value: "{}" is not found in: {} column'.format(value, arg)
                break
    return None