#1 Re: mORMot 1 » Updating datetime in Sample Project02 » 2014-11-30 19:05:24

tks for the reply.
TTimeLog does update when used.

i have to handle datetime with daylight savings time.  is TModTime a better way to handle daylight savings time.  the values saved is 8 hours ahead of my local time.  i am not sure what is meant by ServerTime?

tks for your help
ted

#2 mORMot 1 » Updating datetime in Sample Project02 » 2014-11-29 20:49:17

tedroper
Replies: 3

This is the AddButtonClick procedure from you sample projects.
i want the sample to search for a record that may match the name entered and then update the record instead of adding the record at the end of the database.

1. i added sRec: TSQLSampleRecord to search the database for the old record.
2. if found, i want to update the datetime and the question.
3. The datetime is TModTime type, so i'm using sRec.Time := TimeLogNow;  (which puts my computer time in db).
4. if Database.Add(Rec,true, false, true)=0 then  //updates time correctly, the last true updates to my time i think.
5. if not Database.Update(sRec) then  //DOES NOT UPDATE DATETIME CORRECTLY
note:  i have tried Database.Update(sRec, [0..2]) and other updates, but can not get the update to change with my time.

Please advise how to code the update to update the question and time?
tks,
ted


//SAMPLE CODE FROM PROJECT
procedure TForm1.AddButtonClick(Sender: TObject);
var Rec, sRec: TSQLSampleRecord;
begin
  Rec := TSQLSampleRecord.Create;
  try
    sRec := TSQLSampleRecord.Create(Database,'Name=?',[StringToUTF8(NameEdit.Text)]);
    sRec.Name := StringToUTF8(NameEdit.Text);
    sRec.Question := StringToUTF8(QuestionMemo.Text);
    sRec.Time := TimeLogNow;
    // we use explicit StringToUTF8() for conversion below
    // a real application should use TLanguageFile.StringToUTF8() in mORMoti18n
    Rec.Name := StringToUTF8(NameEdit.Text);
    Rec.Question := StringToUTF8(QuestionMemo.Text);
    Rec.Time := TimeLogNow;
    if sRec.ID>0 then begin
      if not Database.Update(sRec) then  //DOES NOT UPDATE DATETIME CORRECTLY
      ShowMessage('Error updating the data') else begin
       NameEdit.Text := '';
       QuestionMemo.Text := '';
       NameEdit.SetFocus;
      end;
    end else
    if Database.Add(Rec,true, false, true)=0 then  //updates time correctly
      ShowMessage('Error adding the data') else begin
       NameEdit.Text := '';
       QuestionMemo.Text := '';
       NameEdit.SetFocus;
    end;
  finally
    sRec.Free;
    Rec.Free;
  end;
end;

#3 Re: mORMot 1 » Error compiling SynSQLite3 - Delphi 2010 » 2012-01-03 16:59:59

tks for the reply, but i am still lost.
i don't know what the C sources with SEE on is?  These are *.pas files.
how do you use the c.bat file or *.obj files?  do these file go into the project directory?
or is this not a delphi 2010 demo file?

i am just trying to compile a project in your sample directory.
ted

#4 mORMot 1 » Error compiling SynSQLite3 - Delphi 2010 » 2012-01-02 20:59:10

tedroper
Replies: 3

I get these errors on any project using SynSQLite3.pas

Compiling SynFile.dproj (Debug configuration)
dcc command line for "SynFile.dpr"
[DCC Error] SynSQLite3.pas(1): E2065 Unsatisfied forward or external declaration: 'sqlite3CodecAttach'
[DCC Error] SynSQLite3.pas(1): E2065 Unsatisfied forward or external declaration: 'sqlite3CodecGetKey'
[DCC Error] SynSQLite3.pas(1): E2065 Unsatisfied forward or external declaration: 'sqlite3_key'
[DCC Error] SynSQLite3.pas(1): E2065 Unsatisfied forward or external declaration: 'sqlite3_rekey'
[DCC Error] SynSQLite3.pas(1): E2065 Unsatisfied forward or external declaration: 'sqlite3_activate_see'
[DCC Fatal Error] SQLite3.pas(209): F2063 Could not compile used unit 'SynSQLite3.pas'
Failed

Can you help solve this problem?
tks,
ted

Board footer

Powered by FluxBB