Jump to content

Recommended Posts

  • Replies 385
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

here's the first release... only a few functions so far, any input would be appriciated Todo: _CreateTable() _CreateColumn() _DropCol() _DropTbl() _CountRecords() _CountTables() _GetTblNames() _GetCol

So much for homework lol... No includes, ready to compile and use wherever you like. Global Const $ES_PASSWORD = 32 Global Const $ES_AUTOVSCROLL = 64 Global Const $ES_AUTOHSCROLL = 128 $sDr

Try to use my ADO.au3 UDF - look in my signature.

Posted Images

111.111.111.111 works too :)

As i said, i connected to my localhost serv first, and then to other not real servers.

I see few bugs in your code.

When you use _MySqlConnect you asign its result to the $sql variable.

But when you want to close the connection you use a viariable returned by _Query function. In fact you dont close the connection with the DB.

Edited by EFF
Link to post
Share on other sites
  • I've found the problem, and am updating the first post now with new file.
  • Edited _AddRecord so you do not have to enter a value, the default will be the default value for that column.
  • Removed 4 msgboxes that i had left on after debugging by accident.
~cdkid Edited by cdkid
AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
Link to post
Share on other sites

Hmm i skimmed through the thread quickly and didnt see my question answered. For the .dll for the mysql stuff, can it just be in your programs directory, or does it need to be in a certain place? Because that might be difficult when distributing a program that does soemthing like authenticate you before you can run the program.

Link to post
Share on other sites

Hmm, good idea, fluxster, i'll se what i can come up with. Just so everyone knows, i'm converting all the functions to VB COM so they can be used in most any language

via objcreate

~cdkid

edit:

this install wont be hard at all, i'll just use WinSetState @SW_HIDE and ControlClicks, when i finish it, i'll post it up here.

Maybe I'm missing something, but is this installer now available?

Thanks

“Efficiency is doing things right; effectiveness is doing the right things.”-Peter F. Drucker

Link to post
Share on other sites

Look on page 2(or 3) in one of my posts it's attatched. I'll add it to the first post.

*first post updated*

~cdkid

Edited by cdkid
AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
Link to post
Share on other sites

I don't know. A COM DLL (ADODB) does everything for me. I imagine that it encrypts the connection string ETC, but I'm sure you could find more info on MSDN

~cdkid

AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
Link to post
Share on other sites

ADODB is secure...as good as any db connexions u r going to make ith VB, or ne other application where u use ADODB...the UDF does not send this info over the network...it just passes them to the Connector.

Hope it clears ur doubts

I believe we should all pay our tax with a smile. I tried - but they wanted cash!

Link to post
Share on other sites

Actually, KCL, ADODB is one of the slowest connectors I found :) but it's the only one that works with scripting languages.

The System.Data.ODBC namespace has a much faster connector, executing queries in only a few miliseconds, usually.

I've been trying to figure out how i can return a DataTable to a scripting language from my COM DLL, but it always throws a big error if i try to access any methods or properties of the returned DataTable from a scripting language (AutoIt, VBScript) If anyone with a little more of a clue than me could help me figure it out, that'd be great :mellow:

~cdkid

Edited by cdkid
AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
Link to post
Share on other sites

Hi guys,

I'm new at AutoIt. First, this is a really great UDF and one of the reasons y I started learning AutoIt. But it was a little setback when I did my first test with the MySQL UDS. I tried to connect to an external Server first, which caused an error. I got the same error when I tried to connect to my local server.

My error :mellow: :

Posted Image

My Code:

; MySQL Connect
#include <mysql.au3>


$connect = _MySQLConnect('User', 'password', 'database', 'localhost')
$row = _Query($connect, "SELECT * FROM test")

With $row
While NOT .EOF
    MsgBox(0, "ID output", "ID: " & .Fields("id").value)
WEnd
    EndWith

_MySQLEnd($connect)

Do you know why I get this error? Did I make any mistakes?

Thanks for your help!

Chris

BTW. you maybe allready noticed: I'm from germany. So please be clement with my english :) Thanks!

Link to post
Share on other sites

Hi,

Will "ADODB" let you "save table data" [as I have said, I found that there is a query command for this in MySQL] to csv file, in one command?; like in my "sqliteExe.au3", you could then get the table data quickly into AutoIt from the csv?

