What is the best of MySql (lib or class) TMySql, TDolphin
- Daniel Garcia-Gil
- Posts: 2365
- Joined: Wed Nov 02, 2005 11:46 pm
- Location: Isla de Margarita
- Contact:
Re: What is the best of MySql (lib or class) TMySql, TDolphin
Hello
are you downloaded from svn?
are you downloaded from svn?
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Re: What is the best of MySql (lib or class) TMySql, TDolphin
To be honest - I dont remember. Where is svn?Daniel Garcia-Gil wrote:Hello
are you downloaded from svn?
- Daniel Garcia-Gil
- Posts: 2365
- Joined: Wed Nov 02, 2005 11:46 pm
- Location: Isla de Margarita
- Contact:
Re: What is the best of MySql (lib or class) TMySql, TDolphin
look
http://tdolphin.blogspot.com/2010/06/co ... rting.html
do you have gmail account? maybe we can talk by gmail chat
http://tdolphin.blogspot.com/2010/06/co ... rting.html
do you have gmail account? maybe we can talk by gmail chat
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Re: What is the best of MySql (lib or class) TMySql, TDolphin
I cannot change value of a field :
When I run this sample second time account is still "dog".
Code: Select all
oQry = oServer:Query( "SELECT account, last_name, first_name,balance FROM lanu" )
do while !oQry:Eof()
if oQry:account="dog"
?"before",oQry:account,oQry:balance
oQry:FieldPut("account" , "sobachka" )
oQry:FieldPut("balance" , 3.14 )
?"after",oQry:account,oQry:balance
endif
oQry:Skip()
enddo
oQry:Save()
- Daniel Garcia-Gil
- Posts: 2365
- Joined: Wed Nov 02, 2005 11:46 pm
- Location: Isla de Margarita
- Contact:
Re: What is the best of MySql (lib or class) TMySql, TDolphin
Hello
put the save after modify value
put the save after modify value
Code: Select all
do while !oQry:Eof()
if oQry:account="dog"
?"before",oQry:account,oQry:balance
oQry:account = "sobachka"
oQry:balancen = 3.14
oQry:Save()
?"after",oQry:account,oQry:balance
endif
oQry:Skip()
enddo
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Re: What is the best of MySql (lib or class) TMySql, TDolphin
[quote="Daniel Garcia-Gil"]Hello
put the save after modify value
It doesnt help. After Save() value becomes as it was before FieldPut!
put the save after modify value
Code: Select all
do while !oQry:Eof()
if oQry:account="dog"
?"before",oQry:account,oQry:balance // dog 0.00
oQry:FieldPut("account" , "sobachka" )
oQry:FieldPut("balance" , 3.14 )
?"after",oQry:account,oQry:balance // sobachka 3.14
oQry:Save()
?"after save",oQry:account,oQry:balance // dog 0.00
endif
oQry:Skip()
enddo
- Daniel Garcia-Gil
- Posts: 2365
- Joined: Wed Nov 02, 2005 11:46 pm
- Location: Isla de Margarita
- Contact:
Re: What is the best of MySql (lib or class) TMySql, TDolphin
hello
it's a better way and more fast
with dolphin
method 1
method 2
it's a better way and more fast
with dolphin
method 1
Code: Select all
oServer:Execute( "UPDATE table_name SET account = 'sobachka', balance = 3.14 WHERE account = 'dog' )
Code: Select all
oServer:Update( "table_name", { "account", "balance" }, { 'sobachka', 3.14 } , "account = 'dog' " )
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Re: What is the best of MySql (lib or class) TMySql, TDolphin
1) May there is better way but why this way doesn't work? And what if I need to replace just one record?Daniel Garcia-Gil wrote:hello
it's a better way and more fast
with dolphin
method 1method 2Code: Select all
oServer:Execute( "UPDATE table_name SET account = 'sobachka', balance = 3.14 WHERE account = 'dog' )
Code: Select all
oServer:Update( "table_name", { "account", "balance" }, { 'sobachka', 3.14 } , "account = 'dog' " )
2)Both ways give me same error :
08/15/12 19:16:14
Error MYSQL/1406 Data too long for column 'ACCOUNT' at row 1
=> DOLPHIN_DEFERROR line 2478
=> TDOLPHINSRV:CHECKERROR line 691
=> TDOLPHINSRV:SQLQUERY line 1705
=> TDOLPHINSRV:UPDATE line 1920
=> MAIN line 51
e:genCode 0
e:osCode 0
Workarea :
- Daniel Garcia-Gil
- Posts: 2365
- Joined: Wed Nov 02, 2005 11:46 pm
- Location: Isla de Margarita
- Contact:
Re: What is the best of MySql (lib or class) TMySql, TDolphin
Hello
please create the table in Dolphin server, add some data and post the minimal sample here...
please create the table in Dolphin server, add some data and post the minimal sample here...
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Re: What is the best of MySql (lib or class) TMySql, TDolphin
1) This is the Dolphin server ?Daniel Garcia-Gil wrote:Hello
please create the table in Dolphin server, add some data and post the minimal sample here...
host=dolphintest.sitasoft.net
user=test_dolphin
psw=123456
flags=0
port=3306
dbname=dolphin_man
2) I there a sample how to create a table from Dbstruct() ?
- Daniel Garcia-Gil
- Posts: 2365
- Joined: Wed Nov 02, 2005 11:46 pm
- Location: Isla de Margarita
- Contact:
Re: What is the best of MySql (lib or class) TMySql, TDolphin
yesmosh1 wrote:1) This is the Dolphin server ?
host=dolphintest.sitasoft.net
user=test_dolphin
psw=123456
flags=0
port=3306
dbname=dolphin_man
use in mysql console... SHOW CREATE TABLE my_table
use this result to create the table in Dolphin server, is very fast and to easy
nomosh1 wrote:2) I there a sample how to create a table from Dbstruct() ?
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Re: What is the best of MySql (lib or class) TMySql, TDolphin
Daniel Garcia-Gil wrote:Hello
please create the table in Dolphin server, add some data and post the minimal sample here...
Code: Select all
#include "tdolphin.ch"
#define CRLF Chr( 13 ) + Chr( 10 )
PROCEDURE Main()
LOCAL oServer := NIL
LOCAL cText := ""
local chost:="dolphintest2.sitasoft.net"
local cuser:="test2_dolphin"
local cpsw:="123456"
local cflags:=0
local cport:=3306
local cdbname:="tdolphin_test"
local oQry
IF ( oServer := ConnectTo(2) ) == NIL
RETURN
ENDIF
IF ! oServer:lError
cText += "Connection OK" + CRLF
cText += "Host: " + oServer:cHost +CRLF
cText += "Database: " +oServer:cDBName + CRLF
cText += oServer:GetServerInfo() + CRLF
cText += oServer:GetClientInfo()
? cText + CRLF
ENDIF
oQry = oServer:Query( "SELECT account, last_name, first_name,balance FROM lanu2" )
do while !oQry:Eof()
if oQry:account="dog"
?"before",oQry:account,oQry:balance
oQry:FieldPut("account" , "sobaka" )
oQry:FieldPut("balance" , 3.14 )
?"after",oQry:account,oQry:balance
oQry:Save()
?"after save",oQry:account,oQry:balance
endif
oQry:Skip()
enddo
?"Wait"
inkey(0)
oServer:End()
RETURN
#include "connto.prg"
- Daniel Garcia-Gil
- Posts: 2365
- Joined: Wed Nov 02, 2005 11:46 pm
- Location: Isla de Margarita
- Contact:
Re: What is the best of MySql (lib or class) TMySql, TDolphin
Hello
not work because dolphin delete extra space using Function AllTrim
the field LAST_NAME all content start with one SPACE,
example: " polkan"
when TDolphin use the Method Save, does convert the data to UPDATE statement ( but delete the first space ), now the field FIRST_NAME is "" TDolphin convert it to NULL (maybe a little bug)
for this case the best way is use the statement UPDATE directly...
now if you create a primary key, TDolphin locate the value for primary key and will make the SAVE successful
look the next sample with a copy of lanu2 ( lanu2_copy)
not work because dolphin delete extra space using Function AllTrim
the field LAST_NAME all content start with one SPACE,
example: " polkan"
when TDolphin use the Method Save, does convert the data to UPDATE statement ( but delete the first space ), now the field FIRST_NAME is "" TDolphin convert it to NULL (maybe a little bug)
for this case the best way is use the statement UPDATE directly...
now if you create a primary key, TDolphin locate the value for primary key and will make the SAVE successful
look the next sample with a copy of lanu2 ( lanu2_copy)
Code: Select all
#include "tdolphin.ch"
PROCEDURE Main()
LOCAL oServer := NIL
LOCAL cText := ""
local chost:="dolphintest2.sitasoft.net"
local cuser:="test2_dolphin"
local cpsw:="123456"
local cflags:=0
local cport:=3306
local cdbname:="tdolphin_test"
local oQry
CONNECT oServer HOST chost ;
USER cUser ;
PASSWORD cpsw ;
PORT cPort ;
DATABASE cDBName
oServer:bDebug = {| c | logfile( "debug.txt", { c } ) }
oQry = oServer:Query( "SELECT id, account, last_name, first_name,balance FROM lanu2_copy" )
do while !oQry:Eof()
if oQry:account="dog"
oQry:FieldPut("account" , "sobaka" )
oQry:FieldPut("balance" , 3.14 )
oQry:Save()
endif
oQry:Skip()
enddo
oServer:End()
RETURN
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Re: What is the best of MySql (lib or class) TMySql, TDolphin
Dear Mosh1,
I use update() or replace data in field and save() for delete the record. I'm not quite show what is the different but it's working fine for me.
Dutch
I use update() or replace data in field and save() for delete the record. I'm not quite show what is the different but it's working fine for me.
Dutch
Code: Select all
odb1:=oServer:Query("select * from rmty_avl")
n := 0
cTlRec := strim(odb1:reccount())
odb1:gotop()
do while !odb1:eof() // odb1:recno() <= 100
if valtype(odb1:rta_date) = 'D'
if odb1:fieldget("rta_date") < MEMVAR->comdat
do while odb1:fieldget("rta_date") < MEMVAR->comdat .and. !odb1:eof()
odb1:delete()
odb1:save()
end
else
if RTY->(DbSeek( dtos(odb1:rta_date)+odb1:rta_rmty ))
if odb1:fieldget("rta_ooo") <> RTY->RTA_OOO .or. odb1:fieldget("rta_occ") <> RTY->RTA_OCC
odb1:fieldput('rta_ooo', RTY->RTA_OOO )
odb1:fieldput('rta_occ', RTY->RTA_OCC )
odb1:update()
n++
end
end
end
end
odb1:skip()
end
odb1:End()
mosh1 wrote:I cannot change value of a field :
When I run this sample second time account is still "dog".Code: Select all
oQry = oServer:Query( "SELECT account, last_name, first_name,balance FROM lanu" ) do while !oQry:Eof() if oQry:account="dog" ?"before",oQry:account,oQry:balance oQry:FieldPut("account" , "sobachka" ) oQry:FieldPut("balance" , 3.14 ) ?"after",oQry:account,oQry:balance endif oQry:Skip() enddo oQry:Save()
Regards,
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Re: What is the best of MySql (lib or class) TMySql, TDolphin
Dear dutch,
There is no such method in my TDolphin versiondutch wrote: odb1:update()