Jump to content
Fivewin Brasil

Index/Sql


jose hilton

Recommended Posts

Bom dia a Todos

Pessoal alguem poderia mim informa porque essa messagem

cSelect := "select * from Grupo"

Sqla := 'SELECT * FROM Grupo ORDER BY Codigo'

sele 2

USE "ArqGru" AS Sqla NEW VIA 'mysql' ALIAS tmp

IF !Index( 'iGrupo' )

INDEX ON STRZERO(Codigo,3,0) TAG Codigo TO iGrupo

endif

Application

===========

Path and name: C:\sqlxdev\TESTE_FWH\PRG_OBJ\teste.EXE (32 bits)

Size: 1,359,872 bytes

Time from start: 0 hours 0 mins 0 secs

Error occurred at: 31/03/2008, 09:44:01

Error description: Warning SQLLIB/1000 MySQL RDD: COMPLEX SQL not suport INDEX!

Stack Calls

===========

Called from SQL_ERROR(144)

Called from _SQL_NO_SUPPORT_INDEX(964)

Called from _MYSQL_ORDMANAGER(1002)

Called from ORDCONDSET(0)

Called from MAIN(212)

Compiler version: xHarbour build 0.99.50 Intl. (SimpLex)

Windows version: 5.1, Build 2600 Service Pack 2

Agradeco antecipadamente

Hilton

FWH 2.6 XDEV / XHARBOUR

Link to comment
Share on other sites

Bom dia a Todos

Pessoal alguem poderia mim informa porque essa messagem

cSelect := "select * from Grupo"

Sqla := 'SELECT * FROM Grupo ORDER BY Codigo'

sele 2

USE "ArqGru" AS Sqla NEW VIA 'mysql' ALIAS tmp

IF !Index( 'iGrupo' )

INDEX ON STRZERO(Codigo,3,0) TAG Codigo TO iGrupo

endif

Application

===========

Path and name: C:\sqlxdev\TESTE_FWH\PRG_OBJ\teste.EXE (32 bits)

Size: 1,359,872 bytes

Time from start: 0 hours 0 mins 0 secs

Error occurred at: 31/03/2008, 09:44:01

Error description: Warning SQLLIB/1000 MySQL RDD: COMPLEX SQL not suport INDEX!

Stack Calls

===========

Called from SQL_ERROR(144)

Called from _SQL_NO_SUPPORT_INDEX(964)

Called from _MYSQL_ORDMANAGER(1002)

Called from ORDCONDSET(0)

Called from MAIN(212)

Compiler version: xHarbour build 0.99.50 Intl. (SimpLex)

Windows version: 5.1, Build 2600 Service Pack 2

Agradeco antecipadamente

Hilton

FWH 2.6 XDEV / XHARBOUR

Link to comment
Share on other sites

Olá,

Veja no manual que não se pode indexar com algumas funções ( strzero() é uma delas ). Retire o strzero().

[]s,

Evandro G. de Paula

Curvelo - MG

evandro@skillnet.com.br (Escr. - na Cidade)

imortal@skillnet.com.br (Res. - na Roça)

FWH 2.6+PellesC+MyMake+xHarbour.org 0.99.5+SqlLib

I PREPARATÓRIO PARA O VI ENCONTRO FIVEWIN - JULHO/2008 - CURVELO - MG

Link to comment
Share on other sites

eu retirei o strzero() e o erro continua

veja

Path and name: C:\sqlxdev\TESTE_FWH\PRG_OBJ\teste.EXE (32 bits)

Size: 1,359,872 bytes

Time from start: 0 hours 0 mins 0 secs

Error occurred at: 31/03/2008, 10:53:44

Error description: Warning SQLLIB/1000 MySQL RDD: COMPLEX SQL not suport INDEX!

Stack Calls

===========

Called from SQL_ERROR(144)

Called from _SQL_NO_SUPPORT_INDEX(964)

Called from _MYSQL_ORDMANAGER(1002)

Called from ORDCONDSET(0)

Called from MAIN(212)

Link to comment
Share on other sites

Olá

