Меню

Sql state hy010 ошибка последовательности функций

Я
   Irina3gger

04.07.17 — 10:41

Доброго времени. Возникла такая проблема, В справочнике создала новый реквизит, но при сохранение выдает ошибку:

SQL State:HY010

Native:0

Message:[Microsoft][ODBC SQL Server Driver] Ошибка последовательности функций

Файлы sqlsrv32.dll sqlsrv32.rll odbcbcp.dll были заменены еще при установке SQL Server

Подскажите в чем еще может быть проблема?

   Ёпрст

1 — 04.07.17 — 10:42

(0) только в этом

   Ёпрст

2 — 04.07.17 — 10:44

Если что, новый реквизит добавьте ручоками.

В табличку скуля через альтер, и потом просто подмените мд и ддс. Усё

   Irina3gger

3 — 04.07.17 — 10:49

(2) Можете пожалуйста повторить еще раз что сделать? А то я не очень поняла

   Ёпрст

4 — 04.07.17 — 10:52

(3)

1. на пустой базе получить новый мд и ддс с добавленным реквизитом,

2.в рабочей базе через alter table добавить этот реквизит в соответствующую табличку справочника.

3. Далее, подменить мд и ддс в рабочей на те, что получены в п.1.

4. Наслаждаться, кушать печенки

https://msdn.microsoft.com/ru-ru/library/ms190273(SQL.90).aspx

   Ёпрст

5 — 04.07.17 — 10:53

Альтернативный вариант

1.Поставить скуль, НЕ меняя никакие библиотеки в нём.

2.Поставить секретный релиз платформы 1с

3.Наслаждаться, кушать печенки

   Builder

6 — 04.07.17 — 10:56

(5) Это самый правильный вариант.

Секретный 7.7 + SQL 2008 работает стабильно.

   Irina3gger

7 — 04.07.17 — 10:57

Спасибо большое буду пробовать.

  

Slypower

8 — 05.07.17 — 09:51

Или поставить ХР, на ней данная ошибка не будет проявляться.

ВНИМАНИЕ! Если вы потеряли окно ввода сообщения, нажмите Ctrl-F5 или Ctrl-R или кнопку «Обновить» в браузере.

Тема не обновлялась длительное время, и была помечена как архивная. Добавление сообщений невозможно.
Но вы можете создать новую ветку и вам обязательно ответят!
Каждый час на Волшебном форуме бывает более 2000 человек.

When calling SQLFetch() in our application, the error status «HY010: function sequence error» is returned when using SQL Server 2008 R2. The ODBC trace log contains these entries:

otsvcctl        1954-13bc ENTER SQLGetData

  HSTMT               037BE728
  UWORD                        3

  SWORD                       -8 <SQL_C_WCHAR>
  PTR                 0x02D24E1C

  SQLLEN                   256
  SQLLEN *            0x0012BF6C

otsvcctl        1954-13bc EXIT  SQLGetData  with return code 0 (SQL_SUCCESS)
  HSTMT               037BE728
  UWORD                        3

  SWORD                       -8 <SQL_C_WCHAR>
  PTR                 0x02D24E1C [      14] «winword»
  SQLLEN                   256
  SQLLEN *            0x0012BF6C (14)

otsvcctl        1954-13bc ENTER SQLFetch

  HSTMT               037BE728

otsvcctl        1954-13bc EXIT  SQLFetch  with return code -1 (SQL_ERROR)
  HSTMT               037BE728

  DIAG [HY010] [Microsoft][SQL Server Native Client 10.0]Function sequence error (0)

If I understand
http://msdn.microsoft.com/en-us/library/ms710996(v=VS.85).aspx and
http://msdn.microsoft.com/en-us/library/ms712424(v=VS.85).aspx correctly, SQLFetch() never should return HY010 if a previous SQLGetData() succeeded on the same statement handle (because SQLGetData() causes the statement handle to remain in state S6
and SQLFetch() never can return HY010 in state S6).

Is this right, or is there any condition that could cause HY010 in this case? Are there any debugging options that I could use to determine the reason of the HY010 error?

Regards
— Frank

The problem

During a very simple insert query, using PDO with an ODBC driver for a DB2 database, the driver returns the following error:

SQLSTATE[HY010]: Function sequence error: 0 [Microsoft][Driver Manager ODBC] [italian message translation] (SQLExecute[0] at extpdo_odbcodbc_stmt.c:254)

The query itself is a prepared statement insert, with strings and dates. [italian message translation] just says «Function sequence error» in italian.

The research

This SO question reports the same problem, but occurred during a SELECT query, which is not my case
This PHP bug report reports the same problem, but I’ve determined that’s not my case either.

The question

Why does a simple insert cause a function sequence error with SQLSTATE[HY010]?

Community's user avatar

asked Dec 3, 2014 at 10:15

STT LCU's user avatar

Reading from the PHP bug report, users have reported that the issue is related to the format of the date being inserted, because (in that particular case) it was missing some digits from the months number.