Randall

(PS I think the command only works quickly if you save the file on the same machine as the Database; depending on permissions and speed, you may have to be able to transfer the csv to the client machine?)

Edited by randallc
Link to post
Share on other sites

@dunno: Do u have the ODBC connector properly installed? Make sure the username, password, hostname and database are correct.

Finally...always use the COM error handler while using ne COM associated UDFs. U can find the COM Error Handler here:

COM Error Handler

Edited by kclteam

I believe we should all pay our tax with a smile. I tried - but they wanted cash!

Link to post
Share on other sites

Dunno what i'm doing wrong maybe someone else has an idea.

So thats my code:

#include <mysql.au3>
#include <file.au3>
#notrayicon


$sql_name = "root"
$sql_pass = ""
$sql_daba = "mydb"
$sql_host = "localhost"
$psave = "C:\mytext.txt"
$pcount = _FileCountLines("$psave")

$sql = _MySQLConnect($sql_name, $sql_pass, $sql_daba, $sql_host)
$file = FileOpen($psave, 0)
$alines = 1

Do 
$azeile = FileReadLine($file, $alines)

_AddRecord($sql, "txtfile", "line", $alines)
_AddRecord($sql, "txtfile", "content", $azeile)
    
$alines = $alines + 1

Until $alines = $pcount

It works well. But it writes the data wrong into the spreadsheet.

So if my txt-file is like that:

I love autoit

I love mysql

<3<3<3

This is written in the spreadsheet:

Line | Content

1 |

0 | I love autoit

2 |

0 | I love mysql

3 |

0 | <3<3<3

Any idea what i am doing wrong?
Link to post
Share on other sites

$pcount = _FileCountLines("$psave")

Should probably be

$pcount = _FileCountLines($psave)

I may be off-base here, but that should help.

~cdkid

EDIT:

I've just tested this script

#include <MySQL.au3>
$a = _MySQLConnect("*******","****","*****","******")
#include <File.au3>
$lines = _FileCountLines("c:\test.txt")
$afile = FileOpen("c:\test.txt", 0)
For $i = 1 To $lines
    _AddRecord($a, "users", "username", FileReadLine($afile, $i))
Next
_MySQLEnd($a)
FileClose($afile)

c:\test.txt contained

autoit > all

MySQL & autoit

->->->

and three records were added, with the correct value.

~cdkid

Edited by cdkid
AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
Link to post
Share on other sites

Hi guys,

I'm new at AutoIt. First, this is a really great UDF and one of the reasons y I started learning AutoIt. But it was a little setback when I did my first test with the MySQL UDS. I tried to connect to an external Server first, which caused an error. I got the same error when I tried to connect to my local server.

My error :mellow: :

My Code:

; MySQL Connect
#include <mysql.au3>
$connect = _MySQLConnect('User', 'password', 'database', 'localhost')
$row = _Query($connect, "SELECT * FROM test")

With $row
While NOT .EOF
    MsgBox(0, "ID output", "ID: " & .Fields("id").value)
WEnd
    EndWith

_MySQLEnd($connect)

Do you know why I get this error? Did I make any mistakes?

Thanks for your help!

Chris

BTW. you maybe allready noticed: I'm from germany. So please be clement with my english :) Thanks!

Sorrry I took so long to answer.

I see the problem, you need the latest beta. It can be downloaded in the developers forum in the sticky called "Latest Beta"

~cdkid

Edited by cdkid
AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
Link to post
Share on other sites

Sorrry I took so long to answer.

I see the problem, you need the latest beta. It can be downloaded in the developers forum in the sticky called "Latest Beta"

~cdkid

yeah! It works! Thanks a lot cdkid! U did a great job!!

Cheers,

Chris

Link to post
Share on other sites

Well, that was my mistake, dunno why i wrote the ". Anyway it hasnt worked with the _AddRecord's. So i tried using the query-udf and it worked. I tried this instead of the addrecord:

For $i = 1 To $lines

_query($sql, "INSERT INTO `txtfile` ( `line` , `content` ) VALUES ('" & $i & "', '" & FileReadLine($afile, $i) & "');")

Next
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...