* * * UPDATE * * *
July 8th, 2012 - New DataBase Class http://www.b4x.com/forum/additional-libraries-classes-official-updates/22118-class-databases.html
JUST POSTED - The New Easy DataBase V1.6 Functions with Samples and Full Working App! - September 3rd, 2011 5:00 PM
Just added some new date functions per request to Version 1.6. The 1.6 sample is attached below. It now includes these new date functions:
db.Date() --- Returns the current date
db.DateNew("09/03/2011", 30) --- Returns a new date from any selected date, enter positive or negative numbers as second parameter
db.DateNOD("09/03/2011", "03/11/2009") --- Returns the number of days between any two dates passed to it
See Post # 24 for other details: http://www.b4x.com/forum/basic4andr...sy-use-database-functions-v1-0-samples-3.html
Hello All. I just added Version 1.2 to this post. I found a bug that the db.pointer did not update correctly depending on the sorted results in the db.AddRecord and db.UpdateRecord functions. This has been corrected. I also made all functions not return any exceptions if you called them and the database didn't exist. It returns a Toast message stating that the file could not be found.
*** Older Post ***
I Just added Version 1.1. It has a few new things added and the variable names corrected to be more in line with the other functions. In version 1.1:
db.Pointer
db.RecordCount
db.FilePath
db.FileName
db.Field
I have also moved all variable declarations out of the main project. This leaves a totally clean main module to work in. All support for the database is now in the code module. I have attached a new Zip of version 1.1 but I also left the original. I changed over to 1.1 just this afternoon and went through it pretty quick. I feel it is tested and working just as it should, but I went through it quick. Please let me know if you find any errors or issues and I will fix them.
*** Original Post Below **************************************
Hello All,
No extra libraries are needed, just the CORE B4A library. I have tested some of the functions on my NookColor with up to 2500 records. With 2500 records, it moves very fast and searches are instant. All data stored will be in string format, however, you will be able to store links to images, web pages, etc. I wrote and posted the Strings functions here: http://www.b4x.com/forum/basic4android-getting-started-tutorials/10365-string-functions.html, and these functions will work in a similar way.
The functions and sample code are now attached. Some benefits may be that it is easier for new users to learn and less overhead on the processor. You don't have to learn SQL, etc. and the code required for each function is much less. Each device will have its limit on the number of records you can have before the system slows down, based on memory and processor. This will do just fine for most apps and contacts style programs. If you need to save images, objects, etc. directly into the database this will not work for you. You can have as many fields of any size as B4A and Android will support. It will also include the s.GenerateRecords(1000) functions, so you can populate the database with hundreds or thousands of records to test how the app performs under max load. Also, the database handles the pointer for you, it also handles BOF, EOF and no records in the database. It makes your coding job much easier!
If you have problems or questions, please post them and I will try to help. Hope you find it useful!:sign0089:
___________________________________________________________________
db.AddRecord()
db.DeleteRecord()
db.Exist()
db.FindRecord()
db.GenerateRecords()
db.GetRecord()
db.GetStructure()
db.ListRecords()
db.UpdateRecord()
db.FirstRecord()
db.LastRecord()
db.PreviousRecord()
db.NextRecord()
*** Added in Version 1.1 ***
db.Pointer
db.RecordCount
db.FilePath
db.FileName
db.Field
___________________________________________________________________
Thanks,
Margret
If you are using a version less than 1.2, please download the newest version, db.pointer issues were found in previous version(s).
July 8th, 2012 - New DataBase Class http://www.b4x.com/forum/additional-libraries-classes-official-updates/22118-class-databases.html
JUST POSTED - The New Easy DataBase V1.6 Functions with Samples and Full Working App! - September 3rd, 2011 5:00 PM
Just added some new date functions per request to Version 1.6. The 1.6 sample is attached below. It now includes these new date functions:
db.Date() --- Returns the current date
db.DateNew("09/03/2011", 30) --- Returns a new date from any selected date, enter positive or negative numbers as second parameter
db.DateNOD("09/03/2011", "03/11/2009") --- Returns the number of days between any two dates passed to it
See Post # 24 for other details: http://www.b4x.com/forum/basic4andr...sy-use-database-functions-v1-0-samples-3.html
Hello All. I just added Version 1.2 to this post. I found a bug that the db.pointer did not update correctly depending on the sorted results in the db.AddRecord and db.UpdateRecord functions. This has been corrected. I also made all functions not return any exceptions if you called them and the database didn't exist. It returns a Toast message stating that the file could not be found.
*** Older Post ***
I Just added Version 1.1. It has a few new things added and the variable names corrected to be more in line with the other functions. In version 1.1:
db.Pointer
db.RecordCount
db.FilePath
db.FileName
db.Field
I have also moved all variable declarations out of the main project. This leaves a totally clean main module to work in. All support for the database is now in the code module. I have attached a new Zip of version 1.1 but I also left the original. I changed over to 1.1 just this afternoon and went through it pretty quick. I feel it is tested and working just as it should, but I went through it quick. Please let me know if you find any errors or issues and I will fix them.
*** Original Post Below **************************************
Hello All,
No extra libraries are needed, just the CORE B4A library. I have tested some of the functions on my NookColor with up to 2500 records. With 2500 records, it moves very fast and searches are instant. All data stored will be in string format, however, you will be able to store links to images, web pages, etc. I wrote and posted the Strings functions here: http://www.b4x.com/forum/basic4android-getting-started-tutorials/10365-string-functions.html, and these functions will work in a similar way.
The functions and sample code are now attached. Some benefits may be that it is easier for new users to learn and less overhead on the processor. You don't have to learn SQL, etc. and the code required for each function is much less. Each device will have its limit on the number of records you can have before the system slows down, based on memory and processor. This will do just fine for most apps and contacts style programs. If you need to save images, objects, etc. directly into the database this will not work for you. You can have as many fields of any size as B4A and Android will support. It will also include the s.GenerateRecords(1000) functions, so you can populate the database with hundreds or thousands of records to test how the app performs under max load. Also, the database handles the pointer for you, it also handles BOF, EOF and no records in the database. It makes your coding job much easier!
If you have problems or questions, please post them and I will try to help. Hope you find it useful!:sign0089:
___________________________________________________________________
db.AddRecord()
db.DeleteRecord()
db.Exist()
db.FindRecord()
db.GenerateRecords()
db.GetRecord()
db.GetStructure()
db.ListRecords()
db.UpdateRecord()
db.FirstRecord()
db.LastRecord()
db.PreviousRecord()
db.NextRecord()
*** Added in Version 1.1 ***
db.Pointer
db.RecordCount
db.FilePath
db.FileName
db.Field
___________________________________________________________________
Thanks,
Margret
If you are using a version less than 1.2, please download the newest version, db.pointer issues were found in previous version(s).
Attachments
Last edited: