openlsd.database.data.mysql
Class LSDMySQLSpecific

java.lang.Object
  extended by openlsd.database.data.mysql.LSDMySQLSpecific

public class LSDMySQLSpecific
extends java.lang.Object

Class for specific MySQL Request

Author:
Frederic Bregier LGPL

Constructor Summary
LSDMySQLSpecific()
           
 
Method Summary
static LSDDbPreparedStatement admin_get(LSDDbAdmin admin, long lid)
          Admin get
static LSDDbPreparedStatement check_get(LSDDbAdmin admin, LSDDbPreparedStatement p_check_get, long lid, long start, long end, java.sql.Timestamp opdate)
          Check Get
static java.lang.String check_getSQLDB(java.sql.Timestamp opdate, boolean localcheckmd5, long newlid)
          Get the request string to check DB
static java.lang.String check_getSQLDBDual(java.sql.Timestamp opdate, java.sql.Timestamp limitdate, boolean localcheckmd5, long newlid)
          Get the request string to check DB
static java.lang.String check_getSQLLSD(java.sql.Timestamp opdate, boolean localcheckmd5, long newlid)
          Get the request string to check LSD
static java.lang.String check_getSQLLSDDual(java.sql.Timestamp opdate, java.sql.Timestamp limitdate, boolean localcheckmd5, long newlid)
          Get the request string to check LSD
static int check_load(LSDDbAdmin admin, java.lang.String outputfile)
          Check Load
static java.lang.String document_findIndexCommit(LSDDbAdmin admin, long lid, long filesize)
          Find index for one document.
static java.lang.String document_findIndexCommitOp(LSDDbAdmin admin, long lid, long filesize, long idip)
          Find index for one document and create temporary Op entry.
static java.lang.String documents_findIndexCommit(LSDDbAdmin admin, long lid, long sumsize, int nb)
          Find index for several documents that will be in the same Storage.
static java.lang.String documents_findIndexCommitOp(LSDDbAdmin admin, long lid, long sumsize, int nb, long idip)
          Find index for several documents that will be in the same Storage (only LSDConstants.NBLINEOP) and create temporary Op entries.
static LSDDbPreparedStatement getPrimaryOp(LSDDbAdmin admin)
          Get the Primary Op object with status = OPStatusTodo
static LSDDbPreparedStatement getSizeDocument(LSDDbAdmin admin)
          Return the Prepare Statement for get Size from Document in one Legacy/Storage
static LSDDbPreparedStatement ipport_findfirst(LSDDbAdmin admin)
          IpPort FindFirst
static LSDDbPreparedStatement legacy_findfirst(LSDDbAdmin admin)
          Legacy FindFirst
static long op_createOpForDocument(LSDDbAdmin admin, long lid, long sid, long did, java.lang.String md5, int op, java.sql.Timestamp opdate, long idip)
          Create Ops for Document and IDIP
static void op_createOpFromCheck(LSDDbAdmin admin, long lid, long sid, long did, java.lang.String md5, int op, java.sql.Timestamp opdate, long idip, long idipto)
          Create Op for Check for the Document and IDIP as source and IDIPTO as target
static long op_createOpFromLegacyStorage(LSDDbAdmin admin, long lid, long sid, long idip)
          Create Op from Document for the specific Legacy and Storage and IDIP
static long op_newindex(LSDDbAdmin admin)
          Get a new index in Op Table.
static boolean op_refreshIdx(LSDDbAdmin admin)
          Update new index in Op Table.
static java.util.ArrayList<LSDDbOp> op_validOps(LSDDbAdmin admin)
          Get list of Ops that are ready to be executed (only LSDConstants.NBLINEOP)
static LSDDbPreparedStatement service_findfirst(LSDDbAdmin admin)
          Service FindFirst
static LSDDbPreparedStatement storage_findfirstInNew(LSDDbAdmin admin, long lid)
          Storage FindFirst
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LSDMySQLSpecific

public LSDMySQLSpecific()
Method Detail

ipport_findfirst

public static LSDDbPreparedStatement ipport_findfirst(LSDDbAdmin admin)
IpPort FindFirst

Parameters:
admin -
Returns:
the LSDDbPreparedStatement

legacy_findfirst

public static LSDDbPreparedStatement legacy_findfirst(LSDDbAdmin admin)
Legacy FindFirst

Parameters:
admin -
Returns:
the LSDDbPreparedStatement

op_newindex

public static long op_newindex(LSDDbAdmin admin)
Get a new index in Op Table. Does not commit so the caller needs to do commit.

Parameters:
admin -
Returns:
the new next index in Op Table

op_createOpFromCheck

public static void op_createOpFromCheck(LSDDbAdmin admin,
                                        long lid,
                                        long sid,
                                        long did,
                                        java.lang.String md5,
                                        int op,
                                        java.sql.Timestamp opdate,
                                        long idip,
                                        long idipto)
Create Op for Check for the Document and IDIP as source and IDIPTO as target

Parameters:
admin -
lid -
sid -
did -
md5 -
op -
opdate -
idip -
idipto -

op_createOpForDocument

public static long op_createOpForDocument(LSDDbAdmin admin,
                                          long lid,
                                          long sid,
                                          long did,
                                          java.lang.String md5,
                                          int op,
                                          java.sql.Timestamp opdate,
                                          long idip)
