Source language: Translate to:

How can I verify if/witch dbf is active ?

Questions about NeoBook PlugIns

Moderator: Neosoft Support

Postby Neosoft Support » Mon May 21, 2007 12:06 pm

Hello Léonid,

I'm sorry, I don't fully understand your question. The only active dbf files would be the ones currently opened by your publication using dbfOpen or dbfCreate.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5603
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Gaev » Tue May 22, 2007 5:00 am

Leonid:

Reproduced from the (English) Help file for NeoBookDB ...
dbfShowErrors

Purpose:

When True, any problems that occur while processing database commands will be displayed to the user in the form of error messages. When False no messages are displayed. When this feature is turned off, you can obtain the most recent error is by examining the global [dbfError] variable. ShowErrors is set to True automatically when NeoBookDB is initialized.

Category:

NeoBookDB > Misc.

Syntax:

dbfShowErrors "status"


status

The status of the ShowErrors feature. Use True to turn ShowErrors on or False to turn it off.



Example:

dbfShowErrors "False"

When ShowErrors is turned off you can still check [dbfError] to detect important errors and respond if needed. For example:


dbfFind "sample.dbf" "LastName" "Johnson"
If "[dbfError]" ">" ""
AlertBox "Sorry" "No matching records found."
EndIf

This should help you in two ways ...

a) When testing, turn this option ON ... so you catch all typo errors


b) In Run mode, when you absolutely need to check that the database has NOT been closed ... examine the contents of [dbfError] immediately after a dbfXXXX command ... if the database is not open, [dbfError] will be non-empty ... note that this variable gets updated with every dbfXXXX command ... so you MUST examine its contents immediately after the command.
User avatar
Gaev
 
Posts: 3735
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Leos » Tue May 22, 2007 7:21 am

I think this was discussed in a previously topic, so please sorry my double wish:

It was helpfull if the plugin itself had the ability to know if a database is opened or not opened, something like this:

dbfDatabaseStatus "database" "status"

I know that i can program my function, but this solution in some condictions it can be hard to work.
User avatar
Leos
 
Posts: 178
Joined: Mon Apr 04, 2005 11:13 am
Location: Coimbra, Portugal

Postby Wrangler » Tue May 22, 2007 8:06 am

Hard to understand why you would need to check the status of a database. If your program intends to use, let's say 2 databases, you would put the "open" and/or "create" commands in your startup actions.

Once your program is running, you would know all your databases have been opened. If for some reason the program cannot find the db, or had a syntax error, it would give an error. [dbfshowerror] is set to show errors by default. Neobook will give an error if there is a quotation mark missing in the action, or for any other reason neobook cannot perform the action, unless you have show errors turned off in Properties, which should be left on, at least until you have debugged the program.

Let's say this status feature was added. What would you do if it returned that the db WASN'T open? Issue a command to open it? That would be redundant, as there is a reason it isn't open, most likely because the "open" command wasn't issued, or it is not located where you told neobook to look for it. The subsequent "open" command wouldn't solve the problem.

A good knowledge of how neobook works, and diligance in debugging the program, would eliminate the need for a status feature.

I think that neobook does a pretty good job in letting us know if something is not right. But, it can only debug to a point, because it can't read your mind, and let you know you forgot to put the open command in where it belongs. I've coded MANY programs with neobook that contain databases. I've never had this problem, because I understand what is needed to make it work. And it's only as easy as opening, creating, or closing the db. And then properly using the additional commands available.

I'm not being pessimistic. I just don't want to see an unecessary command bloat the plugin even more. And I think the programmer is responsible for missing code, badly coded code, and for not reading the help file to understand what is necessary to make it work properly.

And, if you DO have problems making it work, we have this forum. :)
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1507
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Wrangler » Tue May 22, 2007 9:23 am

I hope you don't think I was picking on you. I too started out with Neobook as a beginner. Luckily, with time, things will become easier. :)

This feature would say the openned database was just blowed out


I am thinking "blowed out" means the database became corrupted, which can happen sometimes, but rarely. Probably the incorrect code caused a corruption. In that case, the only thing you can do is recreate the database. I know that it is possible to repair corrupted databases. Maybe Dave would consider adding this function to the plugin. It wouldn't be used often, but sure would come in handy when it DID happen. This feature could be included as a menu option in the program for the user to use when needed. It could save a lot of valuable data in some cases.

