Gibt es noch die libmysql.dll?

Für allgemeine Fragen zur Programmierung mit PureBasic.
scoty
Beiträge: 64
Registriert: 18.10.2005 16:43
Wohnort: Raum Hildesheim

Gibt es noch die libmysql.dll?

Beitrag von scoty »

Hallo Community,
ich wollte gerade ein Beispiel benutzen um mich mit meiner mySQL-Datebank zu verbinden.

Das Problem ist, dass die Website ders Downloadlink: www.mysqltools.com zum Verkauf steht.

Kennt jemand eine neu Quelle oder kann mir die DLL irgendwie anders zukommen lassen?


Gruß Scotty
Benutzeravatar
Bisonte
Beiträge: 2465
Registriert: 01.04.2007 20:18

Re: Gibt es noch die libmysql.dll?

Beitrag von Bisonte »

also auf der offiziellen Seite : http://dev.mysql.com ist sie im installerpaket (vom 5.5.16)
drin (nach installation im Lib ordner) da haste dann definitiv die aktuellste


warum in der zip nur die sourcen drin sind (obwohl da nix von src steht) weiss der geier ;)
PureBasic 6.21 (Windows x86/x64) | Windows11 Pro x64 | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | GeForce RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
Benutzeravatar
Shardik
Beiträge: 746
Registriert: 25.01.2005 12:19

Re: Gibt es noch die libmysql.dll?

Beitrag von Shardik »

Es ist nicht nötig, das komplette Installationspaket herunterzuladen und MySQL
komplett zu installieren, nur um an die libmysql.dll heranzukommen... :wink:

Es reicht, von http://dev.mysql.com/downloads/connector/c die Datei
mysql-connector-c-noinstall-6.0.2-win32.zip (für Windows x86) herunterzuladen.
Für Windows x64, Linux und MacOS existieren separate Downloads. Eine Registrierung
für den Download ist übrigens nicht nötig. Nach dem Klick auf die Download-Schaltfläche
einfach ganz unten auf der Seite auf den Link "No thanks, just take me to the
downloads!
" klicken... :wink:

Danach sollte man aus dem Verzeichnis mysql-connector-c-noinstall-6.0.2-win32\lib
die Datei libmysql.dll nach C:\Windows\System32 kopieren und die Datei
libmysql.lib (nur für Windows nötig) nach
C:\Programme\PureBasic 4.xx\PureLibraries\Windows\Libraries
kopieren.

Einen guten MySQL-Wrapper von Thalius (basierend auf einem Wrapper von Flype),
der unter Windows und Linux läuft (bei mir im Einsatz) und auch unter Mac OS und
AmigaOS laufen sollte, findet man hier:
http://www.purebasic.fr/english/viewtop ... 12&t=29361
Benutzeravatar
Bisonte
Beiträge: 2465
Registriert: 01.04.2007 20:18

Re: Gibt es noch die libmysql.dll?

Beitrag von Bisonte »

Schade das MySQL Lizenzgebühren verlangt, wenn man damit ein kommerzielles Produkt bastelt.
Sonst hätte Fred, laut seiner Aussage die Funktionen nativ implementiert.
PureBasic 6.21 (Windows x86/x64) | Windows11 Pro x64 | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | GeForce RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
VoSs2o0o
Beiträge: 25
Registriert: 29.08.2004 16:58
Kontaktdaten:

Re: Gibt es noch die libmysql.dll?

Beitrag von VoSs2o0o »

Hier mal meine Version eines Wrappers für libmySQL.dll

04.12.12 aktualisiert, neue Version 1.13
Siehe hier: http://forums.purebasic.com/german/view ... =6&t=26151

untenstehender Code veraltet....

Code: Alles auswählen

; German forum, English Forum 
; Author: VoSs2o0o
; Version: 1.11
; Date: 25. Januar 2012
; OS: Windows
;
; Library for using MySQL with the libmysql.dll 
; You can download mysql-connector-c-noinstall-6.0.2-win32.zip (für Windows x86)  package from
; http://dev.mysql.com/downloads/connector/c to get the dll.
;
; The Library supports the Purebasic Standard to connect to databases, but also supports the Mysql-Syntax
; See an example at the bottom of the code.