Create Ops for Document and IDIP

Parameters:
admin -
lid -
sid -
did -
md5 -
op -
opdate -
idip -
Returns:
the new associated idop

op_createOpFromLegacyStorage

public static long op_createOpFromLegacyStorage(LSDDbAdmin admin,
                                                long lid,
                                                long sid,
                                                long idip)
Create Op from Document for the specific Legacy and Storage and IDIP

Parameters:
admin -
lid -
sid -
idip -
Returns:
the number of created Op or (-1) if an error occurs

op_refreshIdx

public static boolean op_refreshIdx(LSDDbAdmin admin)
Update new index in Op Table. Does not commit at the end.

Parameters:
admin -
Returns:
True if OK

op_validOps

public static java.util.ArrayList<LSDDbOp> op_validOps(LSDDbAdmin admin)
Get list of Ops that are ready to be executed (only LSDConstants.NBLINEOP)

Parameters:
admin -
Returns:
The ArrayList or NULL in case of error

getPrimaryOp

public static LSDDbPreparedStatement getPrimaryOp(LSDDbAdmin admin)
Get the Primary Op object with status = OPStatusTodo

Parameters:
admin -
Returns:
the LSDDbPrepareStatement

service_findfirst

public static LSDDbPreparedStatement service_findfirst(LSDDbAdmin admin)
Service FindFirst

Parameters:
admin -
Returns:
the LSDDbPreparedStatement

storage_findfirstInNew

public static LSDDbPreparedStatement storage_findfirstInNew(LSDDbAdmin admin,
                                                            long lid)
Storage FindFirst

Parameters:
admin -
lid -
Returns:
the LSDDbPreparedStatement

documents_findIndexCommit

public static java.lang.String documents_findIndexCommit(LSDDbAdmin admin,
                                                         long lid,
                                                         long sumsize,
                                                         int nb)
Find index for several documents that will be in the same Storage.

Parameters:
admin -
lid -
sumsize -
nb -
Returns:
the result as "newsid newdids";

document_findIndexCommit

public static java.lang.String document_findIndexCommit(LSDDbAdmin admin,
                                                        long lid,
                                                        long filesize)
Find index for one document.

Parameters:
admin -
lid -
filesize -
Returns:
the result as "newsid newdid";

documents_findIndexCommitOp

public static java.lang.String documents_findIndexCommitOp(LSDDbAdmin admin,
                                                           long lid,
                                                           long sumsize,
                                                           int nb,
                                                           long idip)
Find index for several documents that will be in the same Storage (only LSDConstants.NBLINEOP) and create temporary Op entries.

Parameters:
admin -
lid -
sumsize -
nb -
idip - of the source
Returns:
the result as "newsid newdids newidops";

document_findIndexCommitOp

public static java.lang.String document_findIndexCommitOp(LSDDbAdmin admin,
                                                          long lid,
                                                          long filesize,
                                                          long idip)
Find index for one document and create temporary Op entry.

Parameters:
admin -
lid -
filesize -
idip - of the source
Returns:
the result as "newsid newdid newidop";

admin_get

public static LSDDbPreparedStatement admin_get(LSDDbAdmin admin,
                                               long lid)
Admin get

Parameters:
admin -
lid -
Returns:
the LSDDbPreparedStatement

check_get

public static LSDDbPreparedStatement check_get(LSDDbAdmin admin,
                                               LSDDbPreparedStatement p_check_get,
                                               long lid,
                                               long start,
                                               long end,
                                               java.sql.Timestamp opdate)
Check Get

Parameters:
admin -
p_check_get -
lid -
start -
end -
opdate -
Returns:
the LSDDbPreparedStatement

check_getSQLDB

public static java.lang.String check_getSQLDB(java.sql.Timestamp opdate,
                                              boolean localcheckmd5,
                                              long newlid)
Get the request string to check DB

Parameters:
opdate -
localcheckmd5 -
newlid -
Returns:
the request string

check_getSQLLSD

public static java.lang.String check_getSQLLSD(java.sql.Timestamp opdate,
                                               boolean localcheckmd5,
                                               long newlid)
Get the request string to check LSD

Parameters:
opdate -
localcheckmd5 -
newlid -
Returns:
the request string

check_getSQLDBDual

public static java.lang.String check_getSQLDBDual(java.sql.Timestamp opdate,
                                                  java.sql.Timestamp limitdate,
                                                  boolean localcheckmd5,
                                                  long newlid)
Get the request string to check DB

Parameters:
opdate -
limitdate -
localcheckmd5 -
newlid -
Returns:
the request string

check_getSQLLSDDual

public static java.lang.String check_getSQLLSDDual(java.sql.Timestamp opdate,
                                                   java.sql.Timestamp limitdate,
                                                   boolean localcheckmd5,
                                                   long newlid)
Get the request string to check LSD

Parameters:
opdate -
limitdate -
localcheckmd5 -
newlid -
Returns:
the request string

check_load

public static int check_load(LSDDbAdmin admin,
                             java.lang.String outputfile)
Check Load

Parameters:
admin -
outputfile -
Returns:
the number of lines loaded

getSizeDocument

public static LSDDbPreparedStatement getSizeDocument(LSDDbAdmin admin)
Return the Prepare Statement for get Size from Document in one Legacy/Storage

Parameters:
admin -
Returns:
the LSDDbPrepareStatement