Module does not define type // php

116 views
Skip to first unread message

skittles

unread,
Apr 2, 2015, 2:14:23 AM4/2/15
to haxe...@googlegroups.com
Hi,

i suppose it is obvious i am starting new with haxe  :)
I got it up and running with sublime text on mac. 

Now that i have some Basics, i want to step in and start to open up a DatabaseConnection.
For this i have an application which is to use a DataBaseUtil to do that.

Application.hx
package ;

import com.skittles.haxe.util.DataBaseUtil;

class Application 
{
public static function main()
{
var db_connection : sys.db.Connection = com.skittles.haxe.util.DataBaseUtil.getDBConnection();
}
}

com.skittles.haxe.util.DataBaseUtil;

package com.skittles.haxe.util;


class DatabaseUtil
{
private static var db_connection : sys.db.Connection;

/**
     * Checks if database connection is opened.
     * If not, then tries to open it.
     */
    private static function databaseConnectionAvailable() 
    {
        if (db_connection != null) {
            return true;
        } else {
            try {
                db_connection = sys.db.Mysql.connect(
 
           host : "localhost",
           port : 8889,
           user : "root",
           pass : "root",
           socket : null,
           database : "skittles"
        });


                return true;
            } catch ( e:sys.db.Object) {
                return false;
            }
        }
    }

    
    public static function getDBConnection() : sys.db.Connection
    {
    if( databaseConnectionAvailable() )
    {
    return db_connection;
    }
    return null;
    }
}


I do get an Error that " Module com.skittles.haxe.util.DataBaseUtil does not define type DataBaseUtil . 
First of all i do not really find answers, what this means - and therefore i do not now, what type is expected.

Can someone please tell me how to read that Error and what changes are needed to do to work properly?

Thanks in advance!




Jason O'Neil

unread,
Apr 2, 2015, 4:26:33 AM4/2/15
to haxe...@googlegroups.com
Haxe is case sensitive, it looks like you've used both "DatabaseUtil" and "DataBaseUtil", which are not the same.

That's my first guess anyway :)

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.

skittles

unread,
Apr 2, 2015, 4:59:36 AM4/2/15
to haxe...@googlegroups.com, he...@jasono.co
I can't believe i did this kind of error . Thx - of course it needs to be DataBaseUtil....

Thx Jason!
Reply all
Reply to author
Forward
0 new messages