DSQL - Dynamic SQL

Moderator: Rathinagiri

User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: DSQL - Dynamic SQL

Post by esgici »

andyglezl wrote:Gracias Amarante
Me parece muy bueno tu trabajo, yo no estoy familiarizado con SQL pero quiero aprender.
----------------------------------------------------------------------------------------------------------
Thanks Amarante
I feel very good your work, I'm not familiar with SQL but I want to learn.
+1
Viva INTERNATIONAL HMG :D
User avatar
Amarante
Posts: 182
Joined: Fri Apr 27, 2012 9:44 pm
DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL
Location: Araruama-RJ, Brazil

Re: DSQL - Dynamic SQL

Post by Amarante »

Andy,
If you are familiar with the DBF format is necessary to forget the record-locking idea ... In SQL works like this:
Imagine that there is a book (the database) and you read a certain line (record) of a page (the table) .... but that line was not locked to only use .... others can access -la ... and when you re-read the line, it may already be different. But outside this difference SQL advantages over the DBF are absurdly large. It's worth it. But look depending on what you need sometimes is faster to create a dbf ... everything in life depends on something.
-------------------
Andy,
Si está familiarizado con el formato DBF es necesario olvidar la idea de bloqueo de registros ... En SQL funciona así:
Imagine que hay un libro (la base de datos) y leer una línea determinada (registro) de una página (la tabla) .... pero esa línea no estaba cerrada a solo uso .... otros pueden acceder -la ... y cuando vuelva a leer la línea, ya puede ser diferente. Pero, fuera de esta diferencia SQL ventajas sobre la DBF son absurdamente grande. Vale la pena. Pero mira dependiendo de lo que es necesario a veces es más rápido crear un dbf ... todo en la vida depende de algo.
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: DSQL - Dynamic SQL

Post by Rathinagiri »

Amarante wrote:A question:
I'm recording images in Blob fields as string, that is, I am converting to Hex. I did not understand how to write binary files in BLOB fields (SQLite or MySQL) in HMG.
If someone can analyze the sources or give me a hint I thank you.
To solve this, I use (like many others in web) this. Base64 conversion of a file to string and string to a file helps us to save any type of file (not only images, pdf files etc) to a string and back. Whenever required the string is converted to a temporary file to show the image.

Code: Select all

#include <hmg.ch>

function file2str( cFileName )
   local oEncoder := TIPEncoderBase64():New()
   local hInput
   local cData := ''
   local cBuffer := Space( 1024 )
   IF hb_FileExists( cFileName )
      hInput := FOpen( cFileName )
      nLen := FRead( hInput, @cBuffer, 1024 )
      DO WHILE nLen > 0
         IF nLen < 1024
            cData += hb_BLeft( cBuffer, nLen )
         ELSE
            cData += cBuffer
         ENDIF
         nLen := FRead( hInput, @cBuffer, 1024 )
      ENDDO
      FClose( hInput )
      cData := oEncoder:Encode( cData )
      return cData
   ENDIF
return cData


function str2file( cStr, cFileName )
   local oEncoder := TIPEncoderBase64():New()
   local hOutput
   cStr := oEncoder:Decode( cStr )
   hOutput := FCreate( cFileName )
   FWrite( hOutput, cStr )
   FClose( hOutput )
return nil
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: DSQL - Dynamic SQL

Post by Rathinagiri »

You can enable CELLNavigation and mention the row, col value to position.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Amarante
Posts: 182
Joined: Fri Apr 27, 2012 9:44 pm
DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL
Location: Araruama-RJ, Brazil

Re: DSQL - Dynamic SQL

Post by Amarante »

Rathinagiri,
Thanks for your valuable teachings.
User avatar
Ismach
Posts: 161
Joined: Wed Nov 28, 2012 5:55 pm
DBs Used: DBF, mySQL, Mariadb, postgreSQL, Oracle, Db2, Interbase, Firebird, and SQLite
Location: Buenos Aires - Argentina