Neste caso vc terá que usar o dbusearea(). Para um Select a LIB cria um "Arquivo" virtual apenas de leitura.

Tente assim:

//

dbUseArea( .t., 'MySQL', 'grupo', 'tmp')

if !index('igrupo')

index on codigo TAG codigo to igrupo

endif

//

Um abraço,

Alexandre Pereira

fwh 2.6, xharbour, .99.6, MyMake

msn: alexpdasilva6@hotmail.com

atualmente em Rondônia

Link to comment
Share on other sites

Bom a todos

Alex

fiz do jeito q vc mandou mais a

messagem continua

dbUseArea( .t., 'MySQL', 'grupo', 'tmp')

if !index('igrupo')

index on codigo TAG codigo to igrupo

endif

Path and name: C:\sqlxdev\TESTE_FWH\PRG_OBJ\teste.EXE (32 bits)

Size: 1,359,872 bytes

Time from start: 0 hours 0 mins 0 secs

Error occurred at: 01/04/2008, 10:22:43

Error description: Error SQLLIB/4001 MySQL RDD: Operation not supported!

Stack Calls

===========

Called from SQL_ERROR(144)

Called from _MYSQL_ORDCREATE(1065)

Called from _MYSQL_ORDMANAGER(1014)

Called from ORDCREATE(0)

Called from MAIN(207)

System

======

CPU type: GetCPU() failed! 1800 Mhz

Hardware memory: 480 megs

Free System resources: 90 %

GDI resources: 90 %

User resources: 90 %

Compiler version: xHarbour build 0.99.50 Intl. (SimpLex)

Windows version: 5.1, Build 2600 Service Pack 2

Windows total applications running: 0

o que pode ser ja fiz assim tambem

IF !Index( 'idgrupo' )

cIndice := "CREATE INDEX idgrupo USING BTREE;

ON a_grupo(Codigo)"

SqlExecute("Start Transaction")

// SqlExecute(cIndice)

SQLLIB_ExecSql(nil,cIndice)

else

msginfo("indice existe")

endif

o interesante e que parece que ele cria porque nao da erro no sql_errorno()

mais quando eu teste

if !index("idgrupo")

msginfo("Indice nao foi criado")

return( .f.)

endif

nao acha o indice

mim ajute por favor !!

Obrigado

HIlton

Link to comment
Share on other sites

Ola Jose

Esperimente o seguinte

no seu fonte principal veja se tem estas linhas

SQL CUSTOM INDEXES ON

No caso do indice tente isso

// Antes de criar

IF Index('iGrupo')

CLEAR INDEXES

ENDIF

INDEX ON Codigo TAG Codigo TO iGrupo

Um abraço

Marcelo Ferro

Petrópolis - Rj

Fwh7.04/xHarbour 99.71/SqlLib /xMate/WS

Link to comment
Share on other sites

Aqui todo o codigo fonte

#Include "FiveWin.Ch"

#Include "sqllib.ch"

#include "c:\browses\sql.ch"

#include "\objetivo\fileio.ch"

#include 'ord.ch'

#define CRLF Chr(13)+Chr(10)

*/////////////////////////////////////////////////////

Request HB_CODEPAGE_PT850

Request HB_LANG_PT

Request DESCEND

FUNCTION MAIN()

#define CLR_WINDOW 16

#define SRCPAINT 15597702

#define SRCAND 8913094

HB_SETCODEPAGE("PT850")

HB_LANGSELECT("PT")

SET DECIMALS TO 06

SET DATE FRENCH

SET DELETED On

SET CENTURY On

SET EPOCH TO 1960

SET EXCLUSIVE OFF

request DBFCDX

request sqllib

request mysql

rddSetDefault('mysql')

SQL CONNECT ON 'localhost' ;

PORT 3306 ;

USER 'root' ;

PASSWORD 'objetivo' ;

LIB 'MySQL'

if! database("objetivo")

SQLLIB_ExecSql(nil,"create database OBJETIVO")

else

// msginfo("Tabela ja Existe")

endif

IF SQL_ERRORNO() > 0

