Sqlite on ftp server

875 views
Skip to first unread message

Musa Ajayi

unread,
Jun 22, 2016, 5:26:27 PM6/22/16
to DroidScript
Can I serve my sql database in my ftp server and access it with droidscript

XGamer CraftTime-Network

unread,
Jun 23, 2016, 12:52:29 AM6/23/16
to DroidScript
You want to access a sql database using an ftp server?

ftp is very slow, why dont you just make a php script, that handles you the information using httprequest get.

Giorgio Sforza

unread,
Jun 23, 2016, 3:17:25 AM6/23/16
to DroidScript

Musa Ajayi

unread,
Jun 23, 2016, 4:21:10 PM6/23/16
to DroidScript
Thank you for the suggestion. Speed doesn't matter to the app. And I don't know PHP. I can only program in Javascript and sqlite. The app is just for our village group. We're not more than 150 people. So the speed can be neglected.

Steve Garman

unread,
Jun 23, 2016, 6:15:23 PM6/23/16
to DroidScript
FTP is not a protocol over which you can run sqlite queries.

When XGamer suggests it will be slow, I assume he is thinking of the circumstance where the database is maintained centrally and the whole database file is downloaded by each client every time there is a database change and queries are then run locally.

This is not just a slow process, it would be agonisingly slow.

If you want the clients to be able to update the database as well, you would need some control (not available in ftp) to ensure that simultaneous updates made by different clients did not overwrite each other when files were uploaded.

In my opinion, that would be totally impractical.

Of course I could be missing something...

XGamer CraftTime-Network

unread,
Jun 24, 2016, 1:41:39 PM6/24/16
to DroidScript
I have no Problem in writing an Example + give you a database (as long as you dont screw it up)

Musa Ajayi

unread,
Jun 25, 2016, 6:52:34 PM6/25/16
to DroidScript
I need to learn PHP then. The problem is I'm new to programming

Musa Ajayi

unread,
Jun 25, 2016, 6:53:19 PM6/25/16
to DroidScript

Musa Ajayi

unread,
Jun 25, 2016, 6:53:21 PM6/25/16
to DroidScript

Musa Ajayi

unread,
Jun 25, 2016, 6:55:35 PM6/25/16
to DroidScript
I'll appreciate that
Message has been deleted

XGamer CraftTime-Network

unread,
Jun 26, 2016, 4:51:30 AM6/26/16
to DroidScript
Well to Query Data the Database needs ~0.0001 - 0.0003 seconds
Thats DAMN fast...
Message has been deleted

XGamer CraftTime-Network

unread,
Jun 26, 2016, 10:42:12 AM6/26/16
to DroidScript
UPDATE:
+ ability to change "Useless Data"
+ ability to Create new Users

function OnStart()
{
    lay
= app.CreateLayout( "linear", "VCenter,FillXY" );    

    TXT
= app.CreateText( "Username:", 0.85, 0.03, "Left" )
    lay
.AddChild( TXT )
    edt
= app.CreateTextEdit( "TestUser", 0.9 );
    lay
.AddChild( edt );
    TXT
= app.CreateText( "Useless Data:", 0.85, 0.03, "Left" )
    lay
.AddChild( TXT )
    edtUD
= app.CreateTextEdit( "Some Useless Data :D", 0.9 );
    lay
.AddChild( edtUD );

    TXT
= app.CreateText( "", 1, 0.05, "Left" )
    lay
.AddChild( TXT )
   
    btn
= app.CreateButton( "Update Data", 0.6, 0.1 );
    btn
.SetOnTouch( btn_Update_OnTouch );
    lay
.AddChild( btn );
    btn
= app.CreateButton( "Get Data", 0.6, 0.1 );
    btn
.SetOnTouch( btn_Get_OnTouch );
    lay
.AddChild( btn );
    btn
= app.CreateButton( "Create User", 0.6, 0.1 );
    btn
.SetOnTouch( btn_Create_OnTouch );
    lay
.AddChild( btn );

    TXT
= app.CreateText( "", 1, 0.05, "Left" )
    lay
.AddChild( TXT )

    txt
= app.CreateText( "", 1, 0.5, "Left,Multiline" );
    txt
.SetBackColor( "#ff222222" );
    txt
.SetTextSize( 20 );
    lay
.AddChild( txt );
   
    app
.AddLayout( lay );

}  

function btn_Update_OnTouch()
{
 
var url = "http://CraftTime-Network.de/getData.php?get=UpdateData&UselessData="+edtUD.GetText();
 
SendRequest( url  );
}
function btn_Get_OnTouch()
{
 
var url = "http://CraftTime-Network.de/getData.php?get=GetData";
 
SendRequest( url  );
}
function btn_Create_OnTouch()
{
 
var url = "http://CraftTime-Network.de/getData.php?get=CreateData&UselessData="+edtUD.GetText();
 
SendRequest( url  );
}

function SendRequest( url )
{
    url
+= "&id=1985298&user=" + edt.GetText();
   
   
var httpRequest = new XMLHttpRequest();
    httpRequest
.onreadystatechange = function() { HandleReply(httpRequest); };  
    httpRequest
.open("GET", url, true);
    httpRequest
.send(null);
   
    app
.ShowProgress( "Loading..." );
}

function HandleReply( httpRequest )
{
   
if( httpRequest.readyState==4 )
   
{
       
//If we got a valid response.
       
if( httpRequest.status==200 )
       
{
            data
= httpRequest.responseText.replace(/#/g, "\n");
            txt
.SetText( data )
       
}
       
//An error occurred
       
else
            txt
.SetText( "Error: " + httpRequest.status + httpRequest.responseText);
   
}
  app
.HideProgress();
}



Reply all
Reply to author
Forward
0 new messages