powered by simpleCommunicator - 2.0.60     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Sybase ASA, ASE, IQ [игнор отключен] [закрыт для гостей] / ASE 12.5, Perl и text
4 сообщений из 4, страница 1 из 1
ASE 12.5, Perl и text
    #34905908
White Owl
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Кто работал с ASE12.5 из Перла через DBD:Sybase?
Застрял на работе с блобом.
Пытаюсь подготовить запрос:
Код: plaintext
1.
2.
3.
4.
$sth = $dbh->prepare(<<SQL);
update mydb.dbo.table_with_text_field
    set text_field=?
    where pk=?
SQL
Получаю отлуп:
ASE 12.5.0.3ct_result(ct_dynamic(CS_PREPARE)) returned -205 at C:/Perl/site/lib/DBD/Sybase.pm line 133.
DBD::Sybase::db prepare failed: Server message number=2782 severity=16 state=1 line=1 server=tst procedure=DBD5 text=An untyped variable in the PREPARE statement 'DBD5' is being resolved to a TEXT or IMAGE type. This is illegal in a dynamic PREPARE statement.
Спрашивается, кто виноват и что делать?

---
http://www.rusug.ru] Портал русскоязычной группы пользователей Sybase
...
Рейтинг: 0 / 0
ASE 12.5, Perl и text
    #34906149
sn1251
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Ничего с этим не поделать
perldoc DBD::Sybase

IMAGE and TEXT datatypes can not be passed as parameters using ?-style placeholders, and placeholders can't refer to IMAGE or TEXT columns (this is a limitation of the TDS protocol used by Sybase, not a DBD::Sybase limitation.)

Можно либо вставить значение литералом в текст запроса, либо работать через спец-API для блобов.
...
Рейтинг: 0 / 0
ASE 12.5, Perl и text
    #34906426
Фотография MasterZiv
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
White Owl пишет:
> Спрашивается, кто виноват и что делать?

Видимо тут проблема в том, что в ханимых процедурах в ASE не разрешается
иметь параметры типа BLOB. Выход, видимо, не использовать Prepared Statements,
а использовать языковые запросы.
Posted via ActualForum NNTP Server 1.4
...
Рейтинг: 0 / 0
ASE 12.5, Perl и text
    #34908473
White Owl
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Даааа... ужжж... Во что превращается простой апдейт блоба когда вынужден использовать Open Client.


Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
sub write_text($$$$) {
	my ($text_field, $table_name, $where_clause, $long_text) = @_;
	my $sth;

	# If you have a NULL value that needs updating you must first update it to some non-NULL value
	# (for example an empty string) using standard SQL before you can retrieve the CS_IODESC entry.
	#          I HATE Sybase Open Client!
	$dbh->do("update $table_name set $text_field='empty' where $where_clause");

	# first we need to find the CS_IODESC data for the data
	## print "select $text_field from $table_name where $where_clause", "\n"; # for debug!
	$sth = $dbh->prepare("select $text_field from $table_name where $where_clause");
	$sth->execute;
	while($sth->fetch) {    # don't care about the data!
		$sth->syb_ct_data_info('CS_GET', 1);
	}

	# OK - we have the CS_IODESC values, so do the update:
	$sth->syb_ct_prepare_send();
	# Set the size of the new data item (that we are inserting), and make
	# the operation unlogged
	$sth->syb_ct_data_info('CS_SET', 1, {total_txtlen => length($long_text), log_on_update => 0});
	# now transfer the data (in a single chunk, this time)
	$sth->syb_ct_send_data($long_text, length($long_text));
	# commit the operation
	$sth->syb_ct_finish_send();
}


---
http://www.rusug.ru] Портал русскоязычной группы пользователей Sybase
...
Рейтинг: 0 / 0
4 сообщений из 4, страница 1 из 1
Форумы / Sybase ASA, ASE, IQ [игнор отключен] [закрыт для гостей] / ASE 12.5, Perl и text
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]