EnableExplicit

#MySQL_CLIENT_COMPRESS = 32 ;client_flag for compress

Global __Lib_mysql_hdl.l, __mysqllibinit, __mysql_pb_any

Structure st_MYSQL_ROW
  fields.s[255]
EndStructure

Structure st_mysql_field
  *name.s                    ;/* Name of column */
  *org_name.s                ;/* Original column name, if an alias */
  *table.s                   ;/* Table of column if column was a field */
  *org_table.s               ;/* Org table name, if table was an alias */
  *DB.s                      ;/* Database for table */
  *catalog.s	               ;/* Catalog for table */
  *def.s                     ;/* Default value (set by mysql_list_fields) */
  length.l                   ;/* Width of column (create length) */
  max_length.l               ;/* Max width for selected set */
  name_length.l
  org_name_length.l
  table_length.l
  org_table_length.l
  db_length.l
  catalog_length.l
  def_length.l
  flags.l                    ;/* Div flags */
  decimals.l                 ;/* Number of decimals in field */
  charsetnr.l                ;/* Character set */
  type.l                     ;/* Type of field. See enum_field_types */
  *extension.l
EndStructure ;MYSQL_FIELD;

Structure st_arr_of_fields
  field.st_mysql_field[0]
EndStructure

Structure st_Long_array
  long.l[0]
EndStructure

Structure st_MYSQL_Lib_Data
  dbhnd.l
  sqlresult.l
  sqlresult_row.l
  sqlresult_fields.l
  rownumber.l
  List blogparams.s()
EndStructure

Enumeration ;enum_field_types
  #MYSQL_TYPE_DECIMAL         ;DECIMAL- oder NUMERIC-Feld
  #MYSQL_TYPE_TINY            ;TINYINT-Feld
  #MYSQL_TYPE_SHORT           ;SMALLINT-Feld
  #MYSQL_TYPE_LONG            ;INTEGER-Feld
  #MYSQL_TYPE_FLOAT           ;FLOAT-Feld
  #MYSQL_TYPE_DOUBLE          ;DOUBLE- oder REAL-Feld
  #MYSQL_TYPE_NULL            ;Feld mit NULL-Typ
  #MYSQL_TYPE_TIMESTAMP       ;TIMESTAMP-Feld
  #MYSQL_TYPE_LONGLONG        ;BIGINT-Feld
  #MYSQL_TYPE_INT24           ;MEDIUMINT-Feld
  #MYSQL_TYPE_DATE            ;DATE-Feld
  #MYSQL_TYPE_TIME            ;TIME-Feld
  #MYSQL_TYPE_DATETIME        ;DATETIME-Feld
  #MYSQL_TYPE_YEAR            ;YEAR-Feld
  #MYSQL_TYPE_NEWDATE         ;DATETIME-Feld
  #MYSQL_TYPE_VARCHAR         ;VARCHAR
  #MYSQL_TYPE_BIT             ;BIT-Feld
  #MYSQL_TYPE_NEWDECIMAL=246  ;DECIMAL- oder NUMERIC-Typ für Präzisionsberechnungen
  #MYSQL_TYPE_ENUM=247        ;ENUM-Feld
  #MYSQL_TYPE_SET=248         ;SET-Feld
  #MYSQL_TYPE_TINY_BLOB=249   ;TINYTEXT
  #MYSQL_TYPE_MEDIUM_BLOB=250 ;MEDIUMTEXT
  #MYSQL_TYPE_LONG_BLOB=251   ;LONGTEXT
  #MYSQL_TYPE_BLOB=252        ;BLOB- oder TEXT-Feld (die Maximallänge wird mit max_length ermittelt)
  #MYSQL_TYPE_VAR_STRING=253  ;VARCHAR- oder VARBINARY-Feld
  #MYSQL_TYPE_STRING=254      ;CHAR- oder BINARY-Feld
  #MYSQL_TYPE_GEOMETRY=255    ;Feld eines raumbezogenen Typs
  #MAX_NO_FIELD_TYPES ;/* Should always be last */