MSGALERT("NAO FOI POSSIVEL CRIAR A TABELA ERROR "+;

SQL_ERRORMSG())

SQL DISCONNECT

QUIT

ENDIF

SQL DISCONNECT

SQL CONNECT ON 'localhost' ;

PORT 3306 ;

DATABASE "OBJETIVO" ;

USER 'root' ;

PASSWORD 'objetivo' ;

LIB 'MySQL'

IF SQL_ErrorNO() > 0

Alert( "Não foi possível conectar ao banco de dados !;"+;

"Informe esta mensagem ao suporte : ;;"+;

SQL_ErrorMsg() )

QUIT

ENDIF

if ! table("grupo")

cTable := "create table a_grupo(Codigo int(3),;

Descricao varchar(40) NOT NULL,;

UNIQUE key(codigo))"

SQLLIB_ExecSql(nil, cTable)

if sql_errorno() > 0

MSGINFO("Tabela nao criada")

else

msginfo("tabela Criada")

endif

else

// msginfo("Existe tabela de Grupos")

endif

IF !Index( 'igrupo' )

cIndice := "CREATE INDEX a_idgrupo;

USING BTREE ON a_grupo(Codigo)"

SqlExecute("Start Transaction")

// SqlExecute(cIndice)

SQLLIB_ExecSql(nil,cIndice)

else

msginfo("indice existe")

endif

cSelect := "select * from Grupo"

Sqla := 'SELECT * FROM a_grupo use index(Codigo)'

use grupo new via "mysql" alias tmp

ordSetFocus("Codigo")

DbGotop()

use c:\objetivo\db\grupo via "dbfcdx" new alias grup

go top

PRIV AA

do while ! eof()

sele tmp

aba := Grup->Codigo

abb := grup->Descricao

if !(dbseek( aba ))