Again, I hope I haven't discouraged you in any way in coming here for help, as a beginner OR experienced user. If it wasn't for this forum, it would have taken me MUCH longer to learn neobook than it did. It is a priceless resource. Stick with it. The more you learn, the more you will realize how powerful neobook really is. :D

I am convinced that there is no need to add unnecessary commands.


I agree. I was actually responding to Leo's post concerning adding this command to the plugin. I just didn't think it would solve the problem.

Welcome to the new Neobook, Leonid. And just ignore my "rantings". It's the nature of the beast. :lol:
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1507
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Leos » Tue May 22, 2007 12:03 pm

Wrangler wrote:...I was actually responding to Leo's post concerning adding this command to the plugin. I just didn't think it would solve the problem.


My reply is not to solve Leonid's problem, but to answer to her and mine questions.

Wrangler wrote:...Hard to understand why you would need to check the status of a database.


Ok I will intent to help:

If you have one or two databases in a one pub, maybe this not make sense, but if you must handle 10, or 20 databases (in this plugin we have just tables), and one or two of them, it have 10 or 20 fields, this can become a nice problem (relational databases are not supported by the plugin - you must to do all do job).
You can try to have a table with 20 fields, some of theme text/255 with, lets say 2000 records. If you use

dbfSetColumnTitles "C:\NB\Moedas\DB\moedas_G.dbf" "MGORDER|MGBBCODE|MGINTCODE|MGCOUNTRYC|MGCOUNTRY|MGPROVINCI|
MGONDECIRC|MGCAT|MGCAT0|MGCAT1|MGGRUPO|MGFACIALVA|
MGMOEDA|MGVARIA|MGCOGNOME|MGUNIDADE|MGSISTEMA|
MGEQUIVAL|MGCHAPA|MGALCUNHA|MGMETAL|MGLIGA|MGCOMPOSI|
MGYEAR|MGEPOCA|MGDATAA|MGFORMA|MGSISE|MGPESO|
MGESPESSUR|MGTIRAGEM|MGRECOLHA|MGBORDO|MGEMISSAO|
MGSPECIAL|MGTXTFRENT|MGTXTFHORA|MGTXTVERSO|
MGTXTVHORA|MGTXTBORDO|MGIMAVERSO|MGIMVERSO|MGAPRESENT|MGIMALL|MGIMA1|MGIMMARCA|MGEMORDER|MGEMENTIDA|MGAUTOR|
MGMOTIVO|MGEMISSAOT|MGDESCRIBE|MGENQHISTO|MGNOTES|
MGCOT1|MGCOT2|MGCOT3|MGCOTE1|MGCOTE2|MGCOTDAT|MGRAR|
MGMASTER|MGDATA1|MGDATA2|MGCOTCOM|MGFAKE|MGTIPO"
(this is a REAL example from my job)

...at this time you may considere my way: "you don't need it, you kill it" (in other words, if you don't need the opened database, you MUST to close it).

What can i do if i have status reponse?

Many things: (re)open the database, don't do nothing, go to my error's page, a lot of things...

I also know that neobook can handle many variables at the some time, and it do a nice job with this, but i also know that in larger aplicattions with a lot of pages and databases, i got strange errors (some of theme reported here in the forum) (sorry Neosoft: neobook is a GREAT language programming, but is not yet perfect), and all the help to reduce this problem is welcome.
Another thing: maybe in this case (a lot of databases) i may consider to use another programs to work with (PHP and mySql and other's) but also in this case i have too my way: if i can use neobook, it is made with neobook.

To finish i complete my suggestion:

dbfDatabaseStatus "[database]" "[status]" "[ActiveSubroutine]"

My best salutes to you,
Last edited by Leos on Wed May 23, 2007 3:57 am, edited 2 times in total.
User avatar
Leos
 
Posts: 178
Joined: Mon Apr 04, 2005 11:13 am
Location: Coimbra, Portugal

Postby Wrangler » Tue May 22, 2007 12:13 pm

OK. I think I understand what you're saying. When you aren't using a database, you are closing it. But, is it necessary to close it? Why not leave them all open until the program closes?

I guess that brings up the question as to whether having temporarily unused databases open will slow the program down, or maybe use a lot of memory.

Dave: Is the memory consumption of an open database critical to the program's performance?
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1507
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA


Return to PlugIn Discussions

Who is online

Users browsing this forum: No registered users and 1 guest