That made me think: maybe the length of some input data was incompatible with the table column. In fact, I was writing 80 characters where only 60 could fit.

The solution

Check your input values: length, format and type. One of these may be incompatible with the column you’re writing into. I’d expect a different message from the driver to be honest (data truncated in my case), because the problem isn’t too hard to solve if you have better information.

As soon as I reduced the input length below the maximum value allowed, the query executed successfully

Jared Mellentine's user avatar

answered Dec 3, 2014 at 10:15

STT LCU's user avatar

STT LCUSTT LCU

4,3284 gold badges30 silver badges47 bronze badges

Прямой SQL, ошибка HY010

Модераторы: m0p3e, edward_K, Модераторы

Прямой SQL, ошибка HY010

Салют!
Пытаюсь освоить прямой SQL. Запускаю запрос, собранный операторами sqlAddStr, однако при этом в ms70drv.log выбрасывается

Код: Выделить всё
30.06.2010 15:52:54 [USER]:
<текст запроса>
30.06.2010 15:52:54 [USER]:
Ошибка(1,0): Ожидался SQL оператор
30.06.2010 15:52:54 [USER]:
  HY010: [Microsoft][─шёяхЄўхЁ фЁрщтхЁют ODBC] ╬°шсър яюёыхфютрЄхы№эюёЄш ЇєэъЎшщ

причём именно так, с разной кодировкой последних строк (для тех, кто не понял: последняя строка расшифровывается как «HY010: [Microsoft][Диспетчер драйверов ODBC] Ошибка последовательности функций»). Сам <текст запроса>, скопированный в Query Analyzer, выполняется. Что бы это значило?

RAJAH
Местный житель
 
Сообщения: 929
Зарегистрирован: Пн фев 18, 2008 13:49
Reputation point: 57

Re: Прямой SQL, ошибка HY010

Сообщение Masygreen » Пт июл 02, 2010 15:49

Собственно логичнее выкладывать код который приводит к ошибкам, а не ошибки ….

Время ведет!

Masygreen
Местный житель
 
Сообщения: 1089
Зарегистрирован: Чт сен 04, 2008 11:27
Откуда: Москва
Reputation point: 26
  • Сайт
  • ICQ

Re: Прямой SQL, ошибка HY010

Сообщение RAJAH » Пт июл 02, 2010 16:56

Мне показалось, что дело не в коде, ведь запрос, собранный им, нормально отрабатывает в Query Analyzer. К тому же он весьма громоздок, и я не хотел бы тратить время уважаемых пользователей на анализ сотен строк кода. Вот если бы мне подсказали о природе этих ошибок, я бы поискал фрагмент, отвечающий за это безобразие, и постарался бы его выложить. Если вы настаиваете на том, что причина вышеприведенной ошибки в коде, а не в запросе, приведу и его. :smile:

RAJAH
Местный житель
 
Сообщения: 929
Зарегистрирован: Пн фев 18, 2008 13:49
Reputation point: 57

Re: Прямой SQL, ошибка HY010

Сообщение RAJAH » Пн июл 05, 2010 12:02

Я так понял, пока не приведу код, никто не ответит? Ладно, сами напросились… Под <текст запроса> скрывается это:

Код: Выделить всё
declare @hdrpsnrec binary(8)
declare @canvalnrec binary(8)
set @hdrpsnrec=0x8001000000002C71
declare @pbigint bigint
set @pbigint=convert(bigint, 0x80010000000002E5)
set @hdrpsnrec=convert(binary(8),@pbigint)
set @pbigint=convert(bigint,0x8000000000000000)
set @pbigint=convert(bigint, 0x8001000000000599) 
set @canvalnrec=convert(binary(8),@pbigint)
declare @stackid int
set @stackid=0
declare @spstack table
(id int IDENTITY(0,1) primary key,
sid int,
param1 int
)
declare @tident int
declare @sptable1 table
(id int IDENTITY(0,1) primary key,
level int,
strindex varchar(255),
strindex2 varchar(255),
pslinesnrec binary(8),
pslinescdet binary(8),
  hdrpscdetnrec binary(8),
katmcobozn varchar(50),
katmcname varchar(200),
pslinesced binary(8),
barkod varchar(20),
okp varchar(20),
pslinescpodr binary(8),
pslinesceh binary(8),
izgot binary(8),
izgots int,
edizm varchar(20),
edkoef real,
alt_edizm varchar(20),
vesid real,
rashnaed real,
kol real,
alt_koef real,
rashnaizd real,
  sklad varchar(20),
  ceh varchar(20),
  izgotc varchar(20),
  marshrut varchar(100),
dm varchar(20),
dl varchar(20),
shr varchar(20),
tol varchar(20),
razmer varchar(50),
tz varchar(50),
katmcorder int,
idce int,
typemainowner int,
idmainowner int,
KD varchar(20)
)
declare @level as int
set @level=0
insert @sptable1 (level, pslinescdet, katmcname, katmcobozn, barkod, okp,vesid,
edizm,
strindex,katmcorder,
idce,typemainowner,
izgot,izgots,
kol,rashnaed, edkoef)
select @level 'level',  hdr_ps.f$cizd pslinescdet, katmc.f$name, katmc.f$obozn, katmc.f$barkod,katmc.f$okdp,katmc.f$massa,
case when hdr_ps.f$ced=0x8000000000000000 then kated.f$abbr else katotped.f$abbr end,
'',2,
0,2,
hdr_ps.f$cpodr,hdr_ps.f$wpodr,
hdr_ps.f$ednorm,1,
case when hdr_ps.f$ced=0x8000000000000000 then 1 else katotped.f$koef end
from t$hdr_ps hdr_ps
  inner join t$katmc katmc
    on hdr_ps.f$cizd=katmc.f$nrec
  inner join t$kated kated
    on katmc.f$ced=kated.f$nrec
  left join t$katotped katotped
    on hdr_ps.f$ced=katotped.f$nrec