EndEnumeration

#CLIENT_MULTI_STATEMENTS = 65536

Global NewMap __MySQLLib_Data.st_MYSQL_Lib_Data()

;{ Prototypes
Prototype.i proto_mysql_init(dbHnd)
Prototype.i proto_mysql_connect(dbHnd, host.p-ascii, user.p-ascii, passwd.p-ascii, DB.p-ascii, port.l, unix_socket.p-ascii, client_flag.l)
Prototype.i proto_mysql_error(dbHnd)
Prototype.i proto_mysql_errno(dbHnd)
Prototype.i proto_mysql_close(dbHnd)
Prototype.i proto_mysql_query(dbHnd, sql.p-ascii,Len_sql.l)
Prototype.i proto_mysql_use_result(dbHnd)
Prototype.i proto_mysql_store_result(dbHnd)
Prototype.i proto_mysql_free_result(QueryResult)
Prototype.i proto_mysql_field_count(dbHnd)
Prototype.i proto_mysql_fetch_row(SQLResult)
Prototype.i proto_mysql_fetch_fields(SQLResult)
Prototype.i proto_mysql_fetch_lengths(SQLResult)
Prototype.i proto_mysql_num_rows(SQLResult)
Prototype.i proto_mysql_num_fields(SQLResult)
Prototype.i proto_mysql_data_seek(SQLResult, Row_offset.q)
Prototype.i proto_mysql_insert_id(dbHnd)
Prototype.i proto_mysql_affected_rows(dbHnd)
Prototype.i proto_mysql_real_escape_string(dbHnd, strTo.p-ascii, *strfrom.p-ascii, length)
;}

Procedure isLastElement(List myList.l())
  If ListIndex(myList()) <= ListSize(myList()) - 1
    ProcedureReturn  #True
  EndIf
EndProcedure