SQLLIB_ExecSql(NIL,"INSERT INTO Grupo(Codigo,Descricao) ;

VALUES (&aba,'&abb')")

endif

select grup

skip

enddo

select tmp

go top

define dialog oDlg from 01,01 to 20,70 title 'Testes SQL'

@ 01,01 listbox oLbx fields ;

headers "Código","Descricao" ;

size 250,100 of oDlg

@ 07,19 button 'Abandonar' of oDlg size 30,12 action ( oDlg:End() )

activate dialog oDlg centered

sql disconnect

return

Link to comment
Share on other sites

Olá Jose Hilton,

Parece que o problema é no tipo de campo (INT), experimente mudar o campo para decimal(3,0) ou char(3) ao invés de int(3). E use da forma que te falei. Se vc usar 'select ...' não vai funcionar. Apenas dbusearea() emula um dbf original. Os demais funcionam apenas como leitura.

Um abraço,

Alexandre Pereira

fwh 2.6, xharbour, .99.6, MyMake

msn: alexpdasilva6@hotmail.com

atualmente em Rondônia

Editado por - alex2002 on 01/04/2008 12:19:46

Link to comment
Share on other sites

Alex eu fiz

dbUseArea( .t., 'MySQL', 'a_grupo', 'tmp')

if index('igrupo')

SQLLIB_ExecSql(nil,"CLEAR INDICES")

ENDIF

Index on codigo TAG codigo to igrupo

Application

===========

Path and name: C:\sqlxdev\TESTE_FWH\PRG_OBJ\teste.EXE (32 bits)

Size: 1,363,968 bytes

Time from start: 0 hours 0 mins 0 secs

Error occurred at: 01/04/2008, 12:45:24

Error description: Error SQLLIB/4001 MySQL RDD: Operation not supported!

Stack Calls

===========

Called from SQL_ERROR(144)

Called from _MYSQL_ORDCREATE(1065)

Called from _MYSQL_ORDMANAGER(1014)

Called from ORDCREATE(0)

Called from MAIN(214)

alinha 214 e o index on xx tag xx to xx

alex essa tabela que eu quero index ela nao e DBF

e se eu entendi

foi uma tabela do sql

na realidade eu nao to entendendo bem, se eu quando cria a tabema eu tigo ja o indico e tanto quela ele cria o SQL%INDEXES

e quando eu faco a exportacao sem o seek ele diz

===========

Path and name: C:\sqlxdev\TESTE_FWH\PRG_OBJ\teste.EXE (32 bits)

Size: 1,363,456 bytes

Time from start: 0 hours 0 mins 0 secs

Error occurred at: 01/04/2008, 12:52:06

Error description: Warning SQLLIB/1000 MySQL RDD: Duplicate entry '1' for key 2

Stack Calls

===========

Called from SQL_ERROR(144)

Called from _MYSQL_EXECSQL(142)

Called from SQLLIB_EXECSQL(113)

Called from MAIN(247)

e com o seek ele diz

Application

===========

Path and name: C:\sqlxdev\TESTE_FWH\PRG_OBJ\teste.EXE (32 bits)

Size: 1,363,968 bytes

Time from start: 0 hours 0 mins 0 secs

Error occurred at: 01/04/2008, 12:53:21

Error description: Error MYSQL/1201 Workarea nÆo indexada

Stack Calls

===========

Called from SQL_ERRNOORDER(0)

Called from _MYSQL_SEEK(1828)

Called from DBSEEK(0)

Called from MAIN(246)

System

=====

e ai alguma ideia do que possa ser

tem algum outro comando que posso usa para testa se o item ja existe no cadastro para que nao possa ser gravado com duplicidade

agradeco pela atencao

no aguardo

Hilton

Link to comment
Share on other sites

Retire a messagem continua

dbUseArea( .t., 'MySQL', 'a_grupo', 'tmp')

if index('igrupo')

SQLLIB_ExecSql(nil,"CLEAR INDICES")

ENDIF

Index on codigo to igrupo

Application

===========

Path and name: C:\sqlxdev\TESTE_FWH\PRG_OBJ\teste.EXE (32 bits)

Size: 1,363,968 bytes

Time from start: 0 hours 0 mins 0 secs

Error occurred at: 01/04/2008, 17:05:45

Error description: Error SQLLIB/4001 MySQL RDD: Operation not supported!

Stack Calls

===========

Called from SQL_ERROR(144)

Called from _MYSQL_ORDCREATE(1065)

Called from _MYSQL_ORDMANAGER(1014)

Called from ORDCREATE(0)

Called from DBCREATEINDEX(59)

Called from MAIN(213)

System

======

CPU type: GetCPU() failed! 1800 Mhz

Hardware memory: 480 megs

Free System resources: 90 %

GDI resources: 90 %

User resources: 90 %

Compiler version: xHarbour build 0.99.50 Intl. (SimpLex)

Windows version: 5.1, Build 2600 Service Pack 2

Windows total applications running: 0

HIlton

Link to comment
Share on other sites

Jose

Não tenho certeza mas acho q. a Sqllib Free não da suporte aos as funções DbSeek()/OrdSetFocus() nada disso.

me refiro a

ordSetFocus("Codigo")

DbGotop()

if !(dbseek( aba ))

SQLLIB_ExecSql(NIL,"INSERT INTO Grupo(Codigo,Descricao) ;

VALUES (&aba,'&abb')")

// Aqui tbem teria um erro pos nao iria colocar o valor do campo codigo vc teria q. criar uma query antes

+- assim

cQuery := "INSERT INTO a_Grupo(Codigo,Descricao) VALUES (" + Str(aba) + ",'&abb')"

SQLLIB_ExecSql(NIL,cQuery )

Marcelo Ferro

Petrópolis - Rj

Fwh7.04/xHarbour 99.71/SqlLib /xMate/WS

Link to comment
Share on other sites

citação:Não tenho certeza mas acho q. a Sqllib Free não da suporte aos as funções DbSeek()/OrdSetFocus() nada disso.
id=quote>id=quote>

Eu tenho certeza. A versão free não suporta mesmo. só a comercial.

Eroni

(48) 3045-1575

xHarbour 0.99.5 & FWH 2.4

SqlLib, MySql & Dbf

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...