|
| WD21: How to Create & Update MySQL Tempoary Table |
| Iniciado por guest, 12,mar. 2018 17:49 - 3 respuestas |
| |
| | | |
|
| |
| Publicado el 12,marzo 2018 - 17:49 |
Dear All,
I have struggled with a challenge for while and thought I will share it here for help.
I have the code below; I want to create a temporary table in MySQL and insert records into it to speed up a process that is running slow updating directly on disk.
=========Code============== ShtTable is string="MF" indb is string="INFILE" SQL1, SQL2 are Data Source
sQuery is string="create temporary table "+ShtTable +" ("+... "`country` varchar(10) NOT NULL,"+... "`towncode` varchar(10) default NULL,"+... "`townaddress` varchar(20) default NULL,"+... "`townDigiLoc` varchar(20) default NULL'"
IF NOT HExecuteSQLQuery(SQL1 , mainConnect, hQueryDefault+hQueryWithoutCorrection, sQuery ) THEN Error(HErrorInfo(hErrFullDetails)) RETURN END
sQuery2="insert into "+ShtTable+"select * from "+indb
IF NOT HExecuteSQLQuery(SQL2, mainConnect, hQueryDefault+hQueryWithoutCorrection, sQuery2) THEN Error(HErrorInfo(hErrFullDetails)) RETURN END
===The above works without error but when I try to display contents of SQL2 as below, I get an error that SQL2 is not initialized.
BuildBrowsingTable(TABLE2, SQL2, taItemCaption+taFillTable)
I will appreciate any help to get over this since I really need to reduce the processing speed. I could also do with another method than this approach.
Sam |
| |
| |
| | | |
|
| | |
| |
| Publicado el 13,marzo 2018 - 02:22 |
Hi Sam,
Are you sure your code works... i.e. where is your sQuery2 variable created?
Is this all your code or are you trying to simplify it for us but missing something out? |
| |
| |
| | | |
|
| | |
| |
| Publicado el 13,marzo 2018 - 06:12 |
| try to put create and insert in one sql |
| |
| |
| | | |
|
| | |
| |
| Publicado el 13,marzo 2018 - 10:23 |
Thanks for the comments and lead.
sQuery2 is defined before usage so it works well. Moreover I have used this mode of access for a lot of my code and it works fine.
Maybe I will simplify my question this way:
1. What is the best way to update or insert records from one MySQL file into a temporary file without noticeable degradation in speed of process.
My client insist on MySQL. Is there a way to partly process in HFSQL and write to MySQL and gain some speed?
Thanks in advance.
Sam |
| |
| |
| | | |
|
| | | | |
| | |
|