AKB Forums

Go Back   AKB Forums > Technical sections > Languages, Compilers and Interpreters > Web Development
Home Register Blogs FAQ Members List Calendar Downloads Arcade Mark Forums Read

Web Development Java/PHP/Perl/ASP and more

Troubles when posting message? Click here! :: Проблемы с отправлением сообщения? Нажмите сюда!

Reply
 
LinkBack Thread Tools Display Modes
Old Mar 25, 2003, 19:02   #1
Administrator
 
acid's Avatar
 
Join Date: Sep 2001
Location: Yerevan, Armenia
Posts: 7,155
Blog Entries: 15
Rep Power: 10
Reputation: 293
File -> BLOB using PHP

1. Как в PHP корректно загнать бинарный файл в столбик типа BLOB?

2. Можно ли бинарный файл загнать в тип TEXT ?

Спасибо.
__________________
Chat with acid


acid is offline   Reply With Quote Quote selected
Old Mar 26, 2003, 09:18   #2
Moderator
 
Join Date: Mar 2002
Location: Ukraine
Posts: 123
Rep Power: 7
Reputation: 10
1. Обыкновенно. Сначала надо прочитать содержимое файла в переменную, затем использовать ее в sql запросе.

2. Скорее всего да. BLOB и TEXT отличаются лишь регистро-зависимостью/-независимостью (я так думаю )
Правда при работе через odbc поля типа TEXT преабразуются в тип LONGVARCHAR.
А зачем такой изврат?
__________________
Життя - це не тільки будні © Nemiroff
hayk is offline   Reply With Quote Quote selected
Old Mar 26, 2003, 09:36   #3
Administrator
 
acid's Avatar
 
Join Date: Sep 2001
Location: Yerevan, Armenia
Posts: 7,155
Blog Entries: 15
Rep Power: 10
Reputation: 293
1. просто когда я листал mysql, не нашел как к примеру с командной строки mysql> добавить бинарную информацию в базу. Неужели без PHP или других вспомогательных интерфейсов этого делать не возможно

2. Насчет ТЕХТ-а я просто однажды увидел вот это в исходниках форума:

PHP Code:
$query[]="CREATE TABLE attachment (
   attachmentid smallint(5) unsigned DEFAULT '0' NOT NULL auto_increment,
   userid int(10) unsigned DEFAULT '0' NOT NULL,
   dateline int(10) unsigned DEFAULT '0' NOT NULL,
   filename varchar(100) NOT NULL,
   [b]filedata mediumtext NOT NULL,[/b]
   visible smallint(5) unsigned DEFAULT '0' NOT NULL,
   counter smallint(5) unsigned DEFAULT '0' NOT NULL,
   PRIMARY KEY (attachmentid)
)"

__________________
Chat with acid


acid is offline   Reply With Quote Quote selected
Old Mar 26, 2003, 09:52   #4
Moderator
 
Join Date: Mar 2002
Location: Ukraine
Posts: 123
Rep Power: 7
Reputation: 10
1. Может конечно это и возможно, но я этим никогда не интересовался.

2. Я как-то встречал скрипт типа
Code:
create table
....
ID varchar(6) NOT NULL,
PRIMARY KEY (ID) 
....
но это ведь не значит что это правильно.
__________________
Життя - це не тільки будні © Nemiroff
hayk is offline   Reply With Quote Quote selected
Old Mar 26, 2003, 10:56   #5
Moderator
 
Join Date: Mar 2002
Location: Ukraine
Posts: 123
Rep Power: 7
Reputation: 10
1. Посмотри mysqlimport и LOAD DATA INFILE. Может это оно?
__________________
Життя - це не тільки будні © Nemiroff
hayk is offline   Reply With Quote Quote selected
Old Mar 26, 2003, 13:00   #6
Консервативный Демагог
 
VX's Avatar
 
Join Date: Jan 2002
Location: Кавказская Албания
Posts: 889
Rep Power: 7
Reputation: 10
LIKBEZ

znachit chuvstvitel'nost' mysql k registru zavisit ot konkretnoy realizachii,

когда я листал mysql, не нашел как к примеру с командной строки mysql> добавить бинарную информацию в базу. Неужели без PHP или других вспомогательных интерфейсов этого делать не возможно

mojno, no stroku v 16-ov vide only


1. Как в PHP корректно загнать бинарный файл в столбик типа BLOB?
Google tebe v ruki,
vobsheto ya v svoe vremya napisal class na php dlya etix cheley, no..
__________________
Праздник к нам приходит...

|^^^^^^^^^'''^\| ||\__
| ВОДКА-ВОДКА | ||','''|'''''''\_____,_
| _..... _ | ||_ _|'__|_____||.........| |
'(@)'(@)'(@)''''''''''''''''''''''*|(@)""""|(@)*
VX is offline   Reply With Quote Quote selected
Old Mar 26, 2003, 18:52   #7
Administrator
 
acid's Avatar
 
Join Date: Sep 2001
Location: Yerevan, Armenia
Posts: 7,155
Blog Entries: 15
Rep Power: 10
Reputation: 293
Нашел:

A BLOB is a binary large object that can hold a variable amount of data. The four BLOB types TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB differ only in the maximum length of the values they can hold.

The four TEXT types TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT correspond to the four BLOB types and have the same maximum lengths and storage requirements. The only difference between BLOB and TEXT types is that sorting and comparison is performed in case-sensitive fashion for BLOB values and case-insensitive fashion for TEXT values. In other words, a TEXT is a case-insensitive BLOB.
__________________
Chat with acid


acid is offline   Reply With Quote Quote selected
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 19:11.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
This board was founded on September 29, 2001
Powered by Viper Internet

Affordable Web Hosting | ParevNet

Buy text link