tinyblob로 저장된 값을 bit wise하기

따스한이야기의 이미지

MySQL상에서 버젼은 4.1.13버젼을 사용합니다.

create table aaa( abc tinyblob );
로 table를 생성하였고 그 안에
insert into aaa value( 'I am a boy' );
로 값을 집어넣었습니다.

그런데 여기서 제가 bit wise연산을 하려고하는데
결과값이 나오질 안네요
select 쿼리는 아래와 같은 방식으로 했습니다.

select * from aaa where abc & 'I am a boy';
select * from aaa where abc & 1;
이렇게 두가지 방식을 넣었는데 결과갑이 아무것도 안떠요 ㅜㅜ

select * from aaa where abc | 1
바로 위에 처럼하면 결과가 나오는데 '|'을 '&'로 하면 전혀 값들이 안나옵니다. ㅜㅜ
그리고 tinyblob가 문제라고 생각되어서 tinyblob를 char(100)으로 바꿔서 해보았으나
결과는 마찬가지였습니다.

어떻게 해야하는지 아시는분은 가려쳐주세요

송효진의 이미지

blob 은 text 필드에 바이너리를 못넣기 때문에 (혹은 로케일변환에 영향을 안받도록) 있는 자료형입니다.

실험해 보니 int 형에 비트연산이 가능했습니다.

http://dev.mysql.com/doc/refman/4.1/en/data-types.html

emerge money

따스한이야기의 이미지

int형에서는 된다는것은 알고 있으나 char형이나 blob, text타입에서는

되는지 의문입니다.

이것저것 다 해보았으나 실행이 되지를 않아서 다시 질문드립니다.

혹시 다른방법은 없는건가요...

생성된 칼럼을 변화를 int형으로 변환시키지않고 char, blob, text타입으로는

불가능한건가요??

송효진의 이미지

목적이 무엇인지 모르겠지만, 문자열 형은 이미 배열같은 구조기 때문에,
비트연산을 하기가 곤란해 보입니다.
http://dev.mysql.com/doc/refman/4.1/en/bit-functions.html
보시다 시피 비트연산은 unsigned 64bit 가 한계입니다.

bit 를 define 해서 쓰는 SET 이라는 자료형도 있습니다.(이것도 64bit 네요.)

emerge money

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.