Procedure mysql_lib_init(dllfile.s)
  If __Lib_mysql_hdl.l = 0
    __Lib_mysql_hdl.l = OpenLibrary(#PB_Any, dllfile)
    If __mysqllibinit = #False
      Global mysql_init.proto_mysql_init=GetFunction(__Lib_mysql_hdl.l,"mysql_init")
      Global mysql_real_connect.proto_mysql_connect=GetFunction(__Lib_mysql_hdl.l, "mysql_real_connect")
      Global __mysql_error.proto_mysql_error=GetFunction(__Lib_mysql_hdl.l,"mysql_error")
      Global mysql_errno.proto_mysql_errno=GetFunction(__Lib_mysql_hdl.l,"mysql_errno")
      Global mysql_real_query.proto_mysql_query=GetFunction(__Lib_mysql_hdl.l, "mysql_real_query")
      Global mysql_use_result.proto_mysql_use_result=GetFunction(__Lib_mysql_hdl.l,"mysql_use_result")
      Global mysql_store_result.proto_mysql_store_result=GetFunction(__Lib_mysql_hdl.l,"mysql_store_result")
      Global mysql_free_result.proto_mysql_free_result=GetFunction(__Lib_mysql_hdl.l,"mysql_free_result")
      Global mysql_field_count.proto_mysql_field_count=GetFunction(__Lib_mysql_hdl.l,"mysql_field_count")
      Global mysql_fetch_row.proto_mysql_fetch_row=GetFunction(__Lib_mysql_hdl.l,"mysql_fetch_row")
      Global mysql_fetch_fields.proto_mysql_fetch_fields=GetFunction(__Lib_mysql_hdl.l,"mysql_fetch_fields")
      Global mysql_fetch_lengths.proto_mysql_fetch_lengths=GetFunction(__Lib_mysql_hdl.l,"mysql_fetch_lengths")
      Global mysql_num_rows.proto_mysql_num_rows=GetFunction(__Lib_mysql_hdl.l,"mysql_num_rows")
      Global mysql_num_fields.proto_mysql_num_fields=GetFunction(__Lib_mysql_hdl.l,"mysql_num_fields")
      Global mysql_insert_id.proto_mysql_insert_id=GetFunction(__Lib_mysql_hdl.l,"mysql_insert_id")
      Global mysql_close.proto_mysql_close=GetFunction(__Lib_mysql_hdl.l,"mysql_close")
      Global mysql_affected_rows.proto_mysql_affected_rows=GetFunction(__Lib_mysql_hdl.l,"mysql_affected_rows")
      Global mysql_data_seek.proto_mysql_data_seek=GetFunction(__Lib_mysql_hdl.l, "mysql_data_seek")
      Global mysql_real_escape_string.proto_mysql_real_escape_string=GetFunction(__Lib_mysql_hdl.l, "mysql_real_escape_string")
      
      __mysqllibinit = #True
    EndIf
  EndIf
EndProcedure

Procedure.s mysql_error(dbHnd, requester.l = 0) 
Define *Error, Res
  
  Protected Errormsg.s, i.l, Error.l
  If mysql_errno(dbHnd) > 0
     *Error= __mysql_error(dbHnd)      
     Errormsg = PeekS(*Error) 
    If requester 
       Res= MessageRequester("MySQL error",Errormsg,#PB_MessageRequester_Ok)
    EndIf 
  EndIf 
  ProcedureReturn Errormsg 
EndProcedure 

Procedure mysql_lib_close()
  CloseLibrary(__Lib_mysql_hdl.l)
  __Lib_mysql_hdl.l = 0
EndProcedure

;PB compatible fnctions.....

Procedure.s MYSQL_DatabaseError(Databaseno)
Define dbhnd = __MySQLLib_Data(Str(Databaseno))\dbhnd
  ProcedureReturn mysql_error(dbHnd) 
EndProcedure

Procedure MYSQL_UseMySQLDatabase()
  mysql_lib_init("libmysql.dll")
  __mysql_pb_any = 1
EndProcedure

Procedure MYSQL_OpenDatabase(Databaseno, Host.s, Benutzer.s, Passwort.s, Database.s, Port.l = 3306) ; DefaultPort (no need to change)
Define res.l
  If Databaseno = #PB_Any
    While FindMapElement(__MySQLLib_Data(), Str(__mysql_pb_any))
      __mysql_pb_any + 1
    Wend
    Databaseno = __mysql_pb_any
    res.l = Databaseno
  Else
    If FindMapElement(__MySQLLib_Data(), Str(Databaseno))
      ProcedureReturn 0
    Else
      res.l = 1
    EndIf
  EndIf
  __MySQLLib_Data(Str(Databaseno))\dbhnd = mysql_init(0)
  If mysql_real_connect(__MySQLLib_Data(Str(Databaseno))\dbhnd, Host.s, Benutzer.s, Passwort.s, Database.s, Port.l,#NULL$, #CLIENT_MULTI_STATEMENTS) ;#Null$>Verbindungsart TCP, #Null>kein Client_Flag
    ProcedureReturn res.l
  Else
    ProcedureReturn 0
  EndIf
EndProcedure

Procedure MYSQL_DatabaseQuery(Databaseno, Abfrage.s)
Define res.l, sqlresult, dbhnd = __MySQLLib_Data(Str(Databaseno))\dbhnd
Define *dat.st_MYSQL_Lib_Data = __MySQLLib_Data(Str(Databaseno)), i
  
  If ListSize(*dat\blogparams()) > 0
    For i = 0 To ListSize(*dat\blogparams()) - 1
      SelectElement(*dat\blogparams(), i)
      ReplaceString(Abfrage.s, "$" + Str(i), *dat\blogparams())
    Next
    ClearList(*dat\blogparams()) 
  EndIf
  
  res.l = mysql_real_query(dbHnd, Abfrage.s, Len(Abfrage.s))
  If res.l = 0
    
    __MySQLLib_Data(Str(Databaseno))\sqlresult = mysql_store_result.l(dbHnd)
    sqlresult = __MySQLLib_Data(Str(Databaseno))\sqlresult
    If sqlresult
      __MySQLLib_Data(Str(Databaseno))\sqlresult_fields = mysql_fetch_fields(sqlresult)
      __MySQLLib_Data(Str(Databaseno))\rownumber = -1
      ProcedureReturn 1
    Else
      ProcedureReturn 0
    EndIf
  Else
    ProcedureReturn 0
  EndIf
EndProcedure

Procedure MYSQL_DatabaseUpdate(Databaseno, Abfrage.s)
Define res.l, dbhnd = __MySQLLib_Data(Str(Databaseno))\dbhnd
Define *dat.st_MYSQL_Lib_Data = __MySQLLib_Data(Str(Databaseno)), i

  If ListSize(*dat\blogparams()) > 0
    For i = 0 To ListSize(*dat\blogparams()) - 1
      SelectElement(*dat\blogparams(), i)
      ReplaceString(Abfrage.s, "$" + Str(i), *dat\blogparams())
    Next
    ClearList(*dat\blogparams()) 
  EndIf  
  
  res.l = mysql_real_query(dbHnd, Abfrage.s, Len(Abfrage.s))
  If res.l = 0
    ProcedureReturn mysql_affected_rows(dbHnd)
  Else
    ProcedureReturn 0
  EndIf
EndProcedure

Procedure MYSQL_NextDatabaseRow(Databaseno)
Define sqlresult = __MySQLLib_Data(Str(Databaseno))\sqlresult

  __MySQLLib_Data(Str(Databaseno))\rownumber + 1
  __MySQLLib_Data(Str(Databaseno))\sqlresult_row = mysql_fetch_row(sqlresult) 

  ProcedureReturn __MySQLLib_Data(Str(Databaseno))\sqlresult_row
EndProcedure

Procedure MYSQL_PreviousDatabaseRow(Databaseno)
Define sqlresult = __MySQLLib_Data(Str(Databaseno))\sqlresult

  __MySQLLib_Data(Str(Databaseno))\rownumber - 1
  mysql_data_seek(sqlresult, __MySQLLib_Data(Str(Databaseno))\rownumber)
  __MySQLLib_Data(Str(Databaseno))\sqlresult_row = mysql_fetch_row(sqlresult)
  
  ProcedureReturn __MySQLLib_Data(Str(Databaseno))\sqlresult_row 
EndProcedure 

Procedure MYSQL_FirstDatabaseRow(Databaseno)
Define sqlresult = __MySQLLib_Data(Str(Databaseno))\sqlresult
Define res.l

  mysql_data_seek(sqlresult, 0)
  __MySQLLib_Data(Str(Databaseno))\rownumber = 0
  __MySQLLib_Data(Str(Databaseno))\sqlresult_row = mysql_fetch_row(sqlresult) 

  ProcedureReturn __MySQLLib_Data(Str(Databaseno))\sqlresult_row
EndProcedure

Procedure MYSQL_DatabaseColumnType(Databaseno, Spalte.l)
Define *fields.st_arr_of_fields = __MySQLLib_Data(Str(Databaseno))\sqlresult_fields, numfields.l
Define sqlresult = __MySQLLib_Data(Str(Databaseno))\sqlresult

  numfields = mysql_num_fields(sqlresult)
  If Spalte.l < numfields
    Select *fields\field[Spalte.l]\type
    Case #MYSQL_TYPE_TINY, #MYSQL_TYPE_SHORT, #MYSQL_TYPE_LONG, #MYSQL_TYPE_NULL, #MYSQL_TYPE_TIMESTAMP, #MYSQL_TYPE_YEAR, #MYSQL_TYPE_BIT, #MYSQL_TYPE_ENUM
      ProcedureReturn #PB_Database_Long 
    Case #MYSQL_TYPE_DATE, #MYSQL_TYPE_TIME, #MYSQL_TYPE_DATETIME, #MYSQL_TYPE_NEWDATE, #MYSQL_TYPE_VARCHAR, #MYSQL_TYPE_SET, #MYSQL_TYPE_GEOMETRY
      ProcedureReturn #PB_Database_String
    Case #MYSQL_TYPE_FLOAT
      ProcedureReturn #PB_Database_Float
    Case #MYSQL_TYPE_DECIMAL, #MYSQL_TYPE_DOUBLE, #MYSQL_TYPE_NEWDECIMAL
      ProcedureReturn #PB_Database_Double 
    Case #MYSQL_TYPE_LONGLONG, #MYSQL_TYPE_INT24
      ProcedureReturn #PB_Database_Quad 
    Case #MYSQL_TYPE_TINY_BLOB, #MYSQL_TYPE_MEDIUM_BLOB, #MYSQL_TYPE_LONG_BLOB, #MYSQL_TYPE_BLOB, #MYSQL_TYPE_VAR_STRING, #MYSQL_TYPE_STRING
      ProcedureReturn #PB_Database_Blob
    Default
      ProcedureReturn #PB_Database_Long
    EndSelect
  EndIf
EndProcedure

Procedure.s MYSQL_DatabaseColumnName(Databaseno, Spalte.l)
Define *fields.st_arr_of_fields = __MySQLLib_Data(Str(Databaseno))\sqlresult_fields, numfields.l
Define sqlresult = __MySQLLib_Data(Str(Databaseno))\sqlresult

  numfields = mysql_num_fields(sqlresult)
  If Spalte.l < numfields
    ProcedureReturn *fields\field[Spalte.l]\name
  EndIf
EndProcedure

Procedure MYSQL_DatabaseColumns(Databaseno)
Define sqlresult = __MySQLLib_Data(Str(Databaseno))\sqlresult
   ;   Debug mysql_field_count(dbHnd)
  ProcedureReturn mysql_num_fields(sqlresult)
EndProcedure

Procedure MYSQL_DatabaseRows(Databaseno)
Define sqlresult = __MySQLLib_Data(Str(Databaseno))\sqlresult
  ProcedureReturn mysql_num_rows(sqlresult)
EndProcedure

Procedure.l MYSQL_GetDatabaseBlob(Databaseno, Spalte.l)
Define *row.st_MYSQL_ROW, sqlresultrow = __MySQLLib_Data(Str(Databaseno))\sqlresult_row
  *row = sqlresultrow
  If *row
    ProcedureReturn @*row\fields[Spalte.l]
  EndIf
EndProcedure

Procedure.d MYSQL_GetDatabaseDouble(Databaseno, Spalte.l)
Define *row.st_MYSQL_ROW, sqlresultrow = __MySQLLib_Data(Str(Databaseno))\sqlresult_row
  *row = sqlresultrow
  If *row
    ProcedureReturn ValD(*row\fields[Spalte.l])
  EndIf
EndProcedure

Procedure.f MYSQL_GetDatabaseFloat(Databaseno, Spalte.l)
Define *row.st_MYSQL_ROW, sqlresultrow = __MySQLLib_Data(Str(Databaseno))\sqlresult_row
  *row = sqlresultrow
  If *row
    ProcedureReturn ValF(*row\fields[Spalte.l])
  EndIf
EndProcedure

Procedure.l MYSQL_GetDatabaseLong(Databaseno, Spalte.l)
Define *row.st_MYSQL_ROW, sqlresultrow = __MySQLLib_Data(Str(Databaseno))\sqlresult_row
  *row = sqlresultrow
  If *row
    ProcedureReturn Val(*row\fields[Spalte.l])
  EndIf
EndProcedure

Procedure.q MYSQL_GetDatabaseQuad(Databaseno, Spalte.l)
Define *row.st_MYSQL_ROW, sqlresultrow = __MySQLLib_Data(Str(Databaseno))\sqlresult_row
  *row = sqlresultrow
  If *row
    ProcedureReturn Val(*row\fields[Spalte.l])
  EndIf
EndProcedure

Procedure.s MYSQL_GetDatabaseString(Databaseno, Spalte.l)
Define *row.st_MYSQL_ROW, sqlresultrow = __MySQLLib_Data(Str(Databaseno))\sqlresult_row
  *row = sqlresultrow
  If *row
    ProcedureReturn *row\fields[Spalte.l]
  EndIf
EndProcedure

Procedure.l MYSQL_DatabaseColumnSize(Databaseno, Spalte.l)
Define *sizes.st_Long_array, sqlresult = __MySQLLib_Data(Str(Databaseno))\sqlresult
Define numfields

  numfields = mysql_num_fields(sqlresult)
  If Spalte.l < numfields
    *sizes = mysql_fetch_lengths(sqlresult)
    If *sizes
      ProcedureReturn *sizes\long[Spalte]
    EndIf
  EndIf
  
EndProcedure 

Procedure.l MYSQL_FinishDatabaseQuery(Databaseno)
Define sqlresult = __MySQLLib_Data(Str(Databaseno))\sqlresult  
  mysql_free_result(sqlresult)
  __MySQLLib_Data(Str(Databaseno))\sqlresult = 0
EndProcedure

Procedure MYSQL_CloseDatabase(Databaseno, Libclose=0)
Define dbhnd = __MySQLLib_Data(Str(Databaseno))\dbhnd
  
  if dbhnd
    mysql_close(dbHnd)
    __MySQLLib_Data(Str(Databaseno))\dbhnd = 0
  endif

  If Libclose = #True
    mysql_lib_close()    
  EndIf
EndProcedure

Procedure MYSQL_IsDatabase(Databaseno)
Define dbhnd = __MySQLLib_Data(Str(Databaseno))\dbhnd
  If dbHnd And __Lib_mysql_hdl.l
    ProcedureReturn 1
  EndIf
EndProcedure

Procedure MYSQL_DatabaseID(Databaseno)
  ProcedureReturn __MySQLLib_Data(Str(Databaseno))\dbhnd
EndProcedure

;Use $1, $2, $3.... in your query 
Procedure MYSQL_SetDatabaseBlob(Databaseno, Statementindex.l, *Puffer, Pufferlaenge.l)
Define dbhnd = __MySQLLib_Data(Str(Databaseno))\dbhnd

  While ListSize(__MySQLLib_Data(Str(Databaseno))\blogparams()) - 1 < Statementindex.l
    AddElement(__MySQLLib_Data(Str(Databaseno))\blogparams())
  Wend
  SelectElement(__MySQLLib_Data(Str(Databaseno))\blogparams(), Statementindex.l)
  __MySQLLib_Data(Str(Databaseno))\blogparams() = Space(Pufferlaenge.l*2 + 1)

  If mysql_real_escape_string(dbhnd, __MySQLLib_Data(Str(Databaseno))\blogparams(), *Puffer, Pufferlaenge.l)
    __MySQLLib_Data(Str(Databaseno))\blogparams() = "'" + __MySQLLib_Data(Str(Databaseno))\blogparams() + "'"
    Debug __MySQLLib_Data(Str(Databaseno))\blogparams()
    ProcedureReturn 1
  EndIf
EndProcedure

; Define  user.s, passwd.s, port.l, host.s, DB.s, SQL.s, Res.l, SQLResult, *row.st_MYSQL_ROW, *mem
; 
; user.s    = "user"
; passwd.s  = "password"
; host.s    = "localhost"
; DB.s      = "phpmyadmin" ;Schema / DB
; 
; 
; SQL.s="SELECT * FROM pma_history"
; 
; MySQL_UseMySQLDatabase()
; res = MYSQL_OpenDatabase(0, Host.s, user.s, passwd.s, DB.s)
; If res
;   res = MYSQL_DatabaseQuery(0,SQL.s)
;   If res
;     Debug "Query ok"
;         
;     Debug MYSQL_DatabaseColumnType(0, 1)
;     Debug MYSQL_DatabaseColumnName(0, 1)
;     
;     While MYSQL_NextDatabaseRow(0)
;       Debug MYSQL_GetDatabaseString(0, 0)
;       Debug MYSQL_DatabaseColumnSize(0, 0)
;     Wend
;         
;     MYSQL_FinishDatabaseQuery(0)
;   Else
;     Debug "Query fehlgeschlagen"
;     Debug MYSQL_DatabaseError(0)  
;   EndIf 
; Else
;   Debug MYSQL_DatabaseError(0)
; EndIf
;
Zuletzt geändert von VoSs2o0o am 04.12.2012 18:23, insgesamt 4-mal geändert.
Andreas21
Beiträge: 390
Registriert: 30.08.2004 09:05
Computerausstattung: Desktop
Windows 10 Pro x64
CPU: AMD Ryzen 5 2600 3.40 GHz
Ram: 16GB RAM
Grafik: NVIDA Geforce 1060
PB: 5.72 X86/X64
Wohnort: Heidelberg

Re: Gibt es noch die libmysql.dll?

Beitrag von Andreas21 »

@VoSs2o0o

Bei deinem Code bekomm ich zwar über MYSQL_DatabaseColumns(0) die richtiege anzahl an Fields, nur wenn ich sie auslesen will mit MYSQL_DatabaseColumnName(0, x) nur bis zum zweiten Field Namen auslesen. Danach kommt ein Memory Fehler den ich aber nicht finden kann.

Edit:

Code: Alles auswählen

Structure st_mysql_field
  *name.s                    ;/* Name of column */
  *org_name.s                ;/* Original column name, if an alias */
  *table.s                   ;/* Table of column if column was a field */
  *org_table.s               ;/* Org table name, if table was an alias */
  *DB.s                      ;/* Database for table */
  *catalog.s                  ;/* Catalog for table */
  *def.s                     ;/* Default value (set by mysql_list_fields) */
  length.l                   ;/* Width of column (create length) */
  max_length.l               ;/* Max width for selected set */
  name_length.l
  org_name_length.l
  table_length.l
  org_table_length.l
  db_length.l
  catalog_length.l
  def_length.l
  flags.l                    ;/* Div flags */
  decimals.l                 ;/* Number of decimals in field */
  charsetnr.l                ;/* Character set */
  type.l                     ;/* Type of field. See enum_field_types */
  ;*extension.l
EndStructure ;MYSQL_FIELD;
in

Code: Alles auswählen

Structure st_mysql_field
  *name.s                    ;/* Name of column */
  *org_name.s                ;/* Original column name, if an alias */
  *table.s                   ;/* Table of column if column was a field */
  *org_table.s               ;/* Org table name, if table was an alias */
  *DB.s                      ;/* Database for table */
  *catalog.s                  ;/* Catalog for table */
  *def.s                     ;/* Default value (set by mysql_list_fields) */
  length.l                   ;/* Width of column (create length) */
  max_length.l               ;/* Max width for selected set */
  name_length.l
  org_name_length.l
  table_length.l
  org_table_length.l
  db_length.l
  catalog_length.l
  def_length.l
  flags.l                    ;/* Div flags */
  decimals.l                 ;/* Number of decimals in field */
  charsetnr.l                ;/* Character set */
  type.l                     ;/* Type of field. See enum_field_types */
  *extension.l
EndStructure ;MYSQL_FIELD;
ändern dann geht es.
Windows 10 x64 Pro - PB 5.61 X64 / x32 - PB 4.6 x32
VoSs2o0o
Beiträge: 25
Registriert: 29.08.2004 16:58
Kontaktdaten:

Re: Gibt es noch die libmysql.dll?

Beitrag von VoSs2o0o »

Uups da war doch glatt noch ne uralt-Version von 16.04.2006 auf meinem Rechner,
nach dem Austausch der dll klappt alles mit dem unkommentierten "*extension.l"

den Code hab ich aktualisiert.
Benutzeravatar
bobobo
jaAdmin
Beiträge: 3873
Registriert: 13.09.2004 17:48
Kontaktdaten:

Re: Gibt es noch die libmysql.dll?

Beitrag von bobobo »

bei Benutzung des Compressflags wie im englischen Forum von dir angegeben erhalte ich eine PerformanceSteigerung von ca. Faktor 2

sehr nett ! :allright:
‮pb aktuel 6.2 windoof aktuell und sowas von 10
Ich hab Tinnitus im Auge. Ich seh nur Pfeifen.
Antworten