[Gambas-user] Is there a limit for MySQL-Connections?

Alex Ciric a.ciric at ...1147...
Tue Oct 25 11:45:59 CEST 2005


Hello Nigel,

thanks for your answer. In the meantime i solved that problem by making 
more instances of my sql-class.

Here is my code of that class:
------------------------------
' Gambas class file
STATIC sql_open AS Boolean
STATIC conn AS NEW Connection
PUBLIC authenticated AS String  'THIS MAKES PROBLEMS

PUBLIC SUB _new()
IF (sql_open = FALSE) THEN make_connection
END

STATIC PUBLIC FUNCTION sql_query(query AS String) AS result
   DIM res AS Result
   DIM sql AS String
   sql = query
   res = conn.Exec(sql)
   RETURN res
END

STATIC FUNCTION make_connection() AS Boolean
   WITH conn
     .Type = "mysql"
     .Host = "localhost"
     .Login = "root"
     .Password = ""
     .Name = "ciric"
   TRY conn.Open
   IF ERROR THEN
     Message("Cannot Open Database. Error = " & Error.Text)
     RETURN FALSE
   END IF
   sql_open = TRUE
   RETURN TRUE
END WITH
END

PUBLIC SUB _free()
'conn.Close
END
------------------------------

Now i make an instance of that class for every single form i use.
But there are two last problems:
1. It seems, that the constructor is not executed for every instance. 
Example: i have a main form including some details about customers. If i 
  open another form with more details, i create a new instance of my 
sql-class for that specific form. Also i close the parent form. This 
executes "conn.close". The new form then says that there is no 
sql-connection. Do you have any clue?

2. At the top i have the variable "authenticated" declared as Public. At 
the moment this variable is NOT used in the whole application. But if i 
delete that variable, i get the error "Class MAIN is static" when i want 
to execute a sql query. Why is this?

Thanks.

Alex



nigel at ...38... schrieb:
> Alex,
> 
> Do you have any code that reproduces this error? I will investigate it if so.
> 
> Regards
> 
> Nigel
> 
> 
>>Message Received: Oct 24 2005, 04:14 PM
>>From: "Alex Ciric" <a.ciric at ...1147...>
>>To: gambas-user at lists.sourceforge.net
>>Cc: 
>>Subject: [Gambas-user] Is there a limit for MySQL-Connections?
>>
>>Hi together.
>>
>>I am working on a crm solution. So i am using a log of SQL-Queries.
>>But often i get a Sig11 error or sometimes an "SQL-Connection already 
>>opened" Error.
>>
>>Is this because of an Connetion-limit or are there other interesting 
>>limits when using SQL-DBs with gambas?
>>
>>Thx
>>
>>Alex
>>
>>
>>-------------------------------------------------------
>>This SF.Net email is sponsored by the JBoss Inc.
>>Get Certified Today * Register for a JBoss Training Course
>>Free Certification Exam for All Training Attendees Through End of 2005
>>Visit http://www.jboss.com/services/certification for more information
>>_______________________________________________
>>Gambas-user mailing list
>>Gambas-user at lists.sourceforge.net
>>https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>>
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by the JBoss Inc.
> Get Certified Today * Register for a JBoss Training Course
> Free Certification Exam for All Training Attendees Through End of 2005
> Visit http://www.jboss.com/services/certification for more information
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user





More information about the User mailing list