where  @hdrpsnrec=hdr_ps.f$nrec
while (((select count(*) from @sptable1 sptable1 where @level=sptable1.level)>0) and (@level<100))
begin
  set @level=@level+1
  insert @sptable1 ( level, strindex, pslinesnrec,
  pslinescdet, katmcorder,katmcname, katmcobozn,
  idce,
  typemainowner,
  idmainowner,
  pslinescpodr, pslinesceh, izgot,izgots, pslinesced,
  barkod,okp,vesid,
  rashnaed,
  kol)
  select @level 'level',sptable1.strindex+str(sptable1.id,4)'|', ps_lines.f$nrec pslinesnrec,
  ps_lines.f$cdet pslinescdet,typemc.f$order,katmc.f$name,katmc.f$obozn,
  case when sptable1.katmcorder=2 then sptable1.id else sptable1.idce end,
  case when (typemc.f$order=2) or (typemc.f$order=3) then typemc.f$order else sptable1.typemainowner end,
  case when (typemc.f$order=2) or (typemc.f$order=3) then null else case when (sptable1.idmainowner is null) then sptable1.id else sptable1.idmainowner end end,
  ps_lines.f$cpodr,ps_lines.f$canval1,
  isnull(hdr_psvar.f$cpodr,hdr_ps.f$cpodr),isnull(hdr_psvar.f$wpodr,hdr_ps.f$cpodr),
  ps_lines.f$ced,
  katmc.f$barkod,katmc.f$okdp,katmc.f$massa,
  ps_lines.f$kol,
  sptable1.kol*ps_lines.f$kol
  from  @sptable1 sptable1
  inner join t$hdr_ps hdr_ps
    on 4=hdr_ps.f$ctypeizd and sptable1.pslinescdet = hdr_ps.f$cizd and 25=hdr_ps.f$kind and 1=hdr_ps.f$active
  left join t$hdr_ps hdr_psvar
    on 4=hdr_psvar.f$ctypeizd and sptable1.pslinescdet = hdr_psvar.f$cizd and 25=hdr_psvar.f$kind and @canvalnrec=hdr_psvar.f$canval1
  inner join t$ps_lines ps_lines
    on isnull(hdr_psvar.f$nrec,hdr_ps.f$nrec)=ps_lines.f$chdr
  inner join t$katmc katmc
    on ps_lines.f$cdet=katmc.f$nrec
  inner join t$typemc typemc
    on katmc.f$ctype=typemc.f$nrec
  where @level-1=sptable1.level
  order by typemc.f$order, katmc.f$obozn, katmc.f$name
end
update @sptable1 set strindex2=strindex+str(id,4)+'|', idmainowner=isnull(idmainowner,id)
update @Sptable1 set hdrpscdetnrec=isnull(hdr_psvar.f$nrec,hdr_ps.f$nrec),izgotc=case when isnull(hdr_psvar.f$wpodr,hdr_ps.f$wpodr)=2 then isnull(pizgot.f$kod,'') else '**' end
from @Sptable1 sptable1
inner join t$hdr_ps hdr_ps
on 4=hdr_ps.f$ctypeizd and sptable1.pslinescdet = hdr_ps.f$cizd and 25=hdr_ps.f$kind and 1=hdr_ps.f$active
left join t$hdr_ps hdr_psvar
on 4=hdr_psvar.f$ctypeizd and sptable1.pslinescdet = hdr_psvar.f$cizd and 25=hdr_psvar.f$kind and @canvalnrec=hdr_psvar.f$canval1
left join t$katpodr pizgot
on isnull(hdr_psvar.f$cpodr,hdr_ps.f$cpodr)=pizgot.f$nrec
update @Sptable1 set sklad=isnull(psklad.f$kod,''),ceh=isnull(pceh.f$kod,''),izgotc=isnull(izgotc,''),marshrut=isnull(izgotc,''),
edizm=isnull(edizm,case when pslinesced=0x8000000000000000 then kated.f$abbr else katotped.f$abbr end),
edkoef=case when pslinesced=0x8000000000000000 then 1 else katotped.f$koef end,
alt_edizm=case when pslinesced=0x8000000000000000
               then
                 case when
                   (select otped.f$akt
                    from t$katotped otped
                    where otped.f$ckated = kated.f$nrec and otped.f$cmcusl = katmc.f$nrec)=1
                 then
                   (select otped.f$abbr
                    from t$katotped otped
                    where otped.f$pr = 1 and otped.f$akt <> 1 and otped.f$cmcusl = katmc.f$nrec)
                 end
               else
                 case when katotped.f$pr=1
                      then edizm
                      else
                        (select otped.f$abbr
                         from t$katotped otped
                         inner join t$katmc
                         on otped.f$cmcusl = t$katmc.f$nrec and otped.f$pr=1
                         where pslinescdet = otped.f$cmcusl and pslinesced <> otped.f$nrec)
                 end
          end,