Re: DSQL - Dynamic SQL

Post by Ismach »

SQLite is a Relational Database (ANSI SQL) created for every single user application, such
a browser, Firefox uses SQL, messaging systems, any application for mobile / tablets etc etc phones use this database
if you want an example

Firefox uses SQL if Firefox has:
in% APPDATA% \ Mozilla \ Firefox \ Profiles \ tpgbxoks.default \
places.sqlite
places.sqlite-wal (temporary)
cookies.sqlite
webappsstore.sqlite
healthreport.sqlite

SQLite is ideal for applications in mobile devices (single-user)
User avatar
Amarante
Posts: 182
Joined: Fri Apr 27, 2012 9:44 pm
DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL
Location: Araruama-RJ, Brazil

Re: DSQL - Dynamic SQL

Post by Amarante »

-------------[English - via google]
Ismach,
Thank you for information.
I know well the limitations of SQLite, but the main purpose of DSQL is trying to help our community HMG in the development of small applications that use SQL (MySQL, Postgres SQL and SQLite).
I have several applications in MySQL and some small banks in SQLite. In SQLite use is more information query. In an application with SQLite should limit users to enter data.
My goal in the example MySongs was simply show that it is possible to do with HMG and SQL. Would be difficult to show her an example in MySQL, as many users would not have MySQL installed.
-------------------------[Portuguese]
Ismach,
Obrigado por sua informação.
Eu sei bem das limitações de SQLite, mas o objetivo principal da DSQL é tentar ajudar nossa comunidade HMG no desenvolvimento de pequenas aplicações que utilizem SQL (MySQL, Postgre SQL e SQLite).
Eu tenho várias aplicações em MySQL e também alguns pequenos bancos em SQLite. Em SQLite a utilização é mais para consulta de informações. Em uma aplicação com SQLite devemos limitar os usuários que inserem dados.
O meu objetivo no exemplo MySongs foi simplesmente mostrar o que que é possível fazermos com HMG e SQL. Ficaria dificil demonstra-la um exemplo em MySQL, já que muitos usuários não teriam MySQL instalado.
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: DSQL - Dynamic SQL

Post by andyglezl »


I know well the limitations of SQLite, but the main purpose of DSQL is trying to help our community HMG in the development of small applications that use SQL (MySQL, Postgres SQL and SQLite).
"SQL Server 2008 Express is a free edition of SQL Server and is an ideal platform to learn and execute small server applications and desktop data"
- Entonces, (para yo entender) si instalo el "SQL Server 2008 Express" no tengo la limitante del bloqueo de registros
y se podría hacer una aplicación multiusuarios ?
- Algún comentario sobre SQL Server 2008 Express ?
---------------------------------------------------------------------------------------------------------------------------------------------
- Then, (to understand) if I install the "SQL Server 2008 Express" I have no limiting lock records could make a multiuser application?
- Any comments on SQL Server 2008 Express?
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: DSQL - Dynamic SQL

Post by esgici »

andyglezl wrote: - Any comments on SQL Server 2008 Express?
"Express" versions always has some limits; such as record count, file size, usage duration etc
Viva INTERNATIONAL HMG :D
User avatar
Amarante
Posts: 182
Joined: Fri Apr 27, 2012 9:44 pm
DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL
Location: Araruama-RJ, Brazil

Re: DSQL - Dynamic SQL

Post by Amarante »

Andy,
If you program in Visual Basic, Microsoft SQL Server is ideal.
Otherwise, I particularly prefer MariaDB that is identical to MySQL or Postgres SQL. They are free and have been proven tested.
When I worked in a search engine back in the 2000s we used MySQL. If your target user will basically queries, MySQL is the best motor seach I know.
If your goal is a robust application with data entry competition, Postgres SQL is your solution.
I did not speak here of large banks like Oracle ... I do not have access ... and do not even know.
Sorry what was exposed here has little technical knowledge, but it is the opnion of a simple programmer, poor, using free stuff and trying to learn from the information coming to me.
Post Reply