Recent

Author Topic: Android + Mysql...  (Read 18920 times)

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: Android + Mysql...
« Reply #15 on: November 17, 2017, 08:28:00 pm »

Yes, LCL not is supported in LAMW ... so we need a core/raw ".so"  for arm/android or x86/android,  etc...

but,  MorMot + LAMW is possible!

There is a demo [by DonAlfredo] here:

https://github.com/jmpessoa/lazandroidmodulewizard/tree/master/demos/GUI/AppmORMotDemo1


Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

A.S.

  • Jr. Member
  • **
  • Posts: 76
Re: Android + Mysql...
« Reply #16 on: November 17, 2017, 09:39:39 pm »
I thought I got it.
Mysql found library.
BUT and its a big BUT, there is an error using SQLDBLaz.

You should not use SQLDBLaz package. Instead you need units for fcl-db: sqldb, mysqlXXconn (where XX is your libMySql version), etc.

amartitegui

  • Jr. Member
  • **
  • Posts: 84
Re: Android + Mysql...
« Reply #17 on: November 18, 2017, 12:40:24 pm »
Mmmmmm you mean... use just the component units instead of the pakage rigth?
Necer thought of it. Gotta check also if they dont include lcl... but its a nice idea
Thanks. Gonna try.
I was making some tries creating the app without LAWN Too. But apk building its a pain in the ass.
Cant get it properly working.
Only got to buil .ap_ but stuck with .dex and signing. Mainly i think because of the dex part.

amartitegui

  • Jr. Member
  • **
  • Posts: 84