alt_koef=case when pslinesced=0x8000000000000000
               then
                 case when
                   (select otped.f$akt
                    from t$katotped otped
                    where otped.f$ckated = kated.f$nrec and otped.f$cmcusl = katmc.f$nrec)=1
                 then
                   (select otped.f$koef
                    from t$katotped otped
                    where otped.f$pr = 1 and otped.f$akt <> 1 and otped.f$cmcusl = katmc.f$nrec)
                 end
               else
                 case when katotped.f$pr=1
                      then 1
                      else
                        (select otped.f$koef
                         from t$katotped otped
                         inner join t$katmc
                         on otped.f$cmcusl = t$katmc.f$nrec and otped.f$pr=1
                         where pslinescdet = otped.f$cmcusl and pslinesced <> otped.f$nrec)
                 end
         end,
dm=case when paramvoldlsr.f$valempty#8#=1 then convert(varchar(20),convert(float,paramvoldlsr.f$value#8#)) else '' end,
dl=case when paramvoldlsr.f$valempty#9#=1 then convert(varchar(20),convert(float,paramvoldlsr.f$value#9#)) else '' end,
shr=case when paramvoldlsr.f$valempty#10#=1 then convert(varchar(20),convert(float,paramvoldlsr.f$value#10#)) else '' end,
tol=case when paramvoltol.f$valempty#1#=1 then convert(varchar(20),convert(float,paramvoltol.f$value#1#)) else '' end,
KD=case when paramvolKD.f$valempty#5#=1 then convert(varchar(20),convert(float,paramvolKD.f$value#5#)) else '' end,
tz=isnull(spkau.f$code,'')
from @Sptable1 sptable1
inner join t$katmc katmc
on Sptable1.pslinescdet=katmc.f$nrec
left join t$kated kated
on katmc.f$ced=kated.f$nrec
left join t$katotped katotped
on sptable1.pslinesced=katotped.f$nrec
left join t$katpodr pceh
on sptable1.pslinescpodr=pceh.f$nrec
left join t$katpodr psklad
on sptable1.pslinesceh=psklad.f$nrec
left join t$paramvol paramvoldlsr
on sptable1.pslinesnrec=paramvoldlsr.f$cobject and 11053=paramvoldlsr.f$tobject and 0=paramvoldlsr.f$block
left join t$paramvol paramvoltol
on sptable1.pslinesnrec=paramvoltol.f$cobject and 11053=paramvoltol.f$tobject and 1=paramvoltol.f$block
left join t$paramvol paramvolKD
on sptable1.pslinesnrec=paramvolKD.f$cobject and 11053=paramvolKD.f$tobject and 1=paramvolKD.f$block
left join t$spkau spkau
on (paramvoldlsr.f$valempty#7#=1) and
(convert(binary(8),convert(bigint,0x8000000000000000)+convert(bigint,paramvoldlsr.f$value#7#))=spkau.f$nrec)
while  (@level>0)
begin
  update @sptable1 set marshrut=sptable2.marshrut+'-'+sptable1.marshrut
  from @sptable1 sptable1
  inner join (select * from @sptable1 where @level=level and 5>katmcorder ) sptable2
  on sptable1.idmainowner=sptable2.idmainowner
  where @level-1=sptable1.level and 5>sptable1.katmcorder
  set @level=@level-1
end
insert @spstack (sid)
values(@stackid)
declare @strindex1 varchar(255)
declare @katmcorder int
declare @pslinesnrec binary (8)
declare @tmptable1 table
(i int IDENTITY(0,1) primary key,
strindex varchar(255),
id int,
idce int,
repr int
)
declare @tmptable2 table
(strindex varchar(255),
id int,
idce int
)
declare @startid int
declare @strindex2 varchar(255)
declare @idce int
while (Select count(*) from @spstack)>0 begin
  Select @stackid=max(id) from @spstack
  select  @startid=sid from @spstack where (@stackid)=id
  select @strindex2=strindex2,@idce=idce from @sptable1 where @startid=id
  insert @tmptable1 (strindex,repr)
  values ('Узел',1)
  insert @tmptable1 (strindex,id,idce,repr)
  values (@strindex2,@startid,@idce,1)
  insert @tmptable1 (strindex,id,idce,repr)
  select strindex2,id,idce,1 from @sptable1 where @startid=idce and 1=katmcorder
  order by strindex2
  insert @tmptable1 (strindex,repr)
  values ('СЕ узла',2)
  delete from @tmptable2
  insert @tmptable2 (strindex,id,idce)
  select strindex2,id,idce from @sptable1 where @Startid<>id and @startid=idce and 2=katmcorder
  order by strindex2
  insert @spstack (sid)
  select id from @tmptable2
  order by id desc
  insert @tmptable1 (strindex,id,idce,repr)
  select strindex,id,idce,2 from @tmptable2
  insert @tmptable1 (strindex,repr)
  values ('Детали собств. пр-ва',3)
  select @tident=@@identity
  insert @tmptable1 (strindex,id,idce,repr)
  select strindex2,id,idce,3 from @sptable1 where @startid=idce and 3=typemainowner
  order by strindex2
  if @tident=@@identity delete from @tmptable1 where @tident=i
  insert @tmptable1 (strindex,repr)
  values ('Стандартные покупные изделия',7)
  select @tident=@@identity
  insert @tmptable1 (strindex,id,idce,repr)
  select strindex2,id,idce,4 from @sptable1 where @startid=idce and 7=katmcorder and 2=typemainowner
  order by strindex2
  if @tident=@@identity delete from @tmptable1 where @tident=i
  insert @tmptable1 (strindex,repr)
  values ('Покупные материалы',6)
  select @tident=@@identity
  insert @tmptable1 (strindex,id,idce,repr)
  select strindex2,id,idce,4 from @sptable1 where @startid=idce and 6=katmcorder and 2=typemainowner
  order by strindex2
  if @tident=@@identity delete from @tmptable1 where @tident=i
  insert @tmptable1 (strindex,repr)
  values ('Покупные комплектующие',5)
  select @tident=@@identity
  insert @tmptable1 (strindex,id,idce,repr)
  select strindex2,id,idce,4 from @sptable1 where @startid=idce and 5=katmcorder and 2=typemainowner
  order by strindex2
  if @tident=@@identity delete from @tmptable1 where @tident=i
  insert @tmptable1 (strindex,repr)
  values ('-Конец узла-',1)
  delete from @spstack where (@stackid)=id
end
select tmptable1.strindex,tmptable1.repr,
isnull(sptable1.katmcobozn,'<<'+tmptable1.strindex+'>>') 'katmcobozn',
case when sptable1.katmcobozn<>'' then REPLACE(replace(sptable1.katmcname, sptable1.katmcobozn,''), '  ', ' ') else sptable1.katmcname end 'katmcname',
sptable1.barkod,sptable1.okp,sptable1.edizm, sptable1.razmer, sptable1.KD, sptable1.alt_edizm 'alted',
case when sptable1.alt_edizm<>'' then sptable1.edkoef/sptable1.alt_koef else 0 end 'altkoef',
sptable1.vesid,sptable1.rashnaed,sptable1.rashnaizd,sptable1.kol,sptable1.sklad,sptable1.ceh,sptable1.izgotc,sptable1.marshrut,
sptable1.tz, sptable1.dl,sptable1.shr,sptable1.tol,sptable1.dm,
sptable1.katmcorder,sptable1.idce,sptable1.typemainowner,sptable1.idmainowner from @tmptable1 tmptable1
left join @sptable1 sptable1
on tmptable1.id=sptable1.id
RAJAH
Местный житель
 
Сообщения: 929
Зарегистрирован: Пн фев 18, 2008 13:49
Reputation point: 57

Re: Прямой SQL, ошибка HY010

Сообщение edward_K » Пн июл 05, 2010 12:12

я бы вам посоветовал пойти мелкими шажками и уже привести запрос строк в 10 а не в 100.
Ошибка не галки а MSSQL. Google полно тем дает.
Попробуйте отследить что на выходе идет в MSSQL — галка ведь транслирует ваш запрос. Наверняка какие то символы были нет поняты.

edward_K
Заслуженный деятель интернет-сообщества
 
Сообщения: 5172
Зарегистрирован: Вт мар 29, 2005 17:49
Откуда: SPB galaxy spb
Reputation point: 115

Re: Прямой SQL, ошибка HY010

Сообщение edward_K » Пн июл 05, 2010 12:17

вообще по коду добрая часть тянет на сторед процедуру — ее и генерить то каждый раз не нужно — один раз создали и забыли.

edward_K
Заслуженный деятель интернет-сообщества
 
Сообщения: 5172
Зарегистрирован: Вт мар 29, 2005 17:49
Откуда: SPB galaxy spb
Reputation point: 115

Re: Прямой SQL, ошибка HY010

Сообщение RAJAH » Пн июл 05, 2010 12:26

edward_K писал(а):Наверняка какие то символы были нет поняты.

Какие символы вы имеете в виду? NULL? Есть такое. Нельзя, что ли?

edward_K писал(а):Ошибка не галки а MSSQL.

Хм… А в чём конкретно ошибка почему MSSQL не говорит? Запрос прекрасно срабатывает в Query Analyzer.

edward_K писал(а):вообще по коду добрая часть тянет на сторед процедуру — ее и генерить то каждый раз не нужно — один раз создали и забыли.

К стыду своему, про Stored Procedure только слышал, сам не сталкивался. Придётся изучить на досуге…

RAJAH
Местный житель
 
Сообщения: 929
Зарегистрирован: Пн фев 18, 2008 13:49
Reputation point: 57

Re: Прямой SQL, ошибка HY010

Сообщение Den » Пн июл 05, 2010 13:07

Ошибка это не мсскуль, видимо
В ms70,как я понимаю , делает сама галактика ,когда пытается проверить отдаваемый запрос на синтаксис правильный,исходя из продекларированных возможностей dsql. Ведь профайлер, Раджа, ничего не кажет ?

Den
Местный житель
 
Сообщения: 1839
Зарегистрирован: Вт мар 29, 2005 17:49
Откуда: Ярославская область ОАО «Часовой завод Чайка» г. Углич
Reputation point: 60
  • ICQ

Re: Прямой SQL, ошибка HY010

Сообщение Vik » Пн июл 05, 2010 13:15

Ошибка последовательности функций обычно говорит о том, что вы не правильно используете функции доступа к прямому SQL.

Vik
Местный житель
 
Сообщения: 370
Зарегистрирован: Чт сен 28, 2006 15:43
Откуда: Санкт-Петербург
Reputation point: 26
  • Сайт
  • ICQ

Re: Прямой SQL, ошибка HY010

Сообщение RAJAH » Пн июл 05, 2010 13:18

Чувствую себя немного ущербным: то хранимые процедуры, то профайлер… Вы слишком умны для меня. Что такое профайлер?
Den, а вы не тот den, у кого здесь http://forum.galaktika.ru/viewtopic.php?f=10&t=394&start=0 была та же ошибка? Чем вылечили?

RAJAH
Местный житель
 
Сообщения: 929
Зарегистрирован: Пн фев 18, 2008 13:49
Reputation point: 57

Re: Прямой SQL, ошибка HY010

Сообщение Den » Пн июл 05, 2010 13:43

Угу…это я :)
Тогад разработчики предложили использовать COALESCE. Вроде с ним должно работать. Я уж как то тогда локально проблемы решил пока ждал ответа разработчиков — поэтому попробуйте с ним сами.
Profiler — утилита MSSQL. С ее помощью можно просто посмотреть какой запрос собранный приходит от атлантиса…

Den
Местный житель
 
Сообщения: 1839
Зарегистрирован: Вт мар 29, 2005 17:49
Откуда: Ярославская область ОАО «Часовой завод Чайка» г. Углич
Reputation point: 60
  • ICQ

Re: Прямой SQL, ошибка HY010

Сообщение RAJAH » Пн июл 05, 2010 16:55

Den писал(а):Угу…это я :)
Тогад разработчики предложили использовать COALESCE. Вроде с ним должно работать.

Использовать COALESCE вместо ISNULL?

P.S. Profiler так сказал:

Код: Выделить всё
Replay server: BRAIN
Total events = 1
Replayed events = 1
ODBC errors = 0
Internal errors = 1
Total errors = 1
ODBC hit ratio = 100,00 %
Internal hit ratio = 0,00 %
Overall hit ratio = 0,00 %
Replay time = 0 hr 0 min 5 sec 328 ms

Что, интересно, означает «внутренняя ошибка»?

RAJAH
Местный житель
 
Сообщения: 929
Зарегистрирован: Пн фев 18, 2008 13:49
Reputation point: 57

Re: Прямой SQL, ошибка HY010

Сообщение Vik » Пн июл 05, 2010 17:49

Непонятно немного, вы весь код, что привели выше, пытаетесь выполнить из випа при помощи функционала DSQL? Если да, то как-то это неправильно. edward_K вам правильно сказал — это больше на кандидата в хранимку похоже. Сомневаюсь, что многое из того, что у вас написано будет работать без оформления в виде хранимки. И еще раз, повторюсь, хотя может быть это и не тот случай, но сколько бы раз у меня ни была ошибка последовательности функций, всегда это была моя ошибка — не в том порядке или неправильно использовал функции DSQL.

Vik
Местный житель
 
Сообщения: 370
Зарегистрирован: Чт сен 28, 2006 15:43
Откуда: Санкт-Петербург
Reputation point: 26
  • Сайт
  • ICQ

Re: Прямой SQL, ошибка HY010

Сообщение Den » Пн июл 05, 2010 18:24

Что же вы тогда собираете с помощью «..собранный операторами sqlAddStr…» (смотрю первое Ваше сообщение). То что Вы привели — это код на TSQL чистом
Ну да…isnull просто нет в DSQl. Будите огребать ошибку

Den
Местный житель
 
Сообщения: 1839
Зарегистрирован: Вт мар 29, 2005 17:49
Откуда: Ярославская область ОАО «Часовой завод Чайка» г. Углич
Reputation point: 60
  • ICQ

Re: Прямой SQL, ошибка HY010

Сообщение RAJAH » Пн июл 05, 2010 22:48

Vik писал(а):Непонятно немного, вы весь код, что привели выше, пытаетесь выполнить из випа при помощи функционала DSQL?

Я же написал, что этот код из ms70drv.log, «..собранный операторами sqlAddStr…»

Код: Выделить всё
sqlAddStr(qhandle,'declare @hdrpsnrec binary(8)');
sqlAddStr(qhandle,'declare @canvalnrec binary(8)');
sqlAddStr(qhandle,'set @hdrpsnrec=0x8001000000002C71');
sqlAddStr(qhandle,'declare @pbigint bigint');
sqlAddStr(qhandle,'set @pbigint=convert(bigint, '+nrhdr_QA+')');
...
sqlAddStr(qhandle,'sptable1.vesid,sptable1.rashnaed,sptable1.rashnaizd,sptable1.kol,sptable1.sklad,sptable1.ceh,sptable1.izgotc,sptable1.marshrut,');
sqlAddStr(qhandle,'sptable1.tz, sptable1.dl,sptable1.shr,sptable1.tol,sptable1.dm,');
sqlAddStr(qhandle,'sptable1.katmcorder,sptable1.idce,sptable1.typemainowner,sptable1.idmainowner from @tmptable1 tmptable1');
sqlAddStr(qhandle,'left join @sptable1 sptable1');
sqlAddStr(qhandle,'on tmptable1.id=sptable1.id');

Vik писал(а):Сомневаюсь, что многое из того, что у вас написано будет работать без оформления в виде хранимки.

Опять же: выше уже указано, что в Query Analyzer всё работает. :-)

Den писал(а):isnull просто нет в DSQl

Видимо, в этом всё дело… Интересно, документация, где это всё написано, существует?

Последний раз редактировалось RAJAH Вт июл 06, 2010 11:05, всего редактировалось 1 раз.

RAJAH
Местный житель
 
Сообщения: 929
Зарегистрирован: Пн фев 18, 2008 13:49
Reputation point: 57


Вернуться в Программирование

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 1



The problem

During a very simple insert query, using PDO with an ODBC driver for a DB2 database, the driver returns the following error:

SQLSTATE[HY010]: Function sequence error: 0 [Microsoft][Driver Manager ODBC] [italian message translation] (SQLExecute[0] at extpdo_odbcodbc_stmt.c:254)

The query itself is a prepared statement insert, with strings and dates. [italian message translation] just says «Function sequence error» in italian.

The research

This SO question reports the same problem, but occurred during a SELECT query, which is not my case
This PHP bug report reports the same problem, but I’ve determined that’s not my case either.

The question

Why does a simple insert cause a function sequence error with SQLSTATE[HY010]?

Community's user avatar

asked Dec 3, 2014 at 10:15

STT LCU's user avatar

Reading from the PHP bug report, users have reported that the issue is related to the format of the date being inserted, because (in that particular case) it was missing some digits from the months number.

That made me think: maybe the length of some input data was incompatible with the table column. In fact, I was writing 80 characters where only 60 could fit.

The solution

Check your input values: length, format and type. One of these may be incompatible with the column you’re writing into. I’d expect a different message from the driver to be honest (data truncated in my case), because the problem isn’t too hard to solve if you have better information.

As soon as I reduced the input length below the maximum value allowed, the query executed successfully

Jared Mellentine's user avatar

answered Dec 3, 2014 at 10:15

STT LCU's user avatar

STT LCUSTT LCU

4,3284 gold badges30 silver badges47 bronze badges

The problem

During a very simple insert query, using PDO with an ODBC driver for a DB2 database, the driver returns the following error:

SQLSTATE[HY010]: Function sequence error: 0 [Microsoft][Driver Manager ODBC] [italian message translation] (SQLExecute[0] at extpdo_odbcodbc_stmt.c:254)

The query itself is a prepared statement insert, with strings and dates. [italian message translation] just says «Function sequence error» in italian.

The research

This SO question reports the same problem, but occurred during a SELECT query, which is not my case
This PHP bug report reports the same problem, but I’ve determined that’s not my case either.

The question

Why does a simple insert cause a function sequence error with SQLSTATE[HY010]?

Community's user avatar

asked Dec 3, 2014 at 10:15

STT LCU's user avatar

Reading from the PHP bug report, users have reported that the issue is related to the format of the date being inserted, because (in that particular case) it was missing some digits from the months number.

That made me think: maybe the length of some input data was incompatible with the table column. In fact, I was writing 80 characters where only 60 could fit.

The solution

Check your input values: length, format and type. One of these may be incompatible with the column you’re writing into. I’d expect a different message from the driver to be honest (data truncated in my case), because the problem isn’t too hard to solve if you have better information.

As soon as I reduced the input length below the maximum value allowed, the query executed successfully

Jared Mellentine's user avatar

answered Dec 3, 2014 at 10:15

STT LCU's user avatar

STT LCUSTT LCU

4,3284 gold badges30 silver badges47 bronze badges

Имеем Windows 7 стоит 1С 7.7 27 релиза. Есть на нужном месте файлик OrdNoChk.prm. Файлы sqlsrv32.dll и sqlsrv32.rll заменены на аналогичные из 2003 сервера. При изменении текста в модулях конфигурация сохраняется нормально. Но стоит изменить структуру — вылетает ошибка последовательности функции.

На 2003 сервере. Доступ настроен через сетевой диск K: = ServerD$Base

Ошибка вылетает после подключение к базе в момент обработки измененного справочника. Пишет что обработало 900 элементов — а затем ошибка.

текст ошибки полностью в студию

Native: 0 Message: [Microsoft][ODBC SQl Server Driver] Ошибка последовательности функций

не тот код ошибки. Пока читаю дальше

Файлы sqlsrv32.dll и sqlsrv32.rll заменены на аналогичные из 2003 сервера. — я б такими вещами не маялся если честно — а попробовал поставить SQL 2000 Developer

по поводу структуры могу посоветовать посмотреть только общие реквизиты строка неограниченной длины в конец списка

и — та же лажа. ни слова про SQL State: HY010

кстати сюда я полез после того как Гугл мне не помог

ODBC MS SQL какой версии?

далее клиенты набор MDAC посмотреть на 2.7 версию и склоняюсь к ошибке скуля — несовместимости обаботчика — далее про версию скуля не слова как и про сервиспаки … про клиента ОДБСи тож ничего не ясно

ODBC MS SQL 3.86.3959 Немног не понял… Но dll-ки Windows 7 заменил на dll-ки с того сервака на котором скуль. С ХР и 2003 — ошибок нет. Про MDAC  — не понял. Можно по-подробнее.

поставить как вариант клиента MS SQL 2000 Developer  на 7-ку или попробовать таки комплект драйверов Майкрасофт Дата Аксесс  — вытянутый из сборок — версии 2.7 (идет отдельным комплектом) — плюс прописать алиасы на клиенте  через clicoyfg

почту глянь … попробуй данные файлы подменить это для скульного 27

завтра сброшу еще правильные sqlsrv32.dll и sqlsrv32.rll

(26,27) Сенкс. Буду ждать. Пока не пришло.

хм странно от меня ушло уже порядком …

а то у меня там какой-то чен

Огромное сенкс за попытку помощи. Нашел лажу сам. Нужно заменять 3 файла sqlsrv32.dll sqlsrv32.rll odbcbcp.dll Тема закрыта

Тэги:

Комментарии доступны только авторизированным пользователям

— ghst-46 I’ve been busy lately collaborating with —E from the Wincache PHP extension and had no time to look into this.

I am also maintainer for the SQL Server Driver for Drupal. A few months ago I tried to revise the driver to make use of the prefetching capabilities of the driver (otherwise we are emulating prefetching in PHP in Drupal which is a massive performance hog).

Please take a look at the discussion regarding moving prefetch away from PHP and usings the PDO’s implementation:

https://www.drupal.org/node/1471506

I have prepared a sample script that demonstrates two of the problems I came accros: null terminated strings and the «Function sequence error».

There is a third problem with nested statements that I am not sure you guys can look into (see comment #8 in the thread).

The thing here is that either of all these issues are solved, or you are out of game in the major CMS’s due to performance. We are a traditional MS shop but customers and government projects impose nowadays to use one of the major Open Source CMS’s for projects, we are seriously trying to stick to MS but the pieces needed to glue PHP + MS SQL + IIS aren’t simply taken care of as frequently as they should. Should there be a bug, it hangs around for years in a low level C extension that is no fun to dive into. (Praise to the Wincache team that have done a great job improving and updating the extension during these last year).

You can download the sample scripts here:

https://www.dropbox.com/s/l3xj5303zd03p00/democode.zip?dl=0

If needed you can get in touch with me through my Drupal.org profile contact form:

https://www.drupal.org/u/david_garcia

Greetings and thanks, hope to see the PHP driver moving forward (and getting compiled for PHP 5.6 soon).

0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии

А вот еще интересные материалы:

  • Яшка сломя голову остановился исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного где ошибка
  • Sql state 58p01 ошибка
  • Sql state 28000 native 18456 ошибка входа пользователя