Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / i need help whit a database searcher

Author
Message
The Nerd
20
Years of Service
User Offline
Joined: 5th Jun 2004
Location: Denmark
Posted: 24th Jul 2004 22:51
Hi!
im making a small database....
and i need to make a kind of searcher....
example....: if i take the name: Oliver.. then i want so i can click on the "O" button and then the database will show all the names there starting whit "O"
how i make that..?

The Nerd
zenassem
22
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 25th Jul 2004 00:24
So i take it you want to code the Database in DB. Not interact with a database from db.

If so.

You need to decide what type of data structure you will use. I have a entire volume on searching and sorting algorithms.

Data stuctures:From dyanmic arrays, trees, linked lists, etc..

Sorting algorithms:
(bubblesorts, selection sort, Parallel Sort/merge, quicksort, heapsort, Batcher's odd-even sort, hashing,

Which one you use depends on How large will the Database be. Speed VS. memory. Will you want to be able to use other key fields to search? Will you want to be able to sort the database in other ways (like a-z, z-a, first name, last name etc..)

If you are just looking to have it alphebetaized by last name (and that's all you ever want) i can give you code to insert into an array. But if you plan on developing further there are (little but more complex) but better methods. Also will the Databse be a fixed size or will it be changing drastically. Let me know.

~zen


The Nerd
20
Years of Service
User Offline
Joined: 5th Jun 2004
Location: Denmark
Posted: 25th Jul 2004 00:29
"If you are just looking to have it alphebetaized by last name (and that's all you ever want) i can give you code to insert into an array"

i just want that..
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 26th Jul 2004 01:53
Since this is DBC, an arraylist is gonna be a problem. I mean it can be done by creating your own arraylist, but it's slow.
Ok, given your database array, you'll have a search result array as well. Use a search a method to find whatever you're looking for. Count the number of search results found, make an array of that size, then fill it with the results.

"eureka" - Archimedes

Login to post a reply

Server time is: 2025-05-24 22:11:30
Your offset time is: 2025-05-24 22:11:30