Sign in to follow this  
Followers 0
yucatan

database

12 posts in this topic

hi i have a TCP login created but now i wanne add some more functions in the prog and i need a database with that

_SQLite

what is that ?

can i use it to store messages b.v. when i log in i can see that peopel have send me a message ?

Share this post


Link to post
Share on other sites



_SQLite is meant for runtime databases, meaning databases that are only stored in memory for the duration of your script. If you need to query a SQL server you need to find the SQL UDF or search for ADODB.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>
#include <File.au3>
#include <Array.au3>

$Database = @ScriptDir & "\Database.db";Location Of Database file

;Creates The Database file if it does not exist
If FileExists($Database) = 1 Then
 _FileCreate($Database)
EndIf

#Region;Write To Database File
_SQLite_Startup();Starts SQLite
_Sqlite_Open($Database);Opens Up Database

;Title  is the Column title in the database
;BLOB  Means Write The data as it is entered in to the database
_SQLite_Exec(-1, "Create table If Not Exists tbltest (Title BLOB);");Creates a Table called tbltest if it does not exist 
_SQLite_Exec(-1, "Insert into tbltest values ('ENTER YOUR DATA HERE');");Inputs data in to tbltest
_SQLite_Close();closes database 
_SQLite_Shutdown();shutsdown SQLite

#EndRegion

#Region; Read Data From Database File
Local $aResult, $iRows, $iColumns, $var
_SQLite_Startup()
_Sqlite_Open($Database)

$var = _SQLite_GetTable (-1, "SELECT * FROM tbltest;", $aResult, $iRows, $iColumns);Reads all of the data from the database
If $var = $SQLITE_OK Then;IF Every thing is ok Display the array
_ArrayDisplay($aResult, "")
Else
MsgBox(16, "SQLite Error: " & $var, _SQLite_ErrMsg ())
EndIf

_SQLite_Close()
_SQLite_Shutdown()
#EndRegion
Edited by Dead

Share this post


Link to post
Share on other sites

_SQLite is meant for runtime databases, meaning databases that are only stored in memory for the duration of your script. If you need to query a SQL server you need to find the SQL UDF or search for ADODB.

How's that then?

I have several scripts that use sqlite successfully with a permanent database. Also the sqlite site shows how it can use quite large database's. The examples show in memory database but if you specify a path in the _SQLite_Open () function it is then a permanent database that can be accessed by another script. You can have multiple reads on a single database but only 1 write which you deal with using the timeout feature. Or have I missed your point?

Share this post


Link to post
Share on other sites

How's that then?

I have several scripts that use sqlite successfully with a permanent database. Also the sqlite site shows how it can use quite large database's. The examples show in memory database but if you specify a path in the _SQLite_Open () function it is then a permanent database that can be accessed by another script. You can have multiple reads on a single database but only 1 write which you deal with using the timeout feature. Or have I missed your point?

Well for one the OP was asking about TCP functions so the database must be remote. Secondly, the SQLite storage file is proprietary and has nothing to do with an actual SQL database, if he is wanting to open an existing SQL DB with SQLite that will not work.

Share this post


Link to post
Share on other sites

@weaponx

Well for one the OP was asking about TCP functions so the database must be remote. Secondly, the SQLite storage file is proprietary and has nothing to do with an actual SQL database, if he is wanting to open an existing SQL DB with SQLite that will not work.

I think you don't know what you are talking about !! muttley

@ChrisL

You are totally correct.

Regards,

ptrex

Share this post


Link to post
Share on other sites

@weaponx

I think you don't know what you are talking about !! muttley

@ChrisL

You are totally correct.

Regards,

ptrex

The OP was asking about TCP functions, implying a need for ADO access to SQL. I was saying SQLite is meant to be standalone and its purpose is not to connect to a Microsoft SQL server. SQLite does offer the ability to open and store database files in its own proprietary format.

Share this post


Link to post
Share on other sites

@weaponx

I am totally not agreeing with your statement.

_SQLite is meant for runtime databases, meaning databases that are only stored in memory for the duration of your script.

I am not sure where you ever got that from ?

SQLite is a full fletched database, with all main functionality you might need.

Except not being client - server, doesn't mean the database file can't be stored on a server.

And there is a flavour of SQLite that does support client - server functionality. But it is not for free.

Unless someone makes a AU3 version of the client - server, for free.

regards

ptrex

Share this post


Link to post
Share on other sites

@weaponx

I am totally not agreeing with your statement.

I am not sure where you ever got that from ?

SQLite is a full fletched database, with all main functionality you might need.

Except not being client - server, doesn't mean the database file can't be stored on a server.

And there is a flavour of SQLite that does support client - server functionality. But it is not for free.

Unless someone makes a AU3 version of the client - server, for free.

regards

ptrex

You have my vote muttley .

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

@weaponx

I am totally not agreeing with your statement.

I am not sure where you ever got that from ?

SQLite is a full fletched database, with all main functionality you might need.

Except not being client - server, doesn't mean the database file can't be stored on a server.

And there is a flavour of SQLite that does support client - server functionality. But it is not for free.

Unless someone makes a AU3 version of the client - server, for free.

regards

ptrex

Why did you quote my original response? I re-explained it more clearly. I think the misunderstanding here is due to the OP not clearly stating his intention.

Share this post


Link to post
Share on other sites

_SQLite is meant for runtime databases, meaning databases that are only stored in memory for the duration of your script. If you need to query a SQL server you need to find the SQL UDF or search for ADODB.

i know but why i cant use sqlite because my server.exe is always running the client ask for data via tcp..so then its always runnign right ?

Share this post


Link to post
Share on other sites

i know but why i cant use sqlite because my server.exe is always running the client ask for data via tcp..so then its always runnign right ?

If your server is running a script that uses SQLite then the database would always be available to TCP clients.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0