remedial mysql???
Mike Bonner
bonnmike at gmail.com
Sat Aug 18 19:32:18 EDT 2012
Hmm, ok alternate idea.
I did this:
<?lc
put "Mike,Carl,Joe,George,Maynard,Pete,Mark,Mark,Mark,Mark" into tFirst
put
"Mikeson,Carlson,Joeson,Georgeson,Maynardson,Peteson,Markson,Yamarkson,Yomarkson,Yemarkson"
into tLast
put the milliseconds into tStart -- for timing
## build a list of 100 transactions with the loop but make sure to put the
start in there first.
put "START TRANSACTION;" into tList
repeat 100 times
put any item of tFirst into fName
put any item of tLast into lName
put merge("INSERT INTO people (first_name,last_name) VALUES
('[[fName]]','[[lName]]');") & cr after tList
end repeat
## put the final commit into tList
put "COMMIT;" after tList
## you'll want a way to create unique temp file names
put the milliseconds & ".sql" into tDbFile
## put the sequence of commands we created into a file.
put tList into url ("file:" & tDbFile)
## use the mysql command directly to insert from the file that was created
get shell(merge("/usr/bin/mysql --user=yourdbusername
--password=yourdbpassword yourdatabasename < [[tDbFile]]"))
put " It took: " & the milliseconds - tStart & cr
get shell(merge("rm [[tDbFile]]")) -- remove the temp file
?>
It works.
Inserting 100 records, including the time to build and create the file
takes about 14 milliseconds.
If you have trouble (like it can't find mysql) you can do a "put
shell("which mysql") and it will tell you where it is.
More information about the use-livecode
mailing list