[Vala] mysql bindings in genie



Trying mysql bindings in genie ...

[indent=4]
uses
    Mysql

init
    MysqlHost: string = "localhost"
    UserName: string = "weberp_db_user"
    Password: string = "weberp_db_pwd"
    DatabaseName: string = "weberpdemo"
    MysqlDB : Mysql.Database

    MysqlDB = new Mysql.Database()
MysqlDB.real_connect(MysqlHost, UserName, Password, DatabaseName, 0,"/tmp/mysql.sock")
    ReturnValue:int
    ResultSet:Mysql.Result
    MyRow: array of string
ReturnValue = MysqlDB.query("SELECT stockid, description FROM stockmaster")
    ResultSet = MysqlDB.use_result()
    while !ResultSet.eof()
        MyRow = ResultSet.fetch_row()
        print "stockid: %s | description: %s", MyRow[0], MyRow[1]


I get:
# valac --pkg=mysql mysqltest.gs
/tmp/ccumEU4F.o: In function `_vala_main':
mysqltest.vala.c:(.text+0xb6): undefined reference to `mysql_init'
mysqltest.vala.c:(.text+0xca): undefined reference to `mysql_close'
mysqltest.vala.c:(.text+0x116): undefined reference to `mysql_real_connect'
mysqltest.vala.c:(.text+0x13e): undefined reference to `mysql_query'
mysqltest.vala.c:(.text+0x14c): undefined reference to `mysql_use_result'
mysqltest.vala.c:(.text+0x160): undefined reference to `mysql_free_result'
mysqltest.vala.c:(.text+0x178): undefined reference to `mysql_eof'
mysqltest.vala.c:(.text+0x1de): undefined reference to `mysql_fetch_row'
mysqltest.vala.c:(.text+0x27b): undefined reference to `mysql_close'
mysqltest.vala.c:(.text+0x293): undefined reference to `mysql_free_result'
collect2: ld returned 1 exit status
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)


The mysql.h file is under /usr/include/mysql together with all the other mysql header files.

/usr/share/vala/vapi/mysql.vapi

says

[CCode (lower_case_cprefix = "mysql_", cheader_filename = "mysql/mysql.h")]

I am using vala 0.9.2

Appreciate any thoughts??

Finding it very tough to learn! Maybe Vala is the way to go rather than genie?

Phil


PS the code at http://live.gnome.org/Vala/XmlSample
does not compile for me I get
#  valac --pkg libxml-2.0 xmlreader.vala
/initrd/mnt/dev_save/my-documents/genie_programs/xmlreader.vala.c: In function 'xml_sample_create_simple_xml': /initrd/mnt/dev_save/my-documents/genie_programs/xmlreader.vala.c:198: warning: passing argument 2 of 'xmlDocDumpMemory' from incompatible pointer type /usr/include/libxml2/libxml/tree.h:1107: note: expected 'xmlChar **' but argument is of type 'char **'



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]