Re: Android + Mysql...
« Reply #18 on: November 20, 2017, 03:32:11 pm »
Jmpessoa I think that, as A.S said it may work with LAWM. using the units and not the package (felt kinda stupid 'cause I do it all the time with nongraphical classes/units) It compiles, and it builds .APk.
But i think the library is not correct. I've checked and its buit for x86 android and api 14. Im running API19 and arm7. So it gives me an error (catched as exception) runtime.
Checked and should work. Iges its library. So to build library ....

Someone with experience compiling with android ndk?
I need to compile  libmysqlclient_r.so, libmysqlclient.so and libmysql.so properly for arm-7.
I know that its possible to compile with android NDk but have no experience at all.
anyone?
thanks

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: Android + Mysql...
« Reply #19 on: November 23, 2017, 06:09:26 pm »
Quote
I need to compile  libmysqlclient_r.so, libmysqlclient.so and libmysql.so properly for arm-7.

Can you come up with  "C" code [localization] ?
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

amartitegui

  • Jr. Member
  • **
  • Posts: 84
Re: Android + Mysql...
« Reply #20 on: December 01, 2017, 05:20:03 pm »
Sorry I've been on working trip.

Im back.
I think I built a lib , and also i have another allready built.
I installed lawm in ubuntu 17, 64 bit.
Managed to have all working.
made a simple prog test.
compiled.... everything green... should be fine.... but i get:

Ventana de Mensajes, Sugerencias: 2
Verbose: Selected chip architecture: armeabi-v7a
Verbose: Taking libraries from folder: /home/osboxes/Documents/LAZ_droid_projects/TEST_droid_1/Test_mysql_14_1/libs/armeabi-v7a
Verbose: Found library: libcontrols.so
Note: Unidad duplicada "controls" en "test_mysql_14", orphaned ppu "/home/osboxes/Documents/LAZ_droid_projects/TEST_droid_1/Test_mysql_14_1/obj/controls/controls.o"
Note: Unidad duplicada "controls" en "LCLBase 1.8.0.5", ppu="/home/osboxes/.lazarus/lib/LCLBase/units/arm-android/controls.ppu", source="/usr/share/lazarus/1.8.0RC5/lcl/controls.pp"
Compilar proyecto, OS: android, CPU: arm, Objetivo: /home/osboxes/Documents/LAZ_droid_projects/TEST_droid_1/Test_mysql_14_1/libs/armeabi-v7a/libcontrols.so: Éxito
Building APK... : Éxito
Installing APK... : Éxito
Starting APK... : Éxito
Starting: Intent { cmp=org.lamw.test_mysql_14_1/.App }
Error type 3
Error: Activity class {org.lamw.test_mysql_14_1/org.lamw.test_mysql_14_1.App} does not exist.


do you know why?
thanks


amartitegui

  • Jr. Member
  • **
  • Posts: 84
Re: Android + Mysql...
« Reply #21 on: December 01, 2017, 07:40:40 pm »
I think library is not correct.
pain in the .... to build it

amartitegui

  • Jr. Member
  • **
  • Posts: 84
Re: Android + Mysql... FINALLY got .so lib...
« Reply #22 on: December 02, 2017, 12:29:57 pm »
FInally I compilled So lib and as far as I know its ok.
I mounted in a simple program test withg LAMW.
The only problem I get is:
I put the limbysqlclient.so in folder libs.
but when I run the app it does not find the so.
Do i have to do something with the .so file?
I mean, just put the .so library in the libs folder .... I was assuming that it would be packed.... but maybe I need to do something else.
Anyone knows?
thanks

amartitegui

  • Jr. Member
  • **
  • Posts: 84
Re: Android + Mysql...
« Reply #23 on: December 02, 2017, 12:45:33 pm »
NEVER MIND.
It works.
Its just that when compiling my so was called libmysql.so and not libmysqlclient.so
IT WORKS.
thanks anyway.
I will try to post something for this, so anyone can do it without so much trouble.

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: Android + Mysql...
« Reply #24 on: December 02, 2017, 03:53:29 pm »

Good News  and Great Work!

Quote
I will try to post something for this, so anyone can do it without so much trouble.

Much appreciated!

Thank you!



Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

amartitegui

  • Jr. Member
  • **
  • Posts: 84
Re: Android + Mysql...
« Reply #25 on: December 04, 2017, 05:45:07 pm »
Ok, there it is.
I will write a tuto, or something similar.
But here. If anyone needs the SO for android of mysql :

https://mega.nz/#F!sbATBbjL!l-Uc0hpfg9-XwJDb3Vc_mg
 
for android 19, 21, 23, and 24.
So library should be placed in project folder, /libs/armeabi-v7a (if using arm7)


How to use.
WITH LAMW:
IMPORTANT:  SkipLibraryVersionCheck:=true;
Doing so, I checked it works with TMySQL56Connection and TMySQL55Connection
DO NOT use the registered tool in SQLdb (uses LCL). Just declare the TMySQL56Connection, TSQLQuery,TSQLTransaction classes.


in Activity/form:
{DECLARATION OF USES}
uses
  Classes, SysUtils, AndroidWidget, Laz_And_Controls,
  mysql56conn,sqldb, And_jni, surfaceview, drawingview;

{PRIVATE DECLARATIONS}
private   
     MySQL56Connection1:TMySQL56Connection;
    SQLQuery1: TSQLQuery;
    SQLTransaction1: TSQLTransaction; 

And to use it... for example:

{PROCEDURES}

procedure TAndroidModule1.AndroidModule1ActivityCreate(Sender: TObject;
  intentData: jObject);
begin               
  try
     MySQL56Connection1:=TMySQL56Connection.Create(nil);
     MySQL56Connection1.SkipLibraryVersionCheck:=true;     
     ShowMessage('correcto');
     except
           ShowMessage('problema');
    end;       
end;

procedure TAndroidModule1.jButton1Click(Sender: TObject);
begin
     try     
      try
         SQLTransaction1:=TSQLTransaction.Create(nil);
         SQLQuery1:=TSQLQuery.Create(nil);
         SQLTransaction1.DataBase:=MySQL56Connection1;
         SQLQuery1.DataBase:=MySQL56Connection1;       
         SQLQuery1.Transaction:=SQLTransaction1;
           ShowMessage('So far so good');
        except
           ShowMessage('query transactor');
       end;
     with MySQL56Connection1 do
     begin
       DatabaseName:='YOUR DATABASE NAME';
       HostName:='YOUR HOST.IP OR ALIAS';
       Port:={PORT NUMBER WITHOUT QUOTES, ITS NUMBER NOT STRING};
       Password:='YOUR PASSWORD';
       UserName:='YOUR USERNAME';
     end;
      MySQL56Connection1.Open();
      MySQL56Connection1.Connected:=true;
    // ShowMessage('So far so good... still');   
  except
      On E :Exception do begin
      ShowMessage(E.Message);
    end;
    //ShowMessage('ERROR conection');
  end;

  if MySQL56Connection1.connected then begin
    try
      SQLQuery1.close;
      SQLQuery1.SQL.Text:='YOUR QUERY...FOR THIS WITH LIMIT 1';
      SQLQuery1.active:=true;
      SQLQuery1.Open;
      jTextView1.Text:=SQLQuery1.FieldByName('sql_field_name_1').value;
      jTextView2.Text:=SQLQuery1.FieldByName('sql_field_name_2').value;
      jTextView3.Text:=SQLQuery1.FieldByName('sql_field_name_3').value;
      jTextView4.Text:=SQLQuery1.FieldByName('sql_field_name_4').value;   
      SQLQuery1.Close;
    finally
    end;
   end;
end;     

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: Android + Mysql...
« Reply #26 on: December 04, 2017, 07:58:33 pm »
Great!!

Here is my suggestion to configure  your "Application.mk"
Quote
APP_ABI := armeabi armeabi-v7a x86
APP_PLATFORM := android-19

No need for others 20, 21, etc...

Thank you!
« Last Edit: December 04, 2017, 09:05:17 pm by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

amartitegui

  • Jr. Member
  • **
  • Posts: 84
Re: Android + Mysql...
« Reply #27 on: December 04, 2017, 09:43:03 pm »
Thanks man. Will try
 ;)

amartitegui

  • Jr. Member
  • **
  • Posts: 84
Re: Android + Mysql...
« Reply #28 on: December 05, 2017, 07:36:50 am »
jmpessoa, good morning.
Application.mk should be in Jini folder ...
you mean application.mk in the test project where I use the .so file? If so:
Cant find Application.mk in the project folder...
I see the Application Tab in project options, in LAMW project options which refers Android Manifest and Application.
I see manifest,  But cannot fin the file....

thanks

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: Android + Mysql...
« Reply #29 on: December 06, 2017, 03:53:30 am »
Quote
you mean application.mk in the test project where I use the .so file

No!

"application.mk"  is used to configure the ".so" builder project [not LAMW project] ... that is, if you
have the "C" code to produce the ".so" using core NDK...
« Last Edit: December 06, 2017, 03:55:25 am by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

 

TinyPortal © 